Esempio n. 1
0
        /// <summary>
        /// Creates the exit management view.
        /// </summary>
        /// <param name="employeeId">The employee identifier.</param>
        /// <param name="companyId">The company identifier.</param>
        /// <param name="typeOfExitCollection">The type of exit collection.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">
        /// employeeId
        /// or
        /// companyId
        /// or
        /// typeOfExitCollection
        /// </exception>
        public IEmployeeExitView CreateExitManagementView(IEmployee employee, ICompanyDetail company, IList <ITypeOfExit> typeOfExitCollection)
        {
            if (employee == null)
            {
                throw new ArgumentNullException(nameof(employee));
            }

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

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

            var typeOfExitDDL = GetDropDownList.TypeOfExitListItems(typeOfExitCollection, -1);

            var result = new EmployeeExitView
            {
                TypeOfExitDropDown = typeOfExitDDL,
                ProcessingMessage  = string.Empty,
                Employee           = employee,
                Company            = company,
            };

            return(result);
        }
Esempio n. 2
0
        public ActionResult AddEmployeeExit(EmployeeExitView employeeExitView)
        {
            //Check that Training Info is Not Null
            if (employeeExitView == null)
            {
                throw new ArgumentNullException(nameof(employeeExitView));
            }

            //Validate Model
            if (!ModelState.IsValid)
            {
                var model = this.exitManagementService.CreateEmployeeExitUpdatedView(employeeExitView, string.Empty);
                return(PartialView("AddEmployeeExit", model));
            }

            //Process The Training Information
            var processingMessage = this.exitManagementService.ProcessEmployeeExitInfo(employeeExitView);


            //Check if the Processing Message is Not Empty
            //If it is not empty, Means there is no error
            if (!string.IsNullOrEmpty(processingMessage))
            {
                var model = this.exitManagementService.CreateEmployeeExitUpdatedView(employeeExitView, processingMessage);
                return(this.View("AddEmployeeExit", model));
            }

            processingMessage = string.Format("{0} Exited", employeeExitView.Name);

            return(this.RedirectToAction("AddEmployeeExit", new { employeeId = employeeExitView.EmployeeId, message = processingMessage }));
        }