public JsonObject SaveSubscriber(string subscriberEmail, string subscriberMessage, bool subscriberIsDeleted, long subscriberId)
        {
            var retMessage = new JsonObject();

            bool valid = UtilsSecurity.IsValidEmail(DecodeUrl(subscriberEmail));

            if (valid == true)
            {
                string message;
                long   retSubscriberID = DataInfoList.SaveLtdSubscriber(DecodeUrl(subscriberEmail), DecodeUrl(subscriberMessage), subscriberIsDeleted, subscriberId, out message);
                if ((retSubscriberID > 0) && (message.Trim().Length == 0))
                {
                    retMessage.Put("message", subscriberId == 0 ? "Successfully Added Subscriber" : "Successfully Updated Subscriber");
                }
                else
                {
                    if (message.Trim().Length == 0)
                    {
                        message = "Error in Saving Subscriber. Return Subscriber ID is 0";
                    }
                    retMessage.Put("error", message);
                }
            }
            else
            {
                retMessage.Put("error", "Please enter a Valid Email to Subscribe");
            }

            return(retMessage);
        }
Ejemplo n.º 2
0
 private void Awake()
 {
     m_datainfolist = new DataInfoList();
     DontDestroyOnLoad(this);
     InitializedHolePos();
     InitializedTreeData();
     InitializedMonsterData();
     m_datainfolist.playerdata.LastPos = PlayerCreatPos;
 }
Ejemplo n.º 3
0
        public JsonObject DeleteInfoCategory(long infoCategoryId)
        {
            var retMessage = new JsonObject();

            string message;
            bool   success = DataInfoList.DeleteLtdInfoCategory(infoCategoryId, out message);

            if (success)
            {
                retMessage.Put("message", "Successfully Deleted Info Category");
            }
            else
            {
                if (message.Trim().Length == 0)
                {
                    message = "Error in Deleting Info Category";
                }
                retMessage.Put("error", message);
            }

            return(retMessage);
        }
Ejemplo n.º 4
0
        public JsonObject SaveInfoPage(string infoPageName, string infoPageDescription, long infoPageCategoryId, long accessGroupId, bool asyncLoading, bool isActive, DateTime expiryDate, bool commentable, string commentorRoleList, bool isPublic, bool isCommon, bool isDeleted, long sequence, long infoPageId)
        {
            var retMessage = new JsonObject();

            string message;
            long   retID = DataInfoList.SaveLtdInfoPage(DecodeUrl(infoPageName), DecodeUrl(infoPageDescription), infoPageCategoryId, accessGroupId, asyncLoading, isActive, expiryDate, commentable, commentorRoleList, isPublic, isCommon, isDeleted, sequence, infoPageId, out message);

            if ((retID > 0) && (message.Trim().Length == 0))
            {
                retMessage.Put("message", infoPageId == 0 ? "Successfully Added Info Page" : "Successfully Updated Info Page");
            }
            else
            {
                if (message.Trim().Length == 0)
                {
                    message = "Error in Saving Info Page. Return Info Page ID is 0";
                }
                retMessage.Put("error", message);
            }

            return(retMessage);
        }
        public JsonObject DeleteSubscriber(long subscriberId)
        {
            var retMessage = new JsonObject();

            string message;
            bool   success = DataInfoList.DeleteLtdSubscriber(subscriberId, out message);

            if (success)
            {
                retMessage.Put("message", "Successfully Deleted Subscriber");
            }
            else
            {
                if (message.Trim().Length == 0)
                {
                    message = "Error in Deleting Subscriber";
                }
                retMessage.Put("error", message);
            }

            return(retMessage);
        }
Ejemplo n.º 6
0
        public JsonObject SaveInfoSection(string infoSectionName, string infoSectionDescription, bool isActive, bool isDeleted, long sequence, long infoSectionId, long infoPageId)
        {
            var retMessage = new JsonObject();

            string message;
            long   retSectionID = DataInfoList.SaveLtdInfoSection(infoPageId, DecodeUrl(infoSectionName), DecodeUrl(infoSectionDescription), isActive, isDeleted, sequence, infoSectionId, out message);

            if ((retSectionID > 0) && (message.Trim().Length == 0))
            {
                retMessage.Put("message", infoSectionId == 0 ? "Successfully Added Info Section" : "Successfully Updated Info Section");
            }
            else
            {
                if (message.Trim().Length == 0)
                {
                    message = "Error in Saving Info Section. Return Info Section ID is 0";
                }
                retMessage.Put("error", message);
            }

            return(retMessage);
        }
