+
+ // Presumably, the user has given us good data, so we try to populate the
+ // database with this new vendor data.
+ QSqlQuery query;
+ query.prepare("INSERT INTO VALUES (?, ?, ?)");
+
+
+}
+
+
+void MainWindow::FillVendorLevelCombo(QComboBox * combo)
+{
+ QSqlQuery query;
+ query.prepare("SELECT VLID, Description FROM VendorLevel");
+ query.exec();
+
+ while (query.next())
+ {
+ int vlid = query.value(0).toInt();
+ QString description = query.value(1).toString();
+
+ combo->addItem(description, vlid);
+ }
+}
+
+
+void MainWindow::FillContactTypeCombo(QComboBox * combo)
+{
+ QSqlQuery query;
+ query.prepare("SELECT CTID, Description FROM ContactType");
+ query.exec();
+
+ while (query.next())
+ {
+ int ctid = query.value(0).toInt();
+ QString description = query.value(1).toString();
+
+ combo->addItem(description, ctid);
+ }
+}
+
+
+void MainWindow::FillVendorClassList(QListWidget * list)
+{
+ std::vector<VendorType> groupList;
+
+ // Pull in definitions from DB for Vendor Classes/Groups
+ QSqlQuery query1;
+ query1.prepare("SELECT vgid, description FROM VendorGroup ORDER BY seqNo");
+ query1.exec();
+
+ while (query1.next())
+ {
+ VendorType v;
+ v.key = query1.value(0).toInt();
+ v.description = query1.value(1).toString();
+ groupList.push_back(v);
+ }
+
+// QSqlQuery query2;
+ query1.prepare("SELECT vtid, vgid, description FROM VendorType ORDER BY seqNo");
+ query1.exec();
+
+ int previousID = -1, groupListIndex = 0;
+ QListWidgetItem * item;
+
+ while (query1.next())
+ {
+// VendorType v;
+ int vtid = query1.value(0).toInt();
+ int vgid = query1.value(1).toInt();
+ QString description = query1.value(2).toString();
+
+ // Check to see if we need to insert new header yet.
+ // If we're not still in same group, push the next group header into the list
+ // and continue
+ if (previousID != vgid)
+ {
+ item = new QListWidgetItem(groupList[groupListIndex].description);
+ item->setData(Qt::UserRole, groupList[groupListIndex++].key);
+ item->setFont(*boldFont);
+ list->addItem(item);
+ previousID = vgid;
+ }
+
+ item = new QListWidgetItem(description);
+ item->setData(Qt::UserRole, vtid);
+ item->setCheckState(Qt::Unchecked);
+ list->addItem(item);
+ }