예제 #1
0
        /// <summary>
        /// Creates the user profile view.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="profile">The profile.</param>
        /// <param name="educationHistory">The education history.</param>
        /// <param name="employmentHistory">The employment history.</param>
        /// <param name="skillSets">The skill sets.</param>
        /// <param name="profilePictureDetail">The profile picture detail.</param>
        /// <param name="applicantCVDetails">The applicant cv details.</param>
        /// <param name="processingMessage">The processing message.</param>
        /// <returns></returns>
        public IUserProfileView CreateUserProfileView(IUser user, IProfile profile,
                                                      IList <IEducationHistory> educationHistory,
                                                      IList <IEmploymentHistory> employmentHistory, IList <ISpouseModel> spouseModel, IList <ISkillSetModel> skillSets,
                                                      IDigitalFile profilePictureDetail, IDigitalFile applicantCVDetails, IList <IEmergency> emergency,
                                                      IList <IChildrenModel> childrenModel, IList <IBeneficiariesModel> beneficiariesModel,
                                                      IList <INextOfKin> nextOfKin, string processingMessage)
        {
            var viewModel = new UserProfileView
            {
                User                 = user,
                Profile              = profile,
                EducationHistory     = educationHistory,
                EmploymentHistory    = employmentHistory,
                SkillSet             = skillSets,
                spouseModel          = spouseModel,
                nextOfKinModel       = nextOfKin,
                childrenModel        = childrenModel,
                beneficiaryModel     = beneficiariesModel,
                emergencyModel       = emergency,
                ProfilePictureDetail = profilePictureDetail,
                CVDocumentDetail     = applicantCVDetails,
                ProcessingMessage    = processingMessage,
            };

            return(viewModel);
        }
        /// <summary>
        /// Creates the admin dash board view.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="company">The company.</param>
        /// <param name="companyCollection">The company 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="disciplineCollection">The discipline collection.</param>
        /// <param name="leaveRequestModel">The leave request model.</param>
        /// <param name="departmentCollection">The department collection.</param>
        /// <param name="trainingCollection">The training collection.</param>
        /// <param name="employeeCollection">The employee collection.</param>
        /// <param name="employmentHistory">The employment history.</param>
        /// <param name="educationHistory">The education history.</param>
        /// <param name="skillSet">The skill set.</param>
        /// <param name="digitalFile">The digital file.</param>
        /// <param name="pendingLeaveRequests">The pending leave requests.</param>
        /// <param name="pendingLoanRequest">The pending loan request.</param>
        /// <param name="pendingTrainingRequest">The pending training request.</param>
        /// <param name="processingMessage">The processing message.</param>
        /// <returns></returns>
        public IEmployeeProfileView CreateAdminDashBoardView(IUserDetail user, IEmployee employeeInfo, ICompanyDetail company, IList <ICompanyDetail> companyCollection, IList <ILevel> levelCollection, IList <IGrade> gradeCollection,
                                                             IList <IJobTitle> jobTitleCollection, IList <IDiscipline> disciplineCollection, IList <ILeaveRequestModel> leaveRequestModel, IList <IDepartment> departmentCollection,
                                                             IList <ITraining> trainingCollection, IList <IEmployee> employeeCollection, IList <IEmploymentHistory> employmentHistory, IList <IEducationHistory> educationHistory, IList <ISkillSetModel> skillSet,
                                                             IDigitalFile digitalFile, IList <ILeaveRequestModel> pendingLeaveRequests, IList <IEmployeeLoan> pendingLoanRequest, IList <IEmployeeTrainingModel> pendingTrainingRequest, string processingMessage)
        {
            var returnModel = new EmployeeProfileView
            {
                User                   = user,
                Company                = company,
                EducationHistory       = educationHistory,
                EmploymentHistory      = employmentHistory,
                SkillSet               = skillSet,
                ProfilePictureDetail   = digitalFile,
                QueryCollection        = disciplineCollection,
                LeaveTypeCollection    = leaveRequestModel,
                DepartmentCollection   = departmentCollection,
                TrainingCollection     = trainingCollection,
                ProcessingMessage      = processingMessage,
                EmployeeCollection     = employeeCollection,
                LevelCollection        = levelCollection,
                GradeCollection        = gradeCollection,
                JobTitle               = jobTitleCollection,
                PendingLeaveRquest     = pendingLeaveRequests,
                PendingLoanRequest     = pendingLoanRequest,
                PendingTrainingRequest = pendingTrainingRequest,
                CompanyCollection      = companyCollection,
                Employee               = employeeInfo
            };

            return(returnModel);
        }
