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);
        }
Beispiel #2
0
        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);
        }
        public ActionResult Index()
        {
            int EmpCode = Convert.ToInt32(Session["Empcode"]);

            try
            {
                LeaveApplicationModel Result = new LeaveApplicationModel();
                Result.LeaveApplication = _LeaveAddAdmin.LeaveApplicationSearch();

                //

                List <int> OfficeFilterList = _officeService.MyAccessOfficeList();

                Result.LeaveApplicationDetails = _LeaveAddAdmin.LeaveapplicationList().Where(x => x.LeaveEmpCode > 0 && OfficeFilterList.Contains(x.EmployeeDetail.EmpOfficeId)).Take(100).ToList();

                return(View(Result));
            }
            catch (Exception Ex)
            {
                Session["error"] = Ex.Message;
                return(View());
            }
        }
        public List <LeaveEarnedDTO> GetAllLeaveEarnedListByYearIdAndEmpCode(LeaveEarnedInfomationDTO Record)
        {
            List <LeaveEarned> RecordList = new List <LeaveEarned>();

            List <int> OfficeFilterList = _officeService.MyAccessOfficeList();

            RecordList = _unitOfWork.LeaveEarnedRepository.Get(x => x.LeaveYearId == Record.LeaveYearId && OfficeFilterList.Contains(x.Employee.EmpOfficeId)).ToList();

            if (Record.EmpId != null)
            {
                RecordList = RecordList.Where(x => x.EmpCode == Record.EmpId).ToList();
            }

            if (Record.MonthId > 0)
            {
                int monthId = (int)Record.MonthId;

                RecordList = RecordList.Where(x => x.WorkedStartDate.Month == Record.MonthId || x.WorkedEndDate.Month == Record.MonthId).ToList();
            }

            //if (Record.MonthId == 0)
            //{
            //    if (Record.EmpCode == null)
            //    {
            //        RecordList = _unitOfWork.LeaveEarnedRepository.Get(x => x.LeaveYearId == Record.LeaveYearId && OfficeFilterList.Contains(x.Employee.EmpOfficeId)).ToList();
            //    }
            //    else
            //    {
            //        RecordList = _unitOfWork.LeaveEarnedRepository.Get(x => x.EmpCode == Record.EmpId && x.LeaveYearId == Record.LeaveYearId && OfficeFilterList.Contains(x.Employee.EmpOfficeId)).ToList();

            //    }
            //}
            //else
            //{
            //    if (Record.EmpCode == null)
            //    {
            //        RecordList = _unitOfWork.LeaveEarnedRepository.Get(x => x.LeaveYearId == Record.LeaveYearId && (x.WorkedStartDate.Month == Record.MonthId || x.WorkedEndDate.Month == Record.MonthId) && OfficeFilterList.Contains(x.Employee.EmpOfficeId)).ToList();
            //    }
            //    else
            //    {
            //        RecordList = _unitOfWork.LeaveEarnedRepository.Get(x => x.LeaveYearId == Record.LeaveYearId && (x.WorkedStartDate.Month == Record.MonthId || x.WorkedEndDate.Month == Record.MonthId) && x.EmpCode == Record.EmpId && OfficeFilterList.Contains(x.Employee.EmpOfficeId)).ToList();

            //    }

            //}
            List <LeaveEarnedDTO> ReturnRecord = ResponseFormatters.LeaveEarnedResponseFormatter.LeaveEarnedListToDtoList(RecordList);

            return(ReturnRecord);
        }