Beispiel #1
0
        public ActionResult AddBranchUser(BranchListView branchUserListView)  //displays branches with the users
        {
            var user = this.agentOfDeductionService.CheckUserBranchExist(branchUserListView.UserId, branchUserListView.BranchId);

            if (user)
            {
                var processingMessage = "User Already Assigned";
                var userInfo          = this.agentOfDeductionService.GetUpdatedBranchUserListView(branchUserListView, processingMessage);
                return(this.PartialView("AddBranchUser", userInfo));
            }
            if (!ModelState.IsValid)
            {
                var userInfo = this.agentOfDeductionService.GetUpdatedBranchUserListView(branchUserListView, "");
                return(this.PartialView("AddBranchUser", userInfo));
            }
            if (branchUserListView.UserId == -1)
            {
                var processingMessage = "User  Is Required";
                var userInfo          = this.agentOfDeductionService.GetUpdatedBranchUserListView(branchUserListView, processingMessage);
                return(this.PartialView("AddBranchUser", userInfo));
            }

            var branchUserList = this.agentOfDeductionService.SaveBranchUserInfo(branchUserListView);

            if (!string.IsNullOrEmpty(branchUserList))
            {
                ModelState.AddModelError("", branchUserList);
                var userInfo = this.agentOfDeductionService.GetUpdatedBranchUserListView(branchUserListView, "");
                return(this.PartialView("AddBranchUser", userInfo));
            }
            var returnView = this.agentOfDeductionService.GetUpdatedBranchUserListView(branchUserListView, "User Assigned Successfully");

            return(this.PartialView("AddBranchUser", returnView));
        }
