private void btnAdd_Click(object sender, EventArgs e) { try { EmployeeEntities Emp = new EmployeeEntities(); Emp.Name = txtName.Text; Emp.Birthday = dtpBirthday.Value; Emp.Address = txtAddress.Text; Emp.Phone = txtPhone.Text; EmpPro.CreateOrUpdate(Emp); LoadData(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void btnAdd_Click(object sender, EventArgs e) { try { EmployeeEntities Emp = new EmployeeEntities(); Emp.Name = txtName.Text; Emp.Birthday = dtpBirthday.Value; Emp.Address = txtAddress.Text; Emp.Phone = txtPhone.Text; Emp.Account = txtAccount.Text.ToLower(); Emp.Password = Security.Encrypt(txtPassword.Text.ToLower()); Emp.Role = 1; EmpPro.CreateOrUpdate(Emp); LoadData(); SetNull(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }