Exemple #1
0
        //public PayrollServices()
        //{
        //    //Get all the schedule task for a specific companyId
        //    var scheduleCollection = this.lookupRepository.GetSchedules();

        //    //Check f any schedule exist
        //    if (scheduleCollection != null && scheduleCollection.Count > 0)
        //    {
        //        foreach (var item in scheduleCollection)
        //        {
        //            //check if the schedule is a Payroll
        //            if (item.ScheduleName.Contains("Payroll"))
        //            {
        //                // Schedule a more complex action to run immediately and on an monthly interval
        //                if (item.WeekId == 1)
        //                {
        //                    if (item.DayId == 1)
        //                    {
        //                        Schedule<SchedulerServices>().ToRunNow().AndEvery(1).Months().OnTheFirst(DayOfWeek.Monday).At(0, 0);
        //                    }
        //                    else if (item.DayId == 2)
        //                    {
        //                        Schedule<SchedulerServices>().ToRunNow().AndEvery(1).Months().OnTheFirst(DayOfWeek.Tuesday).At(0, 0);
        //                    }
        //                    else if (item.DayId == 3)
        //                    {
        //                        Schedule<SchedulerServices>().ToRunNow().AndEvery(1).Months().OnTheFirst(DayOfWeek.Wednesday).At(0, 0);
        //                    }
        //                    else if (item.DayId == 4)
        //                    {
        //                        Schedule<SchedulerServices>().ToRunNow().AndEvery(1).Months().OnTheFirst(DayOfWeek.Thursday).At(0, 0);
        //                    }
        //                    else if (item.DayId == 5)
        //                    {
        //                        Schedule<SchedulerServices>().ToRunNow().AndEvery(1).Months().OnTheFirst(DayOfWeek.Friday).At(0, 0);
        //                    }
        //                }
        //                else if (item.WeekId == 2)
        //                {
        //                    if (item.DayId == 1)
        //                    {
        //                        Schedule<SchedulerServices>().ToRunNow().AndEvery(1).Months().OnTheSecond(DayOfWeek.Monday).At(0, 0);
        //                    }
        //                    else if (item.DayId == 2)
        //                    {
        //                        Schedule<SchedulerServices>().ToRunNow().AndEvery(1).Months().OnTheSecond(DayOfWeek.Tuesday).At(0, 0);
        //                    }
        //                    else if (item.DayId == 3)
        //                    {
        //                        Schedule<SchedulerServices>().ToRunNow().AndEvery(1).Months().OnTheSecond(DayOfWeek.Wednesday).At(0, 0);
        //                    }
        //                    else if (item.DayId == 4)
        //                    {
        //                        Schedule<SchedulerServices>().ToRunNow().AndEvery(1).Months().OnTheSecond(DayOfWeek.Thursday).At(0, 0);
        //                    }
        //                    else if (item.DayId == 5)
        //                    {
        //                        Schedule<SchedulerServices>().ToRunNow().AndEvery(1).Months().OnTheSecond(DayOfWeek.Friday).At(0, 0);
        //                    }
        //                }
        //                else if (item.WeekId == 3)
        //                {
        //                    if (item.DayId == 1)
        //                    {
        //                        Schedule<SchedulerServices>().ToRunNow().AndEvery(1).Months().OnTheThird(DayOfWeek.Monday).At(0, 0);
        //                    }
        //                    else if (item.DayId == 2)
        //                    {
        //                        Schedule<SchedulerServices>().ToRunNow().AndEvery(1).Months().OnTheThird(DayOfWeek.Tuesday).At(0, 0);
        //                    }
        //                    else if (item.DayId == 3)
        //                    {
        //                        Schedule<SchedulerServices>().ToRunNow().AndEvery(1).Months().OnTheThird(DayOfWeek.Wednesday).At(0, 0);
        //                    }
        //                    else if (item.DayId == 4)
        //                    {
        //                        Schedule<SchedulerServices>().ToRunNow().AndEvery(1).Months().OnTheThird(DayOfWeek.Thursday).At(0, 0);
        //                    }
        //                    else if (item.DayId == 5)
        //                    {
        //                        Schedule<SchedulerServices>().ToRunNow().AndEvery(1).Months().OnTheThird(DayOfWeek.Friday).At(0, 0);
        //                    }
        //                }
        //                else if (item.WeekId == 4)
        //                {
        //                    if (item.DayId == 1)
        //                    {
        //                        Schedule<SchedulerServices>().ToRunNow().AndEvery(1).Months().OnTheFourth(DayOfWeek.Monday).At(0, 0);
        //                    }
        //                    else if (item.DayId == 2)
        //                    {
        //                        Schedule<SchedulerServices>().ToRunNow().AndEvery(1).Months().OnTheFourth(DayOfWeek.Tuesday).At(0, 0);
        //                    }
        //                    else if (item.DayId == 3)
        //                    {
        //                        Schedule<SchedulerServices>().ToRunNow().AndEvery(1).Months().OnTheFourth(DayOfWeek.Wednesday).At(0, 0);
        //                    }
        //                    else if (item.DayId == 4)
        //                    {
        //                        Schedule<SchedulerServices>().ToRunNow().AndEvery(1).Months().OnTheFourth(DayOfWeek.Thursday).At(0, 0);
        //                    }
        //                    else if (item.DayId == 5)
        //                    {
        //                        Schedule<SchedulerServices>().ToRunNow().AndEvery(1).Months().OnTheFourth(DayOfWeek.Friday).At(0, 0);
        //                    }
        //                }

        //            }
        //        }
        //    }
        //}


        /// <summary>
        /// Gets the payroll view.
        /// </summary>
        /// <returns></returns>
        public IPayrollListView GetPayrollView()
        {
            var loggedUserDetails = usersRepository.GetUserById((int)this.session.GetSessionValue(SessionKey.UserId));

            var companyId = (int)this.session.GetSessionValue(SessionKey.CompanyId);

            var employeeCollection = lookupRepository.GetEmployeeByCompanyId(companyId);
            var payrollCollection  = payrollRepository.GetPayrollList(companyId);

            var monthDropDown = this.lookupRepository.GetAllMonths();
            var yearDropDown  = this.lookupRepository.GetAllYears();


            var viewModel = this.payrollViewModelFactory.CreatePayrollView(companyId, employeeCollection, payrollCollection, monthDropDown, yearDropDown);

            return(viewModel);
        }
Exemple #2
0
 public List <PayrollModel> GetPayrollList(int payrollPeriodId, string empType)
 {
     return(_repo.GetPayrollList(payrollPeriodId, empType));
 }