Beispiel #1
0
        public static void InsertNewEmployee(EmployeeUsersDetails employeeUser)
        {
            int      userId   = UserProfilesRepository.GetUserByUserName(employeeUser.UserName).UserId;
            Employee employee = new Employee();

            employee.CurrentSalary = employeeUser.CurrentSalary;
            employee.JoinDate      = employeeUser.JoinDate;
            employee.UserId        = userId;
            employee.CreateDate    = DateTimeHelper.Today();
            if (employeeUser.RoleId == 0)
            {
                webpages_Roles role = RolesRepositories.GetEmployeeRole();
                employeeUser.RoleId = role.RoleId;
            }

            EmployeesRepositories.InsertNewEmployee(employee);
            RolesRepositories.CreateUser(userId, employeeUser.RoleId);
        }
        public static EmployeeUsersDetails GetCreateModel(int id)
        {
            EmployeeUsersDetails model = new EmployeeUsersDetails();
            webpages_Roles       role  = RolesRepositories.GetRoleById(id);

            if (role != null)
            {
                model.RoleDisplayName = role.DisplayName;
            }

            model.RoleId = id;
            model.year   = 1950;
            model.Month  = 1;
            model.day    = 1;

            model.NumberOfDaysInMonth = DateTime.DaysInMonth(model.year, model.Month);
            model.ImgURL   = "";
            model.JoinDate = DateTimeHelper.Today();
            return(model);
        }