void DgvData_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e) { foreach (DataGridViewRow row in pagedDgvSourcingNote.DgvData.Rows) { int supplierId = StringUtil.GetSafeInt(row.Cells[1].Value); SupplierType supplier = SupplierDAL.GetSupplierById(supplierId); if (supplier == null) { continue; } row.Cells[2].Value = supplier.SupplierName; } }
private void ShowSupplierData() { SupplierType supplier = SupplierDAL.GetSupplierById(mSupplierId); if (supplier == null) { MessageBox.Show("无供应商信息", "抱歉", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } this.textBoxSupplierName.Text = supplier.SupplierName; this.textBoxSupplierTel.Text = supplier.SupplierTel; this.textBoxSupplierLink1.Text = supplier.SupplierLink1; this.textBoxSupplierLink2.Text = supplier.SupplierLink2; this.textBoxSupplierLink3.Text = supplier.SupplierLink3; this.textBoxSupplierComment.Text = supplier.Comment; }
private void ToolStripMenuItemEditSupplier_Click(object sender, EventArgs e) { int rowIdx = this.pagedDgvSupplier.DgvData.CurrentRow.Index; int supplierId = StringUtil.GetSafeInt(this.pagedDgvSupplier.DgvData.Rows[rowIdx].Cells[0].Value.ToString()); SupplierType supplier = SupplierDAL.GetSupplierById(supplierId); if (supplier == null) { return; } FrmEditSupplier frmEditSupplier = new FrmEditSupplier(supplierId); frmEditSupplier.ShowDialog(); this.pagedDgvSupplier.LoadData(); }
private void btnFinishSelecting_Click(object sender, EventArgs e) { DataGridViewRow row = this.pagedDgvSupplier.DgvData.CurrentRow; if (row == null) { MessageBox.Show("未选中任何供应商", "抱歉", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } int supplierId = StringUtil.GetSafeInt(row.Cells[0].Value); mSelectedSupplier = SupplierDAL.GetSupplierById(supplierId); if (mSelectedSupplier == null) { MessageBox.Show("未选中任何供应商", "抱歉", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } this.Close(); }