Ejemplo n.º 1
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _exportType = Body.GetQueryString("ExportType");

            if (!IsPostBack)
            {
                var fileName = string.Empty;
                try
                {
                    if (_exportType == ExportTypeSingleTableStyle)
                    {
                        var tableStyle = ETableStyleUtils.GetEnumType(Body.GetQueryString("TableStyle"));
                        var tableName  = Body.GetQueryString("TableName");
                        fileName = ExportSingleTableStyle(tableStyle, tableName);
                    }

                    var link     = new HyperLink();
                    var filePath = PathUtils.GetTemporaryFilesPath(fileName);
                    link.NavigateUrl = ActionsDownload.GetUrl(PageUtils.GetApiUrl(), filePath);
                    link.Text        = "下载";
                    var successMessage = "成功导出文件!  " + ControlUtils.GetControlRenderHtml(link);
                    SuccessMessage(successMessage);
                }
                catch (Exception ex)
                {
                    var failedMessage = "文件导出失败!<br/><br/>原因为:" + ex.Message;
                    FailMessage(ex, failedMessage);
                }
            }
        }
Ejemplo n.º 2
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _tableStyleId      = Body.GetQueryInt("TableStyleID");
            _relatedIdentities = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("RelatedIdentities"));
            if (_relatedIdentities.Count == 0)
            {
                _relatedIdentities.Add(0);
            }
            _tableName     = Body.GetQueryString("TableName");
            _attributeName = Body.GetQueryString("AttributeName");
            _tableStyle    = ETableStyleUtils.GetEnumType(Body.GetQueryString("TableStyle"));
            _redirectUrl   = StringUtils.ValueFromUrl(Body.GetQueryString("RedirectUrl"));

            if (_tableStyleId != 0)
            {
                _styleInfo = BaiRongDataProvider.TableStyleDao.GetTableStyleInfo(_tableStyleId);
            }
            else
            {
                _styleInfo = TableStyleManager.GetTableStyleInfo(_tableStyle, _tableName, _attributeName, _relatedIdentities);
            }

            if (!IsPostBack)
            {
                IsValidate.Items[0].Value = true.ToString();
                IsValidate.Items[1].Value = false.ToString();

                ControlUtils.SelectListItems(IsValidate, _styleInfo.Additional.IsValidate.ToString());

                IsRequired.Items[0].Value = true.ToString();
                IsRequired.Items[1].Value = false.ToString();

                ControlUtils.SelectListItems(IsRequired, _styleInfo.Additional.IsRequired.ToString());

                if (EInputTypeUtils.EqualsAny(_styleInfo.InputType, EInputType.Text, EInputType.TextArea))
                {
                    phNum.Visible = true;
                }
                else
                {
                    phNum.Visible = false;
                }

                MinNum.Text = _styleInfo.Additional.MinNum.ToString();
                MaxNum.Text = _styleInfo.Additional.MaxNum.ToString();

                EInputValidateTypeUtils.AddListItems(ValidateType);
                ControlUtils.SelectListItems(ValidateType, EInputValidateTypeUtils.GetValue(_styleInfo.Additional.ValidateType));

                RegExp.Text       = _styleInfo.Additional.RegExp;
                ErrorMessage.Text = _styleInfo.Additional.ErrorMessage;

                Validate_SelectedIndexChanged(null, EventArgs.Empty);
            }
        }
Ejemplo n.º 3
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _tableName  = Body.GetQueryString("TableName");
            _tableStyle = ETableStyleUtils.GetEnumType(Body.GetQueryString("TableStyle"));
        }
Ejemplo n.º 4
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            tableStyle = ETableStyleUtils.GetEnumType(Body.GetQueryString("tableStyle"));
            type       = Body.GetQueryString("type");

            if (!IsPostBack)
            {
                var pageTitle = string.Empty;
                if (tableStyle == ETableStyle.GovInteractContent)
                {
                    if (StringUtils.EqualsIgnoreCase(type, "DepartmentSelect"))
                    {
                        pageTitle = "负责部门设置";
                    }
                    else if (StringUtils.EqualsIgnoreCase(type, "AdministratorSelect"))
                    {
                        pageTitle = "负责人员设置";
                    }
                    else if (StringUtils.EqualsIgnoreCase(type, "Attributes"))
                    {
                        pageTitle = "办件字段管理";
                    }
                    else if (StringUtils.EqualsIgnoreCase(type, "Apply"))
                    {
                        pageTitle = "办件提交样式";
                    }
                    else if (StringUtils.EqualsIgnoreCase(type, "Query"))
                    {
                        pageTitle = "办件查询样式";
                    }
                    else if (StringUtils.EqualsIgnoreCase(type, "MailSMS"))
                    {
                        pageTitle = " 邮件/短信发送管理";
                    }
                    else if (StringUtils.EqualsIgnoreCase(type, "InteractType"))
                    {
                        pageTitle = "办件类型管理";
                    }
                }

                InfoMessage(pageTitle);

                BindGrid();
            }
        }
Ejemplo n.º 5
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _relatedIdentities = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("RelatedIdentities"));
            if (_relatedIdentities.Count == 0)
            {
                _relatedIdentities.Add(0);
            }
            _tableName   = Body.GetQueryString("TableName");
            _tableStyle  = ETableStyleUtils.GetEnumType(Body.GetQueryString("TableStyle"));
            _redirectUrl = StringUtils.ValueFromUrl(Body.GetQueryString("RedirectUrl"));

            if (!IsPostBack)
            {
                IsVisible.Items[0].Value = true.ToString();
                IsVisible.Items[1].Value = false.ToString();

                IsSingleLine.Items[0].Value = true.ToString();
                IsSingleLine.Items[1].Value = false.ToString();

                IsHorizontal.Items[0].Value = true.ToString();
                IsHorizontal.Items[1].Value = false.ToString();

                EInputTypeUtils.AddListItems(InputType);

                var styleInfo = TableStyleManager.GetTableStyleInfo(_tableStyle, _tableName, string.Empty, _relatedIdentities);

                ControlUtils.SelectListItems(InputType, EInputTypeUtils.GetValue(EInputTypeUtils.GetEnumType(styleInfo.InputType)));
                ControlUtils.SelectListItems(IsVisible, styleInfo.IsVisible.ToString());
                ControlUtils.SelectListItems(IsSingleLine, styleInfo.IsSingleLine.ToString());
                DefaultValue.Text          = styleInfo.DefaultValue;
                IsHorizontal.SelectedValue = styleInfo.IsHorizontal.ToString();
                Columns.Text = styleInfo.Additional.Columns.ToString();

                Height.Text = styleInfo.Additional.Height.ToString();
                Width.Text  = styleInfo.Additional.Width.ToString();

                ItemCount.Text = "0";
            }

            ReFresh(null, EventArgs.Empty);
        }
