コード例 #1
0
        public Task <FrontContentContentNew> ContentNewGetContentType(int ContentTypeId)
        {
            FrontContentContentNew ContentType = new FrontContentContentNew();

            ContentType.CodePrefix = "Pre";
            ContentType.CodeSuffix = "Suf";
            ContentType.CodeTypeId = 1;
            //ContentStatusList Status1 = new ContentStatusList { ContentStatusId = 1, Name = "Active" };
            //ContentStatusList Status2 = new ContentStatusList { ContentStatusId = 2, Name = "Inactive" };
//            ContentType.ContentStatuses = new List<ContentStatusList> { Status1, Status2 };
            ContentType.ContentStatuses = new List <ContentStatusList> {
                new ContentStatusList {
                    ContentStatusId = 1, Name = "Active"
                }, new ContentStatusList {
                    ContentStatusId = 1, Name = "Inactive"
                }
            };
            ContentType.ContentStatusId         = 1;
            ContentType.ContentTypeName         = "Knowledge";
            ContentType.CreatedDate             = DateTime.Now;
            ContentType.CreatorId               = 1;
            ContentType.Description             = "Any content that can help others";
            ContentType.IsFreeEdit              = false;
            ContentType.IsFreeEditSelectable    = false;
            ContentType.IsFreeRead              = false;
            ContentType.IsFreeReadSelectable    = false;
            ContentType.IsOrganizationBasedEdit = false;



            string usp = "usp_FrontContentContentNewGetContentType  @ContentTypeID";

            return(_sqlDataAccess.LoadSingleRecord <FrontContentContentNew, dynamic>(usp, new { ContentTypeId = ContentTypeId }));
        }
コード例 #2
0
        public async Task <IActionResult> ContentNew(FrontContentContentNew Content)
        {
            //PETER TODO other similar methods have different structure
            var token = HttpContext.Session.GetString("Token"); if (token == null)
            {
                return(RedirectToAction("Login", "FrontAuth"));
            }
            var x = await _client.PostProtectedAsync <FrontContentContentNew>($"{_configuration["APIUrl"]}api/FrontContent/ContentNew", Content, token);

            return(RedirectToAction("ShowContent", "FrontContent", new { id = x.NewId }));
        }
コード例 #3
0
        public async Task <IActionResult> ContentNew(FrontContentContentNew Content)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            if (await _claimCheck.CheckClaim(CurrentUser, "ApplicationRight", this.ControllerContext.RouteData.Values["controller"].ToString() + "\\" + this.ControllerContext.RouteData.Values["action"].ToString()))
            {
                Content.UserId = CurrentUser.Id;
                var NewId = await _frontContentProvider.FrontContentCreatePost(CurrentUser.Id, Content);

                Content.NewId = NewId;
                return(Ok(Content));
            }
            return(BadRequest(new
            {
                IsSuccess = false,
                Message = "No rights",
            }));
        }
コード例 #4
0
        public async Task <IActionResult> ContentNew(int Id)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            if (await _claimCheck.CheckClaim(CurrentUser, "ApplicationRight", this.ControllerContext.RouteData.Values["controller"].ToString() + "\\" + this.ControllerContext.RouteData.Values["action"].ToString()))
            {
                var ContentNew = new FrontContentContentNew();
                ContentNew = await _frontContentProvider.ContentNewGetContentType(Id);

                ContentNew.ContentTypeId = Id;
                ContentNew.Organizations = await _organizationProvider.ListofUser(CurrentUser.Id);

                ContentNew.Projects = await _projectProvider.ListofUser(CurrentUser.Id);

                ContentNew.Languages = await _languageProvider.ActiveList(CurrentUser.Id);

                ContentNew.SecurityLevels = await _securityLevelProvider.ListofUser(CurrentUser.Id);

                ContentNew.ContentStatuses = await _contentStatusProvider.List(CurrentUser.Id);

                ContentNew.Classifications = await _frontContentProvider.NewClassifications(CurrentUser.Id, Id);

                ContentNew.ContentTypeName = await _contentTypeProvider.ReturnName(CurrentUser.Id, Id);

                ContentNew.OrganizationId = ContentNew.Organizations.First().OrganizationId;
                foreach (var Classification in ContentNew.Classifications)
                {
                    Classification.ClassificationLevels = await _frontContentProvider.NewClassificationLevels(Classification.ClassificationId);

                    foreach (var Classificationlevel in Classification.ClassificationLevels)
                    {
                        Classificationlevel.ClassificationValues = await _frontContentProvider.NewClassificationValues(CurrentUser.Id, Classification.ClassificationId, Classificationlevel.Sequence, Classificationlevel.Alphabetically);
                    }
                }
                return(Ok(ContentNew));
            }
            return(BadRequest(new
            {
                IsSuccess = false,
                Message = "No rights",
            }));
        }
