示例#1
0
        public bool UpdatePost(OrganizationTypeUpdateGet OrganizationType)
        {
            string usp = "usp_OrganizationTypeUpdatePost @OrganizationTypeId,  @Internal, @LegalEntity,@CodePrefix , @CodeSuffix , @CodeTypeId ,  @Name, @Description, @MenuName, @MouseOver,  @ModifierId";

            _sqlDataAccess.SaveData <OrganizationTypeUpdateGet>(usp, OrganizationType);
            return(true);
        }
示例#2
0
        public async Task <List <ErrorMessage> > UpdatePostCheck(OrganizationTypeUpdateGet OrganizationType)
        {
            string usp           = "usp_OrganizationTypeUpdatePostCheck @OrganizationTypeId,  @Internal, @LegalEntity,@CodePrefix , @CodeSuffix , @CodeTypeId ,  @Name, @Description, @MenuName, @MouseOver,  @ModifierId";
            var    ErrorMessages = await _sqlDataAccess.LoadData <ErrorMessage, dynamic>(usp, OrganizationType);

            return(ErrorMessages);
        }
        public async Task <IActionResult> Update(OrganizationTypeUpdateGet OrganizationType)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            var ErrorMessages = new List <ErrorMessage>();

            if (await _claimCheck.CheckClaim(CurrentUser, "ApplicationRight", this.ControllerContext.RouteData.Values["controller"].ToString() + "\\" + this.ControllerContext.RouteData.Values["action"].ToString()))
            {
                ErrorMessages = await _organizationTypeProvider.UpdatePostCheck(OrganizationType);

                if (ErrorMessages.Count > 0)
                {
                    OrganizationType = await UpdateAddDropDownBoxes(OrganizationType, CurrentUser.Id);
                }
                else
                {
                    _organizationTypeProvider.UpdatePost(OrganizationType);
                }
                OrganizationTypeUpdateGetWithErrorMessages OrganizationTypeWithErrorMessage = new OrganizationTypeUpdateGetWithErrorMessages {
                    OrganizationType = OrganizationType, ErrorMessages = ErrorMessages
                };
                return(Ok(OrganizationTypeWithErrorMessage));
            }
            ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id);

            OrganizationTypeUpdateGetWithErrorMessages OrganizationTypeWithNoRights = new OrganizationTypeUpdateGetWithErrorMessages {
                OrganizationType = OrganizationType, ErrorMessages = ErrorMessages
            };

            return(Ok(OrganizationTypeWithNoRights));
        }
示例#4
0
        public async Task <IActionResult> Edit(OrganizationTypeUpdateGet OrganizationType)
        {
            var token = HttpContext.Session.GetString("Token"); if (token == null)
            {
                return(RedirectToAction("Login", "FrontAuth"));
            }
            var OrganizationTypeUpdateGetWithErrorMessage = await _client.PostProtectedAsync <OrganizationTypeUpdateGetWithErrorMessages>($"{_configuration["APIUrl"]}api/OrganizationType/Update", OrganizationType, token);

            if (OrganizationTypeUpdateGetWithErrorMessage.ErrorMessages.Count > 0)
            {
                var AllStuff = await _loadViewBagModel.ViewBagLoad(this.ControllerContext.RouteData.Values["controller"].ToString(), this.ControllerContext.RouteData.Values["action"].ToString(), token, _hostingEnv.EnvironmentName, _configuration, false, 0, "");

                AllStuff.ErrorMessages = OrganizationTypeUpdateGetWithErrorMessage.ErrorMessages;
                ViewBag.AllStuff       = AllStuff;
                //ViewBag.Favorites = await _client.GetProtectedAsync<List<MVCFavoriteMenu>>($"{_configuration["APIUrl"]}api/MVCFavorite/Menu", token);
                //ViewBag.FavoriteGroupList = await _client.GetProtectedAsync<List<MVCFavoriteGroupList>>($"{_configuration["APIUrl"]}api/MVCFavorite/GroupList", token);
                //ViewBag.UITerms = await _client.GetProtectedAsync<List<UITermLanguageCustomizationList>>($"{_configuration["APIUrl"]}api/MVC/OrganizationType/Edit", token);
                //ViewBag.Env = _hostingEnv.EnvironmentName;

                //ViewBag.ErrorMessages = OrganizationTypeUpdateGetWithErrorMessage.ErrorMessages;
                return(View(OrganizationTypeUpdateGetWithErrorMessage.OrganizationType));
            }

            return(RedirectToAction("Index"));
        }
        private async Task <OrganizationTypeUpdateGet> UpdateAddDropDownBoxes(OrganizationTypeUpdateGet OrganizationType, string UserId)
        {
            var icons = await _masterListProvider.IconList(UserId);

            OrganizationType.Icons = icons;

            return(OrganizationType);
        }