private void showAccNvPanel() { int role = 0; string getDotQuery = "select Id from Account where Role = " + role + ""; cmd = new SqlCommand(getDotQuery, myconn); da = new SqlDataAdapter(getDotQuery, myconn); dt = new DataTable(); ds = new DataSet(); da.Fill(ds); int id = 0; nvList = new nhanvienConfig[ds.Tables[0].Rows.Count]; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { nvList[i] = new nhanvienConfig(); id = Int32.Parse(ds.Tables[0].Rows[i][0].ToString()); nvList[i].getInforWithId(id); createNhanvienAccountPanelAndLabel(id, nvList[i].getName(), nvList[i].getUsername(), nvList[i].getPassword()); } }
private void btndongy_Click(object sender, EventArgs e) { nv = new nhanvienConfig(); name = txtbtennhanvien.Text; username = txttaikhoan.Text; password = txtmatkhau.Text; if (checkValidate()) { int role = 0; nv.addValue(id, name, username, password, role); if (nv.excuteUpdateQuery()) { MessageBox.Show("Chỉnh sửa thành công!"); isUpdate = true; this.Close(); } else { lbThongbao.Text = "Có ai đó đã đặt tên tài khoản này, xin hãy đỗi lại!"; isUpdate = false; } } }
public CreateEmployee() { InitializeComponent(); nv = new nhanvienConfig(); isInsert = false; }