/* * 保存包材信息 */ private void saveBtn_Click(object sender, EventArgs e) { if (checkIntegrity() == true) { NewPackingDetailManager newPackingDetailManager = new NewPackingDetailManager(); if (operateFlag == 1) { newPackingDetailManager.insertNewPackingMaterial(buildPackingMaterialDict(), int.Parse(supplierInformation.Rows[this.supplier.SelectedIndex][0].ToString())); } else if (operateFlag == 2) { //没有更新包材对应的供应商信息 newPackingDetailManager.updatePackingMaterialInformation(buildPackingMaterialDict2(),this.packingMaterialNo.Text); } this.Close(); } }
/* * 填充供应商combobox */ private void fillSupplierComboBox() { NewPackingDetailManager newPackingDetailManager = new NewPackingDetailManager(); supplierInformation = newPackingDetailManager.querySupplierInformation(); foreach(DataRow row in supplierInformation.Rows) { this.supplier.Items.Add(row[1]); } }
/* * 根据包材编号,获取包材其他信息,以及供应商信息 */ private void initFormByPackingMaterialNo(String packingMaterialNo) { NewPackingDetailManager newPackingDetailManager = new NewPackingDetailManager(); packingMaterilDict = newPackingDetailManager.queryPackingMaterialInformationByNo(packingMaterialNo); supplierInforDict = newPackingDetailManager.querySupplierOfPackingMaterialByNo(packingMaterialNo); foreach (Control ctl in this.mainPanel.Controls) { if (ctl.GetType().Name == "TextBox") { TextBox textBox = (TextBox)ctl; if (packingMaterilDict.ContainsKey(textBox.Name)) { textBox.Text = packingMaterilDict[textBox.Name]; } else if (supplierInforDict.ContainsKey(textBox.Name)) { textBox.Text = supplierInforDict[textBox.Name]; } } else if (ctl.GetType().Name == "ComboBox") { ComboBox comboBox = (ComboBox)ctl; if (supplierInforDict.ContainsKey(comboBox.Name)) { comboBox.Items.Clear(); comboBox.Items.Add(supplierInforDict[comboBox.Name]); comboBox.SelectedIndex = 0; } } } }
/* * 生成包材代码 */ private String createPackingMaterialNo() { NewPackingDetailManager newPackingDetailManager = new NewPackingDetailManager(); return newPackingDetailManager.queryBiggestPackingMaterialNo(); }