예제 #3
0
        /// <summary>
        /// Creates the pay slip view.
        /// </summary>
        /// <param name="payroll">The payroll.</param>
        /// <param name="employee">The employee.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">payroll</exception>
        public IPaySlipViewModel CreatePaySlipView(IPayroll payroll, IPayScale payScale, decimal taxRate, IList <IPayScaleBenefit> payScaleBenefits,
                                                   ICompanyDetail companyDetail, IDigitalFile companyLogo, IEmployee employee, ILevel level, IGrade grade, IList <IPayrollEmployeeReward> rewardCollection,
                                                   IList <IPayrollEmployeeDeduction> employeeDeductionCollection, IList <IPayrollEmployeeLoan> loanCollection, decimal pensionContribution, decimal spouseConsolidation,
                                                   decimal childrenConsolidation, decimal consolidationTaxRelief, decimal taxableIncome)
        {
            if (payroll == null)
            {
                throw new ArgumentNullException(nameof(payroll));
            }

            var viewModel = new PaySlipViewModel
            {
                CompanyDetail       = companyDetail,
                Payroll             = payroll,
                Employee            = employee,
                Loan                = loanCollection,
                Reward              = rewardCollection,
                EmployeeDeduction   = employeeDeductionCollection,
                Level               = level,
                Grade               = grade,
                PayScale            = payScale,
                PayScaleCollection  = payScaleBenefits,
                CompanyLogo         = companyLogo,
                TaxRate             = taxRate,
                PensionContribution = pensionContribution,
                Dependant           = spouseConsolidation,
                Children            = childrenConsolidation,
                TaxCollation        = consolidationTaxRelief,
                TaxationAmount      = taxableIncome,
            };

            return(viewModel);
        }
예제 #4
0
        /// <summary>
        /// Signs the in.
        /// </summary>
        /// <param name="logonModel">The logon model.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException">logonModel</exception>
        public bool SignIn(ILogOnView logonModel)
        {
            if (logonModel == null)
            {
                throw new ArgumentNullException("logonModel");
            }

            var userInfo = this.accountRepository.GetUserByUsername(logonModel.UserName);

            if (userInfo == null)
            {
                userInfo = this.accountRepository.GetUserByEmail(logonModel.UserName);
            }


            if (userInfo == null || (userInfo.IsLocked ?? false))
            {
                return(false);
            }

            var companyInfo = this.companyRepository.GetCompanyById(userInfo.CompanyId);

            var employeeInfo = this.employeeOnBoardRepository.GetEmployeeByEmail(userInfo.Email);

            var profileInfo = this.profileRepository.GetProfileByUserId(userInfo.UserId);


            var encriptedPwd =
                this.encryptionService.Encrypt(logonModel
                                               .Password); // for debugging....you dont get the same result when encrypting

            var decryptedValue = this.encryptionService.Decrypt(userInfo.Password);

            //:todo compare encripted or decripted password here
            if (!logonModel.Password.Equals(decryptedValue))
            //if (!logonModel.Password.Equals(userInfo.Password))
            {
                return(false);
            }


            //
            var userActionList = this.accountRepository.GetUserRoleActions(userInfo.Username).ToList();

            if (!userActionList.Any())
            {
                userActionList = new List <string>();
            }

            session.AddValueToSession(SessionKey.UserRoles, userActionList.ToArray());
            session.AddValueToSession(SessionKey.UserId, userInfo.UserId);
            session.AddValueToSession(SessionKey.UserName, logonModel.UserName);
            session.AddValueToSession(SessionKey.FullUserName, userInfo.FirstName + " " + userInfo.LastName);
            session.AddValueToSession(SessionKey.UserIsAuthenticated, true);
            session.AddValueToSession(SessionKey.CompanyId, 0);

            IDigitalFile profilePicture = null;

            if (employeeInfo != null)
            {
                session.AddValueToSession(SessionKey.EmployeeId, employeeInfo.EmployeeId);
                session.AddValueToSession(SessionKey.CompanyId, employeeInfo.CompanyId);
                if (employeeInfo != null)
                {
                    profilePicture = this.digitalFileRepository.GetDigitalFileDetail(employeeInfo.PhotoDigitalFileId ?? 0);
                }
            }

            if (profileInfo != null)
            {
                session.AddValueToSession(SessionKey.ProfileId, profileInfo.ProfileId);

                profilePicture = this.digitalFileRepository.GetDigitalFileDetail(profileInfo.PictureDigitalFileId);
            }


            if (profilePicture != null)
            {
                var imgSrc = "";
                var base64 = Convert.ToBase64String(profilePicture.TheDigitalFile);
                imgSrc = string.Format("data:{0};base64,{1}", profilePicture.ContentType, base64);
                session.AddValueToSession(SessionKey.ProfilePicture, imgSrc);
            }


            if (companyInfo != null)
            {
                var companyLogo = this.digitalFileRepository.GetDigitalFileDetail(companyInfo.LogoDigitalFileId ?? -1);

                var imgSrc = companyInfo.CompanyName;

                if (companyLogo != null)
                {
                    var base64 = Convert.ToBase64String(companyLogo.TheDigitalFile);
                    imgSrc = string.Format("data:{0};base64,{1}", companyLogo.ContentType, base64);
                }

                session.AddValueToSession(SessionKey.CompanyLogo, imgSrc);

                session.AddValueToSession(SessionKey.CompanyId, companyInfo.CompanyId);
            }

            this.formsAuthentication.SignIn(logonModel.UserName, logonModel.RememberMe);

            return(true);
        }
