private string GetEmployeeName() { EmployeeGateway EmployeeGatewayObject = new EmployeeGateway(); Employee employeeObject = EmployeeGatewayObject.SelectEmployee(employeeId); return(employeeObject.Name); }
/// <summary> /// Fills up employeeIdDropDownList DDL /// </summary> private void FillEmployeeDropDownList() { try { TaskGateway TaskGatewayObj = new TaskGateway(); EmployeeGateway EmployeeGatewayObject = new EmployeeGateway(); employeeIdDropDownList.DataSource = EmployeeGatewayObject.SelectAllNonUserEmployees(); employeeIdDropDownList.DataTextField = "Name"; employeeIdDropDownList.DataValueField = "ID"; employeeIdDropDownList.DataBind(); if (EmployeeGatewayObject.SelectAllNonUserEmployees().Count == 0) { errorMessageLabel.Text = "All employee have been assign the user and type."; } } catch (SqlException sqlExceptionObj) { errorMessageLabel.Text = sqlExceptionObj.Message; } catch (Exception exceptionObj) { errorMessageLabel.Text = exceptionObj.Message; } }
protected void employeeIdDropDownList_SelectedIndexChanged1(object sender, EventArgs e) { if (employeeIdDropDownList.SelectedIndex.Equals(0)) // Item in index 0 is "-Select-" and not a valid item. So must not use { employeeNameTextBox.Text = ""; employeeAddressTextBox.Text = ""; employeePhoneTextBox.Text = ""; employeeEmailTextBox.Text = ""; employeeJoinDateTextBox.Text = ""; employeeDOBTextBox.Text = ""; return; } try { EmployeeGateway EmployeeGatewayObject = new EmployeeGateway(); Employee employeeObject = EmployeeGatewayObject.SelectEmployee(employeeIdDropDownList.Text); employeeNameTextBox.Text = employeeObject.Name; employeeAddressTextBox.Text = employeeObject.Address; employeePhoneTextBox.Text = employeeObject.PhoneNo; employeeEmailTextBox.Text = employeeObject.Email; employeeJoinDateTextBox.Text = employeeObject.JoiningDate.ToString(); employeeDOBTextBox.Text = employeeObject.DOB.ToString(); } catch (SqlException sqlExceptionObj) { errorLabel.Text = sqlExceptionObj.Message; } catch (Exception exceptionObj) { errorLabel.Text = exceptionObj.Message; } }
private void acceptButton_Click(object sender, EventArgs e) { Employee employee = new Employee(0, mailInput.Text, passwordInput.Text); if (Functions.IsValidEmail(mailInput.Text)) { if (passwordInput.Text.Length > 6) { if (EmployeeGateway.CheckPassword(employee)) { this.Dispose(); } else { MessageBox.Show("You enetered wrong credentials, try again!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("Password is too short!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("You entered invalid mail address!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public override string[] GetRolesForUser(string username) { Employee securityEmloyee = EmployeeGateway.SelectSecurity(username, "CustomRoleProviderAccount"); /// CustomRoleProviderAccount нужен для Geteway.customConnectionPool return(securityEmloyee.Role.Split(new char [1] { ',' }, StringSplitOptions.RemoveEmptyEntries)); }
// GET: Employees public ActionResult Index() { EmployeeGateway db = new EmployeeGateway(); List <Employee> employees = db.GetEmployees(); ViewBag.Employees = employees; return(View()); }
public void Execute(CheckAvailabilityOfEquipmentRequest request) { IList <Employee> employeesInSector = EmployeeGateway.FindEmployeesBySector(request.SectorId); foreach (Employee employee in employeesInSector) { CheckEmployeeEquipment(employee); } }
public UseCaseTest() { _loggerGatewayMock = Substitute.For <LoggerGateway>(); _employeeGatewayMock = Substitute.For <EmployeeGateway>(); _calculationInfluenceGateway = new CalculationInfluenceAdapter( new AreaCalculator(), new SalaryCalculator(), new AdmissionAtCalculator() ); }
public EmployeeService() { _gateway = new EmployeeGateway(); var mapperConfig = new MapperConfiguration(cfg => { cfg.CreateMap <Employee, EmployeeDto>(); cfg.CreateMap <EmployeeDataSetResponse, Employee>(); }); _mapper = mapperConfig.CreateMapper(); }
public UseCase( LoggerGateway logger, EmployeeGateway employeeGateway, CalculationInfluenceGateway calculationInfluenceGateway ) { _logger = logger; _employeeGateway = employeeGateway; _calculationInfluenceGateway = calculationInfluenceGateway; }
public EmployeePack GetAllEmployees(byte[] recentVersion) { var a = OperationContext.Current.Host.Extensions.Count; string currentUsername = ServiceSecurityContext.Current.PrimaryIdentity.Name; List <Employee> allEmployees = EmployeeGateway.SelectAll(currentUsername); EmployeePack pack = new EmployeePack(); pack.Employees = GetRecentVersionEmployees(allEmployees, recentVersion); pack.CountInDB = allEmployees.Count; return(pack); }
public Employee GetEmployee(string selectableUsername) { string currentUsername = ServiceSecurityContext.Current.PrimaryIdentity.Name; if (string.Equals(selectableUsername, null)) { ArgumentNullException ex = new ArgumentNullException("selectableUsername"); throw new FaultException <ArgumentNullException>(ex, ex.Message); } return(EmployeeGateway.Select(selectableUsername, currentUsername)); }
// GET: Employees public ActionResult Index() { EmployeeGateway employeeGateway = new EmployeeGateway(); List <Employee> employeeList = new List <Employee>(); employeeList = employeeGateway.GetEmployees(); ViewBag.Employees = employeeList; return(View()); }
public override void Validate(string username, string password) { Employee securityEmloyee = EmployeeGateway.SelectSecurity(username, "PasswordValidatorAccount"); ///PasswordValidatorAccount нужен для Geteway.customConnectionPool if (securityEmloyee != null) { if (string.Compare(securityEmloyee.Password, password) == 0) { return; } } throw new SecurityTokenValidationException(); }
/// <summary> /// Fills up employeeGridView /// </summary> private void LoadInitialData() { try { EmployeeGateway employeeGateObj = new EmployeeGateway(); employeeGridView.DataSource = employeeGateObj.GetEmployeeTable(); employeeGridView.DataBind(); } catch (SqlException sqlExceptionObj) { errorMessageLabel.Text = sqlExceptionObj.Message; } catch (Exception exceptionObj) { errorMessageLabel.Text = exceptionObj.Message; } }
protected void updateButton_Click(object sender, EventArgs e) { string message = null; if (!CheckInputValues()) { return; } Employee employeeObject = new Employee(); employeeObject.ID = employeeIdDropDownList.Text; employeeObject.Name = employeeNameTextBox.Text; employeeObject.Address = employeeAddressTextBox.Text; employeeObject.PhoneNo = employeePhoneTextBox.Text; employeeObject.Email = employeeEmailTextBox.Text; employeeObject.JoiningDate = Convert.ToDateTime(employeeJoinDateTextBox.Text); employeeObject.DOB = Convert.ToDateTime(employeeDOBTextBox.Text); try { EmployeeGateway EmployeeGatewayObject = new EmployeeGateway(); message = EmployeeGatewayObject.UpdateEmployee(employeeObject).ToString(); } catch (SqlException sqlExceptionObj) { errorLabel.Text = sqlExceptionObj.Message; } catch (Exception exceptionObj) { errorLabel.Text = exceptionObj.Message; } successLabel.Text = message; if (successLabel.Text == "True") { successLabel.Text = "Employee data is been updated"; } else { successLabel.Text = "Employee data is been not updated"; } errorLabel.Text = ""; }
/// <summary> /// Fills up employeeIdDropDownList DDL /// </summary> private void FillEmployeeIdDropDownList() { try { EmployeeGateway EmployeeGatewayObject = new EmployeeGateway(); employeeIdDropDownList.DataSource = EmployeeGatewayObject.GetEmployeeTable(); employeeIdDropDownList.DataTextField = "employee_Id"; employeeIdDropDownList.DataValueField = "employee_Id"; employeeIdDropDownList.DataBind(); } catch (SqlException sqlExceptionObj) { errorLabel.Text = sqlExceptionObj.Message; } catch (Exception exceptionObj) { errorLabel.Text = exceptionObj.Message; } }
/// <summary> /// Loads employee DDL /// </summary> private void LoadAllEmployeeOfTheProject() { try { EmployeeGateway EmployeeGatewayObject = new EmployeeGateway(); employeeDropDownList.DataSource = EmployeeGatewayObject.GetAllEmployeesOfAProject(projectDropDownList.SelectedItem.Value); employeeDropDownList.DataTextField = "Name"; employeeDropDownList.DataValueField = "ID"; employeeDropDownList.DataBind(); } catch (SqlException sqlExceptionObject) { errorLabel.Text = sqlExceptionObject.Message; } catch (Exception exceptionObject) { errorLabel.Text = exceptionObject.Message; } }
/// <summary> /// Fills up employeeNameDropDownList DDL /// </summary> private void FillDropDownListEmployeeOfTheProject() { try { EmployeeGateway EmployeeGatewayObject = new EmployeeGateway(); employeeNameDropDownList.DataSource = EmployeeGatewayObject.GetAllEmployeesOfAProject(taskObj.Project_Id); employeeNameDropDownList.DataTextField = "Name"; employeeNameDropDownList.DataValueField = "ID"; employeeNameDropDownList.DataBind(); } catch (SqlException sqlExceptionObj) { errorLabel.Text = sqlExceptionObj.Message; } catch (Exception exceptionObj) { errorLabel.Text = exceptionObj.Message; } }
protected void saveButton_Click(object sender, EventArgs e) { string message = null; try { Employee employeeObj = new Employee(); employeeObj.ID = employeeIdLabel.Text; employeeObj.Name = employeeNameLabel.Text; employeeObj.Address = employeeAddressLabel.Text; employeeObj.PhoneNo = employeePhoneLabel.Text; employeeObj.Email = employeeEmailLabel.Text; employeeObj.JoiningDate = Convert.ToDateTime(joinDateLabel.Text); employeeObj.DOB = Convert.ToDateTime(dOBLabel.Text); TaskGateway TaskGatewayObj = new TaskGateway(); EmployeeGateway EmployeeGatewayObject = new EmployeeGateway(); message = EmployeeGatewayObject.InsertEmployee(employeeObj).ToString(); if (message == "True") { message = "Employee Data has been Saved"; } else { message = "Employee Data has not been Saved"; } Response.Redirect("EmployeeUIPage.aspx?" + "&message=" + Server.UrlEncode(message)); } catch (PrimaryKeyException primaryKeyExceptionObj) { errorMessageLabel.Text = primaryKeyExceptionObj.Message; } catch (SqlException sqlExceptionObj) { errorMessageLabel.Text = sqlExceptionObj.Message; } catch (Exception exceptionObj) { errorMessageLabel.Text = exceptionObj.Message; } }
/// <summary> /// Fill up employee ListBox /// </summary> private void FillAllEmployeeListBox() { try { //EmployeeGateway EmployeeGatewayObject = new EmployeeGateway(); EmployeeGateway EmployeeGatewayObject = new EmployeeGateway(); //allEmployeeListBox.DataSource = EmployeeGatewayObject.GetAllUserEmployees(); allEmployeeListBox.DataSource = EmployeeGatewayObject.GetEmployeeTable(); allEmployeeListBox.DataTextField = "employee_Name"; allEmployeeListBox.DataValueField = "employee_ID"; allEmployeeListBox.DataBind(); } catch (SqlException sqlExceptionObj) { errorLabel.Text = sqlExceptionObj.Message; } catch (Exception exceptionObj) { errorLabel.Text = exceptionObj.Message; } }
protected void userDropDownList_SelectedIndexChanged(object sender, EventArgs e) { if (userDropDownList.SelectedIndex.Equals(0)) // Item in index 0 is "-Select-" and not a valid item. So must not use { errorLabel.Text = ""; successLabel.Text = ""; userCurrentTypeLabel.Text = ""; userNameLabel.Text = ""; changeUserTypeButton.Text = "Change Type"; return; } try { UserGateway UserGatewayObject = new UserGateway(); EmployeeGateway EmployeeGatewayObject = new EmployeeGateway(); Employee employeeObject = EmployeeGatewayObject.SelectEmployee(userDropDownList.SelectedItem.Value); userNameLabel.Text = employeeObject.Name; if (UserGatewayObject.GetUserType(userDropDownList.SelectedItem.Value).ToString() == "Admin") { userCurrentTypeLabel.Text = "Admin"; changeUserTypeButton.Text = "Change to Normal user "; } else { userCurrentTypeLabel.Text = "Normal"; changeUserTypeButton.Text = "Change to Admin user "; } } catch (SqlException sqlExceptionObj) { errorLabel.Text = sqlExceptionObj.Message; } catch (Exception exceptionObj) { errorLabel.Text = exceptionObj.Message; } }
/// <summary> /// Fill up employee checkboxList who is not a member of the project /// </summary> private void FillEmployeeListBox() { try { EmployeeGateway EmployeeGatewayObject = new EmployeeGateway(); nonMemberEmployeeListBox.DataSource = EmployeeGatewayObject.GetAllNonMemberEmployeeOfAProjrct(projectDropDownList.SelectedItem.Value); nonMemberEmployeeListBox.DataTextField = "Name"; nonMemberEmployeeListBox.DataValueField = "ID"; nonMemberEmployeeListBox.DataBind(); if (EmployeeGatewayObject.GetAllNonMemberEmployeeOfAProjrct(projectDropDownList.SelectedItem.Value).Count == 0) { errorLabel.Text = "All employees are member of this project"; } } catch (SqlException sqlExceptionObj) { errorLabel.Text = sqlExceptionObj.Message; } catch (Exception exceptionObj) { errorLabel.Text = exceptionObj.Message; } }
void FillMessage(Message message, string currentUsername) { message.Sender = EmployeeGateway.Select(message.SenderUsername, currentUsername); message.Recipients = RecipientGateway.Select((int)message.Id, currentUsername); }
public List <string> GetAllEmployeesIds() { string currentUsername = ServiceSecurityContext.Current.PrimaryIdentity.Name; return(EmployeeGateway.SelectIds(currentUsername)); }
public FindEmployeesRule(EmployeeGateway employeeGateway) { _employeeGateway = employeeGateway; }
public EmployeeController() { this.employeeGateway = new EmployeeGateway(); }
/// <summary> /// Checks if admin can remove a employee /// </summary> /// <returns>true if admin can remove employee else false</returns> private bool CheckForEmployeeRemove() { successLabel.Text = ""; try { string employeeId = Session["userID"].ToString(); ProjectGateway ProjectGatewayObject = new ProjectGateway(); int numberOfProject = ProjectGatewayObject.SelectAllOpenProjects(employeeId).Count; //Admin can remove an employee from a project only if he is a member of it //This counts the number of projects admin have EmployeeGateway EmployeeGatewayObject = new EmployeeGateway(); int numberOfEmployee = EmployeeGatewayObject.GetAllEmployeesOfAProject(projectDropDownList.SelectedItem.Value).Count; //If there is only one project member then he cant be removed //This counts the number of members of the selected project UserGateway UserGatewayObjrct = new UserGateway(); if (projectDropDownList.SelectedIndex.Equals(0)) // Item in index 0 is "-Select-" and not a valid item. So must not use { errorLabel.Text = "Please select a project"; return(false); } else if (numberOfProject == 0) { errorLabel.Text = "Admin is not a member of any project. Admin cant remove any employee"; return(false); } else if (numberOfEmployee == 1) { errorLabel.Text = "Only Admin is employee of the ptoject. Cant remove!"; return(false); } else if (employeeDropDownList.SelectedIndex.Equals(0)) // Item in index 0 is "-Select-" and not a valid item. So must not use { errorLabel.Text = "Please select an employee to remove"; return(false); } else if (UserGatewayObjrct.GetUserType(employeeDropDownList.SelectedItem.Value).ToString() == "True") { errorLabel.Text = "Admin cant be removed"; return(false); } else { return(true); } } catch (NonUserEmployeeException nonUserEmployeeExceptionObject) { /*This exception occours when employee is not a user * but is a member of a project * A non user employee can be removed from the project * so true is returned * Admin will not be aware of this event as errorLabel.text will be removed when non user employee successfully removed * */ errorLabel.Text = nonUserEmployeeExceptionObject.Message + "Can be removed"; return(true); } catch (SqlException sqlExceptionObject) { errorLabel.Text = sqlExceptionObject.Message; return(false); } catch (Exception exceptionObject) { errorLabel.Text = exceptionObject.Message; return(false); } }