Ejemplo n.º 7
0
        public JsonObject SaveInfoCategory(string infoCategoryName, bool isDefault, bool isActive, long infoCategoryId)
        {
            var retMessage = new JsonObject();

            string message;
            long   retCategoryID = DataInfoList.SaveLtdInfoCategory(infoCategoryName, isDefault, isActive, infoCategoryId, out message);

            if ((retCategoryID > 0) && (message.Trim().Length == 0))
            {
                retMessage.Put("message",
                               infoCategoryId == 0 ? "Successfully Added Info Category" : "Successfully Updated Info Category");
            }
            else
            {
                if (message.Trim().Length == 0)
                {
                    message = "Error in Saving Info Category. Return Info Category ID is 0";
                }
                retMessage.Put("error", message);
            }

            return(retMessage);
        }
Ejemplo n.º 8
0
        public static string GetView(long dataIndex, string templateSuffix)
        {
            long id           = 0;
            long pageNo       = 1;
            long itemsPerPage = UtilsGeneric.DefaultItemsPerPage;

            #region Save View

            string htmlSaveView = GetSaveView(id, pageNo, itemsPerPage, dataIndex, templateSuffix);

            #endregion

            #region List View

            string htmlListView = "";
            if (UtilsSecurity.HaveAdminRole() == true)
            {
                htmlListView = GetListView(pageNo, itemsPerPage, dataIndex, templateSuffix);
            }

            #endregion

            long listCount = DataInfoList.GetCountLtdSubscriberId();

            var templateSubscriber = new TemplateSubscriber
            {
                //SaveExpand = (id == 0) ? "true" : "false",
                SaveDetail = htmlSaveView,
                //ListExpand = (id == 0) ? "false" : "true",
                ListDetail = htmlListView,
                ListCount  = listCount.ToString()
            };

            string message = "";
            string html    = templateSubscriber.GetFilled(templateSuffix, UtilsGeneric.Validate, UtilsGeneric.ThrowException, out message);
            return(html);
        }
Ejemplo n.º 9
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);
        }
Ejemplo n.º 10
0
        public static string GetListAllItemView(long pageNo, long itemsPerPage, long dataIndex, string templateSuffix, bool hideDisplay)
        {
            string message = "";
            long totalPages;
            long totalItems;
            string htmlTextItemList = "";
            string htmlAddItemList = "";

            if ((UtilsSecurity.HaveAdminRole() == false) && (UtilsSecurity.HaveAuthorRole() == false))
            {
                TemplateInfoCategoryView templateView = new TemplateInfoCategoryView
                {
                    DataIndex = dataIndex.ToString(),
                    PageNo = pageNo.ToString(),
                    ItemsPerPage = itemsPerPage.ToString(),
                    TemplateSuffix = templateSuffix,
                    HideDisplay = hideDisplay.ToString().ToLower(),
                };
                htmlTextItemList = templateView.GetFilled(templateSuffix, UtilsGeneric.Validate, UtilsGeneric.ThrowException, out message);
            }else
            {
                #region Add Link

                if (UtilsSecurity.HaveAuthorRoleEnabled() == true)
                {
                    TemplateInfoCategorySaveAdd templateSaveAdd = new TemplateInfoCategorySaveAdd
                    {
                        DataIndex = dataIndex.ToString(),
                        PageNo = pageNo.ToString(),
                        ItemsPerPage = itemsPerPage.ToString(),
                        TemplateSuffix = templateSuffix,
                    };
                    htmlAddItemList = templateSaveAdd.GetFilled(templateSuffix, UtilsGeneric.Validate, UtilsGeneric.ThrowException, out message);
                }

                #endregion

                #region Get Fill List

                #region Get Paged Data

                List<LTD_InfoCategory> ltdInfoCategoryList = new List<LTD_InfoCategory>();
                ltdInfoCategoryList = DataInfoList.GetPagedLtdInfoCategory(pageNo, itemsPerPage, out totalPages, out totalItems);

                #endregion

                if (ltdInfoCategoryList.Count > 0)
                {
                    #region Get Pager Details

                    string topPagerDetails = UtilsGeneric.GetItemPagerView(pageNo, itemsPerPage, dataIndex, templateSuffix, totalPages, RefreshListFunctionName, hideDisplay.ToString(CultureInfo.InvariantCulture).ToLower(), true, true);
                    string bottomPagerDetails = UtilsGeneric.GetLinkPagerView(pageNo, itemsPerPage, dataIndex, templateSuffix, totalPages, totalItems, RefreshListFunctionName, hideDisplay.ToString(CultureInfo.InvariantCulture).ToLower());

                    #endregion

                    #region Append Top Pager

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

                    #endregion

                    #region Append Items

                    int index = 0;
                    for (; index < ltdInfoCategoryList.Count; index++)
                    {
                        LTD_InfoCategory ltdInfoCategory = ltdInfoCategoryList[index];
                        string htmlTextItemTemplate = GetListSingleItemView(ltdInfoCategory, pageNo, itemsPerPage, dataIndex, templateSuffix, hideDisplay);
                        htmlTextItemList += htmlTextItemTemplate;
                    }

                    #endregion

                    #region Append Bottom Pager

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

                    #endregion
                }

                #endregion

                #region Set Fill List

                if (htmlTextItemList.Length == 0)
                {
                    TemplateInfoCategoryListDetailEmpty templateListDetailEmpty = new TemplateInfoCategoryListDetailEmpty
                    {
                        DataIndex = dataIndex.ToString(),
                        PageNo = pageNo.ToString(),
                        ItemsPerPage = itemsPerPage.ToString(),
                        TemplateSuffix = templateSuffix,
                        HideDisplay = hideDisplay.ToString().ToLower(),
                    };
                    htmlTextItemList = templateListDetailEmpty.GetFilled(templateSuffix, UtilsGeneric.Validate, UtilsGeneric.ThrowException, out message);
                }

                #endregion
            }

            return htmlAddItemList + htmlTextItemList;
        }
