示例#1
0
        private static string GetListSingleItemView(LTD_InfoDetail ltdDetail, long pageNo, long itemsPerDetail, long dataIndex, string templateSuffix, long infoSectionId)
        {
            string       htmlTextItem = "";
            LTD_InfoPage ltdInfoPage  = DataInfoList.GetLtdInfoPage(ltdDetail.InfoPageID);

            if ((ltdDetail != null) && (ltdInfoPage != null))
            {
                string message;
                List <TemplateInfoDetailListDetailItem.EditAction> editActionList = new List <TemplateInfoDetailListDetailItem.EditAction>();
                if (((UtilsSecurity.HaveAdminRole() == true) && (UtilsSecurity.HaveAuthorRoleEnabled() == true)) || ((UtilsSecurity.HaveAuthorRoleEnabled() == true) && (ltdInfoPage.UserID == UtilsSecurity.GetUserId())))
                {
                    editActionList.Add(new TemplateInfoDetailListDetailItem.EditAction
                    {
                        Id             = ltdDetail.InfoDetailID.ToString(),
                        DataIndex      = dataIndex.ToString(),
                        PageNo         = pageNo.ToString(),
                        ItemsPerPage   = itemsPerDetail.ToString(),
                        TemplateSuffix = templateSuffix,
                        InfoSectionId  = infoSectionId.ToString(),
                    });
                }

                var templateItem = new TemplateInfoDetailListDetailItem
                {
                    InfoDetailName        = ltdDetail.InfoDetailName,
                    InfoDetailDescription = ltdDetail.InfoDetailDescription,
                    IsInActive            = !ltdDetail.IsActive,

                    EditActionList = editActionList
                };
                htmlTextItem = templateItem.GetFilled(templateSuffix, UtilsGeneric.Validate,
                                                      UtilsGeneric.ThrowException,
                                                      out message);
            }
            return(htmlTextItem);
        }
