private void button6_Click(object sender, EventArgs e) { employeeInfo newEmp = new employeeInfo(); newEmp.Name = this.tex_user.Text; newEmp.Password = this.tex_pwd.Text; if (this.checkBox1.Checked == true) { newEmp.Type = "管理员"; } else { newEmp.Type = "员工"; } int ret = DataService.AddEmployee(newEmp); if (ret > 0) { MessageBox.Show("操作成功!"); } else { MessageBox.Show("操作失败!"); } this.dataGridView2.DataSource = PdServices.getallpd(); }
public Form_Product() { InitializeComponent(); List <employeeInfo> list = PdServices.getallpd(); cmb_pd.DataSource = list; cmb_pd.DisplayMember = "pdname"; cmb_pd.ValueMember = "pdid"; this.dataGridView1.DataSource = ProductServices.GetAllProduct(); this.CenterToParent(); this.tex_pronum.Select(); }
private void button8_Click(object sender, EventArgs e) { string str = MessageBox.Show("你确定要删除选中项目吗?", "警告", MessageBoxButtons.YesNo).ToString(); if (str == "Yes") { employeeInfo admin = new employeeInfo(); if (this.dataGridView2.SelectedRows.Count > 0) { for (int i = 0; i < dataGridView2.SelectedRows.Count; i++) { DataGridViewRow dr = dataGridView2.SelectedRows[i]; admin.Id = uint.Parse(dr.Cells[0].Value.ToString()); int ret = PdServices.DlePd(admin); if (ret > 0) { } else { //MessageBox.Show(string.Format("第{0}条删除失败!", i + 1)); } } } else { DataGridViewCell dc = this.dataGridView2.SelectedCells[0]; // DataGridViewRow dr = dc.RowNumber; // dc = dr.Cells[0]; DataGridViewRow dr = dc.OwningRow; // MessageBox.Show(dr.Cells[0].Value.ToString()); admin.Id = uint.Parse(dr.Cells[0].Value.ToString()); // MessageBox.Show(pd.Pdid.ToString()); int ret = PdServices.DlePd(admin); if (ret > 0) { MessageBox.Show("操作成功!"); } else { MessageBox.Show("操作失败!"); } } this.dataGridView2.DataSource = PdServices.getallpd(); } }
private void button1_Click(object sender, EventArgs e) { Pd_info pd = new Pd_info(); pd.Pdname = this.tex_pd.Text; int ret = PdServices.AddPd(pd); if (ret > 0) { MessageBox.Show("添加成功!"); this.dataGridView1.DataSource = PdServices.getallpd(); } }
private void button2_Click(object sender, EventArgs e) { this.dataGridView1.DataSource = PdServices.getallpd(); }