Ejemplo n.º 11
0
        public static string GetSaveDetailView(long infoCategoryId, long pageNo, long itemsPerPage, long dataIndex, string templateSuffix, bool hideDisplay)
        {
            string message; 
            string htmlSaveDetail = "";
            long revisionNo = 0;
            string infoCategoryName = "";
            bool infoCategoryIsDefault = false;
            bool infoCategoryIsActive = true;
            bool infoCategoryIsSystem = false;

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

                if (infoCategoryId > 0)
                {
                    LTD_InfoCategory ltdInfoCategoryExisting = DataInfoList.GetLtdInfoCategory(infoCategoryId);
                    if (ltdInfoCategoryExisting != null)
                    {
                        infoCategoryName = ltdInfoCategoryExisting.InfoCategoryName;

                        infoCategoryIsDefault = ltdInfoCategoryExisting.IsDefault;
                        infoCategoryIsActive = ltdInfoCategoryExisting.IsActive;
                        //infoCategoryIsSystem = ltdInfoCategoryExisting.IsSystem;
                        revisionNo = ltdInfoCategoryExisting.RevisionNo;
                    }
                }

                #endregion

                #region Set Action

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

                #endregion

                #region Set Template

                string addActionHtml = "";
                string editActionHtml = "";
                if (infoCategoryId == 0)
                {
                    var templateSaveAdd = new TemplateInfoCategorySaveDetailAdd
                    {
                        AddActionDisabled =!enableSave,
                        DataIndex = dataIndex.ToString("N0", CultureInfo.InvariantCulture),
                        PageNo = pageNo.ToString("N0", CultureInfo.InvariantCulture),
                        ItemsPerPage = itemsPerPage.ToString("N0", CultureInfo.InvariantCulture),
                        TemplateSuffix = templateSuffix,
                        HideDisplay = hideDisplay.ToString().ToLower(),
                    };
                    addActionHtml = templateSaveAdd.GetFilled(templateSuffix, UtilsGeneric.Validate, UtilsGeneric.ThrowException, out message);
                }
                else
                {
                    var templateSaveEdit = new TemplateInfoCategorySaveDetailEdit
                    {
                        Id = infoCategoryId.ToString(),
                        DataIndex = dataIndex.ToString("N0", CultureInfo.InvariantCulture),
                        PageNo = pageNo.ToString("N0", CultureInfo.InvariantCulture),
                        ItemsPerPage = itemsPerPage.ToString("N0", CultureInfo.InvariantCulture),
                        TemplateSuffix = templateSuffix,
                        HideDisplay = hideDisplay.ToString().ToLower(),
                        SaveActionDisabled = !enableSave,
                        DeleteActionDisabled = !enableDelete,
                    };
                    editActionHtml = templateSaveEdit.GetFilled(templateSuffix, UtilsGeneric.Validate, UtilsGeneric.ThrowException, out message);
                }

                List<TemplateInfoCategorySaveDetail.IsDefaultVisible.IsDefault> isDefaultList = new List<TemplateInfoCategorySaveDetail.IsDefaultVisible.IsDefault>();
                List<TemplateInfoCategorySaveDetail.IsDefaultVisible.IsNotDefault> isNotDefaultList = new List<TemplateInfoCategorySaveDetail.IsDefaultVisible.IsNotDefault>();
                if (infoCategoryIsDefault == true)
                {
                    isDefaultList.Add(new TemplateInfoCategorySaveDetail.IsDefaultVisible.IsDefault
                    {
                        DataIndex = dataIndex.ToString(),
                    });

                }
                else
                {
                    isNotDefaultList.Add(new TemplateInfoCategorySaveDetail.IsDefaultVisible.IsNotDefault
                    {
                        DataIndex = dataIndex.ToString(),
                    });
                }

                List<TemplateInfoCategorySaveDetail.IsDefaultVisible> isDefaultVisibleList = new List<TemplateInfoCategorySaveDetail.IsDefaultVisible>();
                if ((infoCategoryId != 0) && (UtilsSecurity.HaveAdminRole() ==true))
                {
                    isDefaultVisibleList.Add(new TemplateInfoCategorySaveDetail.IsDefaultVisible
                    {
                        DataIndex = dataIndex.ToString(),
                        IsDefaultList = isDefaultList,
                        IsNotDefaultList = isNotDefaultList,
                    });
                }
                List<TemplateInfoCategorySaveDetail.IsActiveVisible.IsActive> isActiveList = new List<TemplateInfoCategorySaveDetail.IsActiveVisible.IsActive>();
                List<TemplateInfoCategorySaveDetail.IsActiveVisible.IsInActive> isInActiveList = new List<TemplateInfoCategorySaveDetail.IsActiveVisible.IsInActive>();
                if (infoCategoryIsActive == true)
                {
                    isActiveList.Add(new TemplateInfoCategorySaveDetail.IsActiveVisible.IsActive
                    {
                        DataIndex = dataIndex.ToString(),
                    });

                }
                else
                {
                    isInActiveList.Add(new TemplateInfoCategorySaveDetail.IsActiveVisible.IsInActive
                    {
                        DataIndex = dataIndex.ToString(),
                    });
                }

                List<TemplateInfoCategorySaveDetail.IsActiveVisible> isActiveVisibleList = new List<TemplateInfoCategorySaveDetail.IsActiveVisible>();
                if (infoCategoryId != 0)
                {
                    isActiveVisibleList.Add(new TemplateInfoCategorySaveDetail.IsActiveVisible
                    {
                        DataIndex = dataIndex.ToString(),
                        IsActiveList = isActiveList,
                        IsInActiveList = isInActiveList,
                    });
                }

                var templateSaveDetail = new TemplateInfoCategorySaveDetail
                {
                    //Id = groupId.ToString("N0", CultureInfo.InvariantCulture),
                    DataIndex = dataIndex.ToString(),                    
                    RevisionNo = revisionNo.ToString("N0", CultureInfo.InvariantCulture),    
                    InfoCategoryName =infoCategoryName,
                    InfoCategoryNameDisabled = infoCategoryIsSystem,
                    IsDefaultVisibleList = isDefaultVisibleList,
                    IsActiveVisibleList = isActiveVisibleList,

                    AddAction = addActionHtml,
                    EditAction = editActionHtml,
                    ShowUserInfo = showUserInfo,   
                };

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

                #endregion
            }

            return htmlSaveDetail;
        }
