private void FormSupplierPriceSheetEdit_Load(object sender, EventArgs e) { if (m_isEditRecord) { this.buttonEdit.Enabled = true; this.buttonSelect.Enabled = false; this.textBoxOrnmFromValue.Enabled = false; this.textBoxOrnmToValue.Enabled = false; this.textBoxPrice.Enabled = false; this.textBoxNote.Enabled = false; this.buttonEnter.Enabled = false; m_supplierPriceSheetRecord = SupplierPriceSheet.getInctance().getSupplierPriceSheetInfoFromPkey(m_editRecordPkey); m_supplierPkey = m_supplierPriceSheetRecord.supplierId; this.textBoxSupplierName.Text = Convert.ToString(m_supplierPriceSheetRecord.supplierId) + "-" + m_supplierPriceSheetRecord.supplierName; this.textBoxOrnmFromValue.Text = m_supplierPriceSheetRecord.ORNMFromValue; this.textBoxOrnmToValue.Text = m_supplierPriceSheetRecord.ORNMToValue; this.textBoxPrice.Text = m_supplierPriceSheetRecord.pirce; this.textBoxNote.Text = m_supplierPriceSheetRecord.note; } if (!m_isDisplaySelectButton) { this.labelSupplier.Hide(); this.textBoxSupplierName.Hide(); this.buttonSelect.Hide(); } }
private void updateDataGridView() { SortedDictionary <int, SupplierPriceSheetTable> dataList = SupplierPriceSheet.getInctance().getAllSupplierPriceSheetInfo(m_materielID); m_materielRecordCount = dataList.Count; SortedDictionary <int, ArrayList> materiels = new SortedDictionary <int, ArrayList>(); for (int i = 0; i < dataList.Count; i++) { SupplierPriceSheetTable record = new SupplierPriceSheetTable(); record = (SupplierPriceSheetTable)dataList[i]; ArrayList temp = new ArrayList(); temp.Add(record.pkey); temp.Add(record.supplierId); temp.Add(record.supplierName); temp.Add(record.ORNMFromValue); temp.Add(record.ORNMToValue); temp.Add(record.date); temp.Add(record.pirce); temp.Add(record.contact); temp.Add(record.tel); temp.Add(record.note); if ((m_isQuerySupplierPrice && record.supplierId != -1) || (!m_isQuerySupplierPrice && record.supplierId == -1)) { materiels.Add(i, temp); } } m_dataGridViewExtend.initDataGridViewData(materiels, 3); }
private void buttonEnter_Click(object sender, EventArgs e) { if (m_isDisplaySelectButton) { if (textBoxSupplierName.Text.Length == 0) { MessageBoxExtend.messageWarning("供应商不能为空"); return; } } if (textBoxPrice.Text.Length == 0) { MessageBoxExtend.messageWarning("单价不能为空"); return; } if (textBoxPrice.Text.Length > 10) { MessageBoxExtend.messageWarning("单价最大长度不能超过10"); textBoxPrice.Text = ""; return; } SupplierPriceSheetTable record = new SupplierPriceSheetTable(); record.supplierId = m_supplierPkey; record.matetielId = m_matetielID; if (this.textBoxOrnmFromValue.Text.Length == 0) { record.ORNMFromValue = "0"; } else { record.ORNMFromValue = this.textBoxOrnmFromValue.Text; } if (this.textBoxOrnmToValue.Text.Length == 0) { record.ORNMToValue = "无限制"; } else { record.ORNMToValue = this.textBoxOrnmToValue.Text; } record.pirce = this.textBoxPrice.Text; record.note = this.textBoxNote.Text; if (!m_isEditRecord) { SupplierPriceSheet.getInctance().insert(record); } else { SupplierPriceSheet.getInctance().update(m_editRecordPkey, record); } this.Close(); }