Beispiel #2
0
        public ActionResult EditBranch(BranchListView branchListView)
        {
            if (branchListView == null)
            {
                throw new ArgumentNullException("branchListView");
            }

            if (!ModelState.IsValid)
            {
                var branchTypeModel = this.agentOfDeductionService.GetBranchView(branchListView, string.Empty);

                return(this.View("EditBranch", branchTypeModel));
            }

            var branchTypeEdit = this.agentOfDeductionService.UpdateBranchInfo(branchListView);

            if (!string.IsNullOrEmpty(branchTypeEdit))
            {
                ModelState.AddModelError("", branchTypeEdit);
                var incomeTypeModel = this.agentOfDeductionService.GetBranchView(branchListView, "");
                return(View("EditBranch", incomeTypeModel));
            }

            var returnMessage = string.Format("BranchType Updated ");

            return(this.RedirectToAction("Branch",
                                         new { message = returnMessage }));
        }
        /// <summary>
        /// Gets the branch ListView.
        /// </summary>
        /// <param name="userRegistrations">The user registrations.</param>
        /// <param name="agentOfDeductionBranches">The agent of deduction branches.</param>
        /// <returns></returns>
        public IBranchListView GetBranchListView(IList <IBranch> branches)
        {
            var view = new BranchListView
            {
                BranchCollection = branches,
            };

            return(view);
        }
        /// <summary>
        /// Creates the branch view.
        /// </summary>
        /// <param name="branch">The branch.</param>
        /// <returns></returns>
        public IBranchListView CreateBranchView(IBranch branch)
        {
            var branchView = new BranchListView
            {
                BranchName = branch.BranchName,
                BranchId   = branch.BranchId
            };

            return(branchView);
        }
        /// <summary>
        /// Creates the branch view.
        /// </summary>
        /// <returns></returns>
        public IBranchListView CreateBranchView(IList <IJurisdiction> jurisdictions)
        {
            var jurisdictionDDL = GetJurisdictionDropdown.GetJurisdicions(jurisdictions, -1);
            var view            = new BranchListView
            {
                ProcessingMessage = string.Empty,
                JurisdictionNames = jurisdictionDDL
            };

            return(view);
        }
        /// <summary>
        /// Creates the branch view.
        /// </summary>
        /// <param name="branchView">The branch view.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException">branchView</exception>
        public IBranchListView CreateBranchView(IBranchListView branchView)
        {
            if (branchView == null)
            {
                throw new ArgumentNullException(nameof(branchView));
            }
            var view = new BranchListView
            {
                ProcessingMessage = "",
                Description       = branchView.Description,
                BranchId          = branchView.BranchId
            };

            return(view);
        }
        public IBranchListView GetBranchUserListView(IList <IUserRegistration> userRegistrations, IList <IBranch> branches)
        {
            var userType = GetUserDropdown.UserListItems(userRegistrations, -1);

            var branchType = GetBranchDropdownList.BranchListItems(branches, -1);

            var view = new BranchListView
            {
                BranchCollection = branches,
                BranchNames      = branchType,
                UserNames        = userType,
            };

            return(view);
        }
        /// <summary>
        /// Gets the updated branch user ListView.
        /// </summary>
        /// <param name="userRegistrations">The user registrations.</param>
        /// <param name="branches">The branches.</param>
        /// <param name="branchUserListView">The branch user ListView.</param>
        /// <param name="processingMessage">The processing message.</param>
        /// <returns></returns>
        public IBranchListView GetUpdatedBranchUserListView(IList <IUserRegistration> userRegistrations, IList <IBranch> agentOfDeductionBranches, IBranchListView branchUserListView, string processingMessage)
        {
            var userType = GetUserDropdown.UserListItems(userRegistrations, branchUserListView.UserId);

            var branchType = GetBranchDropdownList.BranchListItems(agentOfDeductionBranches, branchUserListView.BranchId);


            var view = new BranchListView
            {
                BranchNames       = branchType,
                UserNames         = userType,
                ProcessingMessage = processingMessage
            };

            return(view);
        }
        /// <summary>
        /// Gets the branch user ListView.
        /// </summary>
        /// <param name="userRegistrations">The user registrations.</param>
        /// <param name="branches">The branches.</param>
        /// <returns></returns>
        public IBranchListView GetBranchUserListView(IList <IUserRegistration> userRegistrations, IList <IBranch> branchesUsers, IList <IBranch> branches, string infoMessage, int branchId)
        {
            var userType = GetUserDropdown.UserListItems(userRegistrations, -1);

            var branchType = GetBranchDropdownList.BranchListItems(branches, -1);

            var view = new BranchListView
            {
                BranchCollection  = branchesUsers,
                BranchNames       = branchType,
                UserNames         = userType,
                ProcessingMessage = infoMessage,
                BranchId          = branchId
            };

            return(view);
        }
        /// <summary>
        /// Processes the branch information.
        /// </summary>
        /// <param name="branchView">The branch view.</param>
        /// <returns></returns>
        public string ProcessBranchInfo(IBranchListView branchView)
        {
            var processingMessages = string.Empty;

            var dataValue     = this.agentOfDeductionRepository.GetBranchDescriptionByValue(branchView.BranchName);
            var isRecordExist = (dataValue == null) ? false : true;

            if (isRecordExist)
            {
                processingMessages = Messages.BranchExist;
                return(processingMessages);
            }
            var branchId   = 0;
            var branchInfo = this.agentOfDeductionRepository.SaveBranchInfo(branchView, out branchId);

            if (string.IsNullOrEmpty(branchInfo))
            {
                var            userId             = (int)session.GetSessionValue(SessionKey.UserId);;
                BranchListView branchUserListView = new BranchListView
                {
                    BranchId = branchId,
                    UserId   = userId
                };
                var agentId = (int)session.GetSessionValue(SessionKey.AgentOfDeductionId);;

                AgentOfDeductionBranchView agentOfDeductionView = new AgentOfDeductionBranchView()
                {
                    AgentOfDeductionId = agentId,
                    BranchId           = branchId
                };
                BranchJurisdictionView branchJurisdictionView = new BranchJurisdictionView()
                {
                    BranchId       = branchId,
                    JurisdictionId = branchView.JurisdictionId
                };
                branchInfo = this.agentOfDeductionRepository.SaveBranchUser(branchUserListView);
                branchInfo = this.agentOfDeductionRepository.SaveAgentOfDeductionBranch(agentOfDeductionView);
                branchInfo = this.agentOfDeductionRepository.SaveJurisdictionBranch(branchJurisdictionView);
            }



            return(branchInfo);
        }
        /// <summary>
        /// Creates the branch ListView.
        /// </summary>
        /// <param name="selectedId">The selected identifier.</param>
        /// <param name="selectedDescription">The selected description.</param>
        /// <param name="branchCollection">The branch collection.</param>
        /// <param name="message">The message.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException">branchCollection</exception>
        public IBranchListView CreateBranchListView(IList <IBranch> branchCollection, IList <IJurisdiction> jurisdictions, string infoMessage)
        {
            if (branchCollection == null)
            {
                throw new ArgumentNullException(nameof(branchCollection));
            }

            var jurisdictionDDL = GetJurisdictionDropdown.GetJurisdicions(jurisdictions, -1);


            var returnView = new BranchListView
            {
                BranchCollection  = branchCollection,
                JurisdictionNames = jurisdictionDDL,
                ProcessingMessage = infoMessage,
            };

            return(returnView);
        }
        /// <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);
        }
Beispiel #13
0
        public ActionResult AddBranch(BranchListView branchView)
        {
            if (branchView == null)
            {
                throw new ArgumentNullException(nameof(branchView));
            }

            if (branchView.JurisdictionId == -1)
            {
                this.ModelState.AddModelError("", "Jurisdiction cannot be empty");
                var branchModel = this.agentOfDeductionService.GetBranchView(branchView, string.Empty);
                return(this.PartialView("AddBranch", branchModel));
            }

            if (!ModelState.IsValid)
            {
                var branchModel = this.agentOfDeductionService.GetBranchView(branchView, string.Empty);
                return(this.PartialView("AddBranch", branchModel));
            }


            var branchInfo = this.agentOfDeductionService.ProcessBranchInfo(branchView);

            if (!string.IsNullOrEmpty(branchInfo))
            {
                ModelState.AddModelError("", branchInfo);
                var branchModel = this.agentOfDeductionService.GetBranchView(branchView, "");
                return(this.PartialView("AddBranch", branchModel));
            }

            branchView = new BranchListView();

            var returnModel = this.agentOfDeductionService.GetBranchView(branchView, "Branch Added Successfully");

            return(this.PartialView("AddBranch", returnModel));
        }