Ejemplo n.º 12
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);
        }
Ejemplo n.º 13
0
        public static string GetSaveDetailView(long infoDetailId, long pageNo, long itemsPerDetail, long dataIndex, string templateSuffix, long infoSectionId)
        {
            string message               = "";
            string htmlSaveDetail        = "";
            long   revisionNo            = 0;
            string infoSectionName       = "";
            string infoDetailName        = "";
            string infoDetailDescription = "";
            bool   isActive              = true;
            bool   isDeleted             = false;
            long   sequence              = 0;
            bool   showAdditional        = (infoDetailId != 0);

            if ((UtilsSecurity.HaveAdminRole() == false) && (UtilsSecurity.HaveAuthorRoleEnabled() == false))
            {
                TemplateInfoDetailView view = new TemplateInfoDetailView
                {
                    DataIndex      = dataIndex.ToString(),
                    PageNo         = pageNo.ToString(),
                    ItemsPerPage   = itemsPerDetail.ToString(),
                    TemplateSuffix = templateSuffix,
                    InfoSectionId  = infoSectionId.ToString(),
                };
                htmlSaveDetail = view.GetFilled(templateSuffix, UtilsGeneric.Validate, UtilsGeneric.ThrowException, out message);
            }
            else
            {
                #region Get Section Details

                if (infoSectionId > 0)
                {
                    LTD_InfoSection ltdSectionExisting = DataInfoList.GetLtdInfoSection(infoSectionId);
                    if (ltdSectionExisting != null)
                    {
                        infoSectionName = ltdSectionExisting.InfoSectionName;
                    }
                }

                #endregion

                #region Get Detail Details

                if (infoDetailId > 0)
                {
                    LTD_InfoDetail ltdDetailExisting = DataInfoList.GetLtdInfoDetail(infoDetailId);
                    if (ltdDetailExisting != null)
                    {
                        infoDetailName        = ltdDetailExisting.InfoDetailName;
                        infoDetailDescription = ltdDetailExisting.InfoDetailDescription;
                        isActive   = ltdDetailExisting.IsActive;
                        isDeleted  = ltdDetailExisting.IsDeleted;
                        sequence   = ltdDetailExisting.Sequence;
                        revisionNo = ltdDetailExisting.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 <TemplateInfoDetailSaveDetail.AdditionalVisible> additionalVisibleList = new List <TemplateInfoDetailSaveDetail.AdditionalVisible>();
                if (showAdditional == true)
                {
                    additionalVisibleList.Add(new TemplateInfoDetailSaveDetail.AdditionalVisible
                    {
                        IsActiveHidden  = (infoDetailId == 0),
                        IsActive        = isActive,
                        IsDeletedHidden = !showDeleted,
                        IsDeleted       = isDeleted,
                        SequenceHidden  = (infoDetailId == 0),
                        Sequence        = sequence.ToString(),
                    });
                }

                #endregion

                #region Action

                string addActionHtml  = "";
                string editActionHtml = "";
                if (infoDetailId == 0)
                {
                    var saveDetailAdd = new TemplateInfoDetailSaveDetailAdd
                    {
                        AddActionDisabled = !enableSave,
                        DataIndex         = dataIndex.ToString("N0", CultureInfo.InvariantCulture),
                        PageNo            = pageNo.ToString("N0", CultureInfo.InvariantCulture),
                        ItemsPerPage      = itemsPerDetail.ToString("N0", CultureInfo.InvariantCulture),
                        TemplateSuffix    = templateSuffix,
                        InfoSectionId     = infoSectionId.ToString(),
                    };
                    addActionHtml = saveDetailAdd.GetFilled(templateSuffix, UtilsGeneric.Validate, UtilsGeneric.ThrowException, out message);
                }
                else
                {
                    var templateSaveEdit = new TemplateInfoDetailSaveDetailEdit
                    {
                        Id                   = infoDetailId.ToString(),
                        DataIndex            = dataIndex.ToString("N0", CultureInfo.InvariantCulture),
                        PageNo               = pageNo.ToString("N0", CultureInfo.InvariantCulture),
                        ItemsPerPage         = itemsPerDetail.ToString("N0", CultureInfo.InvariantCulture),
                        TemplateSuffix       = templateSuffix,
                        InfoSectionId        = infoSectionId.ToString(),
                        SaveActionDisabled   = !enableSave,
                        DeleteActionDisabled = !enableDelete,
                    };
                    editActionHtml = templateSaveEdit.GetFilled(templateSuffix, UtilsGeneric.Validate, UtilsGeneric.ThrowException, out message);
                }

                #endregion

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

                    InfoSectionName         = infoSectionName,
                    InfoDetailName          = infoDetailName,
                    InfoDetailDescription   = infoDetailDescription,
                    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);
        }
Ejemplo n.º 14
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);
        }