Ejemplo n.º 6
0
        private int SaveContentInfo(bool isAjaxSubmit, bool isPreview, out string errorMessage)
        {
            int savedContentId;

            errorMessage = string.Empty;
            var contentId = 0;

            if (!isPreview)
            {
                contentId = isAjaxSubmit ? TranslateUtils.ToInt(Request.Form["savedContentID"]) : Body.GetQueryInt("ID");
            }

            if (contentId == 0)
            {
                var contentInfo = ContentUtility.GetContentInfo(_tableStyle);
                try
                {
                    int nodeId = 0;
                    //contentInfo.NodeId = _nodeInfo.NodeId;
                    if (PhCategory.Visible == true)
                    {
                        nodeId = Convert.ToInt32(TbCategory.SelectedValue);
                    }
                    else
                    {
                        nodeId = _nodeInfo.NodeId;
                    }
                    contentInfo.NodeId = nodeId;
                    contentInfo.PublishmentSystemId = PublishmentSystemId;
                    contentInfo.AddUserName         = Body.AdministratorName;
                    if (contentInfo.AddDate.Year == DateUtils.SqlMinValue.Year)
                    {
                        errorMessage = $"内容添加失败:系统时间不能为{DateUtils.SqlMinValue.Year}年";
                        return(0);
                    }
                    contentInfo.LastEditUserName = contentInfo.AddUserName;
                    contentInfo.LastEditDate     = DateTime.Now;

                    //自动保存的时候,不保存编辑器的图片
                    var dic = new Dictionary <string, string>();
                    if (Body.GetQueryInt("ArticleId") > 0)
                    {
                        dic.Add("ExaminationPaperId", Body.GetQueryString("ArticleId"));
                    }
                    InputTypeParser.AddValuesToAttributes(_tableStyle, _tableName, PublishmentSystemInfo, _relatedIdentities, Request.Form, contentInfo.Attributes, ContentAttribute.HiddenAttributes, !_isAjaxSubmit, dic);

                    StringCollection tagCollection;

                    if (isAjaxSubmit)
                    {
                        contentInfo.ContentGroupNameCollection = Request.Form[ContentAttribute.ContentGroupNameCollection];
                        tagCollection = TagUtils.ParseTagsString(Request.Form[ContentAttribute.Tags]);

                        contentInfo.CheckedLevel = LevelManager.LevelInt.CaoGao;
                        contentInfo.IsChecked    = false;
                    }
                    else
                    {
                        contentInfo.ContentGroupNameCollection = ControlUtils.SelectedItemsValueToStringCollection(CblContentGroupNameCollection.Items);
                        tagCollection = TagUtils.ParseTagsString(TbTags.Text);

                        if (PhContentAttributes.Visible)
                        {
                            foreach (ListItem listItem in CblContentAttributes.Items)
                            {
                                var value         = listItem.Selected.ToString();
                                var attributeName = listItem.Value;
                                contentInfo.SetExtendedAttribute(attributeName, value);
                            }
                        }

                        contentInfo.CheckedLevel = TranslateUtils.ToIntWithNagetive(RblContentLevel.SelectedValue);
                        contentInfo.IsChecked    = contentInfo.CheckedLevel >= PublishmentSystemInfo.CheckContentLevel;
                    }
                    contentInfo.Tags = TranslateUtils.ObjectCollectionToString(tagCollection, " ");

                    if (isPreview)
                    {
                        savedContentId = DataProvider.ContentDao.InsertPreview(_tableName, PublishmentSystemInfo, _nodeInfo, contentInfo);
                    }
                    else
                    {
                        savedContentId = DataProvider.ContentDao.Insert(_tableName, PublishmentSystemInfo, contentInfo);
                        //判断是不是有审核权限
                        int checkedLevelOfUser;
                        var isCheckedOfUser = CheckManager.GetUserCheckLevel(Body.AdministratorName, PublishmentSystemInfo, contentInfo.NodeId, out checkedLevelOfUser);
                        if (LevelManager.IsCheckable(PublishmentSystemInfo, contentInfo.NodeId, contentInfo.IsChecked, contentInfo.CheckedLevel, isCheckedOfUser, checkedLevelOfUser))
                        {
                            //添加审核记录
                            BaiRongDataProvider.ContentDao.UpdateIsChecked(_tableName, PublishmentSystemId, contentInfo.NodeId, new List <int> {
                                savedContentId
                            }, 0, true, Body.AdministratorName, contentInfo.IsChecked, contentInfo.CheckedLevel, "");
                        }

                        if (PhTags.Visible)
                        {
                            TagUtils.AddTags(tagCollection, PublishmentSystemId, savedContentId);
                        }
                    }

                    contentInfo.Id = savedContentId;
                }
                catch (Exception ex)
                {
                    LogUtils.AddErrorLog(ex);
                    errorMessage = $"内容添加失败:{ex.Message}";
                    return(0);
                }

                if (!isAjaxSubmit)
                {
                    if (contentInfo.IsChecked)
                    {
                        CreateManager.CreateContentAndTrigger(PublishmentSystemId, _nodeInfo.NodeId, contentInfo.Id);
                    }

                    Body.AddSiteLog(PublishmentSystemId, _nodeInfo.NodeId, contentInfo.Id, "添加内容",
                                    $"栏目:{NodeManager.GetNodeNameNavigation(PublishmentSystemId, contentInfo.NodeId)},内容标题:{contentInfo.Title}");

                    ContentUtility.Translate(PublishmentSystemInfo, _nodeInfo.NodeId, contentInfo.Id, Request.Form["translateCollection"], ETranslateContentTypeUtils.GetEnumType(DdlTranslateType.SelectedValue), Body.AdministratorName);
                    string contentType = WebUtils.GetContentType(_nodeInfo.ContentModelId);
                    if (contentType.Equals("PageExamination"))
                    {
                        PageUtils.Redirect($@"/siteserver/cms/{contentType}.aspx?PublishmentSystemID={Body.GetQueryString("PublishmentSystemID")}&NodeID={(string.IsNullOrEmpty(Body.GetQueryString("PNodeID")) ? Body.GetQueryString("NodeId") : Body.GetQueryString("PNodeID"))}&ArticleId={Body.GetQueryString("ArticleId")}");
                    }
                    PageUtils.Redirect(EContentModelTypeUtils.Equals(_nodeInfo.ContentModelId, EContentModelType.Photo)
                        ? PageContentPhotoUpload.GetRedirectUrl(PublishmentSystemId, _nodeInfo.NodeId, contentInfo.Id,
                                                                Body.GetQueryString("ReturnUrl"))
                        : PageContentAddAfter.GetRedirectUrl(PublishmentSystemId, _nodeInfo.NodeId, contentInfo.Id,
                                                             ReturnUrl));
                }
            }
            else
            {
                var contentInfo = DataProvider.ContentDao.GetContentInfo(_tableStyle, _tableName, contentId);
                try
                {
                    var tagsLast = contentInfo.Tags;

                    contentInfo.LastEditUserName = Body.AdministratorName;
                    contentInfo.LastEditDate     = DateTime.Now;

                    //自动保存的时候,不保存编辑器的图片
                    InputTypeParser.AddValuesToAttributes(_tableStyle, _tableName, PublishmentSystemInfo, _relatedIdentities, Request.Form, contentInfo.Attributes, ContentAttribute.HiddenAttributes, !_isAjaxSubmit);

                    StringCollection tagCollection;
                    if (isAjaxSubmit)
                    {
                        contentInfo.ContentGroupNameCollection = Request.Form[ContentAttribute.ContentGroupNameCollection];
                        tagCollection = TagUtils.ParseTagsString(Request.Form[ContentAttribute.Tags]);
                    }
                    else
                    {
                        contentInfo.ContentGroupNameCollection = ControlUtils.SelectedItemsValueToStringCollection(CblContentGroupNameCollection.Items);
                        tagCollection = TagUtils.ParseTagsString(TbTags.Text);

                        if (PhContentAttributes.Visible)
                        {
                            foreach (ListItem listItem in CblContentAttributes.Items)
                            {
                                var value         = listItem.Selected.ToString();
                                var attributeName = listItem.Value;
                                contentInfo.SetExtendedAttribute(attributeName, value);
                            }
                        }

                        var checkedLevel = TranslateUtils.ToIntWithNagetive(RblContentLevel.SelectedValue);
                        if (checkedLevel != LevelManager.LevelInt.NotChange)
                        {
                            contentInfo.IsChecked    = checkedLevel >= PublishmentSystemInfo.CheckContentLevel;
                            contentInfo.CheckedLevel = checkedLevel;
                        }
                    }
                    contentInfo.Tags = TranslateUtils.ObjectCollectionToString(tagCollection, " ");

                    DataProvider.ContentDao.Update(_tableName, PublishmentSystemInfo, contentInfo);

                    if (PhTags.Visible)
                    {
                        TagUtils.UpdateTags(tagsLast, contentInfo.Tags, tagCollection, PublishmentSystemId, contentId);
                    }

                    if (!isAjaxSubmit)
                    {
                        ContentUtility.Translate(PublishmentSystemInfo, _nodeInfo.NodeId, contentInfo.Id, Request.Form["translateCollection"], ETranslateContentTypeUtils.GetEnumType(DdlTranslateType.SelectedValue), Body.AdministratorName);

                        if (EContentModelTypeUtils.Equals(_nodeInfo.ContentModelId, EContentModelType.Photo))
                        {
                            PageUtils.Redirect(PageContentPhotoUpload.GetRedirectUrl(PublishmentSystemId, _nodeInfo.NodeId, contentInfo.Id, Body.GetQueryString("ReturnUrl")));
                        }

                        //更新引用该内容的信息
                        //如果不是异步自动保存,那么需要将引用此内容的content修改
                        var sourceContentIdList = new List <int>
                        {
                            contentInfo.Id
                        };
                        var tableList = BaiRongDataProvider.TableCollectionDao.GetAuxiliaryTableListCreatedInDbByAuxiliaryTableType(EAuxiliaryTableType.BackgroundContent, EAuxiliaryTableType.JobContent, EAuxiliaryTableType.VoteContent);
                        foreach (var table in tableList)
                        {
                            var targetContentIdList = BaiRongDataProvider.ContentDao.GetReferenceIdList(table.TableEnName, sourceContentIdList);
                            foreach (int targetContentId in targetContentIdList)
                            {
                                var targetContentInfo = DataProvider.ContentDao.GetContentInfo(ETableStyleUtils.GetEnumType(table.AuxiliaryTableType.ToString()), table.TableEnName, targetContentId);
                                if (targetContentInfo != null && targetContentInfo.GetExtendedAttribute(ContentAttribute.TranslateContentType) == ETranslateContentType.ReferenceContent.ToString())
                                {
                                    contentInfo.Id = targetContentId;
                                    contentInfo.PublishmentSystemId = targetContentInfo.PublishmentSystemId;
                                    contentInfo.NodeId      = targetContentInfo.NodeId;
                                    contentInfo.SourceId    = targetContentInfo.SourceId;
                                    contentInfo.ReferenceId = targetContentInfo.ReferenceId;
                                    contentInfo.Taxis       = targetContentInfo.Taxis;
                                    contentInfo.SetExtendedAttribute(ContentAttribute.TranslateContentType, targetContentInfo.GetExtendedAttribute(ContentAttribute.TranslateContentType));
                                    BaiRongDataProvider.ContentDao.Update(table.TableEnName, contentInfo);

                                    //资源:图片,文件,视频
                                    var targetPublishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(targetContentInfo.PublishmentSystemId);
                                    var bgContentInfo       = contentInfo as BackgroundContentInfo;
                                    var bgTargetContentInfo = targetContentInfo as BackgroundContentInfo;
                                    if (bgTargetContentInfo != null && bgContentInfo != null)
                                    {
                                        if (bgContentInfo.ImageUrl != bgTargetContentInfo.ImageUrl)
                                        {
                                            //修改图片
                                            var sourceImageUrl = PathUtility.MapPath(PublishmentSystemInfo, bgContentInfo.ImageUrl);
                                            CopyReferenceFiles(targetPublishmentSystemInfo, sourceImageUrl);
                                        }
                                        else if (bgContentInfo.GetExtendedAttribute(ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.ImageUrl)) != bgTargetContentInfo.GetExtendedAttribute(ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.ImageUrl)))
                                        {
                                            var sourceImageUrls = TranslateUtils.StringCollectionToStringList(bgContentInfo.GetExtendedAttribute(ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.ImageUrl)));

                                            foreach (string imageUrl in sourceImageUrls)
                                            {
                                                var sourceImageUrl = PathUtility.MapPath(PublishmentSystemInfo, imageUrl);
                                                CopyReferenceFiles(targetPublishmentSystemInfo, sourceImageUrl);
                                            }
                                        }
                                        if (bgContentInfo.FileUrl != bgTargetContentInfo.FileUrl)
                                        {
                                            //修改附件
                                            var sourceFileUrl = PathUtility.MapPath(PublishmentSystemInfo, bgContentInfo.FileUrl);
                                            CopyReferenceFiles(targetPublishmentSystemInfo, sourceFileUrl);
                                        }
                                        else if (bgContentInfo.GetExtendedAttribute(ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.FileUrl)) != bgTargetContentInfo.GetExtendedAttribute(ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.FileUrl)))
                                        {
                                            var sourceFileUrls = TranslateUtils.StringCollectionToStringList(bgContentInfo.GetExtendedAttribute(ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.FileUrl)));

                                            foreach (string fileUrl in sourceFileUrls)
                                            {
                                                var sourceFileUrl = PathUtility.MapPath(PublishmentSystemInfo, fileUrl);
                                                CopyReferenceFiles(targetPublishmentSystemInfo, sourceFileUrl);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    LogUtils.AddErrorLog(ex);
                    errorMessage = $"内容修改失败:{ex.Message}";
                    return(0);
                }

                if (!isAjaxSubmit)
                {
                    if (contentInfo.IsChecked)
                    {
                        CreateManager.CreateContentAndTrigger(PublishmentSystemId, _nodeInfo.NodeId, contentId);
                    }

                    Body.AddSiteLog(PublishmentSystemId, _nodeInfo.NodeId, contentId, "修改内容",
                                    $"栏目:{NodeManager.GetNodeNameNavigation(PublishmentSystemId, contentInfo.NodeId)},内容标题:{contentInfo.Title}");
                    string contentType = WebUtils.GetContentType(_nodeInfo.ContentModelId);
                    PageUtils.Redirect($@"/siteserver/cms/{contentType}.aspx?PublishmentSystemID={Body.GetQueryString("PublishmentSystemID")}&NodeID={(string.IsNullOrEmpty( Body.GetQueryString("PNodeID"))? Body.GetQueryString("NodeId"): Body.GetQueryString("PNodeID"))}");
                    //PageUtils.Redirect(ReturnUrl);
                }
                savedContentId = contentId;
            }

            return(savedContentId);
        }
Ejemplo n.º 7
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _styleId    = Body.GetQueryInt("StyleID");
            _tableStyle = ETableStyleUtils.GetEnumType(Body.GetQueryString("TableStyle"));
            var relatedIdentity = Body.GetQueryInt("RelatedIdentity");
            var tagStyleInfo    = DataProvider.TagStyleDao.GetTagStyleInfo(_styleId);

            if (_tableStyle == ETableStyle.GovInteractContent)
            {
                _mailSmsInfo = new TagStyleGovInteractApplyInfo(tagStyleInfo.SettingsXML);
            }

            if (!IsPostBack)
            {
                ltlTips2.Text =
                    $"[{ContentAttribute.AddDate}]代表提交时间,[{GovInteractContentAttribute.QueryCode}]代表查询码,";

                var styleInfoList = RelatedIdentities.GetTableStyleInfoList(PublishmentSystemInfo, _tableStyle, relatedIdentity);
                foreach (var styleInfo in styleInfoList)
                {
                    if (styleInfo.IsVisible)
                    {
                        ltlTips2.Text += $@"[{styleInfo.AttributeName}]代表{styleInfo.DisplayName},";
                    }
                }

                ltlTips2.Text = ltlTips2.Text.TrimEnd(',');

                //短信

                ControlUtils.SelectListItemsIgnoreCase(rblIsSMS, _mailSmsInfo.IsSMS.ToString());
                rblIsSMS_SelectedIndexChanged(null, EventArgs.Empty);

                ControlUtils.SelectListItemsIgnoreCase(rblSMSReceiver, ETriStateUtils.GetValue(_mailSmsInfo.SMSReceiver));
                rblSMSReceiver_SelectedIndexChanged(null, EventArgs.Empty);

                tbSMSTo.Text = _mailSmsInfo.SMSTo;

                foreach (var styleInfo in styleInfoList)
                {
                    if (styleInfo.IsVisible)
                    {
                        var listItem = new ListItem(styleInfo.DisplayName + "(" + styleInfo.AttributeName + ")", styleInfo.AttributeName);
                        if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, _mailSmsInfo.SMSFiledName))
                        {
                            listItem.Selected = true;
                        }
                        ddlSMSFiledName.Items.Add(listItem);
                    }
                }

                ControlUtils.SelectListItemsIgnoreCase(rblIsSMSTemplate, _mailSmsInfo.IsSMSTemplate.ToString());
                rblIsSMSTemplate_SelectedIndexChanged(null, EventArgs.Empty);

                tbSMSContent.Text = _mailSmsInfo.SMSContent;

                if (string.IsNullOrEmpty(tbSMSContent.Text))
                {
                    tbSMSContent.Text = MessageManager.GetSmsContent(styleInfoList);
                }
            }
        }
