public void InsertEmployee(Employee data)
 {
     if(data != null || !(fakeDatabaseOfEmployees.Find(e => (int)e.EmployeeID == data.EmployeeID) == null))
     {
         fakeDatabaseOfEmployees.Add(data);
     }
 }
        public bool IsUserValid(Models.Employee user)
        {
            bool IsValidUser = _dbContext.Employees
                               .Any(u => u.Username.ToLower() == user
                                    .UserName.ToLower() && user
                                    .Password == user.Password);

            return(IsValidUser);
        }
Beispiel #3
0
        public bool AuthenticateUser(Models.Employee user)
        {
            bool IsUserAuthenticated = _dbContext.Employees
                                       .Any(u => u.Username.ToLower() == user
                                            .UserName.ToLower() && user
                                            .Password == user.Password);

            return(IsUserAuthenticated);
        }
        public uint CalculateExemptionForRent(
            Employee        employee,
            ITaxCalculator  ic)
        {
            var taxExemption = ic.calculate(
                                    employee.Property.IsRented,
                                    employee.Property.Location,
                                    employee.AnnualBasicSalary,
                                    employee.Property.MonthlyRent,
                                    employee.AnnualHouseRentAllowance);

            return taxExemption;
        }
        public ActionResult Edit(Employee e)
        {
            if (ModelState.IsValid)
            {
                EmployeeRepository er = new EmployeeRepository();
                er.UpdateOnSubmit(e);
                return RedirectToAction("Index");

            }
            else
            {
                e.DepartmentList = new DepartmentRepository().GetAll();
            }

            return View(e);
        }
 /// <summary>
 /// adds an employee to the list
 /// </summary>
 /// <param name="anEmployee">the employee to insert</param>
 /// <param name="aListOfDependents">a list of the employee's dependents</param>
 public void AddEmployee(Employee anEmployee, List<Dependent> aListOfDependents)
 {
     if (aListOfDependents != null)
     {
         foreach (var dependent in aListOfDependents)
         {
             if (!string.IsNullOrWhiteSpace(dependent.Name))
             {
                 int id = AddDependent(dependent);
                 anEmployee.Dependents.Add(id);
             }
         }
     }
     anEmployee.EmployeeId = MockData.employees.Count + 1;
     anEmployee.Salary = decimal.Parse(configRepo.GetConfigItem("Salary"));
     MockData.employees.Add(anEmployee);
 }
 public void UpdateEmployee(Employee data)
 {
     var entry = (fakeDatabaseOfEmployees.First(e => e.EmployeeID == data.EmployeeID));
     entry.FirstName = data.FirstName;
     entry.FirstName = data.LastName;
     entry.City = data.City;
     entry.Email = data.Email;
     entry.CPR = data.CPR;
     entry.EmpAddress = data.EmpAddress;
     entry.Zip = data.Zip;
     entry.Country = data.Country;
     entry.TelephoneNumber = data.TelephoneNumber;
     entry.MobileNumber = data.MobileNumber;
     entry.CreditCard = data.CreditCard;
     entry.ExpDate = data.ExpDate;
     entry.EmployeePosition = data.EmployeePosition;
 }
 public ActionResult Create()
 {
     Employee e = new Employee();
     e.DepartmentList = new DepartmentRepository().GetAll();
     return View(e);
 }
 /// <summary>
 /// adds an employee the database
 /// </summary>
 /// <param name="anEmployee">the employee to add</param>
 /// <param name="aListOfDependents">a list of the employee's dependents</param>
 public void AddEmployee(Employee anEmployee, List<Dependent> aListOfDependents)
 {
     // TODO: implement this when DB is in place
 }
 public void DeleteEmployee(Employee data)
 {
     fakeDatabaseOfEmployees.Remove(
         fakeDatabaseOfEmployees.FirstOrDefault(
             e => e.EmployeeID == data.EmployeeID));
 }
        public async Task<IHttpActionResult> Register(RegisterBindingModel model)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            User user;

            if (model.IsEmployee)
            {
                user = new Employee { Email = model.Email, UserName = model.Email, FirstName = model.FirstName, LastName = model.LastName, UType = UType.Employee };
            }
            else
            {
                user = new Client { Email = model.Email, UserName = model.Email, FirstName = model.FirstName, LastName = model.LastName, UType = UType.Client };
            }

            IdentityResult result = await UserManager.CreateAsync(user, model.Password);

            if (!result.Succeeded)
            {
                return GetErrorResult(result);
            }

            return Ok();
        }
 /// <summary>
 /// adds an employee to the list
 /// </summary>
 /// <param name="anEmployee">the employee to insert</param>
 /// <param name="aListOfDependents">a list of the employee's dependents</param>
 public void AddEmployee(Employee anEmployee, List<Dependent> aListOfDependents)
 {
     anEmployee.EmployeeId = employees.Count + 1;
     anEmployee.Salary = decimal.Parse(configRepo.GetConfigItem("Salary"));
     employees.Add(anEmployee);
 }
Beispiel #13
0
 public virtual void AddEmployee(Employee employee)
 {
     employee.Store = this;
     Staff.Add(employee);
 }