Ejemplo n.º 15
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);
        }
Ejemplo n.º 16
0
        public static string GetListAllItemView(long pageNo, long itemsPerPage, long dataIndex, string templateSuffix, bool asyncLoading, long filterInfoCategoryId, string filterInfoPage, bool filterInfoPagePublic, long filterCreatedUserId, bool hideFilter)
        {
            string message = "";

            if (itemsPerPage == 0)
            {
                itemsPerPage = UtilsGeneric.DefaultItemsPerPage;
            }
            long   totalPages;
            long   totalItems;
            string htmlTextItemList   = "";
            string htmlAddItemList    = "";
            string htmlFilterItemList = "";

            //if ((filterInfoCategoryId > 0) || (filterInfoPage.Trim().Length > 0) || (filterInfoPagePublic == true)) hideFilter = false;

            #region Filter Section

            List <TemplateInfoPageListDetailFilter.ShowPublicChecked>   showPublicCheckedList   = new List <TemplateInfoPageListDetailFilter.ShowPublicChecked>();
            List <TemplateInfoPageListDetailFilter.ShowPublicUnChecked> showPublicUnCheckedList = new List <TemplateInfoPageListDetailFilter.ShowPublicUnChecked>();

            if (filterInfoPagePublic == true)
            {
                showPublicCheckedList.Add(new TemplateInfoPageListDetailFilter.ShowPublicChecked
                {
                    DataIndex      = dataIndex.ToString(),
                    PageNo         = pageNo.ToString(),
                    ItemsPerPage   = itemsPerPage.ToString(),
                    TemplateSuffix = templateSuffix,
                    AsyncLoading   = asyncLoading.ToString().ToLower()
                });
            }
            else
            {
                showPublicUnCheckedList.Add(new TemplateInfoPageListDetailFilter.ShowPublicUnChecked
                {
                    DataIndex      = dataIndex.ToString(),
                    PageNo         = pageNo.ToString(),
                    ItemsPerPage   = itemsPerPage.ToString(),
                    TemplateSuffix = templateSuffix,
                    AsyncLoading   = asyncLoading.ToString().ToLower()
                });
            }

            #region Get Info Category List

            List <LTD_InfoCategory> ltdInfoCategoryList = DataInfoList.GetAllActiveLtdInfoCategory();

            bool firstRecord = true;
            List <TemplateInfoPageListDetailFilter.InfoCategoryItem> infoCategoryItemList = new List <TemplateInfoPageListDetailFilter.InfoCategoryItem>();
            if (ltdInfoCategoryList.Count == 0)
            {
                infoCategoryItemList.Add(new TemplateInfoPageListDetailFilter.InfoCategoryItem
                {
                    InfoCategoryText     = "No Info Category Found",
                    InfoCategoryValue    = "1",
                    InfoCategorySelected = true
                });
            }
            else
            {
                infoCategoryItemList.Add(new TemplateInfoPageListDetailFilter.InfoCategoryItem
                {
                    InfoCategoryText     = "Select Category Filter",
                    InfoCategoryValue    = "0",
                    InfoCategorySelected = (filterInfoCategoryId == 0)
                });
                if (filterInfoCategoryId == 0)
                {
                    firstRecord = false;
                }
            }

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

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

            #endregion

            long   selectedUserId        = 0;
            string selectUserDetailsHtml = "";
            string userSelectNameId      = "infoPageUserFilter";

            if (UtilsSecurity.HaveAdminRole() == true)
            {
                selectedUserId = UtilsSecurity.GetUserId();
                if (filterCreatedUserId > 0)
                {
                    selectedUserId = filterCreatedUserId;
                }

                #region User Select View

                long   userViewDataIndex    = dataIndex + 5;
                string showFunctionScript   = "";
                string selectChangeCallback = " filterInfoPageList(" + pageNo + "," + itemsPerPage + "," + dataIndex + ",'" + templateSuffix + "'," + asyncLoading.ToString().ToLower() + ") ";
                selectUserDetailsHtml = UserAdminView.GetUserSelectView(userViewDataIndex, 1, 25, templateSuffix, selectedUserId, false, showFunctionScript, "", userSelectNameId, selectChangeCallback, out selectedUserId);

                #endregion
            }

            TemplateInfoPageListDetailFilter listDetailFilter = new TemplateInfoPageListDetailFilter
            {
                InfoPageListFilterHidden = hideFilter,

                ShowPublicCheckedList   = showPublicCheckedList,
                ShowPublicUnCheckedList = showPublicUnCheckedList,
                InfoCategoryItemList    = infoCategoryItemList,
                InfoPageFilter          = filterInfoPage,

                DataIndex      = dataIndex.ToString(),
                PageNo         = pageNo.ToString(),
                ItemsPerPage   = itemsPerPage.ToString(),
                TemplateSuffix = templateSuffix,
                AsyncLoading   = asyncLoading.ToString().ToLower(),

                UserSelect = selectUserDetailsHtml,
            };
            htmlFilterItemList = listDetailFilter.GetFilled(templateSuffix, UtilsGeneric.Validate, UtilsGeneric.ThrowException, out message);

            #endregion

            #region Add Link

            List <TemplateInfoPageSaveAdd.AddAction> addActionList = new List <TemplateInfoPageSaveAdd.AddAction>();

            if (UtilsSecurity.HaveAuthorRoleEnabled() == true)
            {
                addActionList.Add(new TemplateInfoPageSaveAdd.AddAction
                {
                    DataIndex      = dataIndex.ToString(),
                    PageNo         = pageNo.ToString(),
                    ItemsPerPage   = itemsPerPage.ToString(),
                    TemplateSuffix = templateSuffix,
                });
            }

            TemplateInfoPageSaveAdd templateSaveAdd = new TemplateInfoPageSaveAdd
            {
                AddActionList = addActionList,
            };
            htmlAddItemList = templateSaveAdd.GetFilled(templateSuffix, UtilsGeneric.Validate, UtilsGeneric.ThrowException, out message);

            #endregion

            #region Get Fill List

            #region Get Paged Data

            List <LTD_InfoPage> ltdInfoPageList = new List <LTD_InfoPage>();

            if (UtilsSecurity.IsAuthenticated() == true)
            {
                if (filterInfoPagePublic == true)
                {
                    ltdInfoPageList = DataInfoList.GetPublicPagedLtdInfoPage(filterInfoCategoryId, filterInfoPage, selectedUserId, pageNo, itemsPerPage, out totalPages, out totalItems);
                }
                else
                {
                    if (UtilsSecurity.HaveAdminRole() == true)
                    {
                        ltdInfoPageList = DataInfoList.GetPagedLtdInfoPage(filterInfoCategoryId, filterInfoPage, selectedUserId, pageNo, itemsPerPage, out totalPages, out totalItems);
                    }
                    else
                    {
                        ltdInfoPageList = DataInfoList.GetUserPagedLtdInfoPage(filterInfoCategoryId, filterInfoPage, pageNo, itemsPerPage, out totalPages, out totalItems);
                    }

                    long commonTotalPages = 0;
                    long commonTotalItems = 0;
                    List <LTD_InfoPage> commonltdInfoPageList = DataInfoList.GetCommonPagedLtdInfoPage(filterInfoCategoryId, filterInfoPage, pageNo, itemsPerPage, out commonTotalPages, out commonTotalItems);
                    if (commonltdInfoPageList.Count > 0)
                    {
                        ltdInfoPageList.AddRange(commonltdInfoPageList);
                        totalItems = totalItems + commonTotalItems;
                        if (commonTotalPages > 1)
                        {
                            totalPages = totalPages + commonTotalPages - 1;
                        }
                    }
                }
            }
            else
            {
                ltdInfoPageList = DataInfoList.GetPublicPagedLtdInfoPage(filterInfoCategoryId, filterInfoPage, selectedUserId, pageNo, itemsPerPage, out totalPages, out totalItems);
            }

            #endregion

            if (ltdInfoPageList.Count > 0)
            {
                #region Get Pager Details

                string topPagerDetails    = UtilsGeneric.GetItemPagerView(pageNo, itemsPerPage, dataIndex, templateSuffix, totalPages, RefreshListFunctionName, asyncLoading.ToString().ToLower());
                string bottomPagerDetails = UtilsGeneric.GetLinkPagerView(pageNo, itemsPerPage, dataIndex, templateSuffix, totalPages, totalItems, RefreshListFunctionName, asyncLoading.ToString().ToLower(), false);

                #endregion

                #region Append Top Pager

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

                #endregion

                #region Append Items

                int index = 0;
                for (; index < ltdInfoPageList.Count; index++)
                {
                    LTD_InfoPage ltdInfoPage          = ltdInfoPageList[index];
                    string       htmlTextItemTemplate = GetListSingleItemView(ltdInfoPage, pageNo, itemsPerPage, dataIndex, templateSuffix, index, asyncLoading);
                    htmlTextItemList += htmlTextItemTemplate;
                }

                #endregion

                #region Append Bottom Pager

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

                #endregion
            }

            #endregion

            #region Set Fill List

            if (htmlTextItemList.Length == 0)
            {
                TemplateInfoPageListDetailEmpty templateListDetailEmpty = new TemplateInfoPageListDetailEmpty
                {
                    DataIndex      = dataIndex.ToString(),
                    PageNo         = pageNo.ToString(),
                    ItemsPerPage   = itemsPerPage.ToString(),
                    TemplateSuffix = templateSuffix,
                    AsyncLoading   = asyncLoading.ToString().ToLower()
                };
                htmlTextItemList = templateListDetailEmpty.GetFilled(templateSuffix, UtilsGeneric.Validate, UtilsGeneric.ThrowException, out message);
            }
            #endregion

            return(htmlFilterItemList + htmlAddItemList + htmlTextItemList);
        }