Ejemplo n.º 8
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _tableStyleId      = Body.GetQueryInt("TableStyleID");
            _relatedIdentities = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("RelatedIdentities"));
            if (_relatedIdentities.Count == 0)
            {
                _relatedIdentities.Add(0);
            }
            _tableName     = Body.GetQueryString("TableName");
            _attributeName = Body.GetQueryString("AttributeName");
            _tableStyle    = ETableStyleUtils.GetEnumType(Body.GetQueryString("TableStyle"));
            _redirectUrl   = StringUtils.ValueFromUrl(Body.GetQueryString("RedirectUrl"));

            _styleInfo = _tableStyleId != 0 ? BaiRongDataProvider.TableStyleDao.GetTableStyleInfo(_tableStyleId) : TableStyleManager.GetTableStyleInfo(_tableStyle, _tableName, _attributeName, _relatedIdentities);

            if (!IsPostBack)
            {
                RblIsVisible.Items[0].Value = true.ToString();
                RblIsVisible.Items[1].Value = false.ToString();

                RblIsSingleLine.Items[0].Value = true.ToString();
                RblIsSingleLine.Items[1].Value = false.ToString();

                RblIsFormatString.Items[0].Value = true.ToString();
                RblIsFormatString.Items[1].Value = false.ToString();

                DdlIsHorizontal.Items[0].Value = true.ToString();
                DdlIsHorizontal.Items[1].Value = false.ToString();

                EInputTypeUtils.AddListItems(DdlInputType);

                var arraylist = DataProvider.RelatedFieldDao.GetRelatedFieldInfoArrayList(PublishmentSystemId);
                foreach (RelatedFieldInfo rfInfo in arraylist)
                {
                    var listItem = new ListItem(rfInfo.RelatedFieldName, rfInfo.RelatedFieldID.ToString());
                    DdlRelatedFieldId.Items.Add(listItem);
                }

                ERelatedFieldStyleUtils.AddListItems(DdlRelatedFieldStyle);

                if (_styleInfo.TableStyleId != 0 || _attributeName == "IsHot" || _attributeName == "IsRecommend" || _attributeName == "IsColor" || _attributeName == "IsTop")
                {
                    DdlItemType.SelectedValue = false.ToString();
                }
                else
                {
                    DdlItemType.SelectedValue = true.ToString();
                }

                TbAttributeName.Text = _styleInfo.AttributeName;
                TbDisplayName.Text   = _styleInfo.DisplayName;
                TbHelpText.Text      = _styleInfo.HelpText;
                ControlUtils.SelectListItems(DdlInputType, _styleInfo.InputType);
                ControlUtils.SelectListItems(RblIsVisible, _styleInfo.IsVisible.ToString());
                ControlUtils.SelectListItems(RblIsSingleLine, _styleInfo.IsSingleLine.ToString());
                ControlUtils.SelectListItems(RblIsFormatString, _styleInfo.Additional.IsFormatString.ToString());
                TbDefaultValue.Text           = _styleInfo.DefaultValue;
                DdlIsHorizontal.SelectedValue = _styleInfo.IsHorizontal.ToString();
                TbColumns.Text = _styleInfo.Additional.Columns.ToString();

                ControlUtils.SelectListItems(DdlRelatedFieldId, _styleInfo.Additional.RelatedFieldId.ToString());
                ControlUtils.SelectListItems(DdlRelatedFieldStyle, _styleInfo.Additional.RelatedFieldStyle);

                TbHeight.Text = _styleInfo.Additional.Height.ToString();
                TbWidth.Text  = _styleInfo.Additional.Width;

                var styleItems = _styleInfo.StyleItems ?? BaiRongDataProvider.TableStyleDao.GetStyleItemInfoList(_styleInfo.TableStyleId);
                TbItemCount.Text        = styleItems.Count.ToString();
                RptItems.DataSource     = TableStyleManager.GetStyleItemDataSet(styleItems.Count, styleItems);
                RptItems.ItemDataBound += MyRepeater_ItemDataBound;
                RptItems.DataBind();
                if (RptItems.Items.Count > 0)
                {
                    DdlItemType.SelectedValue = false.ToString();
                }
            }

            ReFresh(null, EventArgs.Empty);
        }
