Example #1
0
        public ActionResult EditTypeOfExit(TypeOfExitView TypeOfExit)
        {
            if (TypeOfExit == null)
            {
                throw new ArgumentNullException(nameof(TypeOfExit));
            }

            if (!ModelState.IsValid)
            {
                var viewModel = this.typeOfExitService.GetTypeOfExitUpdateView(TypeOfExit, string.Empty);

                return(this.View("EditTypeOfExit", viewModel));
            }

            var returnMessage = this.typeOfExitService.ProcessEditTypeOfExitInfo(TypeOfExit);

            if (!string.IsNullOrEmpty(returnMessage))
            {
                var viewModel = this.typeOfExitService.GetTypeOfExitUpdateView(TypeOfExit, returnMessage);

                return(this.View("EditTypeOfExit", viewModel));
            }

            returnMessage = string.Format("{0} Edited", TypeOfExit.TypeOfExitName);

            return(this.RedirectToAction("TypeOfExitList", new { message = returnMessage }));
        }
Example #2
0
        public ActionResult CreateTypeOfExit(TypeOfExitView typeOfExitInfo, HttpPostedFileBase typeOfExitExcelFile)
        {
            var processingMessage = string.Empty;

            if (typeOfExitExcelFile != null)
            {
                processingMessage = this.typeOfExitService.ProcessUploadExceltypeOfExit(typeOfExitExcelFile);

                if (!string.IsNullOrEmpty(processingMessage))
                {
                    var viewModel = this.typeOfExitService.GetTypeOfExitUpdateView(typeOfExitInfo, processingMessage);

                    return(this.View("CreateTypeOfExit", viewModel));
                }

                processingMessage = string.Format("{0} successful added", typeOfExitInfo.TypeOfExitName);

                return(this.RedirectToAction("TypeOfExitList", "TypeOfExit", new { message = processingMessage }));
            }

            //Check that TypeOfExit Info is Not Null
            if (typeOfExitInfo == null)
            {
                throw new ArgumentNullException(nameof(typeOfExitInfo));
            }

            //Validate Model
            if (!ModelState.IsValid)
            {
                var model = this.typeOfExitService.GetTypeOfExitUpdateView(typeOfExitInfo, string.Empty);
                return(View("CreateTypeOfExit", model));
            }

            //Process The TypeOfExit Information
            processingMessage = typeOfExitService.ProcessTypeOfExitInfo(typeOfExitInfo);

            //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.typeOfExitService.GetTypeOfExitUpdateView(typeOfExitInfo, processingMessage);
                return(this.View("CreateTypeOfExit", model));
            }

            processingMessage = string.Format("{0} created successfully", typeOfExitInfo.TypeOfExitName);

            return(this.RedirectToAction("TypeOfExitList"));
        }
Example #3
0
        /// <summary>
        /// </summary>
        /// <param name="companyCollection"></param>
        /// <param name="typeOfExitCollection"></param>
        /// <param name="employeeCollection"></param>
        /// <param name="typeOfExitInfo"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public ITypeOfExitView CreateTypeOfExitView(int companyId, IList <ITypeOfExit> typeOfExitCollection, IList <IEmployee> employeeCollection, ITypeOfExit typeOfExitInfo, string message)
        {
            //if (typeOfExitId == null) throw new ArgumentNullException(nameof(typeOfExitId));

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

            var viewModel = new TypeOfExitView
            {
                EmployeeDropDown    = employeeDDL,
                InterViewerDropDown = employeeDDL,
                ProcessingMessage   = string.Empty,
                CompanyId           = companyId
            };

            return(viewModel);
        }
Example #4
0
        /// <summary>
        /// Creates the edit type of exit view.
        /// </summary>
        /// <param name="typeOfExit">The type of exit.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">typeOfExit</exception>
        public ITypeOfExitView CreateEditTypeOfExitView(ITypeOfExit typeOfExit)
        {
            if (typeOfExit == null)
            {
                throw new ArgumentNullException(nameof(typeOfExit));
            }

            var viewResult = new TypeOfExitView
            {
                TypeOfExitId   = typeOfExit.TypeOfExitId,
                TypeOfExitName = typeOfExit.TypeOfExitName,
                CompanyId      = typeOfExit.CompanyId,
                IsActive       = typeOfExit.IsActive
            };

            return(viewResult);
        }