Ejemplo n.º 17
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);
        }
Ejemplo n.º 18
0
        public static string GetSaveDetailView(long subscriberId, long pageNo, long itemsPerPage, long dataIndex, string templateSuffix)
        {
            string message;
            string htmlSaveDetail      = "";
            long   revisionNo          = 0;
            string subscriberEmail     = "";
            string subscriberMessage   = "";
            bool   subscriberIsDeleted = false;

            long dataCount = DataInfoList.GetCountLtdSubscriberId();

            if (dataCount > 0)
            {
                revisionNo = dataCount;
            }

            #region Get Subscriber Details

            if (subscriberId > 0)
            {
                LTD_Subscriber ltdSubscriberExisting = DataInfoList.GetLtdSubscriber(subscriberId);
                if (ltdSubscriberExisting != null)
                {
                    subscriberEmail     = ltdSubscriberExisting.SubscriberEmail;
                    subscriberMessage   = ltdSubscriberExisting.SubscriberMessage;
                    subscriberIsDeleted = ltdSubscriberExisting.IsDeleted;
                    revisionNo          = ltdSubscriberExisting.RevisionNo;
                }
            }

            #endregion

            #region Set Action

            bool showUserInfo = false;
            bool enableSave   = true;
            bool enableDelete = true;

            #endregion

            #region Set Template

            string addActionHtml  = "";
            string editActionHtml = "";
            if (subscriberId == 0)
            {
                var templateSaveAdd = new TemplateSubscriberSaveDetailAdd
                {
                    AddActionDisabled = !enableSave,
                    DataIndex         = dataIndex.ToString("N0", CultureInfo.InvariantCulture),
                    PageNo            = pageNo.ToString("N0", CultureInfo.InvariantCulture),
                    ItemsPerPage      = itemsPerPage.ToString("N0", CultureInfo.InvariantCulture),
                    TemplateSuffix    = templateSuffix,
                };
                addActionHtml = templateSaveAdd.GetFilled(templateSuffix, UtilsGeneric.Validate, UtilsGeneric.ThrowException, out message);
            }
            else
            {
                var templateSaveEdit = new TemplateSubscriberSaveDetailEdit
                {
                    Id                   = subscriberId.ToString(),
                    DataIndex            = dataIndex.ToString("N0", CultureInfo.InvariantCulture),
                    PageNo               = pageNo.ToString("N0", CultureInfo.InvariantCulture),
                    ItemsPerPage         = itemsPerPage.ToString("N0", CultureInfo.InvariantCulture),
                    TemplateSuffix       = templateSuffix,
                    SaveActionDisabled   = !enableSave,
                    DeleteActionDisabled = !enableDelete,
                };
                editActionHtml = templateSaveEdit.GetFilled(templateSuffix, UtilsGeneric.Validate, UtilsGeneric.ThrowException, out message);
            }

            List <TemplateSubscriberSaveDetail.IsDeletedVisible> isDeletedVisibleList = new List <TemplateSubscriberSaveDetail.IsDeletedVisible>();
            if (subscriberId != 0)
            {
                isDeletedVisibleList.Add(new TemplateSubscriberSaveDetail.IsDeletedVisible
                {
                    IsDeleted = subscriberIsDeleted,
                });
            }

            var templateSaveDetail = new TemplateSubscriberSaveDetail
            {
                //Id = subscriberId.ToString("N0", CultureInfo.InvariantCulture),
                RevisionNo             = revisionNo.ToString(),
                SubscriberEmailDisable = (subscriberId != 0),
                SubscriberMessage      = subscriberMessage,
                IsDeletedVisibleList   = isDeletedVisibleList,

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

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

            #endregion

            return(htmlSaveDetail);
        }
Ejemplo n.º 19
0
        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);
        }
