Пример #1
0
        /// <summary>
        /// Creates the employee payroll list.
        /// </summary>
        /// <param name="selectedMonth">The selected month.</param>
        /// <param name="selectedYear">The selected year.</param>
        /// <param name="payrollCollection">The payroll collection.</param>
        /// <param name="company">The company.</param>
        /// <param name="employee">The employee.</param>
        /// <param name="monthCollection">The month collection.</param>
        /// <param name="yearCollection">The year collection.</param>
        /// <param name="message">The message.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">
        /// monthCollection
        /// or
        /// yearCollection
        /// or
        /// payrollCollection
        /// </exception>
        public IPayrollListView CreateEmployeePayrollList(string selectedMonth, int?selectedYear, IList <IPayroll> payrollCollection, ICompanyDetail company,
                                                          IEmployee employee, IList <IMonth> monthCollection, IList <IYear> yearCollection, string message)
        {
            if (monthCollection == null)
            {
                throw new ArgumentNullException(nameof(monthCollection));
            }

            if (yearCollection == null)
            {
                throw new ArgumentNullException(nameof(yearCollection));
            }

            if (payrollCollection == null)
            {
                throw new ArgumentNullException(nameof(payrollCollection));
            }

            var monthDDL = GetDropDownList.Month(monthCollection, "");
            var yearDDL  = GetDropDownList.Year(yearCollection, -1);


            var viewwModel = new PayrollListView
            {
                MonthDropDown     = monthDDL,
                YearDropDown      = yearDDL,
                PayrollList       = payrollCollection,
                ProcessingMessage = message,
                Company           = company,
                Employee          = employee,
            };

            return(viewwModel);
        }
Пример #2
0
        /// <summary>
        /// Creates the payroll view.
        /// </summary>
        /// <param name="companyId">The company identifier.</param>
        /// <param name="employeeCollection">The employee collection.</param>
        /// <param name="payrollCollection">The payroll collection.</param>
        /// <param name="monthCollection">The month collection.</param>
        /// <param name="yearCollection">The year collection.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">
        /// employeeCollection
        /// or
        /// payrollCollection
        /// or
        /// monthCollection
        /// or
        /// yearCollection
        /// </exception>
        public IPayrollListView CreatePayrollView(int companyId, IList <IEmployee> employeeCollection, IList <IPayroll> payrollCollection,
                                                  IList <IMonth> monthCollection, IList <IYear> yearCollection)
        {
            if (employeeCollection == null)
            {
                throw new ArgumentNullException(nameof(employeeCollection));
            }

            if (payrollCollection == null)
            {
                throw new ArgumentNullException(nameof(payrollCollection));
            }

            if (monthCollection == null)
            {
                throw new ArgumentNullException(nameof(monthCollection));
            }

            if (yearCollection == null)

            {
                throw new ArgumentNullException(nameof(yearCollection));
            }

            var monthDDL = GetDropDownList.Month(monthCollection, "");
            var yearDDL  = GetDropDownList.Year(yearCollection, -1);

            var viewwModel = new PayrollListView
            {
                MonthDropDown = monthDDL,
                YearDropDown  = yearDDL,
                EmployeeList  = employeeCollection,
                PayrollList   = payrollCollection,
                CompanyId     = companyId
            };

            return(viewwModel);
        }
Пример #3
0
        /// <summary>
        /// Creates the payroll list.
        /// </summary>
        /// <param name="payrollCollection">The payroll collection.</param>
        /// <param name="monthCollection">The month collection.</param>
        /// <param name="yearCollection">The year collection.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">
        /// monthCollection
        /// or
        /// yearCollection
        /// </exception>
        public IPayrollListView CreatePayrollList(string selectedMonth, int?selectedYear, IList <IPayroll> payrollCollection, IList <IMonth> monthCollection,
                                                  IList <IYear> yearCollection, string message)
        {
            if (monthCollection == null)
            {
                throw new ArgumentNullException(nameof(monthCollection));
            }

            if (yearCollection == null)
            {
                throw new ArgumentNullException(nameof(yearCollection));
            }

            if (payrollCollection == null)
            {
                throw new ArgumentNullException(nameof(payrollCollection));
            }

            var monthDDL = GetDropDownList.Month(monthCollection, "");
            var yearDDL  = GetDropDownList.Year(yearCollection, -1);

            var filteredList = payrollCollection.Where(x => x.YearId.Equals(selectedYear < 1 ? x.YearId : selectedYear)).ToList();

            //filteredList = filteredList.Where(x =>
            //    x.MonthCode.Contains(string.IsNullOrEmpty(selectedMonth)
            //        ? x.MonthCode
            //        : selectedMonth)).ToList();

            var viewwModel = new PayrollListView
            {
                MonthDropDown     = monthDDL,
                YearDropDown      = yearDDL,
                PayrollList       = filteredList,
                ProcessingMessage = message
            };

            return(viewwModel);
        }