示例#1
0
        public ActionResult Index()
        {
            PayrollLeaveDeductionInformation Record = new PayrollLeaveDeductionInformation();

            Record.PayrollLeaveDeductionList = new List <PayrollLeaveDeductionDTO>();
            Record.YearSelectList            = _SpecialleavetypeService.GetYearSelectList();
            Record.EmployeeCodeSelectlist    = _LeaveEarnedService.GetBrancheEmployeeSelectList(Convert.ToInt32(ViewBag.Empcode));
            List <PayrollLeaveDeductionDTO> RecordList = new List <PayrollLeaveDeductionDTO>();

            return(View("../Leave/PayrollLeaveDeduction/Index", Record));
        }
示例#2
0
        public ActionResult Index(PayrollLeaveDeductionInformation Record)
        {
            Record.PayrollLeaveDeductionList = new List <PayrollLeaveDeductionDTO>();
            Record.YearSelectList            = _SpecialleavetypeService.GetYearSelectList();
            Record.EmployeeCodeSelectlist    = _LeaveEarnedService.GetBrancheEmployeeSelectList(Convert.ToInt32(ViewBag.Empcode));
            try
            {
                if (ModelState.IsValid)
                {
                    Record.PayrollLeaveDeductionList = _payrollLeaveDeductionService.GetAllPayrollLeaveDeductionListByYearIdAndEmpCode(Record);
                }
                else
                {
                    ViewBag.Error = "Please Select Properly";
                }
            }
            catch (Exception Exception)
            {
                ViewBag.Error = Exception.Message;
            }

            return(View("../Leave/PayrollLeaveDeduction/Index", Record));
        }
        public List <PayrollLeaveDeductionDTO> GetAllPayrollLeaveDeductionListByYearIdAndEmpCode(PayrollLeaveDeductionInformation Record)
        {
            List <PayrollLeaveDeduction> RecordList = new List <PayrollLeaveDeduction>();
            List <int> OfficeFilterList             = _officeService.MyAccessOfficeList();

            if (Record.MonthId == 0)
            {
                if (Record.EmpId == null)
                {
                    RecordList = _unitOfWork.PayrollLeaveDeductionRepository.Get(x => x.LeaveYearId == Record.LeaveYearId && x.DeductionType == "C" && OfficeFilterList.Contains(x.Employee.EmpOfficeId)).ToList();
                }
                else
                {
                    RecordList = _unitOfWork.PayrollLeaveDeductionRepository.Get(x => x.LeaveYearId == Record.LeaveYearId && x.EmpCode == Record.EmpId && x.DeductionType == "C" && OfficeFilterList.Contains(x.Employee.EmpOfficeId)).ToList();
                }
            }
            else
            {
                if (Record.EmpId == null)
                {
                    RecordList = _unitOfWork.PayrollLeaveDeductionRepository.Get(x => x.LeaveYearId == Record.LeaveYearId && x.LeaveDate.Month == Record.MonthId && x.DeductionType == "C" && OfficeFilterList.Contains(x.Employee.EmpOfficeId)).ToList();
                }
                else
                {
                    RecordList = _unitOfWork.PayrollLeaveDeductionRepository.Get(x => x.LeaveYearId == Record.LeaveYearId && x.EmpCode == Record.EmpId && x.LeaveDate.Month == Record.MonthId && x.DeductionType == "C" && OfficeFilterList.Contains(x.Employee.EmpOfficeId)).ToList();
                }
            }

            List <PayrollLeaveDeductionDTO> ReturnRecord = ResponseFormatters.PayrollLeaveDeductionResponseFormatter.PayrollLeaveDeductionListToDtoList(RecordList);

            return(ReturnRecord);
        }