Exemplo n.º 1
0
        /// <summary>
        /// Gets the trainee ListView.
        /// </summary>
        /// <param name="selectedCompanyId">The selected company identifier.</param>
        /// <param name="selectedTrainingId">The selected training identifier.</param>
        /// <param name="TraineeView">The trainee view.</param>
        /// <param name="companyInfo">The company information.</param>
        /// <param name="trainingCollection">The training collection.</param>
        /// <param name="processingMessage">The processing message.</param>
        /// <param name="trainigReport">The trainig report.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">
        /// TraineeView
        /// or
        /// trainingCollection
        /// </exception>
        public IEmployeeTrainingListView GetTraineeListView(int?selectedCompanyId, int?selectedTrainingId, IList <IEmployeeTrainingModel> TraineeView, ICompanyDetail companyInfo, IList <ITraining> trainingCollection, string processingMessage, IList <ITrainingReport> trainigReport)
        {
            if (TraineeView == null)
            {
                throw new ArgumentNullException(nameof(TraineeView));
            }

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



            var trainingDDL = GetDropDownList.TrainingListItems(trainingCollection, -1);


            var filteredList = TraineeView
                               .Where(x => x.CompanyId.Equals(selectedCompanyId < 1 ? x.CompanyId : selectedCompanyId)).ToList();

            filteredList = filteredList
                           .Where(x => x.TrainingId.Equals(selectedTrainingId < 1 ? x.TrainingId : selectedTrainingId)).ToList();


            var view = new EmployeeTrainingListView
            {
                employeeTrainingView = filteredList,
                Company = companyInfo,
                TrainingDropDownList = trainingDDL,
                ProcessingMessage    = processingMessage ?? ""
            };

            return(view);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates the specific employee training view.
        /// </summary>
        /// <param name="selectedEmployeeId">The selected employee identifier.</param>
        /// <param name="employee">The employee.</param>
        /// <param name="company">The company.</param>
        /// <param name="trainingCollection">The training collection.</param>
        /// <param name="companyCollection">The company collection.</param>
        /// <param name="processingMessage">The processing message.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">
        /// trainingCollection
        /// or
        /// companyCollection
        /// or
        /// trainingCollection
        /// or
        /// trainingCollection
        /// </exception>
        public IEmployeeTrainingListView CreateSpecificEmployeeTrainingView(int?selectedEmployeeId, IEmployee employee, ICompanyDetail company, IList <IEmployeeTrainingModel> trainingCollection, IList <ICompanyDetail> companyCollection, string processingMessage)
        {
            if (trainingCollection == null)
            {
                throw new ArgumentNullException(nameof(trainingCollection));
            }

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

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

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

            var companyDDL          = GetDropDownList.CompanyListItems(companyCollection, -1);
            var employeeTrainingDDL = GetDropDownList.EmployeeTrainingListItems(trainingCollection, -1);

            var viewModel = new EmployeeTrainingListView
            {
                CompanyDropDownList  = companyDDL,
                employeeTrainingView = trainingCollection,
                ProcessingMessage    = processingMessage,
                Employee             = employee,
                Company = company,
            };

            return(viewModel);
        }