public ActionResult Index(LeaveApplicationDTOInformation Record) { Record.YearSelectList = _SpecialleavetypeService.GetYearSelectList(); Record.EmployeeCodeSelectlist = _LeaveEarnedService.GetBrancheEmployeeSelectList(Convert.ToInt32(ViewBag.Empcode)); List <LeaveApplicationDTO> RecordList = new List <LeaveApplicationDTO>(); try { if (ModelState.IsValid) { int roleid = Convert.ToInt32(Session["RoleId"]); Record.LeaveApplicationDTOList = _SpecialleavetypeService.GetAllSpecialApplicationLeaveListByYearAndMonth(Record); } else { ViewBag.Error = "Please Select Properly"; } } catch (Exception Exception) { ViewBag.Error = Exception.Message; return(View("../Leave/LeaveTypeSpecial/Index", Record)); } return(View("../Leave/LeaveTypeSpecial/Index", Record)); }
public ActionResult Index() { LeaveApplicationDTOInformation Record = new LeaveApplicationDTOInformation(); Record.LeaveApplicationDTOList = new List <LeaveApplicationDTO>(); Record.YearSelectList = _SpecialleavetypeService.GetYearSelectList(); Record.EmployeeCodeSelectlist = _LeaveEarnedService.GetBrancheEmployeeSelectList(Convert.ToInt32(ViewBag.Empcode)); return(View("../Leave/LeaveTypeSpecial/Index", Record)); }
public List <LeaveApplicationDTO> GetAllSpecialApplicationLeaveListByYearAndMonth(LeaveApplicationDTOInformation Record) { List <int> OfficeFilterList = _officeService.MyAccessOfficeList(); List <LeaveApplication> RecordList = new List <LeaveApplication>(); if (Record.MonthId == 0) { if (Record.LeaveEmpCode == null) { RecordList = _unitOfWork.LeaveApplicationRepository.Get(x => x.LeaveType.LeaveType1 == "Special" && x.LeaveYearId == Record.LeaveYearId && OfficeFilterList.Contains(x.Employee.EmpOfficeId)).ToList(); } else { RecordList = _unitOfWork.LeaveApplicationRepository.Get(x => x.LeaveType.LeaveType1 == "Special" && x.LeaveEmpCode == Record.LeaveEmpCode && x.LeaveYearId == Record.LeaveYearId && OfficeFilterList.Contains(x.Employee.EmpOfficeId)).ToList(); } } else { if (Record.LeaveEmpCode == null) { RecordList = _unitOfWork.LeaveApplicationRepository.Get(x => x.LeaveType.LeaveType1 == "Special" && x.LeaveYearId == Record.LeaveYearId && (x.LeaveStartDate.Month == Record.MonthId || x.LeaveEndDate.Month == Record.MonthId) && OfficeFilterList.Contains(x.Employee.EmpOfficeId)).ToList(); } else { RecordList = _unitOfWork.LeaveApplicationRepository.Get(x => x.LeaveType.LeaveType1 == "Special" && x.LeaveEmpCode == Record.LeaveEmpCode && x.LeaveYearId == Record.LeaveYearId && (x.LeaveStartDate.Month == Record.MonthId || x.LeaveEndDate.Month == Record.MonthId) && OfficeFilterList.Contains(x.Employee.EmpOfficeId)).ToList(); } } RecordList = _unitOfWork.LeaveApplicationRepository.Get(x => x.LeaveType.LeaveType1 == "Special" && x.LeaveYearId == Record.LeaveYearId && OfficeFilterList.Contains(x.Employee.EmpOfficeId)).ToList(); List <LeaveApplicationDTO> ReturnRecord = ResponseFormatters.LeaveApplicationResponseFormatter.LeaveApplicationDbListToModelList(RecordList); return(ReturnRecord); }