Ejemplo n.º 9
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _tableStyleId  = Body.GetQueryInt("TableStyleID");
            _tableName     = Body.GetQueryString("TableName");
            _attributeName = Body.GetQueryString("AttributeName");
            _tableStyle    = ETableStyleUtils.GetEnumType(Body.GetQueryString("TableStyle"));
            _redirectUrl   = StringUtils.ValueFromUrl(Body.GetQueryString("RedirectUrl"));

            _styleInfo = _tableStyleId != 0 ? BaiRongDataProvider.TableStyleDao.GetTableStyleInfo(_tableStyleId) : TableStyleManager.GetTableStyleInfo(_tableStyle, _tableName, _attributeName, new List <int> {
                0
            });

            if (!IsPostBack)
            {
                rblIsVisible.Items[0].Value = true.ToString();
                rblIsVisible.Items[1].Value = false.ToString();

                rblIsSingleLine.Items[0].Value = true.ToString();
                rblIsSingleLine.Items[1].Value = false.ToString();

                rblIsFormatString.Items[0].Value = true.ToString();
                rblIsFormatString.Items[1].Value = false.ToString();

                ddlIsHorizontal.Items[0].Value = true.ToString();
                ddlIsHorizontal.Items[1].Value = false.ToString();

                EInputTypeUtils.AddListItems(ddlInputType);

                if (_styleInfo.TableStyleId != 0 || _attributeName == "IsHot" || _attributeName == "IsRecommend" || _attributeName == "IsColor" || _attributeName == "IsTop")
                {
                    ddlItemType.SelectedValue = false.ToString();
                }
                else
                {
                    ddlItemType.SelectedValue = true.ToString();
                }

                tbAttributeName.Text = _styleInfo.AttributeName;
                tbDisplayName.Text   = _styleInfo.DisplayName;
                tbHelpText.Text      = _styleInfo.HelpText;
                ControlUtils.SelectListItems(ddlInputType, _styleInfo.InputType);
                ControlUtils.SelectListItems(rblIsVisible, _styleInfo.IsVisible.ToString());
                ControlUtils.SelectListItems(rblIsSingleLine, _styleInfo.IsSingleLine.ToString());
                ControlUtils.SelectListItems(rblIsFormatString, _styleInfo.Additional.IsFormatString.ToString());
                tbDefaultValue.Text           = _styleInfo.DefaultValue;
                ddlIsHorizontal.SelectedValue = _styleInfo.IsHorizontal.ToString();
                tbColumns.Text = _styleInfo.Additional.Columns.ToString();

                tbHeight.Text = _styleInfo.Additional.Height.ToString();
                tbWidth.Text  = _styleInfo.Additional.Width;

                var styleItems = _styleInfo.StyleItems ?? BaiRongDataProvider.TableStyleDao.GetStyleItemInfoList(_styleInfo.TableStyleId);
                tbItemCount.Text          = styleItems.Count.ToString();
                MyRepeater.DataSource     = TableStyleManager.GetStyleItemDataSet(styleItems.Count, styleItems);
                MyRepeater.ItemDataBound += MyRepeater_ItemDataBound;
                MyRepeater.DataBind();
                if (MyRepeater.Items.Count > 0)
                {
                    ddlItemType.SelectedValue = false.ToString();
                }
            }

            ReFresh(null, EventArgs.Empty);
        }
