public void CheckWithNegativeForTestCheckMethod() { EmployeeBL bl = new EmployeeBL(); int result = bl.TestCheck(-20); Assert.AreEqual(-19, result); }
public static void AddEmployee() { Employee employeeNew = new Employee(); Console.WriteLine("Enter employee Id"); employeeNew.EmployeeId = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter employee name"); employeeNew.EmployeeName = Console.ReadLine(); Console.WriteLine("Enter designation Id"); employeeNew.DesignationId = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter department Id"); employeeNew.DepartmentId = Convert.ToInt32(Console.ReadLine()); try { bool success = EmployeeBL.AddEmployeeBL(employeeNew); if (success) { Console.WriteLine("Employee successfully added"); } else { Console.WriteLine("Employee addition unsuccessful"); } } catch (EmployeeAppException ex) { Console.WriteLine(ex.Message); } }
public static void GetAllEmployee() { try { Dictionary <int, Employee> employees = EmployeeBL.GetAllEmployeeBL(); if (employees != null) { Console.WriteLine("Employee Details"); Console.WriteLine("******************************************************************************"); Console.WriteLine("EmployeeID\tEmployeeName\tDesignationNo\tDepartmentNo"); foreach (KeyValuePair <int, Employee> keyVal in employees) { Employee employee = keyVal.Value; Console.WriteLine("******************************************************************************"); Console.WriteLine("{0}\t\t{1}\t\t{2}\t\t{3}", employee.EmployeeId, employee.EmployeeName, employee.DesignationId, employee.DepartmentId); Console.WriteLine("******************************************************************************"); } } else { Console.WriteLine("No employee Found"); } } catch (EmployeeAppException ex) { Console.WriteLine(ex.Message); } }
private static void EmployeeLogIn() { Console.WriteLine("Enter Employee ID, Password and Employee Code to log in"); try { Employee employee = new Employee(); Console.WriteLine("Enter Employee Id"); employee.EmployeeID = Console.ReadLine(); Console.WriteLine("Enter Employee Password"); employee.EmployeePassword = Console.ReadLine(); Console.WriteLine("Enter Employee Code"); employee.EmployeeCode = Console.ReadLine(); bool employeeLoggedin = EmployeeBL.EmployeeLogInBL(employee); if (employeeLoggedin) { Console.WriteLine("Employee Logged In"); } else { Console.WriteLine("Employee not Logged In"); } } catch (PecuniaException ex) { Console.WriteLine(ex.Message); } }
public static void SearchEmployee() { Console.WriteLine("Enter employee Id"); int employeeId = Convert.ToInt32(Console.ReadLine()); try { Employee employee = EmployeeBL.SearchEmployeeBL(employeeId); if (employee != null) { Console.WriteLine("Employee Details"); Console.WriteLine("******************************************************************************"); Console.WriteLine("EmployeeID\t\tEmployeeName\t\tDesignationNo\t\tDepartmentNo"); Console.WriteLine("******************************************************************************"); Console.WriteLine("{0}\t\t\t\t\t\t\t\t{1}\t\t\t\t\t\t\t\t{2}\t\t\t\t\t\t\t\t{3}", employee.EmployeeId, employee.EmployeeName, employee.DesignationId, employee.DepartmentId); Console.WriteLine("******************************************************************************"); } else { Console.WriteLine("Employee doesn't exist"); } } catch (EmployeeAppException ex) { Console.WriteLine(ex.Message); } }
public ActionResult Index() { EmployeeListViewModel employeeListViewModel = new EmployeeListViewModel(); // employeeListViewModel.UserName = User.Identity.Name; //New Line EmployeeBL empBal = new EmployeeBL(); List <Employee> employees = empBal.GetEmployee(); List <EmployeeViewModel> empViewModels = new List <EmployeeViewModel>(); foreach (Employee emp in employees) { EmployeeViewModel empViewModel = new EmployeeViewModel(); empViewModel.EmployeeName = emp.FirstName + " " + emp.LastName; empViewModel.Salary = emp.Salary.ToString("C"); if (emp.Salary > 15000) { empViewModel.SalaryColor = "yellow"; } else { empViewModel.SalaryColor = "green"; } empViewModels.Add(empViewModel); } employeeListViewModel.Employeelist = empViewModels; //employeeListViewModel.FooterData = new FooterViewModel(); //employeeListViewModel.FooterData.CompanyName = "StepByStepSchools";//Can be set to dynamic value //employeeListViewModel.FooterData.Year = DateTime.Now.Year.ToString(); return(View("ViewModel", employeeListViewModel)); }
private EmployeeListViewModel getEmployee() { EmployeeListViewModel empViewModel = new EmployeeListViewModel(); List <EmployeeViewModel> listVwEmp = new List <EmployeeViewModel>(); EmployeeBL employeeBL = new EmployeeBL(); List <Employee> listEmployee = new List <Employee>(); listEmployee = employeeBL.GetEmployee(); foreach (var emp in listEmployee) { EmployeeViewModel vwEmp = new EmployeeViewModel(); vwEmp.EmployeeName = string.Format("{0} {1}", emp.FirstName, emp.LastName); vwEmp.Salary = emp.Salary.ToString("C"); if (emp.Salary > 1000) { vwEmp.SalaryColor = "yellow"; } else { vwEmp.SalaryColor = "green"; } listVwEmp.Add(vwEmp); } empViewModel.Employeelist = listVwEmp; empViewModel.UserName = User.Identity.Name; return(empViewModel); }
public void TestMethod2() { EmployeeBL bl = new EmployeeBL(); int result = bl.GetData().Count; Assert.AreEqual(3, result); }
public void TestMethod1() { EmployeeBL bl = new EmployeeBL(); int result = bl.TestCheck(100); Assert.AreEqual(101, result); }
public IEnumerable <EmployeeDTO> Get() { EmployeeBL employeeBL = new EmployeeBL(); IEnumerable <EmployeeDTO> employees = employeeBL.GetEmployees(); return(employees); }
private void btnSearch_Click(object sender, EventArgs e) { if (txtSearch.Text == string.Empty) { MessageBox.Show("Please Enter An ID"); } else if (!string.IsNullOrEmpty(txtSearch.Text)) { EmployeeBL objEmp = new EmployeeBL() { EmployeeID = Convert.ToInt32(txtSearch.Text) }; var dt = objEmp.Search(); if (dt.Count > 0) { dgvEmpSalary.DataSource = dt; } } else { MessageBox.Show("Invalid Employee ID"); } }
private void Initialize() { _employeeBL = new EmployeeBL(Uow); _vacationBL = new VacationBL(Uow); _vacationTypeBL = new VacationTypeBL(Uow); //VacationType type = new VacationType(Uow); //type.Name = "Verlof"; //Uow.CommitChanges(); List <TIS.Model.Internal.Employee> employees = _employeeBL.GetAll(); List <TIS.Model.Internal.VacationType> vacationTypes = _vacationTypeBL.GetAll(); _vacations = _vacationBL.GetByEmployee(EmployeeModel); gdcVacation.DataSource = _vacations; glouDispatcher.Properties.DataSource = employees; glouDispatcher.Properties.DisplayMember = "DisplayName"; glouDispatcher.Properties.ValueMember = "empID"; glouVacationType.Properties.DataSource = vacationTypes; glouVacationType.Properties.DisplayMember = "Name"; glouVacationType.Properties.ValueMember = "Id"; }
private void AddEmployeeInProject() { Employee employee = _repository.GetEntity <Employee>(_employeeDTONoProj.ID); EmployeeBL canAddEmployee = new EmployeeBL(employee); if (!canAddEmployee.CanAddEmployeeInProject()) { IDialogService dg = new DialogService(); dg.ShowMessage("Внимание", "Нельзя назначать более 3-х \n проектов одному сотруднику"); return; } _project = _repository.GetEntity <Project>(_projectDTO.ID); EmployeeProject empProj = new EmployeeProject() { Employee = employee, Project = _project, Post = "МЕГААА БОСС" }; _repository.UoW.BeginTransaction(); _repository.UoW.Add(empProj); _repository.UoW.CommitTransaction(); if (this._changeProject != null) { this._changeProject(this, null); } }
public changePassword() { InitializeComponent(); this.CenterToScreen(); bussinessLogic = new EmployeeBL(); textBox1.Text = Constants.CurrentUserText; }
public Employees() { try { InitializeComponent(); _vacationList = new List<TIS.Model.Internal.Vacation>(); _vacationSessionList = new List<TIS.Model.Internal.Vacation>(); _employeeBL = new EmployeeBL(Uow); _vacationBL = new VacationBL(Uow); FindAll(); Initialize(); } catch (System.Exception exception1) { System.Exception innerException = exception1; throw new System.Exception(MethodBase.GetCurrentMethod().Name, innerException); } }
public void employee_validation_login_id_must_be_unique() { Action proc = () => { var employee = FakeEmployee.GetFakeEmployee(); database.Insert(employee); var employee1 = FakeEmployee.GetFakeEmployee(); var rules = new EmployeeBL(database).ValidateEmployee(employee1); Assert.IsTrue(rules.Count == 1); Assert.IsTrue(rules[0].ErrorMessage == "Employee: Login id already exists!"); }; database.ExecuteInTest(proc); }
private void Initialize() { _employeeBL = new EmployeeBL(Uow); _vacationBL = new VacationBL(Uow); _vacationTypeBL = new VacationTypeBL(Uow); //VacationType type = new VacationType(Uow); //type.Name = "Verlof"; //Uow.CommitChanges(); List<TIS.Model.Internal.Employee> employees = _employeeBL.GetAll(); List<TIS.Model.Internal.VacationType> vacationTypes = _vacationTypeBL.GetAll(); _vacations = _vacationBL.GetByEmployee(EmployeeModel); gdcVacation.DataSource = _vacations; glouDispatcher.Properties.DataSource = employees; glouDispatcher.Properties.DisplayMember = "DisplayName"; glouDispatcher.Properties.ValueMember = "empID"; glouVacationType.Properties.DataSource = vacationTypes; glouVacationType.Properties.DisplayMember = "Name"; glouVacationType.Properties.ValueMember = "Id"; }