public VMOvertimeApproval GetCreate3(VMOvertimeApprovalSelection es, int?[] SelectedEmployeeIds, VMOvertimeApproval vmOvertimeApproval)
        {
            List <MonthData> monthDatas   = new List <MonthData>();
            List <OTPolicy>  dbOTPolicies = DDService.GetOTPolicy();
            List <VMOvertimeApprovalChild> vmOvertimeApprovalChildList = new List <VMOvertimeApprovalChild>();
            List <VHR_EmployeeProfile>     employees = DDService.GetEmployeeInfo();
            PayrollPeriod payrollPeriod = DDService.GetPayrollPeriod().First(aa => aa.PPayrollPeriodID == es.PayrollPeriodID); // Get selected Payroll Period
            Expression <Func <MonthData, bool> > SpecificEntries = c => c.PayrollPeriodID == payrollPeriod.PPayrollPeriodID && (c.EncashbaleSingleOT > 0 || c.EncashbaleDoubleOT > 0 || c.CPLConversionOT > 0);

            monthDatas = MonthDataReporsitory.FindBy(SpecificEntries);
            foreach (int empid in SelectedEmployeeIds)
            {
                if (monthDatas.Where(aa => aa.EmployeeID == empid).Count() > 0)
                {
                    MonthData monthData = new MonthData();
                    monthData = monthDatas.First(aa => aa.EmployeeID == empid);
                    VMOvertimeApprovalChild vmOvertimeApprovalChild = new VMOvertimeApprovalChild();
                    VHR_EmployeeProfile     employee = employees.First(aa => aa.PEmployeeID == empid);// Get Specific Employee
                    vmOvertimeApprovalChild = GetConveretedOTList(vmOvertimeApprovalChild, employee, monthData, payrollPeriod);
                    vmOvertimeApprovalChildList.Add(vmOvertimeApprovalChild);
                }
            }
            vmOvertimeApproval.PayrollPeriodID       = payrollPeriod.PPayrollPeriodID;
            vmOvertimeApproval.PayrollPeriodName     = payrollPeriod.PRName;
            vmOvertimeApproval.OvertimeApprovalChild = vmOvertimeApprovalChildList;
            return(vmOvertimeApproval);
        }
        public ActionResult Create1()
        {
            VMOvertimeApprovalSelection vmJobCardCreate = new VMOvertimeApprovalSelection();

            vmJobCardCreate         = OvertimeAprrovalService.GetCreate1();
            ViewBag.PayrollPeriodID = new SelectList(DDService.GetPayrollPeriod().ToList().OrderBy(aa => aa.PRName).ToList(), "PPayrollPeriodID", "PRName");
            return(View(vmJobCardCreate));
        }
        public ActionResult Create3(VMOvertimeApprovalSelection es, int?[] SelectedEmpIds)
        {
            VMLoggedUser LoggedInUser = Session["LoggedInUser"] as VMLoggedUser;
            //H HR Admin //U   HR Normal
            VMOvertimeApproval vmOvertimeApproval = new VMOvertimeApproval();

            vmOvertimeApproval        = OvertimeAprrovalService.GetCreate3(es, SelectedEmpIds, vmOvertimeApproval);
            ViewBag.SubmittedToUserID = ViewBag.LineManagerID = new SelectList(AppAssistant.GetLineManagers(DDService.GetUser().Where(aa => aa.UserRoleID == "H").ToList()), "PUserID", "UserName", LoggedInUser.LineManagerID);
            ViewBag.OTStatusID        = new SelectList(DDService.GetMonthOTStage().Where(aa => aa.PMonthDataOTStageID == "H" || aa.PMonthDataOTStageID == "A"), "PMonthDataOTStageID", "MonthDataOTStageName", "H");
            return(View(vmOvertimeApproval));
        }
        public ActionResult Create1(VMOvertimeApprovalSelection es, int?[] SelectedCompanyIds, int?[] SelectedOUCommonIds, int?[] SelectedOUIds, int?[] SelectedEmploymentTypeIds,
                                    int?[] SelectedLocationIds, int?[] SelectedGradeIds, int?[] SelectedJobTitleIds, int?[] SelectedDesignationIds,
                                    int?[] SelectedCrewIds, int?[] SelectedShiftIds)
        {
            VMLoggedUser LoggedInUser = Session["LoggedInUser"] as VMLoggedUser;

            es = OvertimeAprrovalService.GetCreate2(es, SelectedCompanyIds, SelectedOUCommonIds, SelectedOUIds, SelectedEmploymentTypeIds,
                                                    SelectedLocationIds, SelectedGradeIds, SelectedJobTitleIds, SelectedDesignationIds,
                                                    SelectedCrewIds, SelectedShiftIds, LoggedInUser);
            return(View("Create2", es));
        }
        public VMOvertimeApprovalSelection GetCreate2(VMOvertimeApprovalSelection es, int?[] SelectedCompanyIds, int?[] SelectedOUCommonIds, int?[] SelectedOUIds, int?[] SelectedEmploymentTypeIds,
                                                      int?[] SelectedLocationIds, int?[] SelectedGradeIds, int?[] SelectedJobTitleIds, int?[] SelectedDesignationIds,
                                                      int?[] SelectedCrewIds, int?[] SelectedShiftIds, VMLoggedUser LoggedInUser)
        {
            List <MonthData> dbMontData     = new List <MonthData>();
            VMEmpSelection   vmEmpSelection = EmpSelectionService.GetStepTwo(SelectedCompanyIds,
                                                                             SelectedOUCommonIds, SelectedOUIds, SelectedEmploymentTypeIds,
                                                                             SelectedLocationIds, SelectedGradeIds, SelectedJobTitleIds, SelectedDesignationIds,
                                                                             SelectedCrewIds, SelectedShiftIds, es.EmpNo, LoggedInUser);

            es.Criteria     = vmEmpSelection.Criteria;
            es.CriteriaName = vmEmpSelection.CriteriaName;
            es.EmpNo        = vmEmpSelection.EmpNo;
            if (LoggedInUser.UserRoleID == "U")// HR Normal
            {
                Expression <Func <MonthData, bool> > SpecificEntries = c => c.PayrollPeriodID == es.PayrollPeriodID && (c.MonthDataStageID == "P" || c.MonthDataStageID == null) && (c.EncashbaleSingleOT > 0 || c.EncashbaleDoubleOT > 0 || c.CPLConversionOT > 0);
                dbMontData = MonthDataReporsitory.FindBy(SpecificEntries);
            }
            else if (LoggedInUser.UserRoleID == "H")// HR Admin
            {
                Expression <Func <MonthData, bool> > SpecificEntries = c => c.PayrollPeriodID == es.PayrollPeriodID && (c.MonthDataStageID == "H") && (c.EncashbaleSingleOT > 0 || c.EncashbaleDoubleOT > 0 || c.CPLConversionOT > 0);
                dbMontData = MonthDataReporsitory.FindBy(SpecificEntries);
            }
            else if (LoggedInUser.UserRoleID == "A")// Admin
            {
                Expression <Func <MonthData, bool> > SpecificEntries = c => c.PayrollPeriodID == es.PayrollPeriodID && (c.MonthDataStageID == "P") && (c.EncashbaleSingleOT > 0 || c.EncashbaleDoubleOT > 0 || c.CPLConversionOT > 0);
                dbMontData = MonthDataReporsitory.FindBy(SpecificEntries);
            }
            else
            {
                Expression <Func <MonthData, bool> > SpecificEntries = c => c.PayrollPeriodID == es.PayrollPeriodID && (c.EncashbaleSingleOT > 0 || c.EncashbaleDoubleOT > 0 || c.CPLConversionOT > 0);
                dbMontData = MonthDataReporsitory.FindBy(SpecificEntries);
            }
            List <VHR_EmployeeProfile> dbEmployees = new List <VHR_EmployeeProfile>();

            foreach (var item in vmEmpSelection.Employee)
            {
                if (dbMontData.Where(aa => aa.EmployeeID == item.PEmployeeID).Count() > 0)
                {
                    dbEmployees.Add(item);
                }
            }
            es.Employee          = dbEmployees;
            es.PayrollPeriodName = DDService.GetPayrollPeriod().Where(aa => aa.PPayrollPeriodID == es.PayrollPeriodID).First().PRName;
            return(es);
        }
        public VMOvertimeApprovalSelection GetCreate1()
        {
            VMOvertimeApprovalSelection obj = new VMOvertimeApprovalSelection();

            return(obj);
        }