void BindData() { CategoryHelper helper = HelperFactory.GetHelper <CategoryHelper>(); DataGridView.DataSource = helper.GetCategoryByParentID(We7Helper.EmptyGUID); DataGridView.DataBind(); }
private void ProcessRequest() { bool result = false; Response.ContentType = "text/html"; string key = Request.QueryString["key"]; string type = Request.QueryString["type"]; string catType = Request.QueryString["cattype"]; if (!String.IsNullOrEmpty(key)) { CategoryHelper helper = HelperFactory.GetHelper <CategoryHelper>(); if (type == "1") { //result=helper.FindCatetory(key, catType)!=null; } else { //Category cat = helper.GetCategorys(catType); //result=GetCatByName(cat, key) != null; //TODO::检查名称是否重复 } } Response.Clear(); Response.Write(result.ToString().ToLower()); }
protected void SaveButton_ServerClick(object sender, EventArgs e) { if (DemoSiteMessage) { return; //是否是演示站点 } List <ChannelModuleMapping> mappings = HelperFactory.GetHelper <ChannelModuleHelper>().GetMappingByChannelID(ChannelID); if (mappings == null || mappings.Count <= 0) { HelperFactory.GetHelper <ChannelModuleHelper>().CreateMapping(ChannelID, "{928b8e2f-b004-47bb-adef-2053bd8a0db0}", string.Empty); } if (ChannelNameTextBox.Text.Contains("_")) { Messages.ShowMessage("此栏目标识包含非法“_”,请重新起名"); return; } if (ChannelID == null || ChannelID == "" || ChannelNameHidden.Text.Trim() == "") { string channelName = CoverToPinyin.Convert(ChannelNameTextBox.Text.ToLower().Trim()); if (!CheckName(channelName)) { Messages.ShowError("已存在此栏目标识“" + channelName + "”,栏目标识不能重复,请重新编辑。"); return; } ChannelNameHidden.Text = channelName; } SaveInformation(); }
/// <summary> /// 初始化 /// </summary> /// <param name="e"></param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); Links = new List <Link>(); LinkHelper LinkHelper = HelperFactory.GetHelper <LinkHelper>(); if (tag.Contains(",")) { tag = tag.Substring(0, tag.IndexOf(",")); } if (DesignHelper.IsDesigning) { List <Link> links; DesignHelper.FillItems <Link>(out links, PageSize); foreach (Link link in links) { link.Thumbnail = DesignHelper.GetTagThumbnail("small"); } Links = links; } else { Links = LinkHelper.GetPagedAllLinks(0, PageSize, "", tag); } if (ColumnCount <= 0) { columnCount = PageSize; } }
/// <summary> /// 增加一条操作记录 /// </summary> /// <param name="pages"></param> /// <param name="content"></param> public void AddLog(string pages, string content) { HelperFactory HelperFactory = (HelperFactory)HttpContext.Current.Application[HelperFactory.ApplicationID]; LogHelper LogHelper = HelperFactory.GetHelper <LogHelper>(); if (Config.IsAddLog) { LogHelper.WriteLog(Security.CurrentAccountID, pages, content, Config.DefaultHomePageTitle); } }
protected void btnCreateIndex_Click(object sender, EventArgs e) { try { DataControlHelper dchelper = HelperFactory.GetHelper <DataControlHelper>(); dchelper.CreateDataControlIndex(); ClientScript.RegisterStartupScript(this.GetType(), "msg", "alert('重建索引成功!')", true); } catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "msg", "alert('重建索引失败:" + ex.Message + "')", true); } }
/// <summary> /// 取得当前反馈的模型名称 /// </summary> /// <returns></returns> protected virtual string GetModelName() { if (String.IsNullOrEmpty(ModelName)) { if (String.IsNullOrEmpty(AdviceTypeID)) { throw new Exception("反馈类型为空"); } AdviceType adviceType = HelperFactory.GetHelper <AdviceTypeHelper>().GetAdviceType(AdviceTypeID); ModelName = adviceType != null ? adviceType.ModelName : String.Empty; } return(ModelName); }
/// <summary> /// 执行 /// </summary> public override void Execute() { CommentsHelper CommentsHelper = HelperFactory.GetHelper <CommentsHelper>(); if (!string.IsNullOrEmpty(ArticleIDByRedirect)) { Records = CommentsHelper.ArticleIDQueryComments(ArticleIDByRedirect, this.StartIndexs, PageSize, null, true); } else { Records = CommentsHelper.ArticleIDQueryComments(ArticleID, this.StartIndexs, PageSize, null, true); } }
/// <summary> /// 取得反馈类型名称 /// </summary> /// <param name="typeID"></param> /// <returns></returns> protected string GetAdviceTypeName(string typeID) { if (String.IsNullOrEmpty(typeID)) { return("当前类型不存在"); } if (!dicTypeNames.ContainsKey(typeID)) { AdviceType type = HelperFactory.GetHelper <AdviceTypeHelper>().GetAdviceType(typeID); dicTypeNames.Add(typeID, typeID != null ? type.Title : String.Empty); } return(dicTypeNames[typeID]); }
protected void CreateControlIndex_Click(object sender, EventArgs e) { try { DataControlHelper dchelper = HelperFactory.GetHelper <DataControlHelper>(); dchelper.CreateDataControlIndex(); //BaseControlHelper Helper = new BaseControlHelper(); //Helper.CreateIntegrationIndexConfig(); Messages.ShowMessage("重新索引成功"); } catch (Exception ex) { Messages.ShowError("重建索引失败:" + ex.Message); } }
string GetContentUrl(Article a) { if (!String.IsNullOrEmpty(a.ChannelFullUrl)) { return(a.ChannelFullUrl + a.FullUrl); } else { List <Channel> chs = HelperFactory.GetHelper <ChannelHelper>().GetChannelByModelName(a.ModelName); if (chs != null && chs.Count > 0) { return(chs[0].RealUrl + We7Helper.GUIDToFormatString(a.ID) + "." + GeneralConfigs.GetConfig().UrlFormat); } } return(We7Helper.GUIDToFormatString(a.ID) + "." + GeneralConfigs.GetConfig().UrlFormat); }
void SingleTableLinkTo(PanelContext data, We7DataTable dt, string id) { if (DbHelper.CheckTableExits(data.Table.Name)) { DataTable datatables = DbHelper.Query(String.Format("SELECT * FROM [{0}] WHERE [ID]='{1}'", data.Table.Name, id)); if (datatables.Rows.Count > 0) { DataRow row = datatables.Rows[0]; We7DataColumn dc1 = dt.Columns.IndexOfMappingField("ContentUrl"); We7DataColumn dc2 = data.Table.Columns.IndexOfMappingField("OwnerID"); if (dc1 != null && dc2 != null) { StringBuilder sbFields = new StringBuilder(); StringBuilder sbValues = new StringBuilder(); sbFields.Append("[ID],"); sbValues.Append("'" + We7Helper.CreateNewID() + "',"); Channel ch = HelperFactory.GetHelper <ChannelHelper>().GetChannel(row[dc2.Name].ToString(), null); sbFields.AppendFormat("[{0}],", dc1.Name); sbValues.AppendFormat("{0},", String.Format("{0}{1}.{2}", ch.FullUrl, We7Helper.GUIDToFormatString(row["ID"].ToString()), GeneralConfigs.GetConfig().UrlFormat)); dc1 = dt.Columns.IndexOfMappingField("Title"); dc2 = data.Table.Columns.IndexOfMappingField("Title"); if (dc1 != null && dc2 != null) { sbFields.AppendFormat("[{0}],", dc1.Name); sbValues.AppendFormat("'{0}',", row[dc2.Name]); } dc1 = dt.Columns.IndexOfMappingField("ContentType"); dc2 = data.Table.Columns.IndexOfMappingField("ContentType"); if (dc1 != null && dc2 != null) { sbFields.AppendFormat("[{0}],", dc1.Name); sbValues.AppendFormat("{0},", (int)TypeOfArticle.LinkArticle); } Utils.TrimEndStringBuilder(sbFields, ","); Utils.TrimEndStringBuilder(sbValues, ","); string sql = String.Format("INSERT INTO [{0}]({1}) VALUES({2})", dt.Name, sbFields, sbValues); DbHelper.ExecuteSql(sql); } } } }
protected void BindData() { chkModules.DataSource = HelperFactory.GetHelper <ChannelModuleHelper>().GetAllModule(); chkModules.DataTextField = "Title"; chkModules.DataValueField = "ID"; chkModules.DataBind(); List <ChannelModuleMapping> mapping = HelperFactory.GetHelper <ChannelModuleHelper>().GetMappingByChannelID(ChannelID); foreach (ListItem item in chkModules.Items) { foreach (ChannelModuleMapping m in mapping) { if (item.Value == m.ModuleID) { item.Selected = true; } } } }
void DataGridView_RowCommand(object sender, GridViewCommandEventArgs e) { string cmd = e.CommandName; if (String.Compare(cmd, "ed", true) == 0) { Response.Redirect("CategoryEdit.aspx?typeId=" + TypeID + "&id=" + e.CommandArgument); } else if (String.Compare(cmd, "del", true) == 0) { try { HelperFactory.GetHelper <CategoryHelper>().DeleteCategory(e.CommandArgument as string); DataBind(); Messages.ShowMessage("操作成功!"); } catch (Exception ex) { Messages.ShowError("删除失败:" + ex.Message); } } }
public string GetDefaultTemplatePath(string templateAlias, bool isDetail) { HelperFactory helperFactory = (HelperFactory)HttpContext.Current.Application[HelperFactory.ApplicationID]; SiteSettingHelper cdHelper = helperFactory.GetHelper <SiteSettingHelper>(); GeneralConfigInfo si = GeneralConfigs.GetConfig(); if (si.DefaultTemplateGroupFileName != null && si.DefaultTemplateGroupFileName.Length > 0) { TemplateGroup tg = GetTemplateGroupCache(si.DefaultTemplateGroupFileName); string DefaultTemplatePath = ""; foreach (TemplateGroup.Item it in tg.Items) { if (it.Alias == templateAlias && it.IsDetailTemplate == isDetail) { DefaultTemplatePath = it.Template; break; } } if (DefaultTemplatePath != "") { if (EnableSiteSkins) { DefaultTemplatePath = String.Format("{0}/{1}", Path.GetFileNameWithoutExtension(si.DefaultTemplateGroupFileName), DefaultTemplatePath); } return(GetTemplatePath(DefaultTemplatePath)); } else { return(""); } } else { return(""); } }
/// <summary> /// 获取广告位的JS文件路径 /// </summary> /// <param name="siteID">站点ID</param> /// <param name="url">站点Url</param> /// <param name="tag">页面标签</param> /// <returns></returns> public string GetADZoneJSPath(string siteID, string url, string app, string tag) { try { ChannelHelper chHelper = HelperFactory.GetHelper <ChannelHelper>(); url = url.ToLower(); string chID = chHelper.GetChannelIDFromURL(); string channelPath = chHelper.GetFullPath(chID); string pathType = ""; //路径类型:"*"首页与栏目;"*.html"内容页;"*.aspx"其他页 if ((url.EndsWith("_") && !url.EndsWith("aspx_")) || url.EndsWith("_default.aspx") || url.EndsWith("_default.html") || url.EndsWith("_index.html")) { pathType = "*"; } if (url.EndsWith(".html") && !url.EndsWith("default.html")) { pathType = "*.html"; } if ((url.EndsWith(".aspx") && !url.EndsWith("default.aspx")) || url.EndsWith(".aspx_")) { pathType = "*.aspx"; channelPath = "";//如果为其他页,则此路径为空 } return(GetADService().GetAdZoneJSPath(siteID, channelPath, pathType, tag)); } catch (SoapException soapExt) { throw new Exception(We7Helper.SoapExceptionInfo(soapExt)); } catch (Exception ex) { throw ex; } }
protected void Page_Load(object sender, EventArgs e) { HelperFactory helperFactory = HelperFactory.Instance; TemplateHelper TemplateHelper = helperFactory.GetHelper <TemplateHelper>(); string editorUrl = "/admin/DataControlUI/Compose.aspx"; if (GeneralConfigs.GetConfig().DefaultTemplateEditor == "1") { editorUrl = "/admin/VisualTemplate/TemplateCreate.aspx"; } string bindName = string.Format("handler={0}&mode={1}&model={2}", BindConfig.Handler, BindConfig.Mode, BindConfig.Model); string urlCompose = string.Format("{0}?{1}", editorUrl, bindName); TitleLabel.Text = "没有匹配的" + BindConfig.ModelText + BindConfig.Description + "模板"; ActionLiteral.Text = string.Format("<a href='{0}' target='_blank'>创建{1}(模板)</a>", urlCompose, BindConfig.ModelText + BindConfig.Description); if (string.IsNullOrEmpty(GeneralConfigs.GetConfig().DefaultTemplateGroupFileName) || !Directory.Exists(TemplateHelper.DefaultTemplateGroupPath)) { HelpLiteral.Text = "您也可以到微七插件商场下载一套完整模板。<a href='http://m.we7.cn' target='_blank'>去下载</a>"; TemplateGroup[] tg = TemplateHelper.GetTemplateGroups(null); int count = tg.Length; if (count > 0) { string urlSelectTemplate = "/admin/TemplateGroups.aspx"; HelpLiteral.Text += string.Format("<br>本地有{0}套可用模板组,您没有选用,要选用一个吗?<a href='{1}' target='_blank'>选一个</a>", count.ToString(), urlSelectTemplate); } } else { Template[] tps = TemplateHelper.GetTemplates(null, Path.GetFileNameWithoutExtension(GeneralConfigs.GetConfig().DefaultTemplateGroupFileName)); if (tps.Length > 0) { string urlBindTemplate = string.Format("/admin/Template/TemplateGroupEdit.aspx?file={0}&tab=3", GeneralConfigs.GetConfig().DefaultTemplateGroupFileName); HelpLiteral.Text = string.Format("您已经创建了{0}个模板页了,是否已经创建本页模板但尚未指定?<a href='{1}' target='_blank'>去看一下</a>", tps.Length, urlBindTemplate); } } }
protected void SaveButton_ServerClick(object sender, EventArgs args) { if (DemoSiteMessage) { return; } try { HelperFactory.GetHelper <ChannelModuleHelper>().DeleteMappingByChannelID(ChannelID); foreach (ListItem item in chkModules.Items) { if (item.Selected) { HelperFactory.GetHelper <ChannelModuleHelper>().CreateMapping(ChannelID, item.Value, String.Empty); } } Messages.ShowMessage("保存成功"); } catch (Exception ex) { Messages.ShowError(ex.Message); } }
protected string GetUrl(object o) { string oid = HelperFactory.GetHelper <ChannelHelper>().GetChannelIDFromURL(); return(UrlHelper.GetUrl(oid, o as string)); }
/// <summary> /// 压缩文件 /// </summary> /// <param name="zipName">压缩文件名</param> public void Process(string zipName) { if (!Directory.Exists(BasePath)) { Directory.CreateDirectory(BasePath); } using (FileStream fs = File.Open(FileName, FileMode.Open)) { ZipUtils.ExtractZip(fs, BasePath); } string templatePath = ControlPath; HelperFactory helperFactory = (HelperFactory)HttpContext.Current.Application[HelperFactory.ApplicationID]; TemplateVersionHelper templateVersionHelper = helperFactory.GetHelper <TemplateVersionHelper>(); DirectoryInfo di = new DirectoryInfo(BasePath); FileInfo[] fis = di.GetFiles("*.xml"); foreach (FileInfo f in fis) { try { ProcessFile(f); } catch { } } //TemplateVersion tv = templateVersionHelper.GetTemplateVersion(String.Format("{0}\\res", BasePath)); //if (tv != null) //{ // if (tv.TemplatePath == "cgi-bin\\templates\\groups") // tv.TemplatePath = "cgi-bin\\templates"; // DeployGroupPath = Path.Combine(WebRoot, tv.TemplatePath); // if (tv.UseSkin) // { // templatePath = String.Format("{0}\\{1}", ControlPath, zipName.Replace("Package.Templates.", "")); // } // if (Directory.Exists(templatePath)) // { // DirectoryInfo di = new DirectoryInfo(templatePath); // foreach (FileInfo fi in di.GetFiles(FileExtension)) // { // if (tv.UseSkin) // { // ProcessFile(fi, templatePath); // } // else // { // ProcessFile(fi); // } // } // } //} //else //{ // DeployGroupPath = DeployControlPath; // if (DeployControlPath == "_skins") // DeployGroupPath = "_templates"; // if (Directory.Exists(ControlPath)) // { // DirectoryInfo di = new DirectoryInfo(ControlPath); // foreach (FileInfo fi in di.GetFiles(FileExtension)) // { // ProcessFile(fi); // } // } //} }
/// <summary> /// 报得反馈ID /// </summary> /// <returns></returns> protected string GetAdviceID() { return(HelperFactory.GetHelper <ArticleHelper>().GetArticleIDFromURL()); }
public string GetThisHtmlPageTemplate(string ColumnMode, string ColumnID, string SearchWord, string SeSearchWord) { string TemplatePath = ""; bool IsDetail = false; if (ColumnMode == "detail" || ColumnMode == "productDetail" || ColumnMode == "contentMode" || ColumnMode == "adviceMode") { IsDetail = true; } if (!We7Helper.IsEmptyID(ColumnID)) { HelperFactory helperFactory = (HelperFactory)HttpContext.Current.Application[HelperFactory.ApplicationID]; ChannelHelper channelHelper = helperFactory.GetHelper <ChannelHelper>(); Channel ch = channelHelper.GetChannel(ColumnID, null); SiteSettingHelper cdHelper = helperFactory.GetHelper <SiteSettingHelper>(); GeneralConfigInfo si = GeneralConfigs.GetConfig(); if (si.DefaultTemplateGroupFileName != null && si.DefaultTemplateGroupFileName.Length > 0) //判断一下模板文件是否真实存在 { if (IsDetail && ch != null && ch.DetailTemplate != null && ch.DetailTemplate != "" && GetTemplate(ch.DetailTemplate) != null) //详细模板 { TemplatePath = GetTemplatePath(si.DefaultTemplateGroupFileName, ch.DetailTemplate); } else if (ch != null && ch.TemplateName != null && ch.TemplateName != "" && !IsDetail) { TemplatePath = GetTemplatePath(si.DefaultTemplateGroupFileName, ch.TemplateName); } } if (TemplatePath == "" || TemplatePath == null) //按别名匹配 { if (ch != null && ch.Alias != null && ch.Alias != "" && !IsDetail) { string tmp = GetDefaultTemplatePath(ch.Alias, IsDetail); if (tmp != null && tmp != "") { TemplatePath = tmp; } } } if (TemplatePath == "" || TemplatePath == null) //按标签匹配 { if (!IsDetail) { List <string> tags = channelHelper.GetTags(ColumnID); if (tags.Count != 0) { string tmp = GetDefaultTemplatePath(tags[0], IsDetail); if (tmp != null && tmp != "") { TemplatePath = tmp; } } } } } if (TemplatePath == "" || TemplatePath == null) //赋值默认模板 { //if (ColumnMode == "productDetail") //{ // TemplatePath = GetDefaultTemplatePath("[productcontentpage]"); //} if (SeSearchWord != null) { TemplatePath = GetDefaultTemplatePath("[sesearch]"); } else if (SearchWord != null) { TemplatePath = GetDefaultTemplatePath("[search]"); } else if (We7Helper.IsEmptyID(ColumnID) || ColumnID == "/") { TemplatePath = GetDefaultTemplatePath("[homepage]"); } else if (ColumnMode == "detail") { TemplatePath = GetDefaultTemplatePath("[contentpage]", true); } else if (ColumnMode == "productDetail") { TemplatePath = GetDefaultTemplatePath("[productcontentpage]"); } else if (ColumnMode == "contentMode") { TemplatePath = GetDefaultTemplatePath("[ContentMode]"); } else if (ColumnMode == "adviceMode") { TemplatePath = GetDefaultTemplatePath("[AdviceMode]"); } else { TemplatePath = GetDefaultTemplatePath("[channel]"); } } return(TemplatePath); }
public override object Do(PanelContext data) { string oid = data.Objects["oid"] as string; if (We7Helper.IsEmptyID(oid)) { throw new Exception("不能添加到根栏目"); } if (!string.IsNullOrEmpty(oid)) { Channel targetChannel = HelperFactory.GetHelper <ChannelHelper>().GetChannel(oid, null); //if (targetChannel != null && !String.IsNullOrEmpty(targetChannel.ModelName)) if (targetChannel != null) { //ModelInfo modelInfo = ModelHelper.GetModelInfo(targetChannel.ModelName); //We7DataTable dt = modelInfo.DataSet.Tables[0]; List <DataKey> dataKeys = data.State as List <DataKey>; foreach (DataKey key in dataKeys) { string id = key["ID"] as string; //SingleTableLinkTo(data, dt, id); Article a = ArticleHelper.GetArticle(id); if (a != null) { DataSet ds = BaseDataProvider.CreateDataSet(data.Model); DataRow row = ds.Tables[data.Table.Name].NewRow(); ds.Tables[data.Table.Name].Rows.Add(row); a.OwnerID = oid; if (row.Table.Columns.Contains("OwnerID")) { row["OwnerID"] = oid; } if (row.Table.Columns.Contains("Title")) { row["Title"] = a.Title; } if (row.Table.Columns.Contains("Description")) { row["Description"] = a.Description; } a.ContentType = (int)TypeOfArticle.LinkArticle; if (row.Table.Columns.Contains("ContentType")) { row["ContentType"] = a.ContentType; } a.ContentUrl = GetContentUrl(a); if (row.Table.Columns.Contains("ContentUrl")) { row["ContentUrl"] = a.ContentUrl; } a.Content = ""; if (row.Table.Columns.Contains("Content")) { row["Content"] = ""; } a.SourceID = a.ID; if (row.Table.Columns.Contains("SourceID")) { row["SourceID"] = a.ID; } a.Updated = DateTime.Now; if (row.Table.Columns.Contains("Updated")) { row["Updated"] = a.Updated; } a.Created = DateTime.Now; if (row.Table.Columns.Contains("Created")) { row["Created"] = a.Created; } a.Overdue = DateTime.Now.AddYears(2); if (row.Table.Columns.Contains("Overdue")) { row["Overdue"] = a.Overdue; } Channel ch = ChannelHelper.GetChannel(oid, null); if (ch != null) { a.ChannelFullUrl = ch.FullUrl; if (row.Table.Columns.Contains("ChannelFullUrl")) { row["ChannelFullUrl"] = a.ChannelFullUrl; } a.ChannelName = ch.FullPath; if (row.Table.Columns.Contains("ChannelName")) { row["ChannelName"] = a.ChannelName; } a.FullChannelPath = ch.FullFolderPath; if (row.Table.Columns.Contains("FullChannelPath")) { row["FullChannelPath"] = a.FullChannelPath; } a.State = ch.Process != null && ch.Process == "1" ? 2 : a.State; if (row.Table.Columns.Contains("State")) { row["State"] = a.State; } } a.ID = We7Helper.CreateNewID(); if (row.Table.Columns.Contains("ID")) { row["ID"] = a.ID; } a.ModelXml = BaseDataProvider.GetXml(ds); ArticleHelper.AddArticle(a); // 往全文检索里更新数据 ArticleIndexHelper.InsertData(a.ID, 0); } } } } return(null); }
public override object Do(PanelContext data) { string oid = data.Objects["oid"] as string; if (We7Helper.IsEmptyID(oid)) { throw new Exception("不能移动到根栏目"); } ChannelHelper chHelper = HelperFactory.GetHelper <ChannelHelper>(); Channel channel = chHelper.GetChannel(oid, null); if (channel == null) { throw new Exception("当前栏目不存在"); } if (channel.ModelName != data.ModelName) { throw new Exception("移动到的栏目类型与当前栏目类型不一致"); } if (!string.IsNullOrEmpty(oid)) { List <DataKey> dataKeys = data.State as List <DataKey>; foreach (DataKey key in dataKeys) { string id = key["ID"] as string; Article a = ArticleHelper.GetArticle(id); if (a != null) { DataSet ds = BaseDataProvider.CreateDataSet(data.Model); BaseDataProvider.ReadXml(ds, a.ModelXml); if (ds.Tables[data.Table.Name].Rows.Count > 0) { DataRow row = ds.Tables[data.Table.Name].Rows[0]; a.OwnerID = oid; if (row.Table.Columns.Contains("OwnerID")) { row["OwnerID"] = oid; } Channel ch = ChannelHelper.GetChannel(oid, null); if (ch != null) { a.ChannelFullUrl = ch.FullUrl; if (row.Table.Columns.Contains("ChannelFullUrl")) { row["ChannelFullUrl"] = a.ChannelFullUrl; } a.ChannelName = ch.FullPath; if (row.Table.Columns.Contains("ChannelName")) { row["ChannelName"] = a.ChannelName; } a.FullChannelPath = ch.FullFolderPath; if (row.Table.Columns.Contains("FullChannelPath")) { row["FullChannelPath"] = a.FullChannelPath; } } a.ModelXml = BaseDataProvider.GetXml(ds); } } if (DbHelper.CheckTableExits(data.Table.Name)) { DbHelper.ExecuteSql(String.Format("UPDATE [{0}] SET [OwnerID]='{2}' WHERE [ID]='{1}'", data.Table.Name, id, oid)); } ArticleHelper.UpdateArticle(a, new string[] { "ID", "OwnerID", "ChannelFullUrl", "ChannelName", "FullChannelPath", "ModelXml" }); // 往全文检索里更新数据 ArticleIndexHelper.InsertData(id, 1); } } UIHelper.SendMessage("移动成功"); CacheRecord.Create(data.ModelName).Release(); return(null); }
/// <summary> /// 添加评论 /// </summary> protected void SubmitComment() { try { SiteSettingHelper CDHelper = HelperFactory.GetHelper <SiteSettingHelper>(); IAccountHelper AccountHelper = AccountFactory.CreateInstance(); CommentsHelper CommentsHelper = HelperFactory.GetHelper <CommentsHelper>(); Comments cm = new Comments(); DateTime Createdtime = DateTime.Now; if (ArticleIDByRedirect != "") { cm.ArticleID = ArticleIDByRedirect; } else { cm.ArticleID = ArticleID; } if (CDHelper.Config.IsAuditComment) { cm.State = 0; } else { cm.State = 1; } if (IsSignin) { string actID = CurrentAccount; if (We7Helper.IsEmptyID(actID)) { cm.Author = "系统管理员"; } else { Account act = AccountHelper.GetAccount(CurrentAccount, new string[] { "FirstName", "LastName", "LoginName" }); cm.Author = String.Format("{0} {1}({2})", act.LastName, act.FirstName, act.LoginName); } cm.AccountID = actID; } else { cm.Author = Author; cm.AccountID = ""; } cm.Content = Content; cm.Created = Createdtime; cm.ID = We7Helper.CreateNewID(); cm.ArticleName = Title; CommentsHelper.AddComments(cm); Message = CDHelper.Config.IsAuditComment ? "评论发表成功,等待系统审核!" : "发表成功!"; Content = ""; } catch (Exception ex) { Message = ex.Message; } }
/// <summary> /// 构建标签项 /// </summary> /// <returns></returns> string BuildNavString() { XmlDocument docType = new XmlDocument(); if (Application["We7.docType"] == null) { //加载内容信息类型 string fileName = Server.MapPath("Config/tab-index.xml"); if (File.Exists(fileName)) { docType.Load(fileName); Application.Add("We7.docType", docType); } } docType = Application["We7.docType"] as XmlDocument; string tab = "", basictag = ""; string loadControl = "../controls/Article_option.ascx"; string loadName = "基本信息"; string tabString = ""; string dispay = ""; string rawurl = We7Helper.RemoveParamFromUrl(Request.RawUrl, "tab"); rawurl = We7Helper.RemoveParamFromUrl(Request.RawUrl, "saved"); if (TabID != null && TabID != "") { tab = TabID; } int menuCount = 0; XmlNodeList itemNodes = docType.SelectNodes("/configuration/item"); foreach (XmlNode node in itemNodes) { string value = node.Attributes["value"].Value; if (ChannelContentType == Int32.Parse(value)) { if (node.Attributes["basictag"] != null) { basictag = node.Attributes["basictag"].Value; } if (string.IsNullOrEmpty(tab) && node.ChildNodes.Count > 0) { basictag = node.ChildNodes[0].Attributes["name"].Value; //默认第一个tab为基础tab } if (string.IsNullOrEmpty(tab)) { tab = basictag; } foreach (XmlNode tagNode in node.ChildNodes) { if (tagNode.Attributes != null && !tagNode.HasChildNodes) { menuCount++; string tagValue = tagNode.Attributes["name"].Value; if (tagValue == "Article_ipStrategy" && !System.IO.File.Exists(Server.MapPath("/Plugins/IPStrategyPlugin/Plugin.xml"))) { break; } loadControl = tagNode.Attributes["control"].Value; loadName = tagNode.Attributes["value"].Value; if (ArticleID != null && ArticleID != "") { dispay = TabVisble(tagValue); } if (tab == tagValue) { tabString += LoadActiveTabString(basictag, tagValue, loadName, loadControl, dispay); } else { tabString += LoadLinkTabString(basictag, tagValue, loadName, loadControl, rawurl, dispay); } } } } } List <ChannelModuleMapping> mappings = HelperFactory.GetHelper <ChannelModuleHelper>().GetMappingByChannelID(OwnerID); foreach (ChannelModuleMapping m in mappings) { ColumnModule module = HelperFactory.GetHelper <ChannelModuleHelper>().GetModule(m.ModuleID); if (tab == menuCount.ToString()) { tabString += LoadActiveTabString(basictag, menuCount.ToString(), module.Title, module.Path, String.Empty); } else { tabString += LoadLinkTabString(basictag, menuCount.ToString(), module.Title, module.Path, rawurl, String.Empty); } menuCount++; } return(tabString); }
protected void DataBind() { DataGridView.DataSource = HelperFactory.GetHelper <CategoryHelper>().GetFmtChildren(TypeID); DataGridView.DataBind(); }