public int Insert(KeywordResourceInfo resourceInfo) { var resourceID = 0; var sqlString = "INSERT INTO wx_KeywordResource (PublishmentSystemID, KeywordID, Title, ImageUrl, Summary, ResourceType, IsShowCoverPic, Content, NavigationUrl, ChannelID, ContentID, Taxis) VALUES (@PublishmentSystemID, @KeywordID, @Title, @ImageUrl, @Summary, @ResourceType, @IsShowCoverPic, @Content, @NavigationUrl, @ChannelID, @ContentID, @Taxis)"; var taxis = GetMaxTaxis(resourceInfo.KeywordID) + 1; var parms = new IDataParameter[] { GetParameter(PARM_PUBLISHMENT_SYSTEM_ID, EDataType.Integer, resourceInfo.PublishmentSystemID), GetParameter(PARM_KEYWORD_ID, EDataType.Integer, resourceInfo.KeywordID), GetParameter(PARM_TITLE, EDataType.NVarChar, 255, resourceInfo.Title), GetParameter(PARM_IMAGE_URL, EDataType.VarChar, 200, resourceInfo.ImageUrl), GetParameter(PARM_SUMMARY, EDataType.NVarChar, 255, resourceInfo.Summary), GetParameter(PARM_RESOURCE_TYPE, EDataType.VarChar, 50, EResourceTypeUtils.GetValue(resourceInfo.ResourceType)), GetParameter(PARM_IS_SHOW_COVER_PIC, EDataType.VarChar, 18, resourceInfo.IsShowCoverPic.ToString()), GetParameter(PARM_CONTENT, EDataType.NText, resourceInfo.Content), GetParameter(PARM_NAVIGATION_URL, EDataType.VarChar, 200, resourceInfo.NavigationUrl), GetParameter(PARM_CHANNEL_ID, EDataType.Integer, resourceInfo.ChannelID), GetParameter(PARM_CONTENT_ID, EDataType.Integer, resourceInfo.ContentID), GetParameter(PARM_TAXIS, EDataType.Integer, taxis) }; using (var conn = GetConnection()) { conn.Open(); using (var trans = conn.BeginTransaction()) { try { ExecuteNonQuery(trans, sqlString, parms); resourceID = BaiRongDataProvider.DatabaseDao.GetSequence(trans, "wx_KeywordResource"); trans.Commit(); } catch { trans.Rollback(); throw; } } } return(resourceID); }
public int Insert(KeywordResourceInfo resourceInfo) { var resourceId = 0; var sqlString = "INSERT INTO wx_KeywordResource (PublishmentSystemID, KeywordID, Title, ImageUrl, Summary, ResourceType, IsShowCoverPic, Content, NavigationUrl, ChannelID, ContentID, Taxis) VALUES (@PublishmentSystemID, @KeywordID, @Title, @ImageUrl, @Summary, @ResourceType, @IsShowCoverPic, @Content, @NavigationUrl, @ChannelID, @ContentID, @Taxis)"; var taxis = GetMaxTaxis(resourceInfo.KeywordId) + 1; var parms = new IDataParameter[] { GetParameter(ParmPublishmentSystemId, EDataType.Integer, resourceInfo.PublishmentSystemId), GetParameter(ParmKeywordId, EDataType.Integer, resourceInfo.KeywordId), GetParameter(ParmTitle, EDataType.NVarChar, 255, resourceInfo.Title), GetParameter(ParmImageUrl, EDataType.VarChar, 200, resourceInfo.ImageUrl), GetParameter(ParmSummary, EDataType.NVarChar, 255, resourceInfo.Summary), GetParameter(ParmResourceType, EDataType.VarChar, 50, EResourceTypeUtils.GetValue(resourceInfo.ResourceType)), GetParameter(ParmIsShowCoverPic, EDataType.VarChar, 18, resourceInfo.IsShowCoverPic.ToString()), GetParameter(ParmContent, EDataType.NText, resourceInfo.Content), GetParameter(ParmNavigationUrl, EDataType.VarChar, 200, resourceInfo.NavigationUrl), GetParameter(ParmChannelId, EDataType.Integer, resourceInfo.ChannelId), GetParameter(ParmContentId, EDataType.Integer, resourceInfo.ContentId), GetParameter(ParmTaxis, EDataType.Integer, taxis) }; using (var conn = GetConnection()) { conn.Open(); using (var trans = conn.BeginTransaction()) { try { resourceId = ExecuteNonQueryAndReturnId(trans, sqlString, parms); trans.Commit(); } catch { trans.Rollback(); throw; } } } return(resourceId); }
public KeywordResourceInfo GetFirstResourceInfo(int keywordId) { KeywordResourceInfo resourceInfo = null; var parms = new IDataParameter[] { GetParameter(ParmKeywordId, EDataType.Integer, keywordId) }; using (var rdr = ExecuteReader(SqlSelectFirst, parms)) { if (rdr.Read()) { resourceInfo = new KeywordResourceInfo(rdr.GetInt32(0), rdr.GetInt32(1), rdr.GetInt32(2), rdr.GetValue(3).ToString(), rdr.GetValue(4).ToString(), rdr.GetValue(5).ToString(), EResourceTypeUtils.GetEnumType(rdr.GetValue(6).ToString()), TranslateUtils.ToBool(rdr.GetValue(7).ToString()), rdr.GetValue(8).ToString(), rdr.GetValue(9).ToString(), rdr.GetInt32(10), rdr.GetInt32(11), rdr.GetInt32(12)); } rdr.Close(); } return(resourceInfo); }
public KeywordResourceInfo GetResourceInfo(int resourceID) { KeywordResourceInfo resourceInfo = null; var parms = new IDataParameter[] { GetParameter(PARM_RESOURCE_ID, EDataType.Integer, resourceID) }; using (var rdr = ExecuteReader(SQL_SELECT, parms)) { if (rdr.Read()) { resourceInfo = new KeywordResourceInfo(rdr.GetInt32(0), rdr.GetInt32(1), rdr.GetInt32(2), rdr.GetValue(3).ToString(), rdr.GetValue(4).ToString(), rdr.GetValue(5).ToString(), EResourceTypeUtils.GetEnumType(rdr.GetValue(6).ToString()), TranslateUtils.ToBool(rdr.GetValue(7).ToString()), rdr.GetValue(8).ToString(), rdr.GetValue(9).ToString(), rdr.GetInt32(10), rdr.GetInt32(11), rdr.GetInt32(12)); } rdr.Close(); } return(resourceInfo); }
public void Update(KeywordResourceInfo resourceInfo) { var parms = new IDataParameter[] { GetParameter(ParmPublishmentSystemId, EDataType.Integer, resourceInfo.PublishmentSystemId), GetParameter(ParmKeywordId, EDataType.Integer, resourceInfo.KeywordId), GetParameter(ParmTitle, EDataType.NVarChar, 255, resourceInfo.Title), GetParameter(ParmImageUrl, EDataType.VarChar, 200, resourceInfo.ImageUrl), GetParameter(ParmSummary, EDataType.NVarChar, 255, resourceInfo.Summary), GetParameter(ParmResourceType, EDataType.VarChar, 50, EResourceTypeUtils.GetValue(resourceInfo.ResourceType)), GetParameter(ParmIsShowCoverPic, EDataType.VarChar, 18, resourceInfo.IsShowCoverPic.ToString()), GetParameter(ParmContent, EDataType.NText, resourceInfo.Content), GetParameter(ParmNavigationUrl, EDataType.VarChar, 200, resourceInfo.NavigationUrl), GetParameter(ParmChannelId, EDataType.Integer, resourceInfo.ChannelId), GetParameter(ParmContentId, EDataType.Integer, resourceInfo.ContentId), GetParameter(ParmTaxis, EDataType.Integer, resourceInfo.Taxis), GetParameter(ParmResourceId, EDataType.Integer, resourceInfo.ResourceId) }; ExecuteNonQuery(SqlUpdate, parms); }
public List <KeywordResourceInfo> GetResourceInfoList(int keywordId) { var list = new List <KeywordResourceInfo>(); var parms = new IDataParameter[] { GetParameter(ParmKeywordId, EDataType.Integer, keywordId) }; using (var rdr = ExecuteReader(SqlSelectAll, parms)) { while (rdr.Read()) { var resourceInfo = new KeywordResourceInfo(rdr.GetInt32(0), rdr.GetInt32(1), rdr.GetInt32(2), rdr.GetValue(3).ToString(), rdr.GetValue(4).ToString(), rdr.GetValue(5).ToString(), EResourceTypeUtils.GetEnumType(rdr.GetValue(6).ToString()), TranslateUtils.ToBool(rdr.GetValue(7).ToString()), rdr.GetValue(8).ToString(), rdr.GetValue(9).ToString(), rdr.GetInt32(10), rdr.GetInt32(11), rdr.GetInt32(12)); list.Add(resourceInfo); } rdr.Close(); } return(list); }
public void Update(KeywordResourceInfo resourceInfo) { var parms = new IDataParameter[] { GetParameter(PARM_PUBLISHMENT_SYSTEM_ID, EDataType.Integer, resourceInfo.PublishmentSystemID), GetParameter(PARM_KEYWORD_ID, EDataType.Integer, resourceInfo.KeywordID), GetParameter(PARM_TITLE, EDataType.NVarChar, 255, resourceInfo.Title), GetParameter(PARM_IMAGE_URL, EDataType.VarChar, 200, resourceInfo.ImageUrl), GetParameter(PARM_SUMMARY, EDataType.NVarChar, 255, resourceInfo.Summary), GetParameter(PARM_RESOURCE_TYPE, EDataType.VarChar, 50, EResourceTypeUtils.GetValue(resourceInfo.ResourceType)), GetParameter(PARM_IS_SHOW_COVER_PIC, EDataType.VarChar, 18, resourceInfo.IsShowCoverPic.ToString()), GetParameter(PARM_CONTENT, EDataType.NText, resourceInfo.Content), GetParameter(PARM_NAVIGATION_URL, EDataType.VarChar, 200, resourceInfo.NavigationUrl), GetParameter(PARM_CHANNEL_ID, EDataType.Integer, resourceInfo.ChannelID), GetParameter(PARM_CONTENT_ID, EDataType.Integer, resourceInfo.ContentID), GetParameter(PARM_TAXIS, EDataType.Integer, resourceInfo.Taxis), GetParameter(PARM_RESOURCE_ID, EDataType.Integer, resourceInfo.ResourceID) }; ExecuteNonQuery(SQL_UPDATE, parms); }
public List <KeywordResourceInfo> GetKeywordResourceInfoList(int publishmentSystemID, int keywordID) { var list = new List <KeywordResourceInfo>(); var parms = new IDataParameter[] { GetParameter(PARM_PUBLISHMENT_SYSTEM_ID, EDataType.Integer, publishmentSystemID), GetParameter(PARM_KEYWORD_ID, EDataType.Integer, keywordID) }; using (var rdr = ExecuteReader(SQL_SELECT_ALL, parms)) { while (rdr.Read()) { var resourceInfo = new KeywordResourceInfo(rdr.GetInt32(0), rdr.GetInt32(1), rdr.GetInt32(2), rdr.GetValue(3).ToString(), rdr.GetValue(4).ToString(), rdr.GetValue(5).ToString(), EResourceTypeUtils.GetEnumType(rdr.GetValue(6).ToString()), TranslateUtils.ToBool(rdr.GetValue(7).ToString()), rdr.GetValue(8).ToString(), rdr.GetValue(9).ToString(), rdr.GetInt32(10), rdr.GetInt32(11), rdr.GetInt32(12)); list.Add(resourceInfo); } rdr.Close(); } return(list); }
public override void Submit_OnClick(object sender, EventArgs e) { try { var idsCollection = Request.Form["IDsCollection"]; if (string.IsNullOrEmpty(idsCollection)) { FailMessage("操作失败,请选择需要显示的内容"); return; } if (_isKeywordAdd) { if (_keywordId > 0) { var idsList = TranslateUtils.StringCollectionToStringList(idsCollection); var resourceId = 0; foreach (var ids in idsList) { var nodeId = TranslateUtils.ToInt(ids.Split('_')[0]); var contentId = TranslateUtils.ToInt(ids.Split('_')[1]); var tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, nodeId); var tableName = NodeManager.GetTableName(PublishmentSystemInfo, nodeId); var contentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, tableName, contentId); var resourceInfo = new KeywordResourceInfo(); resourceInfo.ResourceId = 0; resourceInfo.PublishmentSystemId = PublishmentSystemId; resourceInfo.KeywordId = _keywordId; resourceInfo.Title = contentInfo.Title; resourceInfo.ImageUrl = contentInfo.GetExtendedAttribute(BackgroundContentAttribute.ImageUrl); resourceInfo.Summary = MPUtils.GetSummary(contentInfo.GetExtendedAttribute(BackgroundContentAttribute.Summary), contentInfo.GetExtendedAttribute(BackgroundContentAttribute.Content)); resourceInfo.ResourceType = EResourceType.Site; resourceInfo.IsShowCoverPic = false; resourceInfo.Content = contentInfo.GetExtendedAttribute(BackgroundContentAttribute.Content); resourceInfo.NavigationUrl = string.Empty; resourceInfo.ChannelId = contentInfo.NodeId; resourceInfo.ContentId = contentInfo.Id; resourceInfo.Taxis = 0; var id = DataProviderWx.KeywordResourceDao.Insert(resourceInfo); if (resourceId == 0) { resourceId = id; } } var redirectUrl = PageKeywordNewsAdd.GetRedirectUrl(PublishmentSystemId, _keywordId, resourceId, !_isMultiple); PageUtils.CloseModalPageAndRedirect(Page, redirectUrl); } } else { var scripts = string.Empty; if (_isMultiple) { var titleBuilder = new StringBuilder(); var idsList = TranslateUtils.StringCollectionToStringList(idsCollection); foreach (var ids in idsList) { var nodeId = TranslateUtils.ToInt(ids.Split('_')[0]); var contentId = TranslateUtils.ToInt(ids.Split('_')[1]); var tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, nodeId); var tableName = NodeManager.GetTableName(PublishmentSystemInfo, nodeId); var contentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, tableName, contentId); titleBuilder.AppendFormat("{0} <a href='{1}' target='blank'>查看</a><br />", contentInfo.Title, PageUtilityWX.GetContentUrl(PublishmentSystemInfo, contentInfo)); } scripts = $@"window.parent.{_jsMethod}(""{idsCollection}"", ""{titleBuilder}"");"; } else { var nodeId = TranslateUtils.ToInt(idsCollection.Split('_')[0]); var contentId = TranslateUtils.ToInt(idsCollection.Split('_')[1]); var tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, nodeId); var tableName = NodeManager.GetTableName(PublishmentSystemInfo, nodeId); var contentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, tableName, contentId); var imageUrl = contentInfo.GetExtendedAttribute(BackgroundContentAttribute.ImageUrl); var imageSrc = PageUtility.ParseNavigationUrl(PublishmentSystemInfo, imageUrl); var summary = MPUtils.GetSummary(contentInfo.GetExtendedAttribute(BackgroundContentAttribute.Summary), contentInfo.GetExtendedAttribute(BackgroundContentAttribute.Content)); var pageUrl = PageUtilityWX.GetContentUrl(PublishmentSystemInfo, contentInfo); scripts = $@"window.parent.{_jsMethod}(""{contentInfo.Title}"", ""{nodeId}"", ""{contentId}"", ""{pageUrl}"", ""{imageUrl}"", ""{imageSrc}"", ""{summary}"");"; if (Request.QueryString["itemIndex"] != null) { scripts = $@"window.parent.{_jsMethod}({_itemIndex}, ""{contentInfo.Title}"", {nodeId}, {contentId});"; } } PageUtils.CloseModalPageWithoutRefresh(Page, scripts); } } catch (Exception ex) { FailMessage(ex, "失败:" + ex.Message); } }
void rptContents_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { var keywordId = SqlUtils.EvalInt(e.Item.DataItem, "KeywordId"); var keywords = SqlUtils.EvalString(e.Item.DataItem, "Keywords"); var isDisabled = TranslateUtils.ToBool(SqlUtils.EvalString(e.Item.DataItem, "IsDisabled")); var reply = SqlUtils.EvalString(e.Item.DataItem, "Reply"); var matchType = EMatchTypeUtils.GetEnumType(SqlUtils.EvalString(e.Item.DataItem, "MatchType")); var addDate = SqlUtils.EvalDateTime(e.Item.DataItem, "AddDate"); var phSingle = e.Item.FindControl("phSingle") as PlaceHolder; var phMultiple = e.Item.FindControl("phMultiple") as PlaceHolder; var resourceInfoList = DataProviderWx.KeywordResourceDao.GetResourceInfoList(keywordId); phMultiple.Visible = resourceInfoList.Count > 1; phSingle.Visible = !phMultiple.Visible; if (phSingle.Visible) { var resourceInfo = new KeywordResourceInfo(); if (resourceInfoList.Count > 0) { resourceInfo = resourceInfoList[0]; } var ltlSingleTitle = e.Item.FindControl("ltlSingleTitle") as Literal; var ltlSingleKeywords = e.Item.FindControl("ltlSingleKeywords") as Literal; var ltlSingleAddDate = e.Item.FindControl("ltlSingleAddDate") as Literal; var ltlSingleImageUrl = e.Item.FindControl("ltlSingleImageUrl") as Literal; var ltlSingleSummary = e.Item.FindControl("ltlSingleSummary") as Literal; var ltlSingleEditUrl = e.Item.FindControl("ltlSingleEditUrl") as Literal; var ltlSingleDeleteUrl = e.Item.FindControl("ltlSingleDeleteUrl") as Literal; ltlSingleTitle.Text = $@"<a href=""{"javascript:;"}"" target=""_blank"">{resourceInfo.Title}</a>"; ltlSingleKeywords.Text = $@"{keywords + (isDisabled ? "(禁用)" : string.Empty)} <a href=""javascript:;"" onclick=""{ModalKeywordAddNews.GetOpenWindowStringToEdit(PublishmentSystemId, keywordId)}"">修改</a>"; ltlSingleAddDate.Text = addDate.ToShortDateString(); if (!string.IsNullOrEmpty(resourceInfo.ImageUrl)) { ltlSingleImageUrl.Text = $@"<img src=""{PageUtility.ParseNavigationUrl(PublishmentSystemInfo, resourceInfo.ImageUrl)}"" class=""appmsg_thumb"">"; } ltlSingleSummary.Text = MPUtils.GetSummary(resourceInfo.Summary, resourceInfo.Content); ltlSingleEditUrl.Text = $@"<a class=""js_edit"" href=""{PageKeywordNewsAdd.GetRedirectUrl(PublishmentSystemId, keywordId, resourceInfo.ResourceId, phSingle.Visible)}""><i class=""icon18_common edit_gray"">编辑</i></a>"; ltlSingleDeleteUrl.Text = $@"<a class=""js_del no_extra"" href=""{GetRedirectUrl( PublishmentSystemId)}&delete=true&keywordID={keywordId}"" onclick=""javascript:return confirm('此操作将删除图文回复“{keywords}”,确认吗?');""><i class=""icon18_common del_gray"">删除</i></a>"; } else { var resourceInfo = resourceInfoList[0]; resourceInfoList.Remove(resourceInfo); var ltlMultipleKeywords = e.Item.FindControl("ltlMultipleKeywords") as Literal; var ltlMultipleAddDate = e.Item.FindControl("ltlMultipleAddDate") as Literal; var ltlMultipleTitle = e.Item.FindControl("ltlMultipleTitle") as Literal; var ltlMultipleImageUrl = e.Item.FindControl("ltlMultipleImageUrl") as Literal; var rptMultipleContents = e.Item.FindControl("rptMultipleContents") as Repeater; var ltlMultipleEditUrl = e.Item.FindControl("ltlMultipleEditUrl") as Literal; var ltlMultipleDeleteUrl = e.Item.FindControl("ltlMultipleDeleteUrl") as Literal; ltlMultipleKeywords.Text = $@"{keywords + (isDisabled ? "(禁用)" : string.Empty)} <a href=""javascript:;"" onclick=""{ModalKeywordAddNews.GetOpenWindowStringToEdit(PublishmentSystemId, keywordId)}"">修改</a>"; ltlMultipleAddDate.Text = addDate.ToShortDateString(); ltlMultipleTitle.Text = $@"<a href=""{"javascript:;"}"" target=""_blank"">{resourceInfo.Title}</a>"; if (!string.IsNullOrEmpty(resourceInfo.ImageUrl)) { ltlMultipleImageUrl.Text = $@"<img src=""{PageUtility.ParseNavigationUrl(PublishmentSystemInfo, resourceInfo.ImageUrl)}"" class=""appmsg_thumb"">"; } rptMultipleContents.DataSource = resourceInfoList; rptMultipleContents.ItemDataBound += rptMultipleContents_ItemDataBound; rptMultipleContents.DataBind(); ltlMultipleEditUrl.Text = $@"<a class=""js_edit"" href=""{PageKeywordNewsAdd.GetRedirectUrl(PublishmentSystemId, keywordId, resourceInfo.ResourceId, phSingle.Visible)}""><i class=""icon18_common edit_gray"">编辑</i></a>"; ltlMultipleDeleteUrl.Text = $@"<a class=""js_del no_extra"" href=""{GetRedirectUrl( PublishmentSystemId)}&delete=true&keywordID={keywordId}"" onclick=""javascript:return confirm('此操作将删除图文回复“{keywords}”,确认吗?');""><i class=""icon18_common del_gray"">删除</i></a>"; } } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("PublishmentSystemID"); keywordID = TranslateUtils.ToInt(GetQueryString("keywordID")); resourceID = TranslateUtils.ToInt(GetQueryString("resourceID")); isSingle = TranslateUtils.ToBool(GetQueryString("isSingle")); if (Request.QueryString["deleteResource"] != null) { var deleteResourceID = TranslateUtils.ToInt(Request.QueryString["deleteResourceID"]); try { DataProviderWX.KeywordResourceDAO.Delete(deleteResourceID); SuccessDeleteMessage(); } catch (Exception ex) { FailDeleteMessage(ex); } } if (!IsPostBack) { var pageTitle = keywordID == 0 ? "添加关键词图文回复" : "修改关键词图文回复"; ltlPageTitle.Text = pageTitle; BreadCrumb(AppManager.WeiXin.LeftMenu.ID_Accounts, AppManager.WeiXin.LeftMenu.Function.ID_ImageReply, pageTitle, AppManager.WeiXin.Permission.WebSite.ImageReply); phSingle.Visible = isSingle; phMultiple.Visible = !isSingle; if (isSingle) { var resourceInfo = new KeywordResourceInfo(); resourceInfo.ResourceID = 0; resourceInfo.PublishmentSystemID = PublishmentSystemID; resourceInfo.KeywordID = keywordID; resourceInfo.Title = "标题"; resourceInfo.ImageUrl = string.Empty; resourceInfo.Summary = string.Empty; resourceInfo.ResourceType = EResourceType.Content; resourceInfo.IsShowCoverPic = true; resourceInfo.Content = string.Empty; resourceInfo.NavigationUrl = string.Empty; resourceInfo.ChannelID = 0; resourceInfo.ContentID = 0; resourceInfo.Taxis = 0; if (resourceID > 0) { resourceInfo = DataProviderWX.KeywordResourceDAO.GetResourceInfo(resourceID); } ltlSingleTitle.Text = $@"<a href=""javascript:;"">{resourceInfo.Title}</a>"; if (string.IsNullOrEmpty(resourceInfo.ImageUrl)) { ltlSingleImageUrl.Text = @"<i class=""appmsg_thumb default"">封面图片</i>"; } else { ltlSingleImageUrl.Text = $@"<img class=""js_appmsg_thumb"" src=""{PageUtility.ParseNavigationUrl( PublishmentSystemInfo, resourceInfo.ImageUrl)}"">"; } ltlSingleSummary.Text = MPUtils.GetSummary(resourceInfo.Summary, resourceInfo.Content); } else { var resourceInfoList = DataProviderWX.KeywordResourceDAO.GetResourceInfoList(keywordID); var resourceInfo = new KeywordResourceInfo(); resourceInfo.ResourceID = 0; resourceInfo.PublishmentSystemID = PublishmentSystemID; resourceInfo.KeywordID = keywordID; resourceInfo.Title = "标题"; resourceInfo.ImageUrl = string.Empty; resourceInfo.Summary = string.Empty; resourceInfo.ResourceType = EResourceType.Content; resourceInfo.IsShowCoverPic = true; resourceInfo.Content = string.Empty; resourceInfo.NavigationUrl = string.Empty; resourceInfo.ChannelID = 0; resourceInfo.ContentID = 0; resourceInfo.Taxis = 0; if (resourceInfoList.Count <= 1) { resourceInfoList.Add(resourceInfo); } if (resourceInfoList.Count > 1) { resourceInfo = resourceInfoList[0]; resourceInfoList.Remove(resourceInfo); } ltlMultipleTitle.Text = $@"<a href=""javascript:;"">{resourceInfo.Title}</a>"; if (string.IsNullOrEmpty(resourceInfo.ImageUrl)) { ltlMultipleImageUrl.Text = @"<i class=""appmsg_thumb default"">封面图片</i>"; } else { ltlMultipleImageUrl.Text = $@"<img class=""js_appmsg_thumb"" src=""{PageUtility.ParseNavigationUrl( PublishmentSystemInfo, resourceInfo.ImageUrl)}"">"; } ltlMultipleEditUrl.Text = $@"<a class=""icon18_common edit_gray js_edit"" href=""{BackgroundKeywordResourceAdd.GetRedirectUrl( PublishmentSystemID, keywordID, resourceInfo.ResourceID, 1, false)}"" target=""resource""> </a>"; rptMultipleContents.DataSource = resourceInfoList; rptMultipleContents.ItemDataBound += rptMultipleContents_ItemDataBound; rptMultipleContents.DataBind(); ltlItemEditUrl.Text = $@"<a class=""icon18_common edit_gray js_edit"" href=""{BackgroundKeywordResourceAdd.GetRedirectUrl( PublishmentSystemID, keywordID, 0, resourceInfoList.Count + 2, false)}"" target=""resource""> </a>"; } ltlIFrame.Text = $@"<iframe frameborder=""0"" id=""resource"" name=""resource"" width=""100%"" height=""1300"" src=""{BackgroundKeywordResourceAdd .GetRedirectUrl(PublishmentSystemID, keywordID, resourceID, 1, isSingle)}"" scrolling=""no""></iframe>"; } }
public override void Submit_OnClick(object sender, EventArgs e) { if (Page.IsPostBack && Page.IsValid) { try { var resourceInfo = new KeywordResourceInfo(); resourceInfo.PublishmentSystemID = PublishmentSystemID; resourceInfo.KeywordID = keywordID; if (resourceID > 0) { resourceInfo = DataProviderWX.KeywordResourceDAO.GetResourceInfo(resourceID); } resourceInfo.Title = tbTitle.Text; resourceInfo.Taxis = Convert.ToInt32(tbTaxis.Text); resourceInfo.ResourceType = EResourceTypeUtils.GetEnumType(Request.Form["resourceType"]); resourceInfo.ImageUrl = Request.Form["imageUrl"]; resourceInfo.Summary = tbSummary.Text; resourceInfo.IsShowCoverPic = TranslateUtils.ToBool(Request.Form["isShowCoverPic"]); resourceInfo.Content = breContent.Text; resourceInfo.NavigationUrl = tbNavigationUrl.Text; resourceInfo.ChannelID = TranslateUtils.ToInt(Request.Form["channelID"]); resourceInfo.ContentID = TranslateUtils.ToInt(Request.Form["contentID"]); var isError = false; if (resourceInfo.ResourceType == EResourceType.Site) { if (resourceInfo.ChannelID == 0) { FailMessage("图文回复保存失败,请选择需要显示的微网站页面!"); ltlScript.Text += $@"<script>$('.nav a.{EResourceTypeUtils.GetValue(EResourceType.Site)}').click();</script>"; isError = true; } } else if (resourceInfo.ResourceType == EResourceType.Url) { if (string.IsNullOrEmpty(resourceInfo.NavigationUrl)) { FailMessage("图文回复保存失败,请填写需要链接的网址!"); ltlScript.Text += $@"<script>$('.nav a.{EResourceTypeUtils.GetValue(EResourceType.Url)}').click();</script>"; isError = true; } } if (!isError) { if (resourceID > 0) { DataProviderWX.KeywordResourceDAO.Update(resourceInfo); StringUtility.AddLog(PublishmentSystemID, "修改关键词图文回复"); SuccessMessage("关键词图文回复修改成功!"); } else { resourceID = DataProviderWX.KeywordResourceDAO.Insert(resourceInfo); StringUtility.AddLog(PublishmentSystemID, "新增关键词图文回复"); SuccessMessage("关键词图文回复新增成功!"); } FileUtilityWX.CreateWeiXinContent(PublishmentSystemInfo, keywordID, resourceID); var redirectUrl = BackgroundKeywordNewsAdd.GetRedirectUrl(PublishmentSystemID, keywordID, resourceID, isSingle); ltlScript.Text += $@"<script>setTimeout(""parent.redirect('{redirectUrl}')"", 1500);</script>"; } } catch (Exception ex) { FailMessage(ex, "关键词图文回复配置失败!"); } } }