示例#2
0
        public static string GetListAllItemView(long pageNo, long itemsPerPage, long dataIndex, string templateSuffix, long infoSectionId)
        {
            string message = "";

            if (itemsPerPage == 0)
            {
                itemsPerPage = UtilsGeneric.DefaultInnerItemsPerPage;
            }
            long   totalDetails;
            long   totalItems;
            string htmlTextItemList = "";
            string htmlAddItemList  = "";

            #region Add Link

            LTD_InfoSection ltdInfoSection = DataInfoList.GetLtdInfoSection(infoSectionId);
            if (ltdInfoSection != null)
            {
                LTD_InfoPage ltdInfoPage = DataInfoList.GetLtdInfoPage(ltdInfoSection.InfoPageID);
                if (UtilsSecurity.HaveAuthorRoleEnabled() == true)
                {
                    if ((ltdInfoPage != null) && (ltdInfoPage.UserID == UtilsSecurity.GetUserId()))
                    {
                        TemplateInfoDetailSaveAdd saveAdd = new TemplateInfoDetailSaveAdd
                        {
                            DataIndex      = dataIndex.ToString(),
                            PageNo         = pageNo.ToString(),
                            ItemsPerPage   = itemsPerPage.ToString(),
                            TemplateSuffix = templateSuffix,
                            InfoSectionId  = infoSectionId.ToString(),
                        };
                        htmlAddItemList = saveAdd.GetFilled(templateSuffix, UtilsGeneric.Validate, UtilsGeneric.ThrowException, out message);
                    }
                }
            }

            #endregion

            #region Get Fill List

            #region Get Detaild Data

            List <LTD_InfoDetail> ltdDetailList = new List <LTD_InfoDetail>();
            if ((UtilsSecurity.HaveAdminRole() == true) || (UtilsSecurity.HaveAuthorRoleEnabled() == true))
            {
                ltdDetailList = DataInfoList.GetPagedLtdInfoDetail(infoSectionId, false, pageNo, itemsPerPage, out totalDetails, out totalItems);
            }
            else
            {
                ltdDetailList = DataInfoList.GetPagedLtdInfoDetail(infoSectionId, true, pageNo, itemsPerPage, out totalDetails, out totalItems);
            }

            #endregion

            if (ltdDetailList.Count > 0)
            {
                #region Get Detail Details

                string topDetailrDetails    = UtilsGeneric.GetItemPagerView(pageNo, itemsPerPage, dataIndex, templateSuffix, totalDetails, RefreshListFunctionName, infoSectionId.ToString());
                string bottomDetailrDetails = UtilsGeneric.GetLinkPagerView(pageNo, itemsPerPage, dataIndex, templateSuffix, totalDetails, totalItems, RefreshListFunctionName, infoSectionId.ToString(), false);

                #endregion

                #region Append Top Details

                if (topDetailrDetails.Trim().Length > 0)
                {
                    htmlTextItemList += topDetailrDetails;
                }

                #endregion

                #region Append Items

                int index = 0;
                for (; index < ltdDetailList.Count; index++)
                {
                    LTD_InfoDetail ltdDetail            = ltdDetailList[index];
                    string         htmlTextItemTemplate = GetListSingleItemView(ltdDetail, pageNo, itemsPerPage, dataIndex, templateSuffix, infoSectionId);
                    htmlTextItemList += htmlTextItemTemplate;
                }

                #endregion

                #region Append Bottom Detailr

                if (bottomDetailrDetails.Trim().Length > 0)
                {
                    htmlTextItemList += bottomDetailrDetails;
                }

                #endregion
            }

            #endregion

            #region Set Fill List

            if ((htmlTextItemList.Length == 0) && (UtilsSecurity.HaveAuthorRoleEnabled() == true))
            {
                //TemplateInfoDetailListDetailEmpty listDetailEmpty = new TemplateInfoDetailListDetailEmpty
                //{
                //    DataIndex = dataIndex.ToString(),
                //    PageNo = pageNo.ToString(),
                //    ItemsPerPage = itemsPerPage.ToString(),
                //    TemplateSuffix = templateSuffix,
                //    InfoSectionId = infoSectionId.ToString(),
                //};
                //htmlTextItemList = listDetailEmpty.GetFilled(templateSuffix, UtilsGeneric.Validate, UtilsGeneric.ThrowException, out message);
            }

            #endregion

            return(htmlAddItemList + htmlTextItemList);
        }
        private static string GetListSingleItemView(LTD_InfoSection ltdSection, long pageNo, long itemsPerSection, long dataIndex, string templateSuffix, long infoPageId, long recordCount, bool asyncLoading)
        {
            string       htmlTextItem = "";
            LTD_InfoPage ltdInfoPage  = DataInfoList.GetLtdInfoPage(infoPageId);

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

                if (((UtilsSecurity.HaveAdminRole() == true) && (UtilsSecurity.HaveAuthorRoleEnabled() == true)) || ((UtilsSecurity.HaveAuthorRoleEnabled() == true) && (ltdInfoPage.UserID == UtilsSecurity.GetUserId())))
                {
                    editActionList.Add(new TemplateInfoSectionListDetailItem.EditAction
                    {
                        Id             = ltdSection.InfoSectionID.ToString(),
                        DataIndex      = dataIndex.ToString(),
                        PageNo         = pageNo.ToString(),
                        ItemsPerPage   = itemsPerSection.ToString(),
                        TemplateSuffix = templateSuffix,
                        InfoPageId     = infoPageId.ToString(),
                    });
                }

                string infoDetailListView = "";
                string infoDetailSaveView = "";

                if ((ltdInfoPage.AsyncLoading == false) || ((ltdInfoPage.AsyncLoading == true) && (asyncLoading == false)))
                {
                    infoDetailListView = InfoDetailView.GetView(ltdSection.InfoSectionID, dataIndex + 1, templateSuffix, false, true, true, false);
                }
                else
                {
                    asyncActionList.Add(new TemplateInfoSectionListDetailItem.AsyncAction
                    {
                        Id             = ltdSection.InfoSectionID.ToString(),
                        DataIndex      = dataIndex.ToString(),
                        PageNo         = pageNo.ToString(),
                        ItemsPerPage   = itemsPerSection.ToString(),
                        TemplateSuffix = templateSuffix,
                    });

                    infoDetailSaveView = InfoDetailView.GetView(ltdSection.InfoSectionID, dataIndex + 1, templateSuffix, false, false, false, false);
                }

                var templateListDetailItem = new TemplateInfoSectionListDetailItem
                {
                    InfoSectionName        = ltdSection.InfoSectionName,
                    InfoSectionDescription = ltdSection.InfoSectionDescription,
                    IsInActive             = !ltdSection.IsActive,

                    EditActionList  = editActionList,
                    AsyncActionList = asyncActionList,
                    InfoDetailView  = infoDetailSaveView + infoDetailListView
                };
                htmlTextItem = templateListDetailItem.GetFilled(templateSuffix, UtilsGeneric.Validate,
                                                                UtilsGeneric.ThrowException,
                                                                out message);
            }
            return(htmlTextItem);
        }
        public static string GetSaveDetailView(long infoSectionId, long pageNo, long itemsPerSection, long dataIndex, string templateSuffix, long infoPageId)
        {
            string message                = "";
            string htmlSaveDetail         = "";
            long   revisionNo             = 0;
            string infoPageName           = "";
            string infoSectionName        = "";
            string infoSectionDescription = "";
            bool   asyncLoading           = false;
            bool   isActive               = true;
            bool   isDeleted              = false;
            long   sequence               = 0;
            bool   showAdditional         = (infoSectionId != 0);

            if ((UtilsSecurity.HaveAdminRole() == false) && (UtilsSecurity.HaveAuthorRoleEnabled() == false))
            {
                TemplateInfoSectionView templateView = new TemplateInfoSectionView
                {
                    DataIndex      = dataIndex.ToString(),
                    PageNo         = pageNo.ToString(),
                    ItemsPerPage   = itemsPerSection.ToString(),
                    TemplateSuffix = templateSuffix,
                    InfoPageId     = infoPageId.ToString()
                };
                htmlSaveDetail = templateView.GetFilled(templateSuffix, UtilsGeneric.Validate, UtilsGeneric.ThrowException, out message);
            }
            else
            {
                #region Get Page Details

                if (infoPageId > 0)
                {
                    LTD_InfoPage ltdInfoPageExisting = DataInfoList.GetLtdInfoPage(infoPageId);
                    if (ltdInfoPageExisting != null)
                    {
                        infoPageName = ltdInfoPageExisting.InfoPageName;
                        asyncLoading = ltdInfoPageExisting.AsyncLoading;
                    }
                }

                #endregion

                #region Get Section Details

                if (infoSectionId > 0)
                {
                    LTD_InfoSection ltdSectionExisting = DataInfoList.GetLtdInfoSection(infoSectionId);
                    if (ltdSectionExisting != null)
                    {
                        infoSectionName        = ltdSectionExisting.InfoSectionName;
                        infoSectionDescription = ltdSectionExisting.InfoSectionDescription;
                        isActive   = ltdSectionExisting.IsActive;
                        isDeleted  = ltdSectionExisting.IsDeleted;
                        sequence   = ltdSectionExisting.Sequence;
                        revisionNo = ltdSectionExisting.RevisionNo;
                    }
                }

                #endregion

                #region Set Action

                bool showDeleted  = false;
                bool showUserInfo = false;
                bool enableSave   = true;
                bool enableDelete = true;
                if (UtilsSecurity.IsAuthenticated() == false)
                {
                    showUserInfo = true;
                    enableSave   = false;
                    enableDelete = false;
                }

                showDeleted = (!UtilsSecurity.HaveAdminRole() && (infoSectionId > 0));

                #endregion

                #region Set Template

                #region Additional

                List <TemplateInfoSectionSaveDetail.AdditionalVisible> additionalVisibleList = new List <TemplateInfoSectionSaveDetail.AdditionalVisible>();
                if (showAdditional == true)
                {
                    additionalVisibleList.Add(new TemplateInfoSectionSaveDetail.AdditionalVisible
                    {
                        IsActiveHidden  = (infoSectionId == 0),
                        IsActive        = isActive,
                        IsDeletedHidden = !showDeleted,
                        IsDeleted       = isDeleted,
                        SequenceHidden  = (infoSectionId == 0),
                        Sequence        = sequence.ToString(),
                    });
                }

                #endregion

                #region Action

                string addActionHtml  = "";
                string editActionHtml = "";
                if (infoSectionId == 0)
                {
                    var templateSaveDetailAdd = new TemplateInfoSectionSaveDetailAdd
                    {
                        AddActionDisabled = !enableSave,
                        DataIndex         = dataIndex.ToString("N0", CultureInfo.InvariantCulture),
                        PageNo            = pageNo.ToString("N0", CultureInfo.InvariantCulture),
                        ItemsPerPage      = itemsPerSection.ToString("N0", CultureInfo.InvariantCulture),
                        TemplateSuffix    = templateSuffix,
                        AsyncLoading      = asyncLoading.ToString().ToLower(),
                        InfoPageId        = infoPageId.ToString(),
                    };
                    addActionHtml = templateSaveDetailAdd.GetFilled(templateSuffix, UtilsGeneric.Validate, UtilsGeneric.ThrowException, out message);
                }
                else
                {
                    var templateSaveDetailEdit = new TemplateInfoSectionSaveDetailEdit
                    {
                        Id             = infoSectionId.ToString(),
                        DataIndex      = dataIndex.ToString("N0", CultureInfo.InvariantCulture),
                        PageNo         = pageNo.ToString("N0", CultureInfo.InvariantCulture),
                        ItemsPerPage   = itemsPerSection.ToString("N0", CultureInfo.InvariantCulture),
                        TemplateSuffix = templateSuffix,
                        AsyncLoading   = asyncLoading.ToString().ToLower(),
                        InfoPageId     = infoPageId.ToString(),

                        SaveActionDisabled   = !enableSave,
                        DeleteActionDisabled = !enableDelete,
                    };
                    editActionHtml = templateSaveDetailEdit.GetFilled(templateSuffix, UtilsGeneric.Validate, UtilsGeneric.ThrowException, out message);
                }

                #endregion

                var templateSaveDetail = new TemplateInfoSectionSaveDetail
                {
                    //Id = infoSectionId.ToString("N0", CultureInfo.InvariantCulture),
                    RevisionNo = revisionNo.ToString(),

                    InfoPageName            = infoPageName,
                    InfoSectionName         = infoSectionName,
                    InfoSectionDescription  = infoSectionDescription,
                    AdditionalActionVisible = showAdditional,
                    AdditionalVisibleList   = additionalVisibleList,

                    //AddMode = (levelId == 0) ? true : false,
                    AddAction    = addActionHtml,
                    EditAction   = editActionHtml,
                    ShowUserInfo = showUserInfo,
                };

                htmlSaveDetail = templateSaveDetail.GetFilled(templateSuffix, UtilsGeneric.Validate, UtilsGeneric.ThrowException,
                                                              out message);
                #endregion
            }

            return(htmlSaveDetail);
        }
