Exemplo n.º 1
0
        /// <summary>
        /// Creates the exit management view.
        /// </summary>
        /// <param name="employeeExitView">The employee exit view.</param>
        /// <param name="processingMessage">The processing message.</param>
        /// <returns></returns>
        public IEmployeeExitView CreateExitManagementView(IEmployeeExitView employeeExitView, IList <ICompanyDetail> companyCollection, IList <IEmployee> employeeCollection, IList <ITypeOfExit> typeOfExitCollection, string processingMessage)
        {
            if (employeeExitView == null)
            {
                throw new ArgumentNullException(nameof(employeeExitView));
            }

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

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

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

            var companyDDL    = GetDropDownList.CompanyListItems(companyCollection, employeeExitView.CompanyId);
            var employeeDDL   = GetDropDownList.EmployeeListitems(employeeCollection, employeeExitView.EmployeeId);
            var typeOfExitDDL = GetDropDownList.TypeOfExitListItems(typeOfExitCollection, employeeExitView.TypeOfExitId);

            employeeExitView.CompanyDropDown    = companyDDL;
            employeeExitView.EmployeeDropDown   = employeeDDL;
            employeeExitView.TypeOfExitDropDown = typeOfExitDDL;
            employeeExitView.ProcessingMessage  = processingMessage;

            return(employeeExitView);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Processes the employee exit information.
        /// </summary>
        /// <param name="employeeExitInfo">The employee exit information.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">employeeExitInfo</exception>
        public string ProcessEmployeeExitInfo(IEmployeeExitView employeeExitInfo)
        {
            if (employeeExitInfo == null)
            {
                throw new ArgumentNullException(nameof(employeeExitInfo));
            }

            var processingMessage = string.Empty;


            processingMessage = this.exitManagementRepository.SaveEmployeeExitInfo(employeeExitInfo);

            return(processingMessage);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Saves the employee exit information.
        /// </summary>
        /// <param name="employeeExitInfo">The employee exit information.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">employeeExitInfo</exception>
        public string SaveEmployeeExitInfo(IEmployeeExitView employeeExitInfo)
        {
            if (employeeExitInfo == null)
            {
                throw new ArgumentNullException(nameof(employeeExitInfo));
            }

            var result = string.Empty;

            var newRecord = new EmployeeExit
            {
                CompanyId            = employeeExitInfo.CompanyId,
                EmployeeId           = employeeExitInfo.EmployeeId,
                DateCreated          = DateTime.Now,
                IsActive             = true,
                Reason               = employeeExitInfo.Reason,
                Interviewer          = employeeExitInfo.Interviewer,
                TypeOfExitId         = employeeExitInfo.TypeOfExitId,
                InterviewDate        = employeeExitInfo.InterviewDate,
                DateRequested        = employeeExitInfo.DateRequested,
                ExitInterViewSummary = employeeExitInfo.ExitInterViewSummary
            };

            try
            {
                using (
                    var dbContext = (HRMSEntities)this.dbContextFactory.GetDbContext(ObjectContextType.HRMS))
                {
                    var employee = dbContext.Employees.SingleOrDefault(p => p.EmployeeId.Equals(employeeExitInfo.EmployeeId));

                    employee.IsExit = true;

                    dbContext.EmployeeExits.Add(newRecord);
                    dbContext.SaveChanges();
                }
            }
            catch (Exception e)
            {
                result = string.Format("SaveEmployeeExitInfo - {0} , {1}", e.Message,
                                       e.InnerException != null ? e.InnerException.Message : "");
            }

            return(result);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Creates the exit management update view.
        /// </summary>
        /// <param name="employeeExitView">The employee exit view.</param>
        /// <param name="typeOfExitCollection">The type of exit collection.</param>
        /// <param name="message">The message.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">
        /// employeeExitView
        /// or
        /// typeOfExitCollection
        /// </exception>
        public IEmployeeExitView CreateExitManagementUpdateView(IEmployeeExitView employeeExitView, IList <ITypeOfExit> typeOfExitCollection, string message)
        {
            if (employeeExitView == null)
            {
                throw new ArgumentNullException(nameof(employeeExitView));
            }

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

            var typeOfExitDDL = GetDropDownList.TypeOfExitListItems(typeOfExitCollection, employeeExitView.TypeOfExitId);

            employeeExitView.TypeOfExitDropDown = typeOfExitDDL;
            employeeExitView.ProcessingMessage  = message;


            return(employeeExitView);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Creates the employee exit updated view.
        /// </summary>
        /// <param name="employeeExitView">The employee exit view.</param>
        /// <param name="userId">The user identifier.</param>
        /// <param name="message">The message.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">
        /// userId
        /// or
        /// employeeExitView
        /// </exception>
        public IEmployeeExitView CreateEmployeeExitUpdatedView(IEmployeeExitView employeeExitView, string message)
        {
            if (employeeExitView == null)
            {
                throw new ArgumentNullException(nameof(employeeExitView));
            }

            var companyInfo = companyRepository.GetCompanyById((int)this.session.GetSessionValue(SessionKey.CompanyId));

            employeeExitView.Company = companyInfo;

            var userInfo = this.usersRepository.GetUserById((int)session.GetSessionValue(SessionKey.UserId));

            var employeeInfo = this.employeeOnBoardRepository.GetOnBoarderById(employeeExitView.EmployeeId);

            employeeExitView.Employee = employeeInfo;

            var typeOfExistCollection = this.typeOfExitRepository.GetAllMyTypeOfExit(employeeExitView.CompanyId);

            return(this.exitManagementViewModelFactory.CreateExitManagementUpdateView(employeeExitView, typeOfExistCollection, message));
        }