private void btnAddAdmin_Click(object sender, EventArgs e) { AdminsModel admin = new AdminsModel(); admin.UserID1 = -1; OperatorAddForm of = new OperatorAddForm(admin); of.Show(); this.Hide(); }
private void btnUpdateAdmin_Click(object sender, EventArgs e) { if (dataGridView1.SelectedCells.Count > 0) { int index = Convert.ToInt32(dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0].Value); string userName = dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[1].Value.ToString(); string pwd = dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[2].Value.ToString(); string name = dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[3].Value.ToString(); ProductTypeModel ptype = new ProductTypeModel(index, name); AdminsModel admin = new AdminsModel(index, userName, pwd, name); OperatorAddForm of = new OperatorAddForm(admin); of.Show(); this.Hide(); } else { MessageBox.Show("请选择数据!"); } }