Ejemplo n.º 10
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemID");

            _relatedIdentity = Body.GetQueryInt("RelatedIdentity");
            _isList          = Body.GetQueryBool("IsList");
            if (Body.GetQueryBool("IsContent"))
            {
                var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, _relatedIdentity);
                _tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, nodeInfo);
            }
            else
            {
                _tableStyle = ETableStyleUtils.GetEnumType(Body.GetQueryString("TableStyle"));
            }

            if (_tableStyle == ETableStyle.Channel)
            {
                var displayAttributes = PublishmentSystemInfo.Additional.ChannelDisplayAttributes;
                if (!_isList)
                {
                    displayAttributes = PublishmentSystemInfo.Additional.ChannelEditAttributes;
                }

                if (!IsPostBack)
                {
                    //添加默认属性
                    var listitem = new ListItem("栏目名称", NodeAttribute.ChannelName);
                    if (CompareUtils.Contains(displayAttributes, NodeAttribute.ChannelName))
                    {
                        listitem.Selected = true;
                    }
                    DisplayAttributeCheckBoxList.Items.Add(listitem);

                    listitem = new ListItem("栏目索引", NodeAttribute.ChannelIndex);
                    if (CompareUtils.Contains(displayAttributes, NodeAttribute.ChannelIndex))
                    {
                        listitem.Selected = true;
                    }
                    DisplayAttributeCheckBoxList.Items.Add(listitem);

                    listitem = new ListItem("生成页面路径", NodeAttribute.FilePath);
                    if (CompareUtils.Contains(displayAttributes, NodeAttribute.FilePath))
                    {
                        listitem.Selected = true;
                    }
                    DisplayAttributeCheckBoxList.Items.Add(listitem);

                    if (!_isList)
                    {
                        listitem = new ListItem("栏目图片地址", NodeAttribute.ImageUrl);
                        if (CompareUtils.Contains(displayAttributes, NodeAttribute.ImageUrl))
                        {
                            listitem.Selected = true;
                        }
                        DisplayAttributeCheckBoxList.Items.Add(listitem);

                        listitem = new ListItem("栏目正文", NodeAttribute.Content);
                        if (CompareUtils.Contains(displayAttributes, NodeAttribute.Content))
                        {
                            listitem.Selected = true;
                        }
                        DisplayAttributeCheckBoxList.Items.Add(listitem);

                        listitem = new ListItem("外部链接", NodeAttribute.LinkUrl);
                        if (CompareUtils.Contains(displayAttributes, NodeAttribute.LinkUrl))
                        {
                            listitem.Selected = true;
                        }
                        DisplayAttributeCheckBoxList.Items.Add(listitem);

                        listitem = new ListItem("链接类型", NodeAttribute.LinkUrl);
                        if (CompareUtils.Contains(displayAttributes, NodeAttribute.LinkUrl))
                        {
                            listitem.Selected = true;
                        }
                        DisplayAttributeCheckBoxList.Items.Add(listitem);

                        listitem = new ListItem("栏目模版", NodeAttribute.ChannelTemplateId);
                        if (CompareUtils.Contains(displayAttributes, NodeAttribute.ChannelTemplateId))
                        {
                            listitem.Selected = true;
                        }
                        DisplayAttributeCheckBoxList.Items.Add(listitem);

                        listitem = new ListItem("内容模版", NodeAttribute.ContentTemplateId);
                        if (CompareUtils.Contains(displayAttributes, NodeAttribute.ContentTemplateId))
                        {
                            listitem.Selected = true;
                        }
                        DisplayAttributeCheckBoxList.Items.Add(listitem);

                        listitem = new ListItem("关键字列表", NodeAttribute.Keywords);
                        if (CompareUtils.Contains(displayAttributes, NodeAttribute.Keywords))
                        {
                            listitem.Selected = true;
                        }
                        DisplayAttributeCheckBoxList.Items.Add(listitem);

                        listitem = new ListItem("页面描述", NodeAttribute.Description);
                        if (CompareUtils.Contains(displayAttributes, NodeAttribute.Description))
                        {
                            listitem.Selected = true;
                        }
                        DisplayAttributeCheckBoxList.Items.Add(listitem);
                    }

                    listitem = new ListItem("栏目组", NodeAttribute.ChannelGroupNameCollection);
                    if (CompareUtils.Contains(displayAttributes, NodeAttribute.ChannelGroupNameCollection))
                    {
                        listitem.Selected = true;
                    }
                    DisplayAttributeCheckBoxList.Items.Add(listitem);

                    var styleInfoList = TableStyleManager.GetTableStyleInfoList(_tableStyle, DataProvider.NodeDao.TableName, _relatedIdentities);

                    foreach (var styleInfo in styleInfoList)
                    {
                        if (styleInfo.IsVisible == false)
                        {
                            continue;
                        }
                        listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);

                        if (CompareUtils.Contains(displayAttributes, styleInfo.AttributeName))
                        {
                            listitem.Selected = true;
                        }

                        DisplayAttributeCheckBoxList.Items.Add(listitem);
                    }

                    if (string.IsNullOrEmpty(displayAttributes))
                    {
                        if (!_isList)
                        {
                            foreach (ListItem item in DisplayAttributeCheckBoxList.Items)
                            {
                                item.Selected = true;
                            }
                        }
                        else
                        {
                            ControlUtils.SelectListItems(DisplayAttributeCheckBoxList, NodeAttribute.ChannelName, NodeAttribute.ChannelIndex);
                        }
                    }
                }
            }
            else if (ETableStyleUtils.IsContent(_tableStyle))
            {
                var nodeInfo  = NodeManager.GetNodeInfo(PublishmentSystemId, _relatedIdentity);
                var tableName = NodeManager.GetTableName(PublishmentSystemInfo, nodeInfo);
                _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, _relatedIdentity);
                var attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(nodeInfo.Additional.ContentAttributesOfDisplay);

                if (!IsPostBack)
                {
                    var styleInfoList            = TableStyleManager.GetTableStyleInfoList(_tableStyle, tableName, _relatedIdentities);
                    var columnTableStyleInfoList = ContentUtility.GetColumnTableStyleInfoList(PublishmentSystemInfo, _tableStyle, styleInfoList);
                    foreach (var styleInfo in columnTableStyleInfoList)
                    {
                        if (styleInfo.AttributeName == ContentAttribute.Title)
                        {
                            continue;
                        }
                        var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);

                        if (_isList)
                        {
                            if (attributesOfDisplay.Contains(styleInfo.AttributeName))
                            {
                                listitem.Selected = true;
                            }
                        }
                        else
                        {
                            if (styleInfo.IsVisible)
                            {
                                listitem.Selected = true;
                            }
                        }

                        DisplayAttributeCheckBoxList.Items.Add(listitem);
                    }
                }
            }
            else if (_tableStyle == ETableStyle.InputContent)
            {
                var inputInfo = DataProvider.InputDao.GetInputInfo(_relatedIdentity);
                _relatedIdentities = RelatedIdentities.GetRelatedIdentities(_tableStyle, PublishmentSystemId, _relatedIdentity);

                if (!IsPostBack)
                {
                    var styleInfoList = TableStyleManager.GetTableStyleInfoList(_tableStyle, DataProvider.InputContentDao.TableName, _relatedIdentities);

                    foreach (var styleInfo in styleInfoList)
                    {
                        var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);

                        if (_isList)
                        {
                            if (styleInfo.IsVisibleInList)
                            {
                                listitem.Selected = true;
                            }
                        }
                        else
                        {
                            if (styleInfo.IsVisible)
                            {
                                listitem.Selected = true;
                            }
                        }

                        DisplayAttributeCheckBoxList.Items.Add(listitem);
                    }
                }
            }
        }