예제 #5
0
        /// <summary>
        /// Creates the header view.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="company">The company.</param>
        /// <param name="companyLogo">The company logo.</param>
        /// <returns></returns>
        public IHeaderViewModel CreateHeaderView(IUserDetail user, ICompanyDetail company, IDigitalFile companyLogo)
        {
            var result = new HeaderViewModel
            {
                User        = user,
                Company     = company,
                CompanyLogo = companyLogo
            };

            return(result);
        }
        /// <summary>
        /// Creates the dash board view.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="employee">The employee.</param>
        /// <param name="companyCollection">The company collection.</param>
        /// <param name="disciplineCollection">The discipline collection.</param>
        /// <param name="leaveRequestModel">The leave request model.</param>
        /// <param name="departmentCollection">The department collection.</param>
        /// <param name="trainingCollection">The training collection.</param>
        /// <param name="trainingRequestCollection">The training request collection.</param>
        /// <param name="leaveRequest">The leave request.</param>
        /// <param name="employeeCollection">The employee collection.</param>
        /// <param name="employmentHistory">The employment history.</param>
        /// <param name="educationHistory">The education history.</param>
        /// <param name="skillSet">The skill set.</param>
        /// <param name="digitalFile">The digital file.</param>
        /// <param name="processingMessage">The processing message.</param>
        /// <returns></returns>
        public IEmployeeProfileView CreateDashBoardView(IUserDetail user, IEmployee employee, IList <ICompanyDetail> companyCollection, IList <IDiscipline> disciplineCollection,
                                                        IList <ILeaveRequestModel> leaveRequestModel, IList <IDepartment> departmentCollection, IList <ITraining> trainingCollection, IList <IEmployeeTrainingModel> trainingRequestCollection, ILeaveRequestModel leaveRequest, IList <IEmployee> employeeCollection,
                                                        IList <IEmploymentHistory> employmentHistory, IList <IEducationHistory> educationHistory, IList <ISkillSetModel> skillSet, IDigitalFile digitalFile, string processingMessage)
        {
            var returnModel = new EmployeeProfileView
            {
                User                      = user,
                EducationHistory          = educationHistory,
                EmploymentHistory         = employmentHistory,
                SkillSet                  = skillSet,
                Employee                  = employee,
                ProfilePictureDetail      = digitalFile,
                QueryCollection           = disciplineCollection,
                LeaveTypeCollection       = leaveRequestModel,
                CompanyCollection         = companyCollection,
                DepartmentCollection      = departmentCollection,
                TrainingCollection        = trainingCollection,
                ProcessingMessage         = processingMessage,
                EmployeeCollection        = employeeCollection,
                TrainingRequestCollection = trainingRequestCollection,
                LeaveRequest              = leaveRequest,
            };

            return(returnModel);
        }
        /// <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);
        }
        /// <summary>
        /// Creates the employee view.
        /// </summary>
        /// <param name="employee">The employee.</param>
        /// <param name="user">The user.</param>
        /// <param name="companyColletion">The company colletion.</param>
        /// <param name="discipline">The discipline.</param>
        /// <param name="leaveRequestModel">The leave request model.</param>
        /// <param name="employmentHistory">The employment history.</param>
        /// <param name="educationHistory">The education history.</param>
        /// <param name="skillSet">The skill set.</param>
        /// <param name="digitalFile">The digital file.</param>
        /// <param name="processingMessage">The processing message.</param>
        /// <returns></returns>
        public IEmployeeProfileView CreateEmployeeView(IEmployee employee, IUserDetail user, IList <ICompanyDetail> companyColletion, IList <IDiscipline> discipline, IList <ILeaveRequestModel> leaveRequestModel, IList <IEmploymentHistory> employmentHistory,
                                                       IList <IEducationHistory> educationHistory, IList <ISkillSetModel> skillSet, IDigitalFile digitalFile,
                                                       IList <ISpouseModel> spouseModel, IList <IEmergency> emergency,
                                                       IList <IChildrenModel> childrenModel, IList <IBeneficiariesModel> beneficiariesModel,
                                                       IList <INextOfKin> nextOfKin, string processingMessage)
        {
            var returnModel = new EmployeeProfileView
            {
                Employee             = employee,
                User                 = user,
                EducationHistory     = educationHistory,
                EmploymentHistory    = employmentHistory,
                SkillSet             = skillSet,
                ProfilePictureDetail = digitalFile,
                QueryCollection      = discipline,
                LeaveTypeCollection  = leaveRequestModel,
                CompanyCollection    = companyColletion,
                ProcessingMessage    = processingMessage,
                spouseModel          = spouseModel,
                emergencyModel       = emergency,
                nextOfKinModel       = nextOfKin,
                childrenModel        = childrenModel,
                beneficiaryModel     = beneficiariesModel
            };

            return(returnModel);
        }
        /// <summary>
        /// Creates the tax report view.
        /// </summary>
        /// <param name="infoMessage">The information message.</param>
        /// <returns></returns>
        public ITaxReportView CreateTaxReportView(string infoMessage, IList <IIncomeType> incomeTypes, IDigitalFile fileType)
        {
            int?fileTypeId    = 0;
            var incomeTypeDDL = GetDropdownIncomeTypeList.GetIncomeType(incomeTypes, -1);

            if (fileType != null)
            {
                fileTypeId = fileType.DigitalFileId;
            }

            var taxReportView = new TaxReportView
            {
                FileTypeId        = fileTypeId,
                ProcessingMessage = infoMessage,

                IncomeTypes = incomeTypeDDL,
            };

            return(taxReportView);
        }
        /// <summary>
        /// Creates the branch view.
        /// </summary>
        /// <param name="branches">The branches.</param>
        /// <returns></returns>
        public IBranchListView CreateBranchView(IList <IBranch> branches, string infomessage, IDigitalFile fileType)
        {
            int?fileTypeId = 0;

            if (fileType != null)
            {
                fileTypeId = fileType.DigitalFileId;
            }
            var branchDDL = GetBranchDropdownList.BranchListItems(branches, -1);

            var branchView = new BranchListView
            {
                FileTypeId        = fileTypeId,
                BranchNames       = branchDDL,
                IncomeTypeNames   = new List <SelectListItem>(),
                ProcessingMessage = infomessage,
            };

            return(branchView);
        }