private void toolStripButton_Edit_Click(object sender, EventArgs e) { if (this.dgvMain.SelectedRows.Count > 0) { DataRow dr = ((DataRowView)dgvMain.Rows[this.dgvMain.CurrentCell.RowIndex].DataBoundItem).Row; string BillID = dr["BillID"].ToString(); DataTable dt = bll.FillDataTable("WMS.SelectBillMaster", new DataParameter[] { new DataParameter("{0}", "Main.BillID='" + BillID + "'") }); if (int.Parse(dt.Rows[0]["State"].ToString()) > 0) { Logger.Info("盘点单号 " + dr["BillID"].ToString() + " 已经" + dt.Rows[0]["StateDesc"].ToString() + ",不能修改!"); return; } frmInventorEdit f = new frmInventorEdit("edit"); f.Owner = this; f.drEdit = dr; if (f.ShowDialog() == DialogResult.OK) { this.BindData(); } } else { Logger.Info("请选择要修改的数据行"); } }
private void toolStripButton_Add_Click(object sender, EventArgs e) { frmInventorEdit f = new frmInventorEdit("add"); f.Owner = this; if (f.ShowDialog() == DialogResult.OK) { this.BindData(); } }