Ejemplo n.º 11
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _exportType = Body.GetQueryString("ExportType");

            if (!IsPostBack)
            {
                var isExport = true;
                var fileName = string.Empty;
                try
                {
                    if (_exportType == ExportTypeTrackerHour)
                    {
                        fileName = ExportTrackingHours();
                    }
                    else if (_exportType == ExportTypeTrackerDay)
                    {
                        fileName = ExportTrackingDays();
                    }
                    else if (_exportType == ExportTypeTrackerMonth)
                    {
                        fileName = ExportTrackingMonths();
                    }
                    else if (_exportType == ExportTypeTrackerYear)
                    {
                        fileName = ExportTrackingYears();
                    }
                    else if (_exportType == ExportTypeTrackerContent)
                    {
                        var startDateString = Body.GetQueryString("StartDateString");
                        var endDateString   = Body.GetQueryString("EndDateString");
                        var nodeId          = Body.GetQueryInt("NodeID");
                        var contentId       = Body.GetQueryInt("ContentID");
                        var totalNum        = Body.GetQueryInt("TotalNum");
                        var isDelete        = Body.GetQueryBool("IsDelete");
                        fileName = ExportTrackingContents(startDateString, endDateString, nodeId, contentId, totalNum, isDelete);
                    }
                    else if (_exportType == ExportTypeInputContent)
                    {
                        var inputId = Body.GetQueryInt("InputID");
                        fileName = ExportInputContent(inputId);
                    }
                    else if (_exportType == ExportTypeComment)
                    {
                        var nodeId    = Body.GetQueryInt("NodeID");
                        var contentId = Body.GetQueryInt("ContentID");
                        fileName = ExportComment(nodeId, contentId);
                    }
                    else if (_exportType == ExportTypeGatherRule)
                    {
                        var gatherRuleNameArrayList = TranslateUtils.StringCollectionToStringList(Body.GetQueryString("GatherRuleNameCollection"));
                        fileName = ExportGatherRule(gatherRuleNameArrayList);
                    }
                    else if (_exportType == ExportTypeInput)
                    {
                        var inputId = Body.GetQueryInt("InputID");
                        fileName = ExportInput(inputId);
                    }
                    else if (_exportType == ExportTypeRelatedField)
                    {
                        var relatedFieldId = Body.GetQueryInt("RelatedFieldID");
                        fileName = ExportRelatedField(relatedFieldId);
                    }
                    else if (_exportType == ExportTypeTagStyle)
                    {
                        var styleId = Body.GetQueryInt("StyleID");
                        fileName = ExportTagStyle(styleId);
                    }
                    else if (_exportType == ExportTypeContentZip)
                    {
                        var nodeId = Body.GetQueryInt("NodeID");
                        var contentIdCollection = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("ContentIDCollection"));
                        var isPeriods           = Body.GetQueryBool("isPeriods");
                        var startDate           = Body.GetQueryString("startDate");
                        var endDate             = Body.GetQueryString("endDate");
                        var checkedState        = ETriStateUtils.GetEnumType(Body.GetQueryString("checkedState"));
                        isExport = ExportContentZip(nodeId, contentIdCollection, isPeriods, startDate, endDate, checkedState, out fileName);
                    }
                    else if (_exportType == ExportTypeContentAccess)
                    {
                        var nodeId = Body.GetQueryInt("NodeID");
                        var contentIdCollection = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("ContentIDCollection"));
                        var displayAttributes   = TranslateUtils.StringCollectionToStringList(Body.GetQueryString("DisplayAttributes"));
                        var isPeriods           = Body.GetQueryBool("isPeriods");
                        var startDate           = Body.GetQueryString("startDate");
                        var endDate             = Body.GetQueryString("endDate");
                        var checkedState        = ETriStateUtils.GetEnumType(Body.GetQueryString("checkedState"));
                        isExport = ExportContentAccess(nodeId, contentIdCollection, displayAttributes, isPeriods, startDate, endDate, checkedState, out fileName);
                    }
                    else if (_exportType == ExportTypeContentExcel)
                    {
                        var nodeId = Body.GetQueryInt("NodeID");
                        var contentIdCollection = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("ContentIDCollection"));
                        var displayAttributes   = TranslateUtils.StringCollectionToStringList(Body.GetQueryString("DisplayAttributes"));
                        var isPeriods           = Body.GetQueryBool("isPeriods");
                        var startDate           = Body.GetQueryString("startDate");
                        var endDate             = Body.GetQueryString("endDate");
                        var checkedState        = ETriStateUtils.GetEnumType(Body.GetQueryString("checkedState"));
                        ExportContentExcel(nodeId, contentIdCollection, displayAttributes, isPeriods, startDate, endDate, checkedState, out fileName);
                    }
                    else if (_exportType == ExportTypeChannel)
                    {
                        var nodeIdList = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("ChannelIDCollection"));
                        fileName = ExportChannel(nodeIdList);
                    }
                    else if (_exportType == ExportTypeSingleTableStyle)
                    {
                        var tableStyle      = ETableStyleUtils.GetEnumType(Body.GetQueryString("TableStyle"));
                        var tableName       = Body.GetQueryString("TableName");
                        var relatedIdentity = Body.GetQueryInt("RelatedIdentity");
                        fileName = ExportSingleTableStyle(tableStyle, tableName, relatedIdentity);
                    }

                    if (isExport)
                    {
                        var link     = new HyperLink();
                        var filePath = PathUtils.GetTemporaryFilesPath(fileName);
                        link.NavigateUrl = ActionsDownload.GetUrl(PublishmentSystemInfo.Additional.ApiUrl, filePath);
                        link.Text        = "下载";
                        var successMessage = "成功导出文件!&nbsp;&nbsp;" + ControlUtils.GetControlRenderHtml(link);
                        SuccessMessage(successMessage);
                    }
                    else
                    {
                        FailMessage("导出失败,所选条件没有匹配内容,请重新选择条件导出内容");
                    }
                }
                catch (Exception ex)
                {
                    var failedMessage = "文件导出失败!<br/><br/>原因为:" + ex.Message;
                    FailMessage(ex, failedMessage);
                }
            }
        }
