// GET: Timekeeping public ActionResult Index() { var timeAttendanceTypes = timeAttendanceType.GetTimeAttendanceTypes(); ViewBag.TimeAttendanceTypes = new SelectList(timeAttendanceTypes, "Id", "Code"); long k = (long)Session["maphongban"]; SalaryHistoryCollectionViewModel model = new SalaryHistoryCollectionViewModel { Employees = employee.GetAll(), SalaryHistorys = _salaryHistoryService.GetSalaryHistorys1().Where(x => x.DepartmentId == k).ToList() }; return(View(model)); }
public ActionResult Login(LoginViewModel model) { //Session["username"] = model.Username; if (!ModelState.IsValid) { return(RedirectToAction("Login", "Account")); } var user = _authenticateService.Login(model); if (user == null) { return(RedirectToAction("Login", "Account")); } var claims = new List <Claim> { new Claim(ClaimTypes.NameIdentifier, user.Id.ToString()), new Claim(ClaimTypes.Name, user.UserName), }; foreach (var role in user.Roles) { claims.Add(new Claim(ClaimTypes.Role, role.Name)); } var identity = new ClaimsIdentity(claims, "Cookies"); _authenticateManager.SignIn(identity); //EmployeeViewModel query = new EmployeeViewModel(); var query = _employeeService.GetAll(); Session["count"] = query.Count(); var query1 = query.Where(x => x.DateOfBirth.Value.Month == DateTime.Now.Month).ToList(); Session["sinhnhat"] = query1.Count(); query = query.Where(x => x.LastName == model.Username).ToList(); Session["username"] = query[0].FirstName; Session["hinhanh"] = query[0].Avatar; Session["id"] = query[0].Id; long k = (long)Session["id"]; var laymaphongban = _salaryHistoryService.GetSalaryHistorys1().Where(x => x.EmployeeId == k).ToList(); Session["maphongban"] = laymaphongban[0].DepartmentId; return(RedirectToAction("Index", "Home")); }
public ActionResult dotuoi(int?department, string salarylever, int?worktitle, int?from, int?to, int?education, int?phongban, DateTime?fromdate, DateTime?todate, int?gender, int?skill, string sugget = "") { int _depart = department.HasValue ? department.Value : -1; int _from = from.HasValue ? from.Value : -1; int _to = to.HasValue ? to.Value : -1; if (fromdate.HasValue) { var model = _employeeService.SearchByDateOfBirth(_depart, fromdate, todate, sugget); return(View(model)); } else if (gender.HasValue) { var model = _employeeService.SearchByGender(_depart, gender, sugget); return(View(model)); } else if (education.HasValue) { var model = _employeeService.SearchByEducation(_depart, education, sugget); return(View(model)); } else if (skill.HasValue) { var model = _employeeService.SearchBySkill(_depart, skill, sugget); return(View(model)); } else if (worktitle.HasValue) { var query = _salaryHistoryservice.GetSalaryHistorys1(); var query1 = _salaryLevelService.GetSalaryLevels(); var query2 = _employeeService.GetAll(); var model = (from a in query1 join b in query on a.Id equals b.SalaryLevelId join p in query2 on b.EmployeeId equals p.Id where a.Node == salarylever && a.WorkTitleId == worktitle select new EmployeeViewModel { Id = p.Id, //Note = a.Node, LastName = p.LastName, FirstName = p.FirstName, Nationality = p.Nationality, Gender = p.Gender, IdentityNo = p.IdentityNo, DateOfBirth = p.DateOfBirth, PlaceOfBirth = p.PlaceOfBirth, DateIssueIdentity = p.DateIssueIdentity, PlaceIssueIdentity = p.PlaceIssueIdentity, EthnicGroup = p.EthnicGroup, Religion = p.Religion, Address = p.Address, Phone = p.Phone, Email = p.Email, YearDayOff = p.YearDayOff, Education = p.Education, DetailEducation = p.DetailEducation, Certificate = p.Certificate, CommunistYouthUnion = p.CommunistYouthUnion, SocialInsuranceNo = p.SocialInsuranceNo, DateIssueSocialInsurance = p.DateIssueSocialInsurance, BankAccount = p.BankAccount, Bank = p.Bank, DateSignContract = p.DateSignContract, DateOffContract = p.DateOffContract }).OrderBy(x => x.Id).ToList(); return(View(model)); } else { var model = _employeeService.SearchByOld(_depart, _from, _to, sugget); return(View(model)); } }
public ActionResult dotuoi(int?department, long?contracttype, int?from, int?to, int?education, int?phongban, DateTime?fromdate, DateTime?todate, int?gender, int?skill, string sugget = "") { int _depart = department.HasValue ? department.Value : -1; int _from = from.HasValue ? from.Value : -1; int _to = to.HasValue ? to.Value : -1; if (fromdate.HasValue) { var model = _employeeService.SearchByDateOfBirth(_depart, fromdate, todate, sugget); return(View(model)); } else if (gender.HasValue) { var model = _employeeService.SearchByGender(_depart, gender, sugget); return(View(model)); } else if (education.HasValue) { var model = _employeeService.SearchByEducation(_depart, education, sugget); return(View(model)); } else if (skill.HasValue) { var model = _employeeService.SearchBySkill(_depart, skill, sugget); return(View(model)); } else if (contracttype.HasValue) { var tablenv = _employeeService.GetAll(); var tablesalaryhistory = _salaryHistoryservice.GetSalaryHistorys1().Where(x => x.DepartmentId == _depart && x.CurrentContractTypeId == contracttype).ToList(); var model = (from a in tablesalaryhistory join p in tablenv on a.EmployeeId equals p.Id select new EmployeeViewModel { Id = p.Id, LastName = p.LastName, FirstName = p.FirstName, Nationality = p.Nationality, Gender = p.Gender, IdentityNo = p.IdentityNo, DateOfBirth = p.DateOfBirth, PlaceOfBirth = p.PlaceOfBirth, DateIssueIdentity = p.DateIssueIdentity, PlaceIssueIdentity = p.PlaceIssueIdentity, EthnicGroup = p.EthnicGroup, Religion = p.Religion, Address = p.Address, Phone = p.Phone, Email = p.Email, YearDayOff = p.YearDayOff, Education = p.Education, DetailEducation = p.DetailEducation, Certificate = p.Certificate, CommunistYouthUnion = p.CommunistYouthUnion, SocialInsuranceNo = p.SocialInsuranceNo, DateIssueSocialInsurance = p.DateIssueSocialInsurance, BankAccount = p.BankAccount, Bank = p.Bank, DateSignContract = p.DateSignContract, DateOffContract = p.DateOffContract }).OrderBy(x => x.Id); //var model = _employeeService.SearchByContractTypes(_depart, contracttype); return(View(model)); } else { var model = _employeeService.SearchByOld(_depart, _from, _to, sugget); return(View(model)); } }