Exemplo n.º 1
0
        private async Task <ContentTypeUpdateGet> UpdateAddDropDownBoxes(ContentTypeUpdateGet ContentType, string UserId)
        {
            var icons = await _masterListProvider.IconList(UserId);

            var ContentTypeGroups = await _contentTypeGroupProvider.List(UserId);

            var SecurityLevels = await _securityLevelProvider.List(UserId);

            var ProcessTypes = await _processTypeProvider.List(UserId);

            var ContentTypeClassifications = await _contentTypeClassificationProvider.UpdateGetClassifications(UserId, ContentType.ContentTypeId);


            var ContentTypeClassificationStatuses = await _contentTypeClassificationStatusProvider.List(UserId);

            ContentType.ContentTypeClassificationStatuses = ContentTypeClassificationStatuses;
            ContentType.ContentTypeGroups          = ContentTypeGroups;
            ContentType.ContentTypeClassifications = ContentTypeClassifications;

            ContentType.SecurityLevels = SecurityLevels;
            ContentType.ProcessTypes   = ProcessTypes;
            ContentType.Icons          = icons;

            return(ContentType);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Update(ContentTypeUpdateGet ContentType)
        {
            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 _contentTypeProvider.UpdatePostCheck(ContentType);

                if (ErrorMessages.Count > 0)
                {
                    ContentType = await UpdateAddDropDownBoxes(ContentType, CurrentUser.Id);
                }
                else
                {
                    ContentType.UserId = CurrentUser.Id;
                    _contentTypeProvider.UpdatePost(ContentType);
                }
                ContentTypeUpdateGetWithErrorMessages ContentTypeWithErrorMessage = new ContentTypeUpdateGetWithErrorMessages {
                    ContentType = ContentType, ErrorMessages = ErrorMessages
                };
                return(Ok(ContentTypeWithErrorMessage));
            }
            ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id);

            ContentTypeUpdateGetWithErrorMessages ContentTypeWithNoRights = new ContentTypeUpdateGetWithErrorMessages {
                ContentType = ContentType, ErrorMessages = ErrorMessages
            };

            return(Ok(ContentTypeWithNoRights));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Edit(ContentTypeUpdateGet ContentType)
        {
            var token = HttpContext.Session.GetString("Token"); if (token == null)
            {
                return(RedirectToAction("Login", "FrontAuth"));
            }
            var ContentTypeUpdateGetWithErrorMessage = await _client.PostProtectedAsync <ContentTypeUpdateGetWithErrorMessages>($"{_configuration["APIUrl"]}api/ContentType/Update", ContentType, token);

            if (ContentTypeUpdateGetWithErrorMessage.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 = ContentTypeUpdateGetWithErrorMessage.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/ContentType/Edit", token);
                //ViewBag.Env = _hostingEnv.EnvironmentName;

                //ViewBag.ErrorMessages = ContentTypeUpdateGetWithErrorMessage.ErrorMessages;
                return(View(ContentTypeUpdateGetWithErrorMessage.ContentType));
            }

            return(RedirectToAction("Index"));
        }