Ejemplo n.º 12
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _relatedIdentity   = string.IsNullOrEmpty(Body.GetQueryString("RelatedIdentity")) ? PublishmentSystemId : Body.GetQueryInt("RelatedIdentity");
            _tableStyle        = ETableStyleUtils.GetEnumType(Body.GetQueryString("TableStyle"));
            _tableName         = Body.GetQueryString("TableName");
            _itemId            = Body.GetQueryInt("itemID");
            _relatedIdentities = RelatedIdentities.GetRelatedIdentities(_tableStyle, PublishmentSystemId, _relatedIdentity);
            _attributeNames    = TableManager.GetAttributeNameList(_tableStyle, _tableName);

            if (IsPostBack)
            {
                return;
            }

            if (_tableStyle == ETableStyle.InputContent)
            {
                BreadCrumb(AppManager.Cms.LeftMenu.IdFunction, AppManager.Cms.LeftMenu.Function.IdInput, "提交表单管理", AppManager.Cms.Permission.WebSite.Input);
            }
            else if (_tableStyle == ETableStyle.Site)
            {
                BreadCrumb(AppManager.Cms.LeftMenu.IdConfigration, "站点属性设置",
                           AppManager.Cms.Permission.WebSite.Configration);
            }
            else
            {
                BreadCrumb(AppManager.Cms.LeftMenu.IdConfigration, AppManager.Cms.LeftMenu.Configuration.IdConfigurationContentModel, "虚拟字段管理",
                           AppManager.Cms.Permission.WebSite.Configration);
            }

            //删除样式
            if (Body.IsQueryExists("DeleteStyle"))
            {
                DeleteStyle();
            }
            else if (Body.IsQueryExists("SetTaxis"))
            {
                SetTaxis();
            }

            if (_tableStyle == ETableStyle.BackgroundContent)
            {
                var urlModel = PageContentModel.GetRedirectUrl(PublishmentSystemId);
                btnReturn.Attributes.Add("onclick", $"location.href='{urlModel}';return false;");
            }
            else if (_tableStyle == ETableStyle.InputContent)
            {
                btnReturn.Attributes.Add("onclick", $"location.href='{PageInput.GetRedirectUrl(PublishmentSystemId)}';return false;");
            }
            else if (_tableStyle == ETableStyle.GovInteractContent)
            {
                var urlReturn = PageGovInteractListAll.GetRedirectUrl(PublishmentSystemId, 0);
                btnReturn.Attributes.Add("onclick", $"location.href='{urlReturn}';return false;");
            }
            else if (_tableStyle == ETableStyle.Site)
            {
                btnReturn.Attributes.Add("onclick", $"location.href='{PageConfigurationSiteAttributes.GetRedirectUrl(PublishmentSystemId)}';return false;");
            }
            else
            {
                btnReturn.Visible = false;
            }

            var styleInfoList = TableStyleManager.GetTableStyleInfoList(_tableStyle, _tableName, _relatedIdentities);

            dgContents.DataSource     = styleInfoList;
            dgContents.ItemDataBound += dgContents_ItemDataBound;
            dgContents.DataBind();

            var redirectUrl = GetRedirectUrl(PublishmentSystemId, _tableStyle, _tableName, _relatedIdentity, _itemId);

            btnAddStyle.Attributes.Add("onclick", ModalTableStyleAdd.GetOpenWindowString(PublishmentSystemId, 0, _relatedIdentities, _tableName, string.Empty, _tableStyle, redirectUrl));
            btnAddStyles.Attributes.Add("onclick", ModalTableStylesAdd.GetOpenWindowString(PublishmentSystemId, _relatedIdentities, _tableName, _tableStyle, redirectUrl));

            btnImport.Attributes.Add("onclick", ModalTableStyleImport.GetOpenWindowString(_tableName, _tableStyle, PublishmentSystemId, _relatedIdentity));
            btnExport.Attributes.Add("onclick", ModalExportMessage.GetOpenWindowStringToSingleTableStyle(_tableStyle, _tableName, PublishmentSystemId, _relatedIdentity));
        }
