protected void EgvSpecial_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { int specialCategoryId = BasePage.RequestInt32("SpecialCategoryID"); SpecialInfo dataItem = e.Row.DataItem as SpecialInfo; if (dataItem != null) { HyperLink link = e.Row.FindControl("HypTitle") as HyperLink; if (link != null) { link.Text = StringHelper.SubString(dataItem.SpecialName, 20, "..."); link.NavigateUrl = "Special.aspx?Action=Modify&SpecialID=" + dataItem.SpecialId; } if (specialCategoryId == 0) { specialCategoryId = dataItem.SpecialCategoryId; SpecialCategoryInfo specialCategoryInfoById = Special.GetSpecialCategoryInfoById(specialCategoryId); ExtendedHyperLink link2 = e.Row.FindControl("LblSpecialCategoryLink") as ExtendedHyperLink; link2.BeginTag = "<strong>["; link2.Text = specialCategoryInfoById.SpecialCategoryName; link2.EndTag = "]</strong>"; link2.NavigateUrl = "SpecialManage.aspx?SpecialCategoryID=" + specialCategoryId.ToString(); } } } }
protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { string str = BasePage.RequestString("Action", "Add"); if (str == "Modify") { SpecialCategoryInfo specialCategoryInfoById = Special.GetSpecialCategoryInfoById(BasePage.RequestInt32("SpecialCategoryID")); if (!specialCategoryInfoById.IsNull) { this.TxtSpecialCategoryName.Text = specialCategoryInfoById.SpecialCategoryName; this.TxtSpecialCategoryDir.Enabled = false; this.TxtSpecialCategoryDir.Text = specialCategoryInfoById.SpecialCategoryDir; this.FileCSpecialTemplatePath.Text = specialCategoryInfoById.SpecialTemplatePath; this.FileCSearchTemplatePath.Text = specialCategoryInfoById.SearchTemplatePath; this.TxtDescription.Text = specialCategoryInfoById.Description; this.PagePostfix.Value = specialCategoryInfoById.PagePostfix; BasePage.SetSelectedIndexByValue(this.RadlCreatHtml, specialCategoryInfoById.IsCreateHtml.ToString()); BasePage.SetSelectedIndexByValue(this.RadOpenType, specialCategoryInfoById.OpenType.ToString()); this.HdnAction.Value = str; this.HdnSpecialCategoryName.Value = specialCategoryInfoById.SpecialCategoryName; this.HdnOrderId.Value = specialCategoryInfoById.OrderId.ToString(); } } } }
public void RaiseCallbackEvent(string eventArgument) { SpecialInfo specialInfoById = Special.GetSpecialInfoById(DataConverter.CLng(eventArgument)); SpecialCategoryInfo specialCategoryInfoById = Special.GetSpecialCategoryInfoById(specialInfoById.SpecialCategoryId); this.result = specialCategoryInfoById.SpecialCategoryName + ">>" + specialInfoById.SpecialName; }
private void CreateSpecialsCategoryHtml(SpecialCategoryInfo specialCategoryInfo) { TemplateInfo templateInfo = new TemplateInfo(); NameValueCollection values = new NameValueCollection(); values.Add("id", specialCategoryInfo.SpecialCategoryId.ToString()); templateInfo.QueryList = values; templateInfo.RootPath = this.PhysicalApplicationPath; templateInfo.SiteUrl = this.SiteUrl; templateInfo.TemplateContent = Template.GetTemplateContent(specialCategoryInfo.SpecialTemplatePath, this.PhysicalApplicationPath); templateInfo.CurrentPage = 1; templateInfo.PageName = SiteConfig.SiteInfo.VirtualPath + VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.CreateHtmlPath) + specialCategoryInfo.CategoryHtmlPageName; string str = VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.CreateHtmlPath) + specialCategoryInfo.CategoryHtmlPageName; HtmlAbstract.AddHeardRunatServer(templateInfo, templateInfo.PageName); try { FileSystemObject.WriteFile(VirtualPathUtility.AppendTrailingSlash(this.PhysicalApplicationPath) + str, TemplateTransform.GetHtml(templateInfo).TemplateContent); string str2 = (VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteInfo.VirtualPath) + str).Replace("//", "/"); this.CreateMessage = string.Concat(new object[] { "<li>成功生成第", this.CreateCompleted + 1, "个专题类别页,专题类别名:<a target=_blank href=", str2, ">", specialCategoryInfo.SpecialCategoryName, "</a></li>", this.CreateMessage }); } catch { this.CreateMessage = string.Concat(new object[] { "<li>第<font color='red'><b>", this.CreateCompleted + 1, "</b>个专题类别页生成失败</font> 专题类别名:", specialCategoryInfo.SpecialCategoryName, " 标签解析出现异常,跳过生成</li>", this.CreateMessage }); } }
public bool UpdateSpecialCategory(SpecialCategoryInfo specialCategoryInfo) { Parameters parms = new Parameters(); GetSpecialCategoryParameters(specialCategoryInfo, parms); string strSql = "UPDATE PE_SpecialCategory SET SpecialCategoryName = @SpecialCategoryName, SpecialCategoryDir = @SpecialCategoryDir, SpecialTemplatePath = @SpecialTemplatePath, SearchTemplatePath = @SearchTemplatePath, OrderId = @OrderId, OpenType = @OpenType, Description = @Description, IsCreateHtml = @IsCreateHtml, PagePostfix = @PagePostfix, NeedCreateHtml = @NeedCreateHtml WHERE SpecialCategoryID = @SpecialCategoryId"; return(DBHelper.ExecuteSql(strSql, parms)); }
private static void DeleteSpecialCategoryFolder(int specialCategoryId) { SpecialCategoryInfo specialCategoryInfoById = GetSpecialCategoryInfoById(specialCategoryId); string str = VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.CreateHtmlPath) + specialCategoryInfoById.SpecialCategoryDir; string file = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, str); if (FileSystemObject.IsExist(file, FsoMethod.Folder)) { FileSystemObject.Delete(file, FsoMethod.Folder); } }
public bool AddSpecialCategory(SpecialCategoryInfo specialCategoryInfo) { Parameters parms = new Parameters(); specialCategoryInfo.SpecialCategoryId = GetMaxSpecialCategoryId() + 1; specialCategoryInfo.OrderId = GetMaxSpecialCategoryOrderId() + 1; GetSpecialCategoryParameters(specialCategoryInfo, parms); string strSql = "INSERT INTO PE_SpecialCategory(SpecialCategoryID, SpecialCategoryName, SpecialCategoryDir, SpecialTemplatePath, SearchTemplatePath, OrderId, OpenType, PagePostfix, IsCreateHtml, Description, NeedCreateHtml) VALUES (@SpecialCategoryID, @SpecialCategoryName, @SpecialCategoryDir, @SpecialTemplatePath, @SearchTemplatePath, @OrderId, @OpenType, @PagePostfix, @IsCreateHtml, @Description, @NeedCreateHtml)"; return(DBHelper.ExecuteSql(strSql, parms)); }
private static void GetSpecialCategoryParameters(SpecialCategoryInfo specialCategoryInfo, Parameters parms) { parms.AddInParameter("@SpecialCategoryId", DbType.Int32, specialCategoryInfo.SpecialCategoryId); parms.AddInParameter("@SpecialCategoryName", DbType.String, specialCategoryInfo.SpecialCategoryName); parms.AddInParameter("@SpecialCategoryDir", DbType.String, specialCategoryInfo.SpecialCategoryDir); parms.AddInParameter("@SpecialTemplatePath", DbType.String, specialCategoryInfo.SpecialTemplatePath); parms.AddInParameter("@SearchTemplatePath", DbType.String, specialCategoryInfo.SearchTemplatePath); parms.AddInParameter("@OrderId", DbType.Int32, specialCategoryInfo.OrderId); parms.AddInParameter("@OpenType", DbType.Boolean, specialCategoryInfo.OpenType); parms.AddInParameter("@Description", DbType.String, specialCategoryInfo.Description); parms.AddInParameter("@PagePostfix", DbType.String, specialCategoryInfo.PagePostfix); parms.AddInParameter("@IsCreateHtml", DbType.Boolean, specialCategoryInfo.IsCreateHtml); parms.AddInParameter("@NeedCreateHtml", DbType.Boolean, specialCategoryInfo.NeedCreateHtml); }
public override void OnInitTemplatePage(EventArgs e) { int specialId = BasePage.RequestInt32("id"); switch (BasePage.RequestStringToLower("action")) { case "special": this.specialInfo = Special.GetSpecialInfoById(specialId); break; case "specialcategory": this.specialCategoryInfo = Special.GetSpecialCategoryInfoById(specialId); break; } }
protected void EBtnSubmit_Click(object sender, EventArgs e) { if (this.Page.IsValid) { bool flag = true; SpecialCategoryInfo specialCategoryInfo = new SpecialCategoryInfo(); specialCategoryInfo.NeedCreateHtml = false; if (this.HdnAction.Value == "Modify") { specialCategoryInfo.SpecialCategoryId = BasePage.RequestInt32("SpecialCategoryID"); specialCategoryInfo.OrderId = DataConverter.CLng(this.HdnOrderId.Value); specialCategoryInfo.NeedCreateHtml = true; } specialCategoryInfo.SpecialCategoryName = this.TxtSpecialCategoryName.Text; specialCategoryInfo.SpecialCategoryDir = this.TxtSpecialCategoryDir.Text; specialCategoryInfo.SpecialTemplatePath = this.FileCSpecialTemplatePath.Text; specialCategoryInfo.SearchTemplatePath = this.FileCSearchTemplatePath.Text; specialCategoryInfo.OpenType = DataConverter.CBoolean(this.RadOpenType.SelectedValue); specialCategoryInfo.Description = this.TxtDescription.Text; specialCategoryInfo.PagePostfix = this.PagePostfix.Value; specialCategoryInfo.IsCreateHtml = DataConverter.CBoolean(this.RadlCreatHtml.SelectedValue); string text = this.TxtSpecialCategoryName.Text; if (((this.HdnAction.Value == "Modify") && (text != this.HdnSpecialCategoryName.Value)) && Special.ExistsSpecialCategoryName(text)) { AdminPage.WriteErrMsg("<li>系统已经有此专题类别名称,请返回重新填写专题类别名称!</li>"); } if (this.HdnAction.Value == "Modify") { flag = Special.UpdateSpecialCategory(specialCategoryInfo); } else { flag = Special.AddSpecialCategory(specialCategoryInfo); } if (flag) { IncludeFile.CreateIncludeFileByAssociateType(AssociateType.Special); base.Response.Write("<script type='text/javascript'>parent.frames[\"left\"].location.reload();</script>"); AdminPage.WriteSuccessMsg("<li>专题类别信息保存成功!</li>", "SpecialCategoryManage.aspx"); } else { AdminPage.WriteErrMsg("<li>专题类别信息保存失败!</li>", "SpecialCategoryManage.aspx"); } } }
private void InitSpecial() { StringBuilder builder = new StringBuilder(); string specialInfoIds = ""; switch (this.m_SpecialInfoType) { case 1: { int generalId = DataConverter.CLng(HttpContext.Current.Request["GeneralId"]); if (generalId > 0) { specialInfoIds = Special.GetSpecialInfoIds(generalId); } break; } case 2: { int id = DataConverter.CLng(HttpContext.Current.Request["ItemId"]); if (id > 0) { specialInfoIds = CollectionItem.GetInfoById(id).SpecialId; } break; } } if (!string.IsNullOrEmpty(specialInfoIds)) { this.HdnSpecial.Value = specialInfoIds; string[] strArray = specialInfoIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < strArray.Length; i++) { SpecialInfo specialInfoById = Special.GetSpecialInfoById(DataConverter.CLng(strArray[i])); SpecialCategoryInfo specialCategoryInfoById = Special.GetSpecialCategoryInfoById(specialInfoById.SpecialCategoryId); builder.Append("\n<span id='SpecialSpanId" + specialInfoById.SpecialId + "'>"); builder.Append(specialCategoryInfoById.SpecialCategoryName + ">>" + specialInfoById.SpecialName); builder.Append(" <input type='button' class='button' onclick=\"javascript:DelSpecial('" + specialInfoById.SpecialId + "')\" value='删除此专题' /><br /></span>"); } } if (builder.Length <= 0) { builder.Append("<span id='SpecialSpanId0'>无专题<br /></span>"); } this.UlSpecial.InnerHtml = builder.ToString(); }
private static SpecialCategoryInfo SpecialCategoryInfoFromrdr(NullableDataReader rdr) { SpecialCategoryInfo info = new SpecialCategoryInfo(); info.SpecialCategoryId = rdr.GetInt32("SpecialCategoryID"); info.SpecialCategoryDir = rdr.GetString("SpecialCategoryDir"); info.SpecialCategoryName = rdr.GetString("SpecialCategoryName"); info.SpecialTemplatePath = rdr.GetString("SpecialTemplatePath"); info.SearchTemplatePath = rdr.GetString("SearchTemplatePath"); info.OrderId = rdr.GetInt32("OrderId"); info.OpenType = rdr.GetBoolean("OpenType"); info.Description = rdr.GetString("Description"); info.IsCreateHtml = rdr.GetBoolean("IsCreateHtml"); info.PagePostfix = rdr.GetString("PagePostfix"); info.NeedCreateHtml = rdr.GetBoolean("NeedCreateHtml"); return(info); }
protected void EgvSpecialCategory_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { SpecialCategoryInfo dataItem = (SpecialCategoryInfo)e.Row.DataItem; HyperLink link = (HyperLink)e.Row.FindControl("HypSpecialAdd"); HyperLink link2 = (HyperLink)e.Row.FindControl("HypSpecialBathAdd"); HyperLink link3 = (HyperLink)e.Row.FindControl("HypSpecialOrder"); link2.Text = "批量添加专题"; link.Text = "添加专题"; link3.Text = "专题排序"; link.NavigateUrl = "Special.aspx?SpecialCategoryID=" + dataItem.SpecialCategoryId.ToString(); link2.NavigateUrl = "Special.aspx?SpecialCategoryID=" + dataItem.SpecialCategoryId.ToString() + "&Action=add&AddType=BatchSpecial"; link3.NavigateUrl = "SpecialOrder.aspx?SpecialCategoryID=" + dataItem.SpecialCategoryId.ToString(); link.Enabled = RolePermissions.AccessCheck(OperateCode.SpecialManage); link3.Enabled = RolePermissions.AccessCheck(OperateCode.SpecialManage); } }
private bool CreateAndCheckFolderPermission(SpecialCategoryInfo categoryInfo) { string file = VirtualPathUtility.AppendTrailingSlash(this.PhysicalApplicationPath) + VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.CreateHtmlPath) + categoryInfo.SpecialCategoryDir; if (!FileSystemObject.IsExist(file, FsoMethod.Folder)) { try { FileSystemObject.Create(file, FsoMethod.Folder); } catch { string errMsg = string.Concat(new object[] { "专题类别ID为:", categoryInfo.SpecialCategoryId, " ", categoryInfo.SpecialCategoryName, " 生成失败! 失败原因:请检查服务器是否给网站", SiteConfig.SiteOption.CreateHtmlPath, "文件夹写入权限!" }); this.ErrorLog(errMsg); return(false); } } return(true); }
private SpecialInfo GetSpecialInfo() { int specialCategoryId = DataConverter.CLng(this.DropSpecialCategory.SelectedValue); if (specialCategoryId <= 0) { AdminPage.WriteErrMsg("<li>请选择专题所属的类别!</li>", "Special.aspx"); } SpecialInfo info = new SpecialInfo(); SpecialCategoryInfo specialCategoryInfoById = Special.GetSpecialCategoryInfoById(specialCategoryId); info.SpecialCategoryId = specialCategoryId; if (BasePage.RequestString("AddType").CompareTo("BatchSpecial") != 0) { info.SpecialName = this.TxtSpecialName.Text; info.SpecialDir = specialCategoryInfoById.SpecialCategoryDir + "/" + this.TxtSpecialDir.Text; info.SpecialIdentifier = this.TxtSpecialIdentifier.Text; } info.SpecialPic = this.TxtSpecialPic.Text; info.SpecialTips = this.TxtSpecialTips.Text; info.SpecialTemplatePath = this.FileCSpecialTemplatePath.Text; info.SearchTemplatePath = this.FileCSearchTemplatePath.Text; info.IsElite = DataConverter.CBoolean(this.RadlIsElite.SelectedValue); info.OpenType = DataConverter.CLng(this.RadOpenType.SelectedValue); info.Description = this.TxtDescription.Text; info.IsCreateListPage = DataConverter.CBoolean(this.RadlCreatHtml.SelectedValue); info.ListPageSavePathType = (ListPagePathType)Enum.Parse(typeof(ListPagePathType), this.RadlListPageHtmlDirType.SelectedValue); info.ListPagePostfix = this.PagePostfix.Value; int num2 = DataConverter.CLng(this.DropCustomNum.SelectedValue); StringBuilder sb = new StringBuilder(); for (int i = 1; i <= num2; i++) { StringHelper.AppendString(sb, ((TextBox)this.PnlCustomFileds.FindControl("Custom_Content" + i)).Text, "{#$$$#}"); } info.CustomContent = sb.ToString(); info.NeedCreateHtml = false; return(info); }
private string GetSpecialTemplate(int specialid, int specialcategoryid) { string str = ""; if (specialcategoryid > 0) { SpecialCategoryInfo specialCategoryInfoById = Special.GetSpecialCategoryInfoById(specialcategoryid); if (!specialCategoryInfoById.IsNull) { if (!string.IsNullOrEmpty(specialCategoryInfoById.SearchTemplatePath)) { return(specialCategoryInfoById.SearchTemplatePath); } TemplatePage.WriteErrMsg("没有设置专题类别模板!", "Special.aspx"); return(str); } TemplatePage.WriteErrMsg("找不到指定的专题类别!", "Special.aspx"); return(str); } if (specialid > 0) { SpecialInfo specialInfoById = Special.GetSpecialInfoById(specialid); if (!specialInfoById.IsNull) { if (!string.IsNullOrEmpty(specialInfoById.SearchTemplatePath)) { return(specialInfoById.SearchTemplatePath); } TemplatePage.WriteErrMsg("没有设置专题模板!", "Special.aspx"); return(str); } TemplatePage.WriteErrMsg("找不到指定的专题!", "Special.aspx"); return(str); } TemplatePage.WriteErrMsg("没有设置任何专题模板!", "Special.aspx"); return(str); }
protected void EBtnSetOrderId_Click(object sender, EventArgs e) { string str = this.HdnList.Value; if (!string.IsNullOrEmpty(str)) { List <SpecialCategoryInfo> list = new List <SpecialCategoryInfo>(); string[] strArray = str.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < strArray.Length; i++) { SpecialCategoryInfo specialCategoryInfoById = Special.GetSpecialCategoryInfoById(DataConverter.CLng(strArray[i])); if (!specialCategoryInfoById.IsNull) { specialCategoryInfoById.OrderId = i + 1; list.Add(specialCategoryInfoById); } } Special.OrderSpecialCategory(list); this.Repeater1.DataBind(); IncludeFile.CreateIncludeFileByAssociateType(AssociateType.Special); base.Response.Write("<script type='text/javascript'>parent.frames[\"left\"].location.reload();</script>"); AdminPage.WriteSuccessMsg("专题类别排序成功!", "SpecialCategoryOrder.aspx"); } }
private static bool CheckIsNeedCreatHtml(SpecialCategoryInfo categoryInfo) { return(categoryInfo.IsCreateHtml); }
protected void RptContent_ItemDataBound(object sender, RepeaterItemEventArgs e) { if ((e.Item.ItemType == ListItemType.AlternatingItem) || (e.Item.ItemType == ListItemType.Item)) { Literal literal2; StringBuilder builder; FieldInfo dataItem = e.Item.DataItem as FieldInfo; this.InitTabByFieldType(e, dataItem); ExtendedLiteral literal = e.Item.FindControl("LitContentText") as ExtendedLiteral; Panel panel = e.Item.FindControl("PnlContent") as Panel; string status = this.contentDataTable.Rows[0][dataItem.FieldName].ToString(); if (dataItem.FieldType == FieldType.KeywordType) { status = StringHelper.ReplaceChar(this.contentDataTable.Rows[0][dataItem.FieldName].ToString(), '|', ' '); } switch (dataItem.FieldType) { case FieldType.SpecialType: literal2 = new Literal(); builder = new StringBuilder(); if (this.m_GeneralId > 0) { string[] strArray = Special.GetSpecialInfoIds(this.m_GeneralId).Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < strArray.Length; i++) { SpecialInfo specialInfoById = Special.GetSpecialInfoById(DataConverter.CLng(strArray[i])); SpecialCategoryInfo specialCategoryInfoById = Special.GetSpecialCategoryInfoById(specialInfoById.SpecialCategoryId); builder.Append("\n<span>"); builder.Append(DataSecurity.HtmlEncode(specialCategoryInfoById.SpecialCategoryName) + ">>" + DataSecurity.HtmlEncode(specialInfoById.SpecialName)); builder.Append("<br /></span>"); } } break; case FieldType.StatusType: literal.Text = this.GetStatusShow(status); return; case FieldType.ContentType: literal.BeginTag = "<iframe marginwidth='0' marginheight='0' frameborder='0' name='ContentPreview' width='650px' height='500px' src='ContentPreview.aspx?GeneralID=" + this.m_GeneralId.ToString() + "&fieldName=" + base.Server.UrlEncode(dataItem.FieldName) + "'></iframe>"; return; case FieldType.NodeType: literal.BeginTag = EasyOne.Contents.Nodes.ShowNodeNavigation(DataConverter.CLng(status)); return; case FieldType.InfoType: { Literal child = new Literal(); StringBuilder builder2 = new StringBuilder(); if (this.m_GeneralId > 0) { foreach (CommonModelInfo info4 in ContentManage.GetInfoList(this.m_GeneralId)) { builder2.Append("<span>"); builder2.Append(EasyOne.Contents.Nodes.ShowNodesAndRootNavigation(info4.NodeId)); builder2.Append("<br /></span>"); } } if (builder2.Length <= 0) { builder2.Append("<span>无其它节点<br /></span>"); } literal.BeginTag = "<div style=\"margin: 0; padding: 0; float: left;\">" + builder2.ToString() + "</div>"; panel.Controls.Add(child); return; } case FieldType.MultipleHtmlTextType: literal.BeginTag = status; return; default: literal.Text = status; return; } if (builder.Length <= 0) { builder.Append("<span id='SpecialSpanId0'>无专题<br /></span>"); } literal.BeginTag = "<div style=\"margin: 0; padding: 0; float: left;\">" + builder.ToString() + "</div>"; panel.Controls.Add(literal2); } }
public static bool UpdateSpecialCategory(SpecialCategoryInfo specialCategoryInfo) { return(dal.UpdateSpecialCategory(specialCategoryInfo)); }
public static bool AddSpecialCategory(SpecialCategoryInfo specialCategoryInfo) { return(dal.AddSpecialCategory(specialCategoryInfo)); }