예제 #1
0
        public ActionResult Create3(VMLeaveQuotaSelection es, int?[] SelectedEmpIds)
        {
            VMLeaveQuota vmLeaveQuota = new VMLeaveQuota();

            vmLeaveQuota = LeaveQuotaService.GetCreate3(es, SelectedEmpIds, vmLeaveQuota);
            return(View(vmLeaveQuota));
        }
예제 #2
0
        public ActionResult Create1()
        {
            VMLeaveQuotaSelection vmJobCardCreate = new VMLeaveQuotaSelection();

            vmJobCardCreate = LeaveQuotaService.GetCreate1();
            Helper();
            return(View(vmJobCardCreate));
        }
예제 #3
0
        public ActionResult Create2(VMLeaveQuotaSelection 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 = LeaveQuotaService.GetCreate2(es, SelectedCompanyIds, SelectedOUCommonIds, SelectedOUIds, SelectedEmploymentTypeIds,
                                              SelectedLocationIds, SelectedGradeIds, SelectedJobTitleIds, SelectedDesignationIds,
                                              SelectedCrewIds, SelectedShiftIds, LoggedInUser);
            return(View(es));
        }
예제 #4
0
        public VMLeaveQuotaSelection GetCreate2(VMLeaveQuotaSelection es, int?[] SelectedCompanyIds, int?[] SelectedOUCommonIds, int?[] SelectedOUIds, int?[] SelectedEmploymentTypeIds,
                                                int?[] SelectedLocationIds, int?[] SelectedGradeIds, int?[] SelectedJobTitleIds, int?[] SelectedDesignationIds,
                                                int?[] SelectedCrewIds, int?[] SelectedShiftIds, VMLoggedUser LoggedInUser)
        {
            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;
            es.Employee          = vmEmpSelection.Employee;
            es.FinancialYearName = DDService.GetFinancialYear().Where(aa => aa.PFinancialYearID == es.FinancialYearID).First().FYName;
            return(es);
        }
예제 #5
0
        public VMLeaveQuotaSelection GetCreate1()
        {
            VMLeaveQuotaSelection obj = new VMLeaveQuotaSelection();

            return(obj);
        }
예제 #6
0
        public VMLeaveQuota GetCreate3(VMLeaveQuotaSelection es, int?[] SelectedEmployeeIds, VMLeaveQuota vmLeaveQuota)
        {
            List <VMLeaveQuotaChild>   vmLeaveQuotaChildList = new List <VMLeaveQuotaChild>();
            List <VHR_EmployeeProfile> employees             = DDService.GetEmployeeInfo();                                                         // Get All Employees from database
            List <LeavePolicy>         leavePolicyList       = DDService.GetLeavePolicy();                                                          // Get all leave policies
            FinancialYear         financialYear              = DDService.GetFinancialYear().First(aa => aa.PFinancialYearID == es.FinancialYearID); // Get selected financial year
            List <FinancialYear>  financialYearCloseList     = DDService.GetFinancialYear().Where(aa => aa.FYStatus == false).OrderByDescending(aa => aa.FYEndDate).ToList();
            List <LeaveQuotaYear> leaveQuotaPreviousYearList = new List <LeaveQuotaYear>();

            // Get Old Financial Year
            if (financialYearCloseList.Count > 0)
            {
                int LastFinYearID = financialYearCloseList.FirstOrDefault().PFinancialYearID;
                Expression <Func <LeaveQuotaYear, bool> > SpecificEntries = c => c.FinancialYearID == LastFinYearID && c.LeaveTypeID == 1;
                leaveQuotaPreviousYearList = LeaveQuotaYearReporsitory.FindBy(SpecificEntries);// Get all Leave quota Balances for specific financial year
            }
            Expression <Func <LeaveQuotaYear, bool> > SpecificEntries2 = c => c.FinancialYearID == es.FinancialYearID;
            List <LeaveQuotaYear> leaveQuotaYearList = LeaveQuotaYearReporsitory.FindBy(SpecificEntries2);// Get all Leave quota Balances for specific financial year

            foreach (int empid in SelectedEmployeeIds)
            {
                if (leaveQuotaYearList.Where(aa => aa.EmployeeID == empid).Count() == 0)
                {
                    VMLeaveQuotaChild   vmLeaveQuotaChild = new VMLeaveQuotaChild();
                    VHR_EmployeeProfile employee          = employees.First(aa => aa.PEmployeeID == empid);// Get Specific Employee
                    float ALDays   = GetTotalDays(leavePolicyList.Where(aa => aa.PLeavePolicyID == employee.ALPolicyID).ToList(), employee, financialYear);
                    float CLDays   = GetTotalDays(leavePolicyList.Where(aa => aa.PLeavePolicyID == employee.CLPolicyID).ToList(), employee, financialYear);
                    float SLDays   = GetTotalDays(leavePolicyList.Where(aa => aa.PLeavePolicyID == employee.SLPolicyID).ToList(), employee, financialYear);
                    float STDLDays = GetTotalDays(leavePolicyList.Where(aa => aa.PLeavePolicyID == employee.STDLPolicyID).ToList(), employee, financialYear);
                    vmLeaveQuotaChild.EmpID             = employee.PEmployeeID;
                    vmLeaveQuotaChild.EmpNo             = employee.OEmpID;
                    vmLeaveQuotaChild.EmployeeName      = employee.EmployeeName;
                    vmLeaveQuotaChild.JobTitleName      = employee.JobTitleName;
                    vmLeaveQuotaChild.FinancialYearID   = financialYear.PFinancialYearID;
                    vmLeaveQuotaChild.FinancialYearName = financialYear.FYName;
                    if (employee.DOJ != null)
                    {
                        vmLeaveQuotaChild.DOJ = employee.DOJ.Value.ToString("dd-MMM-yyyy");
                    }
                    vmLeaveQuotaChild.AL   = ALDays;
                    vmLeaveQuotaChild.CL   = CLDays;
                    vmLeaveQuotaChild.SL   = SLDays;
                    vmLeaveQuotaChild.STDL = STDLDays;
                    // Get LeaveBalance for Previous Year
                    if (leaveQuotaPreviousYearList.Where(aa => aa.EmployeeID == employee.PEmployeeID).Count() > 0)
                    {
                        vmLeaveQuotaChild.CollapseLeave = 0;
                        vmLeaveQuotaChild.ALBalance     = GetALLeaveBalance(leaveQuotaPreviousYearList.Where(aa => aa.EmployeeID == employee.PEmployeeID).ToList());
                        vmLeaveQuotaChild.CarryForward  = vmLeaveQuotaChild.ALBalance - vmLeaveQuotaChild.CollapseLeave;
                    }
                    else
                    {
                        vmLeaveQuotaChild.CarryForward  = 0;
                        vmLeaveQuotaChild.CollapseLeave = 0;
                        vmLeaveQuotaChild.ALBalance     = 0;
                    }
                    vmLeaveQuotaChildList.Add(vmLeaveQuotaChild);
                }
            }
            vmLeaveQuota.FinancialYearID   = financialYear.PFinancialYearID;
            vmLeaveQuota.FinancialYearName = financialYear.FYName;
            vmLeaveQuota.LeaveQuotaChild   = vmLeaveQuotaChildList;
            return(vmLeaveQuota);
        }