Ejemplo n.º 1
0
        public static string GetView(long infoPageId, long dataIndex, string templateSuffix, bool showSave, bool showList, bool loadSaveScript, bool loadListScript)
        {
            long id           = 0;
            long pageNo       = 1;
            long itemsPerPage = UtilsGeneric.DefaultItemsPerPage;

            #region Save View

            string htmlSaveView = "";
            htmlSaveView = GetSaveView(id, pageNo, itemsPerPage, dataIndex, templateSuffix, infoPageId, loadSaveScript, showSave);
            //htmlSaveView += InfoDetailView.GetView(0, dataIndex + 1, templateSuffix, false, false, true, true);
            htmlSaveView += InfoDetailView.GetScript(true, true);

            #endregion

            #region List View

            string htmlListView = "";
            htmlListView = GetListView(pageNo, itemsPerPage, dataIndex, templateSuffix, infoPageId, loadListScript, showList);

            #endregion

            var template = new TemplateInfoSection
            {
                //SaveExpand = (id == 0) ? "true" : "false",
                SaveDetail = htmlSaveView,
                //ListExpand = (id == 0) ? "false" : "true",
                ListDetail = htmlListView,
            };

            string message = "";
            string html    = template.GetFilled(templateSuffix, UtilsGeneric.Validate, UtilsGeneric.ThrowException, out message);
            return(html);
        }
Ejemplo n.º 2
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);
        }