Exemplo n.º 4
0
        public bool UpdatePost(ContentTypeUpdateGet ContentType)
        {
            string usp = "usp_ContentTypeUpdatePost @ContentTypeId, @CodePrefix , @CodeSuffix , @CodeTypeId ,  @ContentTypeGroupId  , @ProcessTypeId  ,@SecurityLevelId,  @Name, @Description, @MenuName, @MouseOver, @UserId, @IsRelationBasedOwnership " +
                         " , @IsProjectBasedOwnership " +
                         " , @IsOrganizationBasedOwnership " +
                         " , @IsFreeOwnership " +
                         " , @IsRelationBasedEdit " +
                         " , @IsRelationBasedEditSelectable " +
                         " , @IsOrganizationBasedEdit " +
                         " , @IsOrganizationBasedEditSelectable " +
                         " , @IsOrganizationBasedEditSub " +
                         " , @IsOrganizationBasedEditParent " +
                         " , @IsProjectBasedEdit " +
                         " , @IsProjectBasedEditSelectable " +
                         " , @IsProjectBasedEditSub " +
                         " , @IsProjectBasedEditParent " +
                         " , @IsFreeEdit " +
                         " , @IsFreeEditSelectable " +
                         " , @IsRelationBasedRead " +
                         " , @IsRelationBasedReadSelectable " +
                         " , @IsOrganizationBasedRead " +
                         " , @IsOrganizationBasedReadSelectable " +
                         " , @IsOrganizationBasedReadSub " +
                         " , @IsOrganizationBasedReadParent " +
                         " , @IsProjectBasedRead " +
                         " , @IsProjectBasedReadSelectable " +
                         " , @IsProjectBasedReadSub " +
                         " , @IsProjectBasedReadParent " +
                         " , @IsFreeRead " +
                         " , @IsFreeReadSelectable, @Color, @IconId, @ContentTypeClassificationTable";

            //_sqlDataAccess.SaveData<ContentTypeUpdateGet>(usp, ContentType);
            //return true;



            System.Data.DataTable ClassificationTable = ContentTypeClassificationValueDataTable.CreateTable();
            var xy = new List <ContentTypeClassification>();

            foreach (var x in ContentType.ContentTypeClassifications)
            {
                //if (x. != null && x.ClassificationValueId != 0)
                //{
                ClassificationTable.Rows.Add(

                    x.ClassificationId
                    , x.ObjectTypeClassificationStatusId);
                //}
            }
            //   string usp = "usp_ContentTypeCreatePost @ContentTypeGroupId, @ProcessTypeId , @SecurityLevelId, @Name , @Description, @MenuName , @MouseOver, @CreatorID, @MouseOver, @IconID, @ContentTypeClassificationTable ";
            _sqlDataAccess.SaveData <dynamic>(usp, new
            {
                ContentTypeId = ContentType.ContentTypeId
                ,
                ContentTypeGroupId = ContentType.ContentTypeGroupId
                ,
                ProcessTypeId = ContentType.@ProcessTypeId
                ,
                SecurityLevelId = ContentType.SecurityLevelId
                ,
                Name = ContentType.Name
                ,
                Description = ContentType.Description
                ,
                MenuName = ContentType.MenuName
                ,
                MouseOver = ContentType.MouseOver
                ,
                UserId = ContentType.UserId
                ,
                IsRelationBasedOwnership = ContentType.IsRelationBasedOwnership
                ,
                IsProjectBasedOwnership = ContentType.IsProjectBasedOwnership
                ,
                IsOrganizationBasedOwnership = ContentType.IsOrganizationBasedOwnership
                ,
                IsFreeOwnership = ContentType.IsFreeOwnership
                ,
                IsRelationBasedEdit = ContentType.IsRelationBasedEdit
                ,
                IsRelationBasedEditSelectable = ContentType.IsRelationBasedEditSelectable
                ,
                IsOrganizationBasedEdit = ContentType.IsOrganizationBasedEdit
                ,
                IsOrganizationBasedEditSelectable = ContentType.IsOrganizationBasedEditSelectable
                ,
                IsOrganizationBasedEditSub = ContentType.IsOrganizationBasedEditSub
                ,
                IsOrganizationBasedEditParent = ContentType.IsOrganizationBasedEditParent
                ,
                IsProjectBasedEdit = ContentType.IsProjectBasedEdit
                ,
                IsProjectBasedEditSelectable = ContentType.IsProjectBasedEditSelectable
                ,
                IsProjectBasedEditSub = ContentType.IsProjectBasedEditSub
                ,
                IsProjectBasedEditParent = ContentType.IsProjectBasedEditParent
                ,
                IsFreeEdit = ContentType.IsFreeEdit
                ,
                IsFreeEditSelectable = ContentType.IsFreeEditSelectable
                ,
                IsRelationBasedRead = ContentType.IsRelationBasedRead
                ,
                IsRelationBasedReadSelectable = ContentType.IsRelationBasedReadSelectable
                ,
                IsOrganizationBasedRead = ContentType.IsOrganizationBasedRead
                ,
                IsOrganizationBasedReadSelectable = ContentType.IsOrganizationBasedReadSelectable
                ,
                IsOrganizationBasedReadSub = ContentType.IsOrganizationBasedReadSub
                ,
                IsOrganizationBasedReadParent = ContentType.IsOrganizationBasedReadParent
                ,
                IsProjectBasedRead = ContentType.IsProjectBasedRead
                ,
                IsProjectBasedReadSelectable = ContentType.IsProjectBasedReadSelectable
                ,
                IsProjectBasedReadSub = ContentType.IsProjectBasedReadSub
                ,
                IsProjectBasedReadParent = ContentType.IsProjectBasedReadParent
                ,
                IsFreeRead = ContentType.IsFreeRead
                ,
                IsFreeReadSelectable = ContentType.IsFreeReadSelectable
                ,
                Color = ContentType.Color
                ,
                IconId = ContentType.IconId
                ,
                ContentTypeClassificationTable = ClassificationTable.AsTableValuedParameter("udt_ContentTypeClassificationNew")
            });
            return(true);
        }