/// <summary>
        /// Creates the employee view.
        /// </summary>
        /// <param name="maritalStatusCollection">The marital status collection.</param>
        /// <param name="companyCollection">The company collection.</param>
        /// <param name="employeeCollection">The employee collection.</param>
        /// <param name="religionCollection">The religion collection.</param>
        /// <param name="genderCollection">The gender collection.</param>
        /// <param name="departmentCollection">The department collection.</param>
        /// <param name="levelCollection">The level collection.</param>
        /// <param name="gradeCollection">The grade collection.</param>
        /// <param name="jobTitleCollection">The job title collection.</param>
        /// <param name="countryCollection">The country collection.</param>
        /// <param name="stateCollection">The state collection.</param>
        /// <returns></returns>
        public IEmployeeOnBoardView CreateEmployeeView(IList <IMaritalStatus> maritalStatusCollection, int companyId, IList <IEmployee> employeeCollection,
                                                       IList <IReligion> religionCollection, IList <IYourGender> genderCollection, IList <IDepartment> departmentCollection, IList <ILevel> levelCollection,
                                                       IList <IGrade> gradeCollection, IList <IPayScale> payScaleCollection, IList <IJobTitle> jobTitleCollection, IList <ICountry> countryCollection, IList <IState> stateCollection, IList <IEmploymentType> employmentTypeCollection)
        {
            var maritalStatusDDL  = GetDropDownList.MaritalStatusListItems(maritalStatusCollection, -1);
            var religionDDL       = GetDropDownList.ReligionListItems(religionCollection, -1);
            var genderDDL         = GetDropDownList.GenderListItems(genderCollection, -1);
            var departmentDDL     = GetDropDownList.DepartmentListItems(departmentCollection, -1);
            var gradeDDL          = GetDropDownList.GradeListItems(gradeCollection, -1);
            var jobTitleDDL       = GetDropDownList.JobTitlesListItems(jobTitleCollection, -1);
            var levelDDL          = GetDropDownList.LevelListItems(levelCollection, -1);
            var countryDDL        = GetDropDownList.CountryListItem(countryCollection, 161);
            var stateDDL          = GetDropDownList.StateListItem(stateCollection, -1);
            var permanentStateDDL = GetDropDownList.StateListItem(stateCollection, -1);
            var homeStateDDL      = GetDropDownList.StateListItem(stateCollection, -1);
            var employeeDDL       = GetDropDownList.EmployeeListitems(employeeCollection, -1);
            var employmentTypeDDL = GetDropDownList.EmploymentTypeListItem(employmentTypeCollection, -1);
            var payScaleDDL       = GetDropDownList.PayScaleListItem(payScaleCollection, -1);

            var view = new EmployeeOnBoardView
            {
                MaritalStatusDropDownList  = maritalStatusDDL,
                ReligionDropDownList       = religionDDL,
                GenderDropDownList         = genderDDL,
                LevelDropDownList          = levelDDL,
                GradeDropDownList          = gradeDDL,
                DepartmentDropDownList     = departmentDDL,
                JobTitleDropDownList       = jobTitleDDL,
                ProcessingMessage          = string.Empty,
                CountryDropDownList        = countryDDL,
                HomeStateDropDownList      = homeStateDDL,
                PermanentStateDropDownList = permanentStateDDL,
                StateDropDownList          = stateDDL,
                EmployeeDropDownList       = employeeDDL,
                EmploymentTypeDropDownList = employmentTypeDDL,
                NationalityId        = 161,
                CompanyID            = companyId,
                PayScaleDropDownList = payScaleDDL
            };

            return(view);
        }
        /// <summary>
        /// Creates the updated employee view.
        /// </summary>
        /// <param name="onboardInfo">The onboard information.</param>
        /// <param name="maritalStatusCollection">The marital status collection.</param>
        /// <param name="companyCollection">The company collection.</param>
        /// <param name="employeeCollection">The employee collection.</param>
        /// <param name="religionCollection">The religion collection.</param>
        /// <param name="genderCollection">The gender collection.</param>
        /// <param name="departmentCollection">The department collection.</param>
        /// <param name="levelCollection">The level collection.</param>
        /// <param name="gradeCollection">The grade collection.</param>
        /// <param name="jobTitleCollection">The job title collection.</param>
        /// <param name="countryCollection">The country collection.</param>
        /// <param name="stateCollection">The state collection.</param>
        /// <param name="processMessage">The process message.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">onboardInfo</exception>
        public IEmployeeOnBoardView CreateUpdatedEmployeeView(IEmployeeOnBoardView onboardInfo, IList <IMaritalStatus> maritalStatusCollection,
                                                              IList <IEmployee> employeeCollection, IList <IReligion> religionCollection, IList <IYourGender> genderCollection, IList <IDepartment> departmentCollection, IList <ILevel> levelCollection,
                                                              IList <IGrade> gradeCollection, IList <IPayScale> payScaleCollection, IList <IJobTitle> jobTitleCollection, IList <ICountry> countryCollection, IList <IState> stateCollection,
                                                              IList <IEmploymentType> employmentTypeCollection, string processMessage)
        {
            if (onboardInfo == null)
            {
                throw new ArgumentNullException(nameof(onboardInfo));
            }

            var maritalStatusDDL  = GetDropDownList.MaritalStatusListItems(maritalStatusCollection, onboardInfo.MaritalStatusId);
            var religionDDL       = GetDropDownList.ReligionListItems(religionCollection, onboardInfo.ReligionId);
            var genderDDL         = GetDropDownList.GenderListItems(genderCollection, onboardInfo.GenderId);
            var departmentDDL     = GetDropDownList.DepartmentListItems(departmentCollection, onboardInfo.DepartmentId);
            var gradeDDL          = GetDropDownList.GradeListItems(gradeCollection, onboardInfo.GradeID);
            var jobTitleDDL       = GetDropDownList.JobTitlesListItems(jobTitleCollection, onboardInfo.JobTitleID);
            var levelDDL          = GetDropDownList.LevelListItems(levelCollection, onboardInfo.LevelID);
            var employeeDDL       = GetDropDownList.EmployeeListitems(employeeCollection, onboardInfo.SupervisorEmployeeId);
            var countryDDL        = GetDropDownList.CountryListItem(countryCollection, onboardInfo.NationalityId);
            var permanentStateDDL = GetDropDownList.StateListItem(stateCollection, onboardInfo.PermanentAddressStateId);
            var homeStateDDL      = GetDropDownList.StateListItem(stateCollection, onboardInfo.HomeAddressStateId);
            var employmentTypeDDL = GetDropDownList.EmploymentTypeListItem(employmentTypeCollection, onboardInfo.EmploymentTypeId);
            var payScaleDDL       = GetDropDownList.PayScaleListItem(payScaleCollection, onboardInfo.LevelGradeId);

            onboardInfo.ProcessingMessage = processMessage;
            //Updating drop down list
            onboardInfo.MaritalStatusDropDownList  = maritalStatusDDL;
            onboardInfo.ReligionDropDownList       = religionDDL;
            onboardInfo.GradeDropDownList          = gradeDDL;
            onboardInfo.DepartmentDropDownList     = departmentDDL;
            onboardInfo.JobTitleDropDownList       = jobTitleDDL;
            onboardInfo.LevelDropDownList          = levelDDL;
            onboardInfo.GenderDropDownList         = genderDDL;
            onboardInfo.CountryDropDownList        = countryDDL;
            onboardInfo.PermanentStateDropDownList = permanentStateDDL;
            onboardInfo.HomeStateDropDownList      = homeStateDDL;
            onboardInfo.EmployeeDropDownList       = employeeDDL;
            onboardInfo.EmploymentTypeDropDownList = employmentTypeDDL;
            onboardInfo.PayScaleDropDownList       = payScaleDDL;

            return(onboardInfo);
        }
        /// <summary>
        /// Creates the employee report.
        /// </summary>
        /// <param name="employeeCollections">The employee collections.</param>
        /// <param name="lastName">The last name.</param>
        /// <param name="firstName">The first name.</param>
        /// <param name="genderId">The gender identifier.</param>
        /// <param name="genderCollection">The gender collection.</param>
        /// <param name="employeeTypeId">The employee type identifier.</param>
        /// <param name="employmentTypeCollection">The employment type collection.</param>
        /// <param name="countryId">The country identifier.</param>
        /// <param name="countryCollection">The country collection.</param>
        /// <param name="stateOfOriginId">The state of origin identifier.</param>
        /// <param name="stateCollection">The state collection.</param>
        /// <param name="dateExitedFrom">The date exited from.</param>
        /// <param name="dateExitTo">The date exit to.</param>
        /// <param name="dateRetirementFrom">The date retirement from.</param>
        /// <param name="dateRetirementTo">The date retirement to.</param>
        /// <param name="dateOfBirthFrom">The date of birth from.</param>
        /// <param name="dateOfBirthTo">The date of birth to.</param>
        /// <param name="age">The age.</param>
        /// <param name="locationStateId">The location state identifier.</param>
        /// <param name="locationCountryId">The location country identifier.</param>
        /// <param name="page">The page.</param>
        /// <returns></returns>
        public IEmployeeOnBoardListView CreateEmployeeReport(IList <IEmployee> employeeCollections, string lastName, string firstName, int genderId, IList <IYourGender> genderCollection,
                                                             int employeeTypeId, IList <IEmploymentType> employmentTypeCollection, int countryId, IList <ICountry> countryCollection, int stateOfOriginId, IList <IState> stateCollection,
                                                             DateTime?dateExitedFrom, DateTime?dateExitTo, DateTime?dateRetirementFrom, DateTime?dateRetirementTo, DateTime?dateOfBirthFrom, DateTime?dateOfBirthTo, int age,
                                                             int locationStateId, int locationCountryId, int?page, DateTime?dateEmployedFrom, DateTime?dateEmployedTo)
        {
            var stateDDL        = GetDropDownList.StateListItem(stateCollection, -1);
            var genderDDL       = GetDropDownList.GenderListItems(genderCollection, -1);
            var employeeTypeDDL = GetDropDownList.EmploymentTypeListItem(employmentTypeCollection, -1);
            var countryDDL      = GetDropDownList.CountryListItem(countryCollection, -1);


            //Filter Employee by Name
            var filteredList = employeeCollections.Where(x => x.LastName.Contains(string.IsNullOrEmpty(lastName)
                ? x.LastName
                : lastName)).ToList();

            filteredList = filteredList.Where(x => x.FirstName.Contains(string.IsNullOrEmpty(firstName)
                ? x.FirstName
                : firstName)).ToList();

            filteredList = filteredList.Where(x => x.GenderId.Equals(genderId < 1 ? x.GenderId : genderId)).ToList();

            filteredList = filteredList.Where(x => x.EmploymentTypeId.Equals(employeeTypeId < 1 ? x.EmploymentTypeId : employeeTypeId)).ToList();

            filteredList = filteredList.Where(x => x.NationalityId.Equals(countryId < 1 ? x.NationalityId : countryId)).ToList();

            filteredList = filteredList.Where(x => x.PermanentAddressStateId.Equals(stateOfOriginId < 1 ? x.PermanentAddressStateId : stateOfOriginId)).ToList();

            filteredList = filteredList.Where(x => x.HomeAddressStateId.Equals(locationStateId < 1  ? x.HomeAddressStateId : locationStateId)).ToList();

            foreach (var item in filteredList)
            {
                if ((item.DateExited >= dateExitedFrom && item.DateExited <= dateExitTo))
                {
                    filteredList = filteredList.Where((x => x.DateExited >= dateExitedFrom && x.DateExited <= dateExitTo)).ToList();
                }
                else
                {
                    filteredList = filteredList.Where(x => x.DateExited.Equals(x.DateExited)).ToList();
                }

                if ((item.DateEmployed >= dateEmployedFrom && item.DateEmployed <= dateEmployedTo))
                {
                    filteredList = filteredList.Where((x => x.DateEmployed >= dateEmployedFrom && x.DateEmployed <= dateEmployedFrom)).ToList();
                }
                else
                {
                    filteredList = filteredList.Where(x => x.DateEmployed.Equals(x.DateEmployed)).ToList();
                }

                if (item.Birthday >= dateOfBirthFrom && item.Birthday <= dateOfBirthTo)
                {
                    filteredList = filteredList.Where((x => x.Birthday >= dateOfBirthFrom && x.Birthday <= dateOfBirthTo)).ToList();
                }
                else
                {
                    filteredList = filteredList.Where(x => x.Birthday.Equals(x.Birthday)).ToList();
                }



                //if (ageFrom >= employeeAge && ageTo <= employeeAge)
                //{
                //    var employeeAge = (int) (DateTime.UtcNow - (DateTime)item.Birthday).Days * 0.00273973;
                //    filteredList = filteredList.Where(x => employeeAge.Equals(age)).ToList();
                //}
            }

            //filteredList = filteredList.Where(x => ((int)(DateTime.Now-(DateTime)x.Birthday).TotalDays / 365.25).Equals(age < 1  ? ((int)(DateTime.Now - (DateTime)x.Birthday).TotalDays / 365.25) : age)).ToList();



            int pageSize   = 10;
            int pageNumber = (page ?? 1);

            var result = new EmployeeOnBoardListView
            {
                EmployeeList             = filteredList.ToPagedList(pageNumber, pageSize),
                GenderDropDown           = genderDDL,
                StateDropDown            = stateDDL,
                CountryDropDown          = countryDDL,
                EmploymentTypeDropDown   = employeeTypeDDL,
                SelectedGenderId         = genderId,
                SelectedFirstName        = firstName,
                SelectedLastName         = lastName,
                SelectedCountryId        = countryId,
                SelectedLocationStateId  = locationStateId,
                SelectedStateOriginId    = stateOfOriginId,
                SelectedEmploymentTypeId = employeeTypeId,
                SelectedDateExitFrom     = dateExitedFrom,
                SelectedDateExitTo       = dateExitTo,
                SelectedDateOfBirthFrom  = dateOfBirthFrom,
                SelectedDateOfBirthTo    = dateOfBirthTo
            };

            return(result);
        }
        /// <summary>
        /// Creates the edit employee view.
        /// </summary>
        /// <param name="onboardInfo">The onboard information.</param>
        /// <param name="maritalStatusCollection">The marital status collection.</param>
        /// <param name="religionCollection">The religion collection.</param>
        /// <param name="genderCollection">The gender collection.</param>
        /// <param name="employeeCollection">The employee collection.</param>
        /// <param name="departmentCollection">The department collection.</param>
        /// <param name="levelCollection">The level collection.</param>
        /// <param name="gradeCollection">The grade collection.</param>
        /// <param name="jobTitleCollection">The job title collection.</param>
        /// <param name="profilePictureDetail">The profile picture detail.</param>
        /// <param name="employeeUser">The employee user.</param>
        /// <param name="countryCollection">The country collection.</param>
        /// <param name="stateCollection">The state collection.</param>
        /// <param name="employmentTypeCollection">The employment type collection.</param>
        /// <param name="processingMessage">The processing message.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">
        /// onboardInfo
        /// or
        /// maritalStatusCollection
        /// or
        /// religionCollection
        /// or
        /// genderCollection
        /// or
        /// departmentCollection
        /// or
        /// gradeCollection
        /// or
        /// levelCollection
        /// or
        /// jobTitleCollection
        /// or
        /// employmentTypeCollection
        /// </exception>
        public IEmployeeOnBoardView CreateEditEmployeeView(IEmployee onboardInfo, IList <IMaritalStatus> maritalStatusCollection,
                                                           IList <IReligion> religionCollection, IList <IYourGender> genderCollection, IList <IEmployee> employeeCollection,
                                                           IList <IDepartment> departmentCollection, IList <ILevel> levelCollection, IList <IGrade> gradeCollection,
                                                           IList <IJobTitle> jobTitleCollection, IDigitalFile profilePictureDetail, IUser employeeUser, IList <ICountry> countryCollection, IList <IState> stateCollection, IList <IEmploymentType> employmentTypeCollection, string processingMessage)
        {
            if (onboardInfo == null)
            {
                throw new ArgumentNullException(nameof(onboardInfo));
            }

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

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

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


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

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

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

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

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


            var maritalStatusDDL =
                GetDropDownList.MaritalStatusListItems(maritalStatusCollection, onboardInfo.MartialStatusId);
            var religionDDL       = GetDropDownList.ReligionListItems(religionCollection, onboardInfo.ReligionId);
            var genderDDL         = GetDropDownList.GenderListItems(genderCollection, onboardInfo.GenderId);
            var departmentDDL     = GetDropDownList.DepartmentListItems(departmentCollection, onboardInfo.DepartmentId);
            var gradeDDL          = GetDropDownList.GradeListItems(gradeCollection, onboardInfo.GradeId);
            var jobTitleDDL       = GetDropDownList.JobTitlesListItems(jobTitleCollection, onboardInfo.JobTitleId ?? -1);
            var levelDDL          = GetDropDownList.LevelListItems(levelCollection, onboardInfo.LevelId);
            var countryDDL        = GetDropDownList.CountryListItem(countryCollection, onboardInfo.NationalityId);
            var permanentStateDDL = GetDropDownList.StateListItem(stateCollection, onboardInfo.PermanentAddressStateId);
            var homeStateDDL      = GetDropDownList.StateListItem(stateCollection, onboardInfo.HomeAddressStateId);
            var employeeDDL       = GetDropDownList.EmployeeListitems(employeeCollection, onboardInfo.SupervisorEmployeeId);
            var employmentTypeDDL = GetDropDownList.EmploymentTypeListItem(employmentTypeCollection, onboardInfo.EmploymentTypeId);
            var returnView        = new EmployeeOnBoardView
            {
                LastName                   = onboardInfo.LastName,
                FirstName                  = onboardInfo.FirstName,
                MiddleName                 = onboardInfo.MiddleName,
                Email                      = onboardInfo.Email,
                CompanyID                  = onboardInfo.CompanyId,
                LevelID                    = onboardInfo.LevelId,
                GradeID                    = onboardInfo.GradeId,
                LevelGradeId               = onboardInfo.LevelGradeId,
                JobTitleID                 = onboardInfo.JobTitleId ?? -1,
                MobileNumber               = onboardInfo.MobileNumber,
                PermanentAddress           = onboardInfo.PermanentAddress,
                PermanentAddressCity       = onboardInfo.PermanentAddressCity,
                PermanentAddressState      = onboardInfo.PermanentAddressState,
                HomeAddress                = onboardInfo.HomeAddress,
                HomeAddressCity            = onboardInfo.HomeAddressCity,
                HomeAddressState           = onboardInfo.HomeAddressState,
                OtherEmail                 = onboardInfo.OtherEmail,
                Birthday                   = onboardInfo.Birthday,
                MaritalStatusId            = onboardInfo.MartialStatusId,
                GenderId                   = onboardInfo.GenderId,
                StaffNumber                = onboardInfo.StaffNumber,
                DateEmployed               = onboardInfo.DateEmployed,
                About                      = onboardInfo.About,
                DateExited                 = onboardInfo.DateExited,
                SkillSet                   = onboardInfo.SkillSet,
                SupervisorEmployeeId       = onboardInfo.SupervisorEmployeeId,
                SeatingLocation            = onboardInfo.SeatingLocation,
                DepartmentId               = onboardInfo.DepartmentId,
                MaidenName                 = onboardInfo.MaidenName,
                PhotoDigitalFileId         = onboardInfo.PhotoDigitalFileId,
                ReligionId                 = onboardInfo.ReligionId,
                Nationality                = onboardInfo.Nationality,
                DateCreated                = onboardInfo.DateCreated,
                EmployeeID                 = onboardInfo.EmployeeId,
                ProcessingMessage          = processingMessage ?? "",
                LevelDropDownList          = levelDDL,
                DepartmentDropDownList     = departmentDDL,
                GradeDropDownList          = gradeDDL,
                JobTitleDropDownList       = jobTitleDDL,
                GenderDropDownList         = genderDDL,
                MaritalStatusDropDownList  = maritalStatusDDL,
                ReligionDropDownList       = religionDDL,
                ProfilePictureDetail       = profilePictureDetail,
                EmployeeUser               = employeeUser,
                IsLocked                   = onboardInfo.IsLocked,
                CountryDropDownList        = countryDDL,
                HomeStateDropDownList      = homeStateDDL,
                PermanentStateDropDownList = permanentStateDDL,
                NationalityId              = onboardInfo.NationalityId,
                PermanentAddressStateId    = onboardInfo.PermanentAddressStateId,
                HomeAddressStateId         = onboardInfo.HomeAddressStateId,
                EmployeeDropDownList       = employeeDDL,
                EmploymentTypeId           = onboardInfo.EmploymentTypeId,
                EmploymentTypeDropDownList = employmentTypeDDL,
                GenderOther                = onboardInfo.GenderOother,
                ReligionOther              = onboardInfo.ReligionOther
            };

            return(returnView);
        }