示例#5
0
        public static string GetInfoPageCategoryOptionList(long infoPageId, string templateSuffix)
        {
            #region Get Category Option List

            List <LTD_InfoCategory> ltdInfoCategoryList = DataInfoList.GetAllActiveLtdInfoCategory();
            long infoCategoryId = 0;
            if (infoPageId > 0)
            {
                LTD_InfoPage ltdInfoPage = DataInfoList.GetLtdInfoPage(infoPageId);
                if (ltdInfoPage != null)
                {
                    infoCategoryId = ltdInfoPage.InfoCategoryID;
                }
            }


            bool firstRecord = true;
            List <TemplateInfoPageCategoryOption.InfoCategoryItem> infoCategoryItemList = new List <TemplateInfoPageCategoryOption.InfoCategoryItem>();
            if (ltdInfoCategoryList.Count == 0)
            {
                infoCategoryItemList.Add(new TemplateInfoPageCategoryOption.InfoCategoryItem
                {
                    InfoCategoryText     = "Add Info Category",
                    InfoCategoryValue    = "0",
                    InfoCategorySelected = true,
                    InfoCategoryDisable  = false,
                });
            }

            if (infoCategoryId != 0)
            {
                LTD_InfoCategory ltdInfoCategory = DataInfoList.GetLtdInfoCategory(infoCategoryId);
                if (ltdInfoCategory != null)
                {
                    infoCategoryItemList.Add(new TemplateInfoPageCategoryOption.InfoCategoryItem
                    {
                        InfoCategoryText     = ltdInfoCategory.InfoCategoryName,
                        InfoCategoryValue    = ltdInfoCategory.InfoCategoryID.ToString(),
                        InfoCategorySelected = true,
                        InfoCategoryDisable  = !ltdInfoCategory.IsActive
                    });
                    firstRecord = false;
                }
            }

            foreach (LTD_InfoCategory ltdInfoCategory in ltdInfoCategoryList)
            {
                if (ltdInfoCategory.IsDefault == true)
                {
                    infoCategoryItemList.Add(new TemplateInfoPageCategoryOption.InfoCategoryItem
                    {
                        InfoCategoryText     = ltdInfoCategory.InfoCategoryName,
                        InfoCategoryValue    = ltdInfoCategory.InfoCategoryID.ToString(),
                        InfoCategorySelected = firstRecord,
                        InfoCategoryDisable  = !ltdInfoCategory.IsActive
                    });
                    firstRecord = false;
                    break;
                }
            }

            foreach (LTD_InfoCategory ltdInfoCategory in ltdInfoCategoryList)
            {
                if (ltdInfoCategory.IsDefault == false)
                {
                    if (ltdInfoCategory.InfoCategoryID != infoCategoryId)
                    {
                        if ((infoCategoryId == 0) && (firstRecord == true))
                        {
                            infoCategoryItemList.Add(new TemplateInfoPageCategoryOption.InfoCategoryItem
                            {
                                InfoCategoryText     = ltdInfoCategory.InfoCategoryName,
                                InfoCategoryValue    = ltdInfoCategory.InfoCategoryID.ToString(),
                                InfoCategorySelected = true,
                                InfoCategoryDisable  = !ltdInfoCategory.IsActive
                            });
                        }
                        else
                        {
                            infoCategoryItemList.Add(new TemplateInfoPageCategoryOption.InfoCategoryItem
                            {
                                InfoCategoryText     = ltdInfoCategory.InfoCategoryName,
                                InfoCategoryValue    = ltdInfoCategory.InfoCategoryID.ToString(),
                                InfoCategorySelected = false,
                                InfoCategoryDisable  = !ltdInfoCategory.IsActive
                            });
                        }
                    }
                }
                firstRecord = false;
            }

            #endregion

            var templateOptioin = new TemplateInfoPageCategoryOption
            {
                InfoCategoryItemList = infoCategoryItemList,
            };

            string message    = "";
            string htmlOption = templateOptioin.GetFilled(templateSuffix, UtilsGeneric.Validate, UtilsGeneric.ThrowException,
                                                          out message);

            return(htmlOption);
        }
