private void btnSave_Click(object sender, EventArgs e) { _empBLL = new EmployeeBusiness(_user); if (true) { } _emp.FirstName = txtFirstName.Text; _emp.LastName = txtLastName.Text; _emp.BirthDate = dtpBirthDate.Value; _emp.HireDate = dtpHireDate.Value; _emp.Email = txtEmail.Text; _emp.Password = txtPassword.Text; _emp.RoleID = (int)cmbRoleID.SelectedValue; try { if (_selectedId > 0) { _empBLL.Update(_emp); MessageBox.Show("Güncelleme başarılı."); } else { _empBLL.Add(_emp); MessageBox.Show("Kayıt işlemi başarılı."); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnSaveEmployee_Click(object sender, EventArgs e) { _employee.Address = txtEAddress.Text; _employee.DateOfBirth = eBirthDate.Value; _employee.EmployeeRoleId = (int)cmbEmployeeRole.SelectedValue; _employee.IdentityNumber = txtETc.Text; _employee.FirstName = txtEFirstName.Text; _employee.LastName = txtELastName.Text; _employee.Mail = txtEMail.Text; _employee.Password = txtEMail.Text; _employee.Phone = txtEPhone.Text; MessageBox.Show(_employeeBusiness.Add(_employee) ? "Calışan Eklendi" : "Çalışan Eklenemedi ! "); }
public void EmployeeCanBeAddedToDatabase() { Employee employee = new Employee { Name = "Stoyan", Role = "Admin", Password = "******", City = "Aytos" }; Assert.AreEqual("The employee was added", employeeBusiness.Add(employee), "Employee can not be added to database"); }
// Buttons private void AddButton_Click(object sender, EventArgs e) { if (String.IsNullOrWhiteSpace(txtRole.Text) || String.IsNullOrWhiteSpace(txtNam.Text) || String.IsNullOrWhiteSpace(txtPassword.Text) || String.IsNullOrWhiteSpace(txtCity.Text)) { MessageBox.Show("One or more entries are empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { employee = new Employee { Role = txtRole.Text, Name = txtNam.Text, Password = txtPassword.Text, City = txtCity.Text }; employeeBusiness.Add(employee); ClearBoxes(); UpdateGrid(); } }
public EmployeeMutation() { Field <NonNullGraphType <EmployeeType> >( _Creation, "Tạo và trả về một nhân viên mới", _InputArgument <EmployeeCreateInput>(), _CheckPermission_TaskObject( p => p.PermissionManageEmployee, context => EmployeeBusiness.Add(_GetInput(context)) ) ); Field <NonNullGraphType <EmployeeType> >( _Updation, "Chỉnh sửa thông tin nhân viên", _InputArgument <EmployeeUpdateInput>(), _CheckPermission_TaskObject( p => p.PermissionManageEmployee, context => EmployeeBusiness.Update(_GetInput(context)) ) ); Field <NonNullGraphType <StringGraphType> >( "ResetPassword", "Reset lại mật khẩu cho nhân viên khi quên mật khẩu", _IdArgument(), _CheckPermission_String( p => p.PermissionManageEmployee, context => { var id = AuthenticationHelper.GetEmployeeId(context); var newPassword = EmployeeBusiness.ResetPassword(id, _GetId <string>(context)); return("Mật khẩu mới: " + newPassword); } ) ); Field <NonNullGraphType <StringGraphType> >( "SetIsActiveAccount", "Vô hiệu hóa/ kích hoạt tài khoản", new QueryArguments( new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "id" }, new QueryArgument <NonNullGraphType <BooleanGraphType> > { Name = "isActive" } ), _CheckPermission_String( p => p.PermissionManageEmployee, context => { var id = AuthenticationHelper.GetEmployeeId(context); var employeeId = context.GetArgument <string>("id"); var isActive = context.GetArgument <bool>("isActive"); EmployeeBusiness.SetIsActiveAccount(id, employeeId, isActive); return("Thành công"); } ) ); }
private void btnSave_Click(object sender, EventArgs e) { _employeeBusiness = new EmployeeBusiness(); try { if (this.employeeID < 1) { employee = new Employee(); employee.Address = txtAdress.Text; employee.BirthDate = dtpDateofBirth.Value; employee.Country = txtCountry.Text; employee.Email = txtEmail.Text; employee.FirstName = txtFirstName.Text; if (rdFemale.Checked) { employee.GenderId = 1; } else { employee.GenderId = 2; } employee.LastName = txtLastName.Text; employee.Password = txtPassword.Text; employee.Phone = mtxtPhoneNumber.Text; employee.SocialNumber = txtSocialNumber.Text; employee.TitleId = (int)cmbTitle.SelectedValue; if (rdWorkOff.Checked) { employee.Status = "Çalışmıyor"; } else { employee.Status = "Çalışıyor"; } employee.UserName = txtUserName.Text; _employeeBusiness.Add(employee); } else { employee.ID = this.employeeID; employee.Address = txtAdress.Text; employee.BirthDate = dtpDateofBirth.Value; employee.Country = txtCountry.Text; employee.Email = txtEmail.Text; employee.FirstName = txtFirstName.Text; if (rdFemale.Checked) { employee.GenderId = 1; } else { employee.GenderId = 2; } employee.LastName = txtLastName.Text; employee.Password = txtPassword.Text; employee.Phone = mtxtPhoneNumber.Text; employee.SocialNumber = txtSocialNumber.Text; employee.TitleId = (int)cmbTitle.SelectedValue; if (rdWorkOff.Checked) { employee.Status = "Çalışmıyor"; } else { employee.Status = "Çalışıyor"; } employee.UserName = txtUserName.Text; _employeeBusiness.Update(employee); } } catch (Exception ex) { MessageBox.Show(ex.Message); DeleteTextBoxes(); } }