/* * 获取供应商信息,填充供应商下拉框 */ private void fillSupplier() { NewProductDetailManager newProductDetailManager = new NewProductDetailManager(); this.supplierTable = newProductDetailManager.querySupplierInformation(); this.supplier.Items.Clear(); foreach(DataRow currentRow in this.supplierTable.Rows) { if (!currentRow[1].Equals(DBNull.Value)) { this.supplier.Items.Add(currentRow[1].ToString()); } } }
/* * 保存产品信息 */ private void saveBtn_Click(object sender, EventArgs e) { NewProductDetailManager newProductDetailManager = new NewProductDetailManager(); switch (operationType) { case 1://新建 switch (productType) { case 1: //彩妆类 if (checkProductIntegrity() && checkCartonIntegrity() && checkPackingMaterialIntegrity()) { newProductDetailManager.insertProduct(addPackingMaterialToDict()); newProductDetailManager.insertSupplierOfProduct(int.Parse(supplierTable.Rows[this.supplier.SelectedIndex][0].ToString()), this.productNo.Text); this.DialogResult = DialogResult.OK; } break; case 2: //眉笔类 if (checkProductIntegrity() && checkCartonIntegrity()) { newProductDetailManager.insertProduct(addCartonToDict()); newProductDetailManager.insertSupplierOfProduct(int.Parse(supplierTable.Rows[this.supplier.SelectedIndex][0].ToString()), this.productNo.Text); this.DialogResult = DialogResult.OK; } break; case 3: //周边类 if (checkProductIntegrity()) { newProductDetailManager.insertProduct(buildProductInforDict()); newProductDetailManager.insertSupplierOfProduct(int.Parse(supplierTable.Rows[this.supplier.SelectedIndex][0].ToString()), this.productNo.Text); this.DialogResult = DialogResult.OK; } break; } break; case 2://编辑 break; default: break; } }
/* * 获取当前最大的可用编码,填充产品代码textBox */ private void fillProductNo(int productType) { NewProductDetailManager newProductDetailManager = new NewProductDetailManager(); switch (productType) { case 1: this.productNo.Text = newProductDetailManager.queryBiggestCosmeticsNo(); break; case 2: this.productNo.Text = newProductDetailManager.queryBiggestEyebrowPencilNo(); break; case 3: this.productNo.Text = newProductDetailManager.queryBiggestPeripheralNo(); break; default: break; } }