public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("PublishmentSystemID", "InputName"); var theInputName = Body.GetQueryString("InputName"); _inputInfo = DataProvider.InputDao.GetInputInfo(theInputName, PublishmentSystemId); if (_inputInfo == null) { return; } if (Body.IsQueryExists("Delete") && Body.IsQueryExists("ContentIDCollection")) { var arraylist = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("ContentIDCollection")); try { DataProvider.InputContentDao.Delete(arraylist); Body.AddSiteLog(PublishmentSystemId, "删除提交表单内容", $"提交表单:{_inputInfo.InputName}"); SuccessMessage("删除成功!"); } catch (Exception ex) { FailMessage(ex, "删除失败!"); } } _relatedIdentities = RelatedIdentities.GetRelatedIdentities(ETableStyle.InputContent, PublishmentSystemId, _inputInfo.InputId); _styleInfoList = TableStyleManager.GetTableStyleInfoList(ETableStyle.InputContent, DataProvider.InputContentDao.TableName, _relatedIdentities); var isAnythingVisible = false; foreach (var styleInfo in _styleInfoList) { if (styleInfo.IsVisibleInList) { isAnythingVisible = true; break; } } if (!isAnythingVisible && _styleInfoList != null && _styleInfoList.Count > 0) { _styleInfoList[0].IsVisibleInList = true; } spContents.ControlToPaginate = rptContents; spContents.ItemsPerPage = PublishmentSystemInfo.Additional.PageSize; spContents.SelectCommand = DataProvider.InputContentDao.GetSelectStringOfContentId(_inputInfo.InputId, string.Empty); spContents.SortField = DataProvider.InputContentDao.GetSortFieldName(); spContents.SortMode = SortMode.DESC; rptContents.ItemDataBound += rptContents_ItemDataBound; if (!IsPostBack) { spContents.DataBind(); BreadCrumbWithItemTitle(AppManager.Cms.LeftMenu.IdFunction, AppManager.Cms.LeftMenu.Function.IdInput, "提交表单内容管理", $"{_inputInfo.InputName}({spContents.TotalCount})", AppManager.Cms.Permission.WebSite.Input); var showPopWinString = string.Empty; showPopWinString = ModalInputContentAdd.GetOpenWindowStringToAdd(PublishmentSystemId, _inputInfo.InputId, PageUrl); AddButton.Attributes.Add("onclick", showPopWinString); //this.Delete.Attributes.Add("onclick", "return confirm(\"此操作将删除所选内容,确定吗?\");"); Delete.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert( PageUtils.GetCmsUrl(nameof(PageInputContent), new NameValueCollection { { "PublishmentSystemID", PublishmentSystemId.ToString() }, { "InputName", _inputInfo.InputName }, { "Delete", true.ToString() } }), "ContentIDCollection", "ContentIDCollection", "请选择需要删除的表单内容!", "此操作将删除所选内容,确定删除吗?")); Check.Attributes.Add("onclick", "return confirm(\"此操作将把所选内容设为审核通过,确定吗?\");"); showPopWinString = ModalInputContentTaxis.GetOpenWindowString(PublishmentSystemId, _inputInfo.InputId, PageUrl); TaxisButton.Attributes.Add("onclick", showPopWinString); showPopWinString = ModalSelectColumns.GetOpenWindowStringToInputContent(PublishmentSystemId, _inputInfo.InputId, true); SelectListButton.Attributes.Add("onclick", showPopWinString); showPopWinString = ModalSelectColumns.GetOpenWindowStringToInputContent(PublishmentSystemId, _inputInfo.InputId, false); SelectFormButton.Attributes.Add("onclick", showPopWinString); ImportExcel.Attributes.Add("onclick", ModalInputContentImport.GetOpenWindowString(PublishmentSystemId, _inputInfo.InputId)); ExportExcel.Attributes.Add("onclick", ModalExportMessage.GetOpenWindowStringToInputContent(PublishmentSystemId, _inputInfo.InputId)); var urlReturn = PageInput.GetRedirectUrl(PublishmentSystemId); btnReturn.Attributes.Add("onclick", $"location.href='{urlReturn}';return false;"); if (_styleInfoList != null) { foreach (var styleInfo in _styleInfoList) { if (styleInfo.IsVisibleInList) { ltlColumnHeadRows.Text += $@"<td class=""center"">{styleInfo.DisplayName}</td>"; } } } if (_inputInfo.IsReply) { ltlHeadRowReply.Text = @" <td class=""center"" style=""width:60px;"">是否回复</td> <td class=""center"" style=""width:60px;""> </td> "; } } }
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)); }
public override void Submit_OnClick(object sender, EventArgs e) { var isChanged = false; InputInfo inputInfo; if (Body.IsQueryExists("InputID")) { try { var inputId = Body.GetQueryInt("InputID"); inputInfo = DataProvider.InputDao.GetInputInfo(inputId); if (inputInfo != null) { if (inputInfo.InputName != InputName.Text) { inputInfo.InputName = InputName.Text; } inputInfo.IsChecked = TranslateUtils.ToBool(IsChecked.SelectedValue); inputInfo.IsReply = TranslateUtils.ToBool(IsReply.SelectedValue); inputInfo.Additional.MessageSuccess = MessageSuccess.Text; inputInfo.Additional.MessageFailure = MessageFailure.Text; inputInfo.Additional.IsAnomynous = TranslateUtils.ToBool(IsAnomynous.SelectedValue); inputInfo.Additional.IsSuccessHide = TranslateUtils.ToBool(IsSuccessHide.SelectedValue); inputInfo.Additional.IsSuccessReload = TranslateUtils.ToBool(IsSuccessReload.SelectedValue); inputInfo.Additional.IsCtrlEnter = TranslateUtils.ToBool(IsCtrlEnter.SelectedValue); } DataProvider.InputDao.Update(inputInfo); Body.AddSiteLog(PublishmentSystemId, "修改提交表单", $"提交表单:{inputInfo.InputName}"); isChanged = true; } catch (Exception ex) { FailMessage(ex, "提交表单修改失败!"); } } else { var inputNameArrayList = DataProvider.InputDao.GetInputNameArrayList(PublishmentSystemId); if (inputNameArrayList.IndexOf(InputName.Text) != -1) { FailMessage("提交表单添加失败,提交表单名称已存在!"); } else { try { inputInfo = new InputInfo { InputName = InputName.Text, PublishmentSystemId = PublishmentSystemId, IsChecked = TranslateUtils.ToBool(IsChecked.SelectedValue), IsReply = TranslateUtils.ToBool(IsReply.SelectedValue) }; inputInfo.Additional.MessageSuccess = MessageSuccess.Text; inputInfo.Additional.MessageFailure = MessageFailure.Text; inputInfo.Additional.IsAnomynous = TranslateUtils.ToBool(IsAnomynous.SelectedValue); inputInfo.Additional.IsSuccessHide = TranslateUtils.ToBool(IsSuccessHide.SelectedValue); inputInfo.Additional.IsSuccessReload = TranslateUtils.ToBool(IsSuccessReload.SelectedValue); inputInfo.Additional.IsCtrlEnter = TranslateUtils.ToBool(IsCtrlEnter.SelectedValue); DataProvider.InputDao.Insert(inputInfo); Body.AddSiteLog(PublishmentSystemId, "添加提交表单", $"提交表单:{inputInfo.InputName}"); isChanged = true; } catch (Exception ex) { FailMessage(ex, "提交表单添加失败!"); } } } if (isChanged) { if (_isPreview) { PageUtils.CloseModalPage(Page); } else { PageUtils.CloseModalPageAndRedirect(Page, PageInput.GetRedirectUrl(PublishmentSystemId)); } } }
public override void Submit_OnClick(object sender, EventArgs e) { var isChanged = false; InputInfo inputInfo; if (Body.IsQueryExists("InputID")) { try { var inputId = Body.GetQueryInt("InputID"); inputInfo = DataProvider.InputDao.GetInputInfo(inputId); if (inputInfo != null) { if (inputInfo.InputName != TbInputName.Text) { inputInfo.InputName = TbInputName.Text; } inputInfo.IsChecked = TranslateUtils.ToBool(RblIsChecked.SelectedValue); inputInfo.IsReply = TranslateUtils.ToBool(RblIsReply.SelectedValue); inputInfo.Additional.IsAnomynous = TranslateUtils.ToBool(RblIsAnomynous.SelectedValue); inputInfo.Additional.IsAdministratorSmsNotify = TranslateUtils.ToBool(RblIsAdministratorSmsNotify.SelectedValue); inputInfo.Additional.AdministratorSmsNotifyTplId = TbAdministratorSmsNotifyTplId.Text; inputInfo.Additional.AdministratorSmsNotifyKeys = ControlUtils.GetSelectedListControlValueCollection(CblAdministratorSmsNotifyKeys); inputInfo.Additional.AdministratorSmsNotifyMobile = TbAdministratorSmsNotifyMobile.Text; DataProvider.InputDao.Update(inputInfo); Body.AddSiteLog(PublishmentSystemId, "修改提交表单", $"提交表单:{inputInfo.InputName}"); } isChanged = true; } catch (Exception ex) { FailMessage(ex, "提交表单修改失败!"); } } else { var inputNameList = DataProvider.InputDao.GetInputNameList(PublishmentSystemId); if (inputNameList.IndexOf(TbInputName.Text) != -1) { FailMessage("提交表单添加失败,提交表单名称已存在!"); } else { try { inputInfo = new InputInfo { InputName = TbInputName.Text, PublishmentSystemId = PublishmentSystemId, IsChecked = TranslateUtils.ToBool(RblIsChecked.SelectedValue), IsReply = TranslateUtils.ToBool(RblIsReply.SelectedValue) }; inputInfo.Additional.IsAnomynous = TranslateUtils.ToBool(RblIsAnomynous.SelectedValue); DataProvider.InputDao.Insert(inputInfo); Body.AddSiteLog(PublishmentSystemId, "添加提交表单", $"提交表单:{inputInfo.InputName}"); isChanged = true; } catch (Exception ex) { FailMessage(ex, "提交表单添加失败!"); } } } if (isChanged) { if (_isPreview) { PageUtils.CloseModalPage(Page); } else { PageUtils.CloseModalPageAndRedirect(Page, PageInput.GetRedirectUrl(PublishmentSystemId)); } } }