Ejemplo n.º 20
0
        public static string GetListAllItemView(long pageNo, long itemsPerPage, long dataIndex, string templateSuffix)
        {
            string message = "";

            if (itemsPerPage == 0)
            {
                itemsPerPage = UtilsGeneric.DefaultItemsPerPage;
            }
            long   totalPages;
            long   totalItems;
            string htmlTextItemList = "";

            if (UtilsSecurity.HaveAdminRole() == false)
            {
                //TemplateSubscriberView subscriberView = new TemplateSubscriberView
                //{
                //    DataIndex = dataIndex.ToString(),
                //    PageNo = pageNo.ToString(),
                //    ItemsPerPage = itemsPerPage.ToString(),
                //    TemplateSuffix = templateSuffix
                //};
                //htmlTextItemList = subscriberView.GetFilled(templateSuffix, UtilsGeneric.Validate, UtilsGeneric.ThrowException, out message);
            }
            else
            {
                #region Get Fill List

                #region Get Paged Data

                List <LTD_Subscriber> ltdSubscriberList = DataInfoList.GetAllLtdSubscriber(pageNo, itemsPerPage, out totalPages, out totalItems);

                #endregion

                if (ltdSubscriberList.Count > 0)
                {
                    #region Get Pager Details

                    string topPagerDetails    = UtilsGeneric.GetItemPagerView(pageNo, itemsPerPage, dataIndex, templateSuffix, totalPages, RefreshListFunctionName, "");
                    string bottomPagerDetails = UtilsGeneric.GetLinkPagerView(pageNo, itemsPerPage, dataIndex, templateSuffix, totalPages, totalItems, RefreshListFunctionName, "");

                    #endregion

                    #region Append Top Pager

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

                    #endregion

                    #region Append Items

                    int index = 0;
                    for (; index < ltdSubscriberList.Count; index++)
                    {
                        LTD_Subscriber ltdSubscriber        = ltdSubscriberList[index];
                        string         htmlTextItemTemplate = GetListSingleItemView(ltdSubscriber, pageNo, itemsPerPage, dataIndex, templateSuffix);
                        htmlTextItemList += htmlTextItemTemplate;
                    }

                    #endregion

                    #region Append Bottom Pager

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

                    #endregion
                }

                #endregion

                #region Set Fill List

                if ((htmlTextItemList.Length == 0) && (UtilsSecurity.HaveAdminRole() == true))
                {
                    TemplateSubscriberListDetailEmpty subscriberListDetailEmpty = new TemplateSubscriberListDetailEmpty
                    {
                        DataIndex      = dataIndex.ToString(),
                        PageNo         = pageNo.ToString(),
                        ItemsPerPage   = itemsPerPage.ToString(),
                        TemplateSuffix = templateSuffix
                    };
                    htmlTextItemList = subscriberListDetailEmpty.GetFilled(templateSuffix, UtilsGeneric.Validate, UtilsGeneric.ThrowException, out message);
                }
                #endregion
            }

            return(htmlTextItemList);
        }