Ejemplo n.º 13
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (Page.IsPostBack && Page.IsValid)
            {
                try
                {
                    foreach (var nodeID in _idsDictionary.Keys)
                    {
                        var tableName     = NodeManager.GetTableName(PublishmentSystemInfo, nodeID);
                        var contentIDList = _idsDictionary[nodeID];

                        if (!_isDeleteFromTrash)
                        {
                            if (bool.Parse(RetainFiles.SelectedValue) == false)
                            {
                                DirectoryUtility.DeleteContents(PublishmentSystemInfo, nodeID, contentIDList);
                                SuccessMessage("成功删除内容以及生成页面!");
                            }
                            else
                            {
                                SuccessMessage("成功删除内容,生成页面未被删除!");
                            }

                            if (contentIDList.Count == 1)
                            {
                                var contentID    = contentIDList[0];
                                var contentTitle = BaiRongDataProvider.ContentDao.GetValue(tableName, contentID, ContentAttribute.Title);
                                Body.AddSiteLog(PublishmentSystemId, nodeID, contentID, "删除内容",
                                                $"栏目:{NodeManager.GetNodeNameNavigation(PublishmentSystemId, nodeID)},内容标题:{contentTitle}");
                            }
                            else
                            {
                                Body.AddSiteLog(PublishmentSystemId, "批量删除内容",
                                                $"栏目:{NodeManager.GetNodeNameNavigation(PublishmentSystemId, nodeID)},内容条数:{contentIDList.Count}");
                            }

                            DataProvider.ContentDao.TrashContents(PublishmentSystemId, tableName, contentIDList);

                            //引用内容,需要删除
                            var tableList = BaiRongDataProvider.TableCollectionDao.GetAuxiliaryTableListCreatedInDbByAuxiliaryTableType(EAuxiliaryTableType.BackgroundContent, EAuxiliaryTableType.JobContent, EAuxiliaryTableType.VoteContent);
                            foreach (AuxiliaryTableInfo table in tableList)
                            {
                                var targetContentIdList = BaiRongDataProvider.ContentDao.GetReferenceIdList(table.TableEnName, contentIDList);
                                if (targetContentIdList.Count > 0)
                                {
                                    var targetContentInfo = DataProvider.ContentDao.GetContentInfo(ETableStyleUtils.GetEnumType(table.AuxiliaryTableType.ToString()), table.TableEnName, TranslateUtils.ToInt(targetContentIdList[0].ToString()));
                                    DataProvider.ContentDao.DeleteContents(targetContentInfo.PublishmentSystemId, table.TableEnName, targetContentIdList, targetContentInfo.NodeId);
                                }
                            }

                            CreateManager.CreateContentTrigger(PublishmentSystemId, nodeID);
                        }
                        else
                        {
                            SuccessMessage("成功从回收站清空内容!");
                            DataProvider.ContentDao.DeleteContents(PublishmentSystemId, tableName, contentIDList, nodeID);

                            Body.AddSiteLog(PublishmentSystemId, "从回收站清空内容", $"内容条数:{contentIDList.Count}");
                        }
                    }


                    AddWaitAndRedirectScript(_returnUrl);
                }
                catch (Exception ex)
                {
                    FailMessage(ex, "删除内容失败!");

                    LogUtils.AddErrorLog(ex);
                }
            }
        }