/// <summary> /// 按照变量生成文章URL /// </summary> /// <param name="sn"></param> /// <param name="create"></param> /// <param name="id"></param> /// <param name="modelName"></param> /// <returns></returns> public string GenerateArticleUrl(long sn, DateTime create, string id, string modelName) { GeneralConfigInfo si = GeneralConfigs.GetConfig(); string ext = si.UrlFormat; if (!String.IsNullOrEmpty(modelName)) { string snRex = si.ArticleUrlGenerator; if (snRex != null && snRex.Trim().Length > 0) { if (snRex == "0") { return(sn.ToString() + "." + ext); } else { return(create.ToString(snRex) + "-" + sn.ToString() + "." + ext); } } else { return(We7Helper.GUIDToFormatString(id) + "." + ext); } } else { return(We7Helper.GUIDToFormatString(id) + "." + ext); } }
/// <summary> /// 按ID取得详细页的Url /// </summary> /// <param name="id">条目ID</param> /// <returns></returns> public string GetUrl(object id) { if (!ChannelMap.ContainsKey(BindColumnID)) { ChannelMap.Add(BindColumnID, ChannelHelper.GetChannel(BindColumnID, null)); } GeneralConfigInfo si = GeneralConfigs.GetConfig(); string ext = si.UrlFormat; return(String.Format("{0}{1}.{2}", ChannelMap[BindColumnID].FullUrl, We7Helper.GUIDToFormatString(ToStr(id)), ext)); }
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); }
protected void SubmitButton_Click(object sender, EventArgs e) { AdviceType adviceType = new AdviceType(); adviceType.CreateDate = DateTime.Now; int index; if (int.TryParse(SortNumber.Text, out index)) { adviceType.Index = index; } adviceType.Title = AdviceNameText.Text.Trim(); adviceType.Description = RemarkText.Text.Trim(); if (string.IsNullOrEmpty(adviceType.Title)) { Messages.ShowError("模型名称不能为空"); return; } if (AdviceTypeID == null || AdviceTypeID == "") // 新建 { adviceType.AccountID = AccountID; string adviceTypeID = We7Helper.CreateNewID(); adviceType.ID = adviceTypeID; AdviceTypeHelper.AddAdviceType(adviceType); } else // 修改 { adviceType.ID = AdviceTypeID; AdviceTypeHelper.UpdateAdviceType(adviceType); Messages.ShowMessage("" + AdviceNameText.Text + " 模型修改成功!!"); } //记录日志 string content = string.Format("编辑了模型“{0}”的信息", adviceType.Title); AddLog("编辑反馈模型", content); if (AdviceTypeID == null || AdviceTypeID == "") { string rawurl = We7Helper.AddParamToUrl(Request.RawUrl, "saved", "1"); rawurl = We7Helper.RemoveParamFromUrl(rawurl, "adviceTypeID"); rawurl = We7Helper.AddParamToUrl(rawurl, "adviceTypeID", We7Helper.GUIDToFormatString(adviceType.ID)); Response.Redirect(rawurl); } }
/// <summary> /// 按ID取得详细页的Url /// </summary> /// <param name="id">条目ID</param> /// <returns></returns> public string GetUrl(object id, object ChannelID) { if (ChannelID == null) { return(""); } string strChannelID = ChannelID.ToString(); if (!ChannelMap.ContainsKey(strChannelID)) { ChannelMap.Add(strChannelID, ChannelHelper.GetChannel(strChannelID, null)); } GeneralConfigInfo si = GeneralConfigs.GetConfig(); string ext = si.UrlFormat; return(String.Format("{0}{1}.{2}", ChannelMap[strChannelID].FullUrl, We7Helper.GUIDToFormatString(ToStr(id)), ext)); }
/// <summary> /// 递归创建子菜单树 /// </summary> /// <param name="mytree"></param> /// <returns></returns> private string BuildSubmenuString(List <We7.CMS.Common.MenuItem> mytree) { if (mytree == null || mytree.Count == 0) { return(""); } else { StringBuilder sb = new StringBuilder(); sb.Append("<ul>"); string strMenu = @"<li id=""{0}"" class=""{1} ""><a href=""#"" class=""{1} ""><ins> </ins>{2}</a> {3} </li>"; foreach (We7.CMS.Common.MenuItem menu in mytree) { string subMenu = BuildSubmenuString(menu.Items); sb.Append(string.Format(strMenu, We7Helper.GUIDToFormatString(menu.ID), menu.PermissionState, menu.Title, subMenu)); } sb.Append("</ul>"); return(sb.ToString()); } }
void SingleTableLinkTo(PanelContext data, We7DataTable dt, string id) { 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.Instance.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); if (DbHelper.CheckTableExits(data.Table.Name)) { DbHelper.ExecuteSql(sql); } } } }
string GetAttachmentPath() { string sn = We7Helper.GUIDToFormatString(ArticleID); return(Constants.AttachmentUrlPath + sn); }
public static string GetModelUrl(string modelName, string id) { return(String.Format("{0}/{1}.{2}", GetModelChannelUrl(modelName).TrimEnd('/', '\\'), We7Helper.GUIDToFormatString(id), Ext)); }
/// <summary> /// 根据栏目ID与信息ID取得详细页Url /// </summary> /// <param name="ownerID"></param> /// <param name="id"></param> /// <returns></returns> public static string GetUrl(string ownerID, string id) { return(String.Format("{0}/{1}.{2}", GetChannelUrl(ownerID).TrimEnd('/', '\\'), We7Helper.GUIDToFormatString(id), Ext)); }