private static string GetListSingleItemView(LTD_InfoCategory ltdInfoCategory, long pageNo, long itemsPerPage, long dataIndex, string templateSuffix, bool hideDisplay)
        {
            string htmlTextItem = "";
            if (ltdInfoCategory != null)
            {
                string message;
                List<TemplateInfoCategoryListDetailItem.EditAction> editActionList = new List<TemplateInfoCategoryListDetailItem.EditAction>();
                editActionList.Add(new TemplateInfoCategoryListDetailItem.EditAction
                {
                    Id = ltdInfoCategory.InfoCategoryID.ToString(),
                    DataIndex = dataIndex.ToString(),
                    PageNo = pageNo.ToString(),
                    ItemsPerPage = itemsPerPage.ToString(),
                    TemplateSuffix = templateSuffix,                    
                    //HideDisplay = hideDisplay.ToString().ToLower(),
                });
                string createdBy = UtilsSecurity.GetUserName(ltdInfoCategory.UserID);
                
                var templateListDetailItem = new TemplateInfoCategoryListDetailItem
                {
                    InfoCategoryName = ltdInfoCategory.InfoCategoryName,
                    IsDefault = ltdInfoCategory.IsDefault,
                    IsInActive = !ltdInfoCategory.IsActive,
                    CreatedBy = createdBy,

                    EditActionList = editActionList
                };
                htmlTextItem = templateListDetailItem.GetFilled(templateSuffix, UtilsGeneric.Validate,
                                                                        UtilsGeneric.ThrowException,
                                                                        out message);


            }
            return htmlTextItem;
        }
Exemple #2
0
        private static string GetListSingleItemView(LTD_InfoPage ltdInfoPage, long pageNo, long itemsPerPage, long dataIndex, string templateSuffix, long recordIndex, bool asyncLoading)
        {
            string htmlTextItem = "";

            if (ltdInfoPage != null)
            {
                string message;
                List <TemplateInfoPageListDetailItem.EditAction>  editActionList  = new List <TemplateInfoPageListDetailItem.EditAction>();
                List <TemplateInfoPageListDetailItem.AsyncAction> asyncActionList = new List <TemplateInfoPageListDetailItem.AsyncAction>();

                if (((UtilsSecurity.HaveAdminRole() == true) && (UtilsSecurity.HaveAuthorRoleEnabled() == true)) || ((UtilsSecurity.HaveAuthorRoleEnabled() == true) && (ltdInfoPage.UserID == UtilsSecurity.GetUserId())))
                {
                    editActionList.Add(new TemplateInfoPageListDetailItem.EditAction
                    {
                        Id             = ltdInfoPage.InfoPageID.ToString(),
                        DataIndex      = dataIndex.ToString(),
                        PageNo         = pageNo.ToString(),
                        ItemsPerPage   = itemsPerPage.ToString(),
                        TemplateSuffix = templateSuffix
                    });
                }

                string           infoCategoryName = "";
                LTD_InfoCategory ltdInfoCategory  = DataInfoList.GetLtdInfoCategory(ltdInfoPage.InfoCategoryID);
                if (ltdInfoCategory != null)
                {
                    infoCategoryName = ltdInfoCategory.InfoCategoryName;
                }

                string infoSectionListView = "";
                string infoSectionSaveView = "";

                if ((ltdInfoPage.AsyncLoading == false) || ((ltdInfoPage.AsyncLoading == true) && (asyncLoading == false)))
                {
                    infoSectionListView = InfoSectionView.GetView(ltdInfoPage.InfoPageID, dataIndex + 1, templateSuffix, false, true, true, false);
                }
                else
                {
                    asyncActionList.Add(new TemplateInfoPageListDetailItem.AsyncAction
                    {
                        DataIndex      = dataIndex.ToString(),
                        PageNo         = pageNo.ToString(),
                        ItemsPerPage   = itemsPerPage.ToString(),
                        TemplateSuffix = templateSuffix,
                        AsyncLoading   = asyncLoading.ToString().ToLower(),
                        InfoPageId     = ltdInfoPage.InfoPageID.ToString(),
                    });

                    infoSectionSaveView = InfoSectionView.GetView(ltdInfoPage.InfoPageID, dataIndex + 1, templateSuffix, false, false, false, false);
                }

                List <TemplateInfoPageListDetailItem.CommentView> commentViewList = new List <TemplateInfoPageListDetailItem.CommentView>();
                if ((ltdInfoPage.Commentable == true) && (UtilsSecurity.IsAuthenticated() == true))
                {
                    if ((UtilsSecurity.HaveRole(ltdInfoPage.CommentorRoleList, false) == true)) //|| ((ltdInfoPage.IsPublic == true) && (ltdInfoPage.CommentorRoleList.Contains(UtilsSecurity.GuestRole) == true)))
                    {
                        bool   allowPublicComments = false;
                        string commentViewHtml     = DataView.GetView(true, ltdInfoPage.InfoPageID, templateSuffix, false, CommonRefType.PageInfo, ltdInfoPage.InfoPageID, CommonDataType.CommentData, "Comment", false, false, false, false, false, false, false, true, true, "Add Comment", "Edit Comment", "Reply", allowPublicComments);
                        commentViewList.Add(new TemplateInfoPageListDetailItem.CommentView
                        {
                            CommentViewDetail = commentViewHtml,
                        });
                    }
                }

                var templateListDetailItem = new TemplateInfoPageListDetailItem
                {
                    InfoPageName        = ltdInfoPage.InfoPageName,
                    InfoPageDescription = ltdInfoPage.InfoPageDescription,
                    InfoCategoryName    = infoCategoryName,
                    CreatedBy           = UtilsSecurity.GetUserName(ltdInfoPage.CreatedUserID),
                    LastUpdateDate      = ltdInfoPage.LastUpdateDate.ToString(UtilsGeneric.DefaultDateFormat),
                    //ExpiryDate = ltdInfoPage.ExpiryDate.ToString(AppCommon.DateFormat),
                    IsInActive = !ltdInfoPage.IsActive,
                    IsDeleted  = ltdInfoPage.IsDeleted,

                    EditActionList  = editActionList,
                    AsyncActionList = asyncActionList,
                    InfoSectionView = infoSectionSaveView + infoSectionListView,
                    CommentViewList = commentViewList,
                };
                htmlTextItem = templateListDetailItem.GetFilled(templateSuffix, UtilsGeneric.Validate,
                                                                UtilsGeneric.ThrowException,
                                                                out message);
            }
            return(htmlTextItem);
        }