コード例 #5
0
        public async Task <int> FrontContentCreatePost(string UserId, FrontContentContentNew Content)
        {
            DataTable ClassificationValueTable = ContentClassificationValueDataTable.CreateTable();
            var       xy = new List <ContentClassificationValue>();

            foreach (var x in Content.Classifications)
            {
                if (x.ClassificationValueId != null && x.ClassificationValueId != 0)
                {
                    ClassificationValueTable.Rows.Add(

                        x.ClassificationId
                        , x.ClassificationValueId
                        , UserId
                        , DateTime.Today);
                }
            }
            var p = new DynamicParameters();

            p.Add("@IsRelationBasedEdit", Content.IsRelationBasedEdit);
            p.Add("@IsRelationBasedRead", Content.IsRelationBasedRead);
            p.Add("@IsFreeEdit", Content.IsFreeEdit);
            p.Add("@IsFreeRead", Content.IsFreeRead);
            p.Add("@IsOrganizationBasedEdit", Content.IsOrganizationBasedEdit);
            p.Add("@IsOrganizationBasedEditParent", Content.IsOrganizationBasedEditParent);
            p.Add("@IsOrganizationBasedEditSub", Content.IsOrganizationBasedEditSub);
            p.Add("@IsOrganizationBasedRead", Content.IsOrganizationBasedRead);
            p.Add("@IsOrganizationBasedReadParent", Content.IsOrganizationBasedReadParent);
            p.Add("@IsOrganizationBasedReadSub", Content.IsOrganizationBasedReadSub);

            p.Add("@IsProjectBasedEdit", Content.IsProjectBasedEdit);
            p.Add("@IsProjectBasedEditParent", Content.IsProjectBasedEditParent);
            p.Add("@IsProjectBasedEditSub", Content.IsProjectBasedEditSub);
            p.Add("@IsProjectBasedRead", Content.IsProjectBasedRead);
            p.Add("@IsProjectBasedReadParent", Content.IsProjectBasedReadParent);
            p.Add("@IsProjectBasedReadSub", Content.IsProjectBasedReadSub);



            p.Add("@ContentTypeId", Content.ContentTypeId);
            p.Add("@ContentStatusId", Content.ContentStatusId);
            p.Add("@LanguageId", Content.LanguageId);
            p.Add("@Title", Content.Title);
            p.Add("@Description", Content.Description);
            p.Add("@SecurityLevelID", Content.SecurityLevelId);
            p.Add("@OrganizationId", Content.OrganizationId);
            p.Add("@ProjectId", Content.ProjectId);
            p.Add("@UserId", Content.UserId);
            p.Add("@ClassificationValueTable", ClassificationValueTable.AsTableValuedParameter("udt_ContentClassificationValueInsert"));
            p.Add("@NewId", dbType: DbType.Int32,
                  direction: ParameterDirection.Output);


//            string usp = "usp_FrontContentNewPost @ContentTypeId, @ContentStatusID , @LanguageID , @Title , @Description , @SecurityLevelID , @ProjectID , @OrganizationId , @UserID, @NewContentId, @ClassificationValueTable ";
            string usp   = "usp_FrontContentNewPost";
            var    NewId = await _sqlDataAccess.SaveData3(usp, p);

            //_sqlDataAccess.SaveData<dynamic>(usp, new
            //{
            //    ContentTypeId = Content.ContentTypeId
            //    ,
            //    ContentStatusId = Content.ContentStatusId
            //    ,
            //    LanguageId = Content.LanguageId
            //    ,
            //    Title = Content.Title
            //    ,
            //    Description = Content.Description
            //    ,
            //    SecurityLevelID = Content.SecurityLevelId
            //    ,
            //    OrganizationId = Content.OrganizationId
            //    ,
            //    ProjectId = Content.ProjectId
            //    ,
            //    UserId = UserId
            //    ,
            //    ClassificationValueTable = ClassificationValueTable.AsTableValuedParameter("udt_ContentClassificationValueInsert")
            //});
            return(NewId);
        }