示例#6
0
        public static string GetSaveDetailView(long infoPageId, long pageNo, long itemsPerPage, long dataIndex, string templateSuffix)
        {
            string message        = "";
            string htmlSaveDetail = "";
            bool   firstRecord    = true;
            bool   showAdditional = (infoPageId != 0);

            long revisionNo = 0;

            string infoPageName        = "";
            string infoPageDescription = "";

            long   accessGroupId     = 0;
            bool   asyncLoading      = false;
            bool   commentable       = false;
            string commentorRoleList = UtilsSecurity.AdminRole;

            bool     isActive   = true;
            DateTime expiryDate = DateTime.Now.AddYears(3);

            bool isPublic  = false;
            bool isCommon  = false;
            bool isDeleted = false;
            long sequence  = 0;


            if ((UtilsSecurity.HaveAdminRole() == false) && (UtilsSecurity.HaveAuthorRoleEnabled() == false))
            {
                TemplateInfoPageView templateView = new TemplateInfoPageView
                {
                    DataIndex      = dataIndex.ToString(),
                    PageNo         = pageNo.ToString(),
                    ItemsPerPage   = itemsPerPage.ToString(),
                    TemplateSuffix = templateSuffix,
                    AsyncLoading   = asyncLoading.ToString().ToLower()
                };
                htmlSaveDetail = templateView.GetFilled(templateSuffix, UtilsGeneric.Validate, UtilsGeneric.ThrowException, out message);
            }
            else
            {
                #region Get Page Details

                if (infoPageId > 0)
                {
                    LTD_InfoPage ltdInfoPageExisting = DataInfoList.GetLtdInfoPage(infoPageId);
                    if (ltdInfoPageExisting != null)
                    {
                        infoPageName        = ltdInfoPageExisting.InfoPageName;
                        infoPageDescription = ltdInfoPageExisting.InfoPageDescription;
                        expiryDate          = ltdInfoPageExisting.ExpiryDate;
                        commentable         = ltdInfoPageExisting.Commentable;
                        commentorRoleList   = ltdInfoPageExisting.CommentorRoleList;
                        asyncLoading        = ltdInfoPageExisting.AsyncLoading;
                        isPublic            = ltdInfoPageExisting.IsPublic;
                        isCommon            = ltdInfoPageExisting.IsCommon;
                        isActive            = ltdInfoPageExisting.IsActive;
                        isDeleted           = ltdInfoPageExisting.IsDeleted;
                        sequence            = ltdInfoPageExisting.Sequence;
                        if (ltdInfoPageExisting.AccessGroupID.HasValue == true)
                        {
                            accessGroupId = ltdInfoPageExisting.AccessGroupID.Value;
                        }
                        revisionNo = ltdInfoPageExisting.RevisionNo;
                    }
                }

                #endregion

                #region Get Category Option List

                List <LTD_InfoCategory> ltdInfoCategoryList = DataInfoList.GetAllActiveLtdInfoCategory();
                long infoCategoryId = 0;
                if (infoPageId > 0)
                {
                    LTD_InfoPage ltdInfoPage = DataInfoList.GetLtdInfoPage(infoPageId);
                    if (ltdInfoPage != null)
                    {
                        infoCategoryId = ltdInfoPage.InfoCategoryID;
                    }
                }


                firstRecord = true;
                List <TemplateInfoPageSaveDetail.InfoCategoryItem> infoCategoryItemList = new List <TemplateInfoPageSaveDetail.InfoCategoryItem>();
                if (ltdInfoCategoryList.Count == 0)
                {
                    infoCategoryItemList.Add(new TemplateInfoPageSaveDetail.InfoCategoryItem
                    {
                        InfoCategoryText     = "Add Info Category",
                        InfoCategoryValue    = "0",
                        InfoCategorySelected = true,
                        InfoCategoryDisable  = false,
                    });
                }

                if (infoCategoryId != 0)
                {
                    LTD_InfoCategory ltdInfoCategory = DataInfoList.GetLtdInfoCategory(infoCategoryId);
                    if (ltdInfoCategory != null)
                    {
                        infoCategoryItemList.Add(new TemplateInfoPageSaveDetail.InfoCategoryItem
                        {
                            InfoCategoryText     = ltdInfoCategory.InfoCategoryName,
                            InfoCategoryValue    = ltdInfoCategory.InfoCategoryID.ToString(),
                            InfoCategorySelected = true,
                            InfoCategoryDisable  = !ltdInfoCategory.IsActive
                        });
                        firstRecord = false;
                    }
                }

                foreach (LTD_InfoCategory ltdInfoCategory in ltdInfoCategoryList)
                {
                    if (ltdInfoCategory.IsDefault == true)
                    {
                        infoCategoryItemList.Add(new TemplateInfoPageSaveDetail.InfoCategoryItem
                        {
                            InfoCategoryText     = ltdInfoCategory.InfoCategoryName,
                            InfoCategoryValue    = ltdInfoCategory.InfoCategoryID.ToString(),
                            InfoCategorySelected = firstRecord,
                            InfoCategoryDisable  = !ltdInfoCategory.IsActive
                        });
                        firstRecord = false;
                        break;
                    }
                }

                foreach (LTD_InfoCategory ltdInfoCategory in ltdInfoCategoryList)
                {
                    if (ltdInfoCategory.IsDefault == false)
                    {
                        if (ltdInfoCategory.InfoCategoryID != infoCategoryId)
                        {
                            if ((infoCategoryId == 0) && (firstRecord == true))
                            {
                                infoCategoryItemList.Add(new TemplateInfoPageSaveDetail.InfoCategoryItem
                                {
                                    InfoCategoryText     = ltdInfoCategory.InfoCategoryName,
                                    InfoCategoryValue    = ltdInfoCategory.InfoCategoryID.ToString(),
                                    InfoCategorySelected = true,
                                    InfoCategoryDisable  = !ltdInfoCategory.IsActive
                                });
                            }
                            else
                            {
                                infoCategoryItemList.Add(new TemplateInfoPageSaveDetail.InfoCategoryItem
                                {
                                    InfoCategoryText     = ltdInfoCategory.InfoCategoryName,
                                    InfoCategoryValue    = ltdInfoCategory.InfoCategoryID.ToString(),
                                    InfoCategorySelected = false,
                                    InfoCategoryDisable  = !ltdInfoCategory.IsActive
                                });
                            }
                        }
                    }
                    firstRecord = false;
                }

                #endregion

                #region Get Add Info Category List

                List <TemplateInfoPageSaveDetail.AddInfoCategory> addInfoCategoryList = new List <TemplateInfoPageSaveDetail.AddInfoCategory>();
                string htmlInfoCategorySaveDetail = "";
                if (UtilsSecurity.HaveAdminRole() == true)
                {
                    long infoCategoryDataIndex = dataIndex + 10;

                    #region Add Info Category

                    addInfoCategoryList.Add(new TemplateInfoPageSaveDetail.AddInfoCategory
                    {
                        DataIndex      = infoCategoryDataIndex.ToString(),
                        PageNo         = pageNo.ToString(),
                        ItemsPerPage   = itemsPerPage.ToString(),
                        TemplateSuffix = templateSuffix,
                    });

                    #endregion

                    #region Set Info Category Save Details

                    string refreshCallback = "refreshInfoPageCategoryOptionList(" + infoPageId + ", '" + templateSuffix + "')";
                    htmlInfoCategorySaveDetail = InfoCategoryView.GetSaveView(infoCategoryId, pageNo, itemsPerPage, infoCategoryDataIndex, templateSuffix, true, refreshCallback);

                    #endregion
                }

                #endregion

                #region Set Action

                bool showAdmin    = false;
                bool showUserInfo = false;
                bool enableSave   = true;
                bool enableDelete = true;
                if (UtilsSecurity.IsAuthenticated() == false)
                {
                    showUserInfo = true;
                    enableSave   = false;
                    enableDelete = false;
                }

                showAdmin = (UtilsSecurity.HaveAdminRole() && (infoPageId > 0));

                #endregion

                #region Set Template

                #region More Details

                string saveDetailMore = "";
                if (showAdditional == true)
                {
                    #region Get Group Option List

                    List <SCD_Group> scdGroupList = UtilsSecurity.GetAllUserActiveScdGroup();
                    firstRecord = true;
                    List <TemplateInfoPageSaveDetailMore.AccessGroupItem> groupItemList = new List <TemplateInfoPageSaveDetailMore.AccessGroupItem>();
                    if (scdGroupList.Count == 0)
                    {
                        groupItemList.Add(new TemplateInfoPageSaveDetailMore.AccessGroupItem
                        {
                            AccessGroupText     = "No Group Found",
                            AccessGroupValue    = "0",
                            AccessGroupSelected = true
                        });
                    }
                    else
                    {
                        groupItemList.Add(new TemplateInfoPageSaveDetailMore.AccessGroupItem
                        {
                            AccessGroupText     = "Select Access Group",
                            AccessGroupValue    = "0",
                            AccessGroupSelected = (accessGroupId == 0)
                        });
                        firstRecord = false;
                    }

                    foreach (SCD_Group scdGroup in scdGroupList)
                    {
                        if ((scdGroup.GroupID == accessGroupId) || ((accessGroupId == 0) && (firstRecord == true)))
                        {
                            groupItemList.Add(new TemplateInfoPageSaveDetailMore.AccessGroupItem
                            {
                                AccessGroupText     = scdGroup.GroupName,
                                AccessGroupValue    = scdGroup.GroupID.ToString(CultureInfo.InvariantCulture),
                                AccessGroupSelected = true
                            });
                        }
                        else
                        {
                            groupItemList.Add(new TemplateInfoPageSaveDetailMore.AccessGroupItem
                            {
                                AccessGroupText     = scdGroup.GroupName,
                                AccessGroupValue    = scdGroup.GroupID.ToString(CultureInfo.InvariantCulture),
                                AccessGroupSelected = false
                            });
                        }
                        firstRecord = false;
                    }

                    #endregion

                    #region Get Role List

                    string[] roleList = UtilsSecurity.GetAllRoleList();
                    if (string.IsNullOrEmpty(commentorRoleList) == true)
                    {
                        commentorRoleList = "";
                    }

                    firstRecord = true;
                    List <TemplateInfoPageSaveDetailMore.CommentorRoleItem> commentorlRoleItemList = new List <TemplateInfoPageSaveDetailMore.CommentorRoleItem>();
                    foreach (string role in roleList)
                    {
                        if ((commentorRoleList.Contains(role)) || ((commentorRoleList.Trim().Length == 0) && (firstRecord == true)))
                        {
                            commentorlRoleItemList.Add(new TemplateInfoPageSaveDetailMore.CommentorRoleItem
                            {
                                CommentorRoleText     = role,
                                CommentorRoleValue    = role,
                                CommentorRoleSelected = true
                            });
                        }
                        else
                        {
                            commentorlRoleItemList.Add(new TemplateInfoPageSaveDetailMore.CommentorRoleItem
                            {
                                CommentorRoleText     = role,
                                CommentorRoleValue    = role,
                                CommentorRoleSelected = false
                            });
                        }
                        firstRecord = false;
                    }


                    #endregion

                    var templateSaveDetailMore = new TemplateInfoPageSaveDetailMore
                    {
                        AccessGroupItemList   = groupItemList,
                        AsyncLoading          = asyncLoading,
                        Commentable           = commentable,
                        CommentorRoleItemList = commentorlRoleItemList,

                        IsActiveHidden = (infoPageId == 0),
                        IsActive       = isActive,
                        ExpiryDate     = expiryDate.ToString(UtilsGeneric.DefaultDateFormat),

                        IsPublicHidden  = !showAdmin,
                        IsPublic        = isPublic,
                        IsCommonHidden  = !showAdmin,
                        IsCommon        = isCommon,
                        IsDeletedHidden = !showAdmin,
                        IsDeleted       = isDeleted,
                        SequenceHidden  = (infoPageId == 0),
                        Sequence        = sequence.ToString(),
                    };

                    saveDetailMore = templateSaveDetailMore.GetFilled(templateSuffix, UtilsGeneric.Validate, UtilsGeneric.ThrowException,
                                                                      out message);
                }

                #endregion

                #region Action

                string addActionHtml  = "";
                string editActionHtml = "";
                if (infoPageId == 0)
                {
                    var templateSaveDetailAdd = new TemplateInfoPageSaveDetailAdd
                    {
                        AddActionDisabled = !enableSave,
                        DataIndex         = dataIndex.ToString("N0", CultureInfo.InvariantCulture),
                        PageNo            = pageNo.ToString("N0", CultureInfo.InvariantCulture),
                        ItemsPerPage      = itemsPerPage.ToString("N0", CultureInfo.InvariantCulture),
                        TemplateSuffix    = templateSuffix,
                        AsyncLoading      = asyncLoading.ToString().ToLower()
                    };
                    addActionHtml = templateSaveDetailAdd.GetFilled(templateSuffix, UtilsGeneric.Validate, UtilsGeneric.ThrowException, out message);
                }
                else
                {
                    var templateSaveDetailEdit = new TemplateInfoPageSaveDetailEdit
                    {
                        Id             = infoPageId.ToString(),
                        DataIndex      = dataIndex.ToString("N0", CultureInfo.InvariantCulture),
                        PageNo         = pageNo.ToString("N0", CultureInfo.InvariantCulture),
                        ItemsPerPage   = itemsPerPage.ToString("N0", CultureInfo.InvariantCulture),
                        TemplateSuffix = templateSuffix,
                        AsyncLoading   = asyncLoading.ToString().ToLower(),

                        SaveActionDisabled   = !enableSave,
                        DeleteActionDisabled = !enableDelete,
                    };
                    editActionHtml = templateSaveDetailEdit.GetFilled(templateSuffix, UtilsGeneric.Validate, UtilsGeneric.ThrowException, out message);
                }

                #endregion

                var templateSaveDetail = new TemplateInfoPageSaveDetail
                {
                    AddInfoCategoryList    = addInfoCategoryList,
                    InfoCategorySaveDetail = htmlInfoCategorySaveDetail,

                    //Id = infoPageId.ToString("N0", CultureInfo.InvariantCulture),
                    RevisionNo = revisionNo.ToString(),

                    InfoPageName         = infoPageName,
                    InfoPageDescription  = infoPageDescription,
                    InfoCategoryItemList = infoCategoryItemList,
                    //InfoCategorySelectDisable = (infoPageId > 0),

                    //AddMode = (infoPageId == 0) ? true : false,
                    AddAction    = addActionHtml,
                    EditAction   = editActionHtml,
                    ShowUserInfo = showUserInfo,

                    AdditionalActionVisible = showAdditional,
                    MoreDetails             = saveDetailMore,
                };

                htmlSaveDetail = templateSaveDetail.GetFilled(templateSuffix, UtilsGeneric.Validate, UtilsGeneric.ThrowException,
                                                              out message);

                #endregion
            }

            return(htmlSaveDetail);
        }