private void btnSaveAcc_Click(object sender, EventArgs e) { eAccount ac = new eAccount(); ac.UserName = txtUsername.Text.TrimEnd(); ac.PassWord = txtPassWord.Text.TrimEnd(); int kq1 = qldtdd.InsertAccount(ac); if (kq1 == 1) { MessageBox.Show("Insert Success !"); grpDS.Text = "Danh sách nhân viên "; this.btnNewAc.Visible = false; this.lblaccId.Visible = true; this.txtAccId.Visible = true; this.txtAccId.Enabled = false; this.lblnote.Visible = false; this.dgvEm.Visible = true; grpNewAc.Visible = false; txtEnableTrue(); this.txtName.Text = ""; this.txtPhone.Text = ""; this.txtAddress.Text = ""; this.txtPosition.Text = ""; this.txtState.Text = ""; txtAccId.Text = qldtdd.getAccidbyUsername(txtUsername.Text.TrimEnd()); } else { MessageBox.Show("Key Exist"); } }
public int InsertAccount(eAccount newacc) // them nhan vien { if (CheckIsExistAccount((int)newacc.AccId)) { return(0); } else { Account ac = new Account(); ac.accID = newacc.AccId; ac.username = newacc.UserName; ac.password = newacc.PassWord; db.Accounts.InsertOnSubmit(ac); db.SubmitChanges(); return(1); } }
public int InsertAccount(eAccount ac) { return(accDAL.InsertAccount(ac)); }