//编辑物品类别 private void EditData() { frmEditMaterialType frmemt = new frmEditMaterialType(); DataTable strgdept; strgdept = rms_var.LoadStorageDept(); for (int i = 0; i <= strgdept.Rows.Count - 1; i++) { frmemt.ComboBox1.Items.Add(strgdept.Rows[i]["DeptName"]); } frmemt.frmMode = 0; //add frmemt.OldMaterialTypeCode = dgMaterialType[dgMaterialType.CurrentRowIndex, 0].ToString(); frmemt.OldMaterialTypeName = dgMaterialType[dgMaterialType.CurrentRowIndex, 1].ToString(); frmemt.TextBox1.Text = dgMaterialType[dgMaterialType.CurrentRowIndex, 0].ToString(); frmemt.TextBox2.Text = dgMaterialType[dgMaterialType.CurrentRowIndex, 1].ToString(); frmemt.ComboBox1.Text = rms_var.GetDeptName(dgMaterialType[dgMaterialType.CurrentRowIndex, 2].ToString()); if (dgMaterialType[dgMaterialType.CurrentRowIndex, 3].ToString() == "1") { frmemt.CheckBox1.Checked = true; } else { frmemt.CheckBox1.Checked = false; } frmemt.Text = "编辑物品类别"; frmemt.ShowDialog(); if (frmemt.DialogResult == DialogResult.OK) { LoadMaterialType(cbStorageDept.Text); } }
private void ToolBar1_ButtonClick(System.Object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e) { switch (ToolBar1.Buttons.IndexOf(e.Button)) { case 0: //添加数据 frmEditMaterialType frmemt = new frmEditMaterialType(); frmemt.frmMode = 1; //add DataTable strgdept; strgdept = rms_var.LoadStorageDept(); for (int i = 0; i <= strgdept.Rows.Count - 1; i++) { frmemt.ComboBox1.Items.Add(strgdept.Rows[i]["DeptName"]); } if (frmemt.ComboBox1.Items.Count > 0) { frmemt.ComboBox1.SelectedIndex = 0; } frmemt.Text = "添加物品类别"; frmemt.ShowDialog(); if (frmemt.DialogResult == DialogResult.OK) { LoadMaterialType(cbStorageDept.Text); } break; case 1: //修改数据 EditData(); break; case 2: //删除当前数据 if (MessageBox.Show("确定要删除当前选中的编号为 " + dgMaterialType[dgMaterialType.CurrentRowIndex, 0].ToString().Trim() + " 的物品类别吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { if (DelMaterialType(dgMaterialType[dgMaterialType.CurrentRowIndex, 0].ToString())) { LoadMaterialType(cbStorageDept.Text); } } break; case 4: this.Close(); break; } }
private void ToolBar1_ButtonClick(System.Object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e) { switch (ToolBar1.Buttons.IndexOf(e.Button)) { case 0: //添加数据 frmEditMaterialType frmemt = new frmEditMaterialType(); frmemt.frmMode = 1; //add DataTable strgdept; strgdept = rms_var.LoadStorageDept(); for (int i = 0; i <= strgdept.Rows.Count - 1; i++) { frmemt.ComboBox1.Items.Add(strgdept.Rows[i]["DeptName"]); } if (frmemt.ComboBox1.Items.Count > 0) { frmemt.ComboBox1.SelectedIndex = 0; } frmemt.Text = "添加物品类别"; frmemt.ShowDialog(); if (frmemt.DialogResult == DialogResult.OK) { LoadMaterialType(cbStorageDept.Text); } break; case 1: //修改数据 EditData(); break; case 2: //删除当前数据 if (MessageBox.Show("确定要删除当前选中的编号为 " + dgMaterialType[dgMaterialType.CurrentRowIndex, 0].ToString().Trim()+ " 的物品类别吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { if (DelMaterialType(dgMaterialType[dgMaterialType.CurrentRowIndex, 0].ToString())) { LoadMaterialType(cbStorageDept.Text); } } break; case 4: this.Close(); break; } }
//编辑物品类别 private void EditData() { frmEditMaterialType frmemt = new frmEditMaterialType(); DataTable strgdept; strgdept = rms_var.LoadStorageDept(); for (int i = 0; i <= strgdept.Rows.Count - 1; i++) { frmemt.ComboBox1.Items.Add(strgdept.Rows[i]["DeptName"]); } frmemt.frmMode = 0; //add frmemt.OldMaterialTypeCode =dgMaterialType[dgMaterialType.CurrentRowIndex, 0].ToString(); frmemt.OldMaterialTypeName = dgMaterialType[dgMaterialType.CurrentRowIndex, 1].ToString(); frmemt.TextBox1.Text = dgMaterialType[dgMaterialType.CurrentRowIndex, 0].ToString(); frmemt.TextBox2.Text = dgMaterialType[dgMaterialType.CurrentRowIndex, 1].ToString(); frmemt.ComboBox1.Text = rms_var.GetDeptName(dgMaterialType[dgMaterialType.CurrentRowIndex, 2].ToString()); if (dgMaterialType[dgMaterialType.CurrentRowIndex, 3].ToString() == "1") { frmemt.CheckBox1.Checked = true; } else { frmemt.CheckBox1.Checked = false; } frmemt.Text = "编辑物品类别"; frmemt.ShowDialog(); if (frmemt.DialogResult == DialogResult.OK) { LoadMaterialType(cbStorageDept.Text); } }