public ActionResult Index() { M_CommonData storeMod = conBll.SelMyStore(mu.UserName); if (storeMod == null) { return(RedirectToAction("StoreApply")); //申请店铺 } else if (storeMod.Status != 99) //等待审核 { return(RedirectToAction("StoreEdit")); } else { DataTable cmdinfo = conBll.GetContent(storeMod.GeneralID); if (cmdinfo.Rows.Count < 1) { function.WriteErrMsg("店铺信息不完整"); return(Content("")); } DataRow dr = cmdinfo.Rows[0]; DataTable sstDT = sstbll.GetStyleByModel(Convert.ToInt32(dr["StoreModelID"]), 1); M_StoreStyleTable sst = sstbll.GetStyleByID(Convert.ToInt32(dr["StoreStyleID"])); ViewBag.sstdp = MVCHelper.ToSelectList(sstDT, "StyleName", "ID", dr["StoreStyleID"].ToString()); ViewBag.dr = dr; ViewBag.sstimg = sst == null ? "" : function.GetImgUrl(sst.StylePic); ViewBag.modelhtml = fieldBll.InputallHtml(DataConvert.CLng(dr["StoreModelID"]), 0, new ModelConfig() { ValueDT = cmdinfo }); } return(View(storeMod)); }
protected void EBtnSubmit_Click(object sender, EventArgs e) { DataTable dt = mfbll.GetModelFieldList(int.Parse(HiddenField1.Value)); Call commonCall = new Call(); DataTable table = commonCall.GetDTFromPage(dt, Page, ViewState); DataRow rs4 = table.NewRow(); rs4[0] = "StoreName"; rs4[1] = "TextType"; rs4[2] = Nametxt.Text; table.Rows.Add(rs4); DataRow rs5 = table.NewRow(); rs5[0] = "StoreStyleID"; rs5[1] = "int"; rs5[2] = DataConverter.CLng(SSTDownList.Text); table.Rows.Add(rs5); M_StoreStyleTable sst = sstbll.GetStyleByID(int.Parse(SSTDownList.Text)); M_CommonData CData = conBll.GetCommonData(gid); CData.Template = sst.StyleUrl; CData.Title = Nametxt.Text; conBll.UpdateContent(table, CData); function.WriteSuccessMsg("提交成功"); }
//初始化 private void GetInit() { M_StoreStyleTable sst = sstbll.GetStyleByID(Sid); this.TxtModelName.Text = sst.StyleName; this.txt_Thumbnails.Text = sst.StylePic; this.ModeTemplate_hid.Value = sst.StyleUrl; this.RadioButtonList1.Text = sst.IsTrue.ToString(); this.ListModeTemplate_hid.Value = sst.ListStyle; this.ContentModeTemplate_hid.Value = sst.ContentStyle; this.DropDownList1.SelectedValue = sst.ModelID.ToString(); }
/// <summary> /// 读取模板表 /// </summary> /// <param name="dr"></param> /// <param name="sst"></param> public void ReadStoreStyle(SqlDataReader dr, M_StoreStyleTable sst) { sst.ID = int.Parse(dr["ID"].ToString()); sst.StyleName = dr["StyleName"].ToString(); sst.StylePic = dr["StylePic"].ToString(); sst.StyleUrl = dr["StyleUrl"].ToString(); sst.ListStyle = dr["ListStyle"].ToString(); sst.ContentStyle = dr["ContentStyle"].ToString(); sst.ModelID = int.Parse(dr["ModelID"].ToString()); sst.IsTrue = int.Parse(dr["IsTrue"].ToString()); dr.Close(); dr.Dispose(); }
/// <summary> /// 取某模型的一个模板 /// </summary> /// <param name="modelid"></param> /// <returns></returns> public M_StoreStyleTable GetNewStyle(int modelid) { try { string sql = "select top 1 * from ZL_StoreStyleTable where ModelID=" + modelid + " and IsTrue=1"; M_StoreStyleTable sst = new M_StoreStyleTable(); using (SqlDataReader dr = SqlHelper.ExecuteReader(CommandType.Text, sql, null)) { if (dr.Read()) { ReadStoreStyle(dr, sst); } } return(sst); } catch { throw; } }
public void StoreIndex() { if (ItemID < 1) { function.WriteErrMsg("店铺ID错误,StoreIndex?id=店铺ID"); return; } M_CommonData cdata = conBll.GetCommonData(ItemID); if (cdata == null) { function.WriteErrMsg("店铺信息不存在"); return; } if (!cdata.IsStore) { function.WriteErrMsg("错误,指定的ID并非店铺"); return; } DataTable dt = conBll.GetContent(ItemID); if (dt != null && dt.Rows.Count < 1) { function.WriteErrMsg("该店铺不存在"); return; } else if (cdata.Status == 0) { function.WriteErrMsg("该店铺被关闭了"); return; } else if (cdata.Status != 99) { function.WriteErrMsg("该店铺还在审核中"); return; } else { string username = cdata.Inputer; int userid = buser.GetUserByName(username).UserID; int StoreStyleID = DataConverter.CLng(dt.Rows[0]["StoreStyleID"]);//店铺风格 M_StoreStyleTable stinfo = sstbll.GetStyleByID(StoreStyleID); string ContentHtml = SafeSC.ReadFileStr(SiteConfig.SiteOption.TemplateDir + "/" + stinfo.StyleUrl); ContentHtml = this.createBll.CreateHtml(ContentHtml, 0, ItemID, 0); Response.Write(ContentHtml); } }
//审核完成后,用户可自由修改店铺信息 public void UserShop_Edit() { M_CommonData storeMod = conBll.SelMyStore(mu.UserName); DataTable cmdinfo = conBll.GetContent(storeMod.GeneralID); //---------- DataTable dt = fieldBll.GetModelFieldList(Convert.ToInt32(cmdinfo.Rows[0]["StoreModelID"])); Call commonCall = new Call(); DataTable table; try { table = commonCall.GetDTFromMVC(dt, Request); } catch (Exception e) { function.WriteErrMsg(e.Message); return; } DataRow rs4 = table.NewRow(); rs4[0] = "StoreName"; rs4[1] = "TextType"; rs4[2] = Request.Form["StoreName_T"]; table.Rows.Add(rs4); DataRow rs5 = table.NewRow(); rs5[0] = "StoreStyleID"; rs5[1] = "int"; rs5[2] = Convert.ToInt32(Request.Form["SSTDownList"]); table.Rows.Add(rs5); M_StoreStyleTable sst = sstbll.GetStyleByID(Convert.ToInt32(Request.Form["SSTDownList"])); if (sst != null) { storeMod.Template = sst.StyleUrl; } storeMod.Title = Request.Form["StoreName_T"]; storeMod.IP = IPScaner.GetUserIP(); conBll.UpdateContent(table, storeMod); function.WriteSuccessMsg("提交成功", "Index"); return; }
protected void EBtnSubmit_Click(object sender, EventArgs e) { M_StoreStyleTable sst = new M_StoreStyleTable(); sst.ID = Sid; sst.StyleName = this.TxtModelName.Text; sst.StylePic = this.txt_Thumbnails.Text; sst.StyleUrl = this.ModeTemplate_hid.Value; sst.ListStyle = this.ListModeTemplate_hid.Value; sst.ContentStyle = this.ContentModeTemplate_hid.Value; sst.ModelID = int.Parse(this.DropDownList1.Text); sst.IsTrue = int.Parse(this.RadioButtonList1.Text); if (Sid > 0) { sstbll.UpdateStoreStyle(sst); } else { sstbll.InsertStoreStyle(sst); } Response.Redirect("StoreStyleManage.aspx"); }
/// <summary> /// 添加店铺模板 /// </summary> /// <param name="sst"></param> public void InsertStoreStyle(M_StoreStyleTable model) { Sql.insert(strTableName, model.GetParameters(), BLLCommon.GetParas(model), BLLCommon.GetFields(model)); }
/// <summary> /// 根据ID更新 /// </summary> public bool UpdateByID(M_StoreStyleTable model) { return(Sql.UpdateByIDs(strTableName, PK, model.ID.ToString(), BLLCommon.GetFieldAndPara(model), model.GetParameters())); }
/// <summary> /// 修改店铺模板 /// </summary> /// <param name="sst"></param> public void UpdateStoreStyle(M_StoreStyleTable model) { Sql.UpdateByIDs(strTableName, PK, model.ID.ToString(), BLLCommon.GetFieldAndPara(model), model.GetParameters()); }
//初始化 private void GetInit() { DataTable shopinfo = mfbll.SelectTableName("ZL_CommonModel", "where tablename like 'ZL_Store_%' and Inputer='" + ubll.GetLogin().UserName + "'"); if (shopinfo.Rows.Count < 1) { Response.Redirect("StoreApply.aspx");//申请店铺 } else { ViewState["gid"] = shopinfo.Rows[0]["GeneralID"].ToString(); this.Label2.Text = "<a href=\"/Store/StoreIndex.aspx?id=" + shopinfo.Rows[0]["GeneralID"].ToString() + "\" target=\"_blank\">浏览店铺</a>"; if (shopinfo.Rows[0]["Status"].ToString() != "99") { Response.Redirect("StoreEdit.aspx"); } else { int id = Convert.ToInt32(shopinfo.Rows[0]["ItemID"].ToString()); string TableName = shopinfo.Rows[0]["TableName"].ToString(); DataTable st = Sql.Sel(TableName, "ID=" + id, ""); if (st.Rows.Count != 0) { this.Nametxt.Text = st.Rows[0]["StoreName"].ToString(); } else { this.Nametxt.Text = ""; } DataTable modeinfo = mfbll.SelectTableName("ZL_Model", "where TableName='" + TableName + "'"); if (modeinfo.Rows.Count > 0) { DataTable cmdinfo = cbll.GetContent(gid); if (cmdinfo.Rows.Count > 0) { this.Label3.Text = cmdinfo.Rows[0]["StoreCredit"].ToString(); this.Label4.Text = GetState(cmdinfo.Rows[0]["StoreCommendState"].ToString()); M_ModelInfo mi = bmll.GetModelById(int.Parse(cmdinfo.Rows[0]["StoreModelID"].ToString())); this.Label1.Text = mi.ModelName; //DataTable slist = sstbll.GetStyleByModel(int.Parse(cmdinfo.Rows[0]["StoreModelID"].ToString()), 1); DataTable slist = sstbll.GetStyleByModel(int.Parse(cmdinfo.Rows[0]["StoreModelID"].ToString()), 1); this.HiddenField1.Value = cmdinfo.Rows[0]["StoreModelID"].ToString(); this.SSTDownList.DataSource = slist; this.SSTDownList.DataTextField = "StyleName"; this.SSTDownList.DataValueField = "ID"; this.SSTDownList.DataBind(); this.SSTDownList.SelectedValue = cmdinfo.Rows[0]["StoreStyleID"].ToString(); M_StoreStyleTable sst = sstbll.GetStyleByID(int.Parse(cmdinfo.Rows[0]["StoreStyleID"].ToString())); this.Image1.ImageUrl = "~/UploadFiles/" + sst.StylePic; if (cmdinfo.Rows.Count > 0) { this.ModelHtml.Text = this.mfbll.GetUpdateHtmlUser(int.Parse(cmdinfo.Rows[0]["StoreModelID"].ToString()), 0, cmdinfo); } else { this.ModelHtml.Text = this.mfbll.GetInputHtmlUser(int.Parse(cmdinfo.Rows[0]["StoreModelID"].ToString()), 0); } //function.WriteErrMsg(ModelHtml.Text.ToString().Replace("<","左")); } } else { cbll.DelContent(gid); Response.Redirect("Default.aspx"); this.Label3.Text = "不可用"; this.Label4.Text = "不可用"; this.Label1.Text = "不可用"; this.SSTDownList.Items.Add(new ListItem("无", "")); this.Image1.Visible = false; } } } }
protected void EBtnSubmit_Click(object sender, EventArgs e) { try { DataTable dt = this.mfbll.GetModelFieldList(int.Parse(this.HiddenField1.Value)).Tables[0]; DataTable table = new DataTable(); table.Columns.Add(new DataColumn("FieldName", typeof(string))); table.Columns.Add(new DataColumn("FieldType", typeof(string))); table.Columns.Add(new DataColumn("FieldValue", typeof(string))); foreach (DataRow dr in dt.Rows) { if (DataConverter.CBool(dr["IsNotNull"].ToString())) { if (string.IsNullOrEmpty(this.Page.Request.Form["txt_" + dr["FieldName"].ToString()])) { function.WriteErrMsg(dr["FieldAlias"].ToString() + "不能为空!"); } } if (dr["FieldType"].ToString() == "FileType") { string[] Sett = dr["Content"].ToString().Split(new char[] { ',' }); bool chksize = DataConverter.CBool(Sett[0].Split(new char[] { '=' })[1]); string sizefield = Sett[1].Split(new char[] { '=' })[1]; if (chksize && sizefield != "") { DataRow row2 = table.NewRow(); row2[0] = sizefield; row2[1] = "FileSize"; row2[2] = this.Page.Request.Form["txt_" + sizefield]; table.Rows.Add(row2); } } if (dr["FieldType"].ToString() == "MultiPicType") { string[] Sett = dr["Content"].ToString().Split(new char[] { ',' }); bool chksize = DataConverter.CBool(Sett[0].Split(new char[] { '=' })[1]); string sizefield = Sett[1].Split(new char[] { '=' })[1]; if (chksize && sizefield != "") { if (string.IsNullOrEmpty(this.Page.Request.Form["txt_" + sizefield])) { function.WriteErrMsg(dr["FieldAlias"].ToString() + "的缩略图不能为空!"); } DataRow row1 = table.NewRow(); row1[0] = sizefield; row1[1] = "ThumbField"; row1[2] = this.Page.Request.Form["txt_" + sizefield]; table.Rows.Add(row1); } } DataRow row = table.NewRow(); row[0] = dr["FieldName"].ToString(); string ftype = dr["FieldType"].ToString(); row[1] = ftype; string fvalue = this.Page.Request.Form["txt_" + dr["FieldName"].ToString()]; if (ftype == "TextType" || ftype == "MultipleTextType" || ftype == "MultipleHtmlType") { fvalue = sll.ProcessSen(fvalue); } row[2] = fvalue; table.Rows.Add(row); } string uname = ubll.GetLogin().UserName; DataRow rs4 = table.NewRow(); rs4[0] = "StoreName"; rs4[1] = "TextType"; rs4[2] = this.Nametxt.Text; table.Rows.Add(rs4); DataRow rs5 = table.NewRow(); rs5[0] = "StoreStyleID"; rs5[1] = "int"; rs5[2] = DataConverter.CLng(this.SSTDownList.Text); table.Rows.Add(rs5); M_StoreStyleTable sst = sstbll.GetStyleByID(int.Parse(this.SSTDownList.Text)); M_CommonData CData = cbll.GetCommonData(gid); CData.Template = sst.StyleUrl; CData.Title = this.Nametxt.Text; //throw new Exception(); cbll.UpdateContent(table, CData); Response.Write("<script language=javascript>alert('提交成功!');location.href='Default.aspx';</script>"); } catch (Exception ee) { function.WriteErrMsg(ee.Message); } }
//初始化 private void GetInit() { M_UserInfo mu = buser.GetLogin(); M_CommonData storeMod = conBll.SelMyStore(mu.UserName); if (storeMod == null) { Response.Redirect("StoreApply.aspx");//申请店铺 } if (storeMod != null) { StoreUrl_L.Text = "<a href='/Store/StoreIndex.aspx?id=" + storeMod.GeneralID + "' target='_blank'> [浏览店铺]</a>"; } gid = storeMod.GeneralID; if (storeMod.Status != 99) { Response.Redirect("StoreEdit.aspx"); } else { DataTable st = Sql.Sel(storeMod.TableName, "ID=" + storeMod.ItemID, ""); if (st.Rows.Count != 0) { Nametxt.Text = st.Rows[0]["StoreName"].ToString(); } else { Nametxt.Text = ""; } DataTable modeinfo = mfbll.SelectTableName("ZL_Model", "TableName='" + storeMod.TableName + "'"); if (modeinfo.Rows.Count > 0) { DataTable cmdinfo = conBll.GetContent(gid); if (cmdinfo.Rows.Count > 0) { Label3.Text = cmdinfo.Rows[0]["StoreCredit"].ToString(); Label4.Text = GetState(cmdinfo.Rows[0]["StoreCommendState"].ToString()); M_ModelInfo mi = bmll.GetModelById(int.Parse(cmdinfo.Rows[0]["StoreModelID"].ToString())); Label1.Text = mi.ModelName; DataTable slist = sstbll.GetStyleByModel(int.Parse(cmdinfo.Rows[0]["StoreModelID"].ToString()), 1); HiddenField1.Value = cmdinfo.Rows[0]["StoreModelID"].ToString(); SSTDownList.DataSource = slist; SSTDownList.DataTextField = "StyleName"; SSTDownList.DataValueField = "ID"; SSTDownList.DataBind(); SSTDownList.SelectedValue = cmdinfo.Rows[0]["StoreStyleID"].ToString(); M_StoreStyleTable sst = sstbll.GetStyleByID(int.Parse(cmdinfo.Rows[0]["StoreStyleID"].ToString())); Image1.ImageUrl = function.GetImgUrl(sst.StylePic); if (cmdinfo.Rows.Count > 0) { ModelHtml.Text = mfbll.InputallHtml(DataConvert.CLng(cmdinfo.Rows[0]["StoreModelID"]), 0, new ModelConfig() { ValueDT = cmdinfo }); } else { ModelHtml.Text = mfbll.InputallHtml(DataConvert.CLng(cmdinfo.Rows[0]["StoreModelID"]), 0, new ModelConfig() { Source = ModelConfig.SType.UserBase }); } } } else { conBll.DelContent(gid); Response.Redirect("Default.aspx"); Label3.Text = "不可用"; Label4.Text = "不可用"; Label1.Text = "不可用"; SSTDownList.Items.Add(new ListItem("无", "")); Image1.Visible = false; } } }
public ActionResult Apply_Add() { int modelid = DataConvert.CLng(Request.Form["model_dp"]); string store = Request.Form["store_t"]; M_CommonData CData = conBll.SelMyStore(mu.UserName); if (CData == null) { CData = new M_CommonData(); } //---------------------------------------- if (string.IsNullOrEmpty(store)) { function.WriteErrMsg("店铺名称不能为空"); return(Content("")); } M_StoreStyleTable sst = sstbll.GetNewStyle(modelid); if (sst.ID == 0) { function.WriteErrMsg("后台没有为该模型绑定可用的模板!"); return(Content("")); } DataTable dt = fieldBll.GetModelFieldList(modelid); DataTable table = new DataTable(); table.Columns.Add(new DataColumn("FieldName", typeof(string))); table.Columns.Add(new DataColumn("FieldType", typeof(string))); table.Columns.Add(new DataColumn("FieldValue", typeof(string))); foreach (DataRow dr in dt.Rows) { if (DataConverter.CBool(dr["IsNotNull"].ToString())) { if (string.IsNullOrEmpty(Request.Form["txt_" + dr["FieldName"].ToString()])) { function.WriteErrMsg(dr["FieldAlias"].ToString() + "不能为空!"); return(Content("")); } } if (dr["FieldType"].ToString() == "FileType") { string[] Sett = dr["Content"].ToString().Split(new char[] { ',' }); bool chksize = DataConverter.CBool(Sett[0].Split(new char[] { '=' })[1]); string sizefield = Sett[1].Split(new char[] { '=' })[1]; if (chksize && sizefield != "") { DataRow row2 = table.NewRow(); row2[0] = sizefield; row2[1] = "FileSize"; row2[2] = Request.Form["txt_" + sizefield]; table.Rows.Add(row2); } } if (dr["FieldType"].ToString() == "MultiPicType") { string[] Sett = dr["Content"].ToString().Split(new char[] { ',' }); bool chksize = DataConverter.CBool(Sett[0].Split(new char[] { '=' })[1]); string sizefield = Sett[1].Split(new char[] { '=' })[1]; if (chksize && sizefield != "") { if (string.IsNullOrEmpty(Request.Form["txt_" + sizefield])) { function.WriteErrMsg(dr["FieldAlias"].ToString() + "的缩略图不能为空!"); return(Content("")); } DataRow row1 = table.NewRow(); row1[0] = sizefield; row1[1] = "ThumbField"; row1[2] = Request.Form["txt_" + sizefield]; table.Rows.Add(row1); } } DataRow row = table.NewRow(); row[0] = dr["FieldName"].ToString(); string ftype = dr["FieldType"].ToString(); row[1] = ftype; string fvalue = Request.Form["txt_" + dr["FieldName"]]; row[2] = fvalue; table.Rows.Add(row); } DataRow rs1 = table.NewRow(); rs1[0] = "UserID"; rs1[1] = "int"; rs1[2] = mu.UserID; table.Rows.Add(rs1); DataRow rs2 = table.NewRow(); rs2[0] = "UserName"; rs2[1] = "TextType"; rs2[2] = mu.UserName; table.Rows.Add(rs2); DataRow rs3 = table.NewRow(); rs3[0] = "StoreModelID"; rs3[1] = "int"; rs3[2] = DataConverter.CLng(modelid); table.Rows.Add(rs3); if (!string.IsNullOrEmpty(sst.StyleName)) { DataRow rs5 = table.NewRow(); rs5[0] = "StoreStyleID"; rs5[1] = "int"; rs5[2] = sst.ID; table.Rows.Add(rs5); DataRow rs4 = table.NewRow(); rs4[0] = "StoreName"; rs4[1] = "TextType"; rs4[2] = store; table.Rows.Add(rs4); CData.ModelID = modelid; CData.NodeID = 0; CData.TableName = modBll.GetModelById(CData.ModelID).TableName; CData.Title = store; CData.Inputer = mu.UserName; CData.EliteLevel = 0; CData.Status = 0; CData.InfoID = ""; CData.SpecialID = ""; CData.Template = sst.StyleUrl; CData.TagKey = ""; CData.PdfLink = ""; CData.Titlecolor = ""; CData.IP = IPScaner.GetUserIP(); CData.UpDateTime = DateTime.Now; CData.CreateTime = DateTime.Now; if (CData.GeneralID > 0) { conBll.UpdateContent(table, CData); } else { conBll.AddContent(table, CData); } } return(View("StoreAuditing")); }
public void Storelist() { if (!string.IsNullOrEmpty(Request.QueryString["id"])) { int sid = DataConverter.CLng(base.Request.QueryString["id"]); if (sid == 0) { ErrToClient("店铺ID错误,Storelist.aspx?id=店铺ID"); return; } else { M_CommonData cdate = conBll.GetCommonData(sid); DataTable dt = null; try { dt = conBll.GetContent(sid); } catch { ErrToClient("该店铺不存在"); } if (dt.Rows.Count < 1) { ErrToClient("该店铺不存在"); } else { try { if (cdate.Status != 99) { ErrToClient("该店铺还在审核中"); } else if (cdate.Status != 99) { ErrToClient("该店铺没有通过"); } else { if (cdate.Status == 0) { ErrToClient("该店铺被关闭了"); } else { string StoreStyleID = conBll.GetContent(sid).Rows[0]["StoreStyleID"].ToString(); string username = conBll.GetCommonData(sid).Inputer; int userid = buser.GetUserByName(username).UserID; M_StoreStyleTable stinfo = sstbll.GetStyleByID(DataConverter.CLng(StoreStyleID)); string ListStyle = stinfo.ListStyle; string TemplateDir = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/" + ListStyle; TemplateDir = TemplateDir.Replace("/", @"\"); string ContentHtml = FileSystemObject.ReadFile(TemplateDir); ContentHtml = this.createBll.CreateHtml(ContentHtml, Cpage, sid, "1"); Response.Write(ContentHtml); } } } catch { ErrToClient("店铺信息读取失败!ID错误!"); } } } } else { ErrToClient("[产生错误的可能原因:没有指定店铺ID]"); return; } }
protected void SSTDownList_SelectedIndexChanged(object sender, EventArgs e) { M_StoreStyleTable sst = sstbll.GetStyleByID(int.Parse(this.SSTDownList.Text)); this.Image1.ImageUrl = "~/" + sst.StylePic; }
public void StoreContent() { if (ItemID < 1) { ErrToClient("[产生错误的可能原因:您访问的商品信息不存在!"); } M_Product ItemInfo = proBll.GetproductByid(ItemID); if (ItemInfo == null) { ErrToClient("[产生错误的可能原因:您访问的商品信息不存在!]"); return; } M_Node nodeinfo = nodeBll.GetNodeXML(ItemInfo.Nodeid); if (nodeinfo.PurviewType) { if (!buser.CheckLogin()) { function.WriteErrMsg("该信息所属栏目需登录验证,请先登录再进行此操作!", "/User/login"); return; } else { //此处以后可以加上用户组权限检测 } } string TemplateDir = ""; //ItemID 商品ID if (proBll.SelectProByCmdID(ItemID).Rows.Count < 1) { function.WriteErrMsg("该商品不存在!"); return; } int UserID = DataConverter.CLng(proBll.SelectProByCmdID(ItemID).Rows[0]["UserID"]); string username = buser.GetUserByUserID(UserID).UserName; DataTable mosinfo = mfbll.SelectTableName("ZL_CommonModel", "TableName like 'ZL_Store_%' and Inputer='" + username + "'"); int GeneralID = DataConverter.CLng(mosinfo.Rows[0]["GeneralID"]); DataTable infos = conBll.GetContent(GeneralID); int StoreStyleID = DataConverter.CLng(infos.Rows[0]["StoreStyleID"]); M_StoreStyleTable stinfo = sstbll.GetStyleByID(DataConverter.CLng(StoreStyleID)); string ContentStyle = stinfo.ContentStyle; M_ModelInfo modelinfo = modBll.GetModelById(ItemInfo.ModelID); string TempNode = nodeBll.GetModelTemplate(ItemInfo.Nodeid, ItemInfo.ModelID); if (!string.IsNullOrEmpty(TempNode)) { TemplateDir = TempNode; } if (!string.IsNullOrEmpty(ContentStyle)) { TemplateDir = ContentStyle; } if (string.IsNullOrEmpty(TemplateDir)) { Response.Write("[产生错误的可能原因:该商品所属模型未指定模板!]"); } else { TemplateDir = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/" + TemplateDir; TemplateDir = TemplateDir.Replace("/", @"\"); string ContentHtml = FileSystemObject.ReadFile(TemplateDir); ContentHtml = this.createBll.CreateHtml(ContentHtml, 0, ItemID, "0"); if (!string.IsNullOrEmpty(ContentHtml)) { /* --------------------判断是否分页 并做处理------------------------------------------------*/ string infoContent = ""; //进行处理的商品字段 string pagelabel = ""; string infotmp = ""; string pattern = @"{\#Content}([\s\S])*?{\/\#Content}"; //查找要分页的商品 if (Regex.IsMatch(ContentHtml, pattern, RegexOptions.IgnoreCase)) { infoContent = Regex.Match(ContentHtml, pattern, RegexOptions.IgnoreCase).Value; infotmp = infoContent; infoContent = infoContent.Replace("{#Content}", "").Replace("{/#Content}", ""); } //查找分页标签 bool isPage = false; string pattern1 = @"{ZL\.Page([\s\S])*?\/}"; if (Regex.IsMatch(ContentHtml, pattern1, RegexOptions.IgnoreCase)) { pagelabel = Regex.Match(ContentHtml, pattern1, RegexOptions.IgnoreCase).Value; isPage = true; } if (isPage) { if (string.IsNullOrEmpty(infoContent)) //没有设定要分页的字段商品 { ContentHtml = ContentHtml.Replace(pagelabel, ""); } else //进行商品分页处理 { //文件名 string file1 = "StoreContent.aspx?ItemID=" + ItemID.ToString(); //取分页标签处理结果 返回字符串数组 根据数组元素个数生成几页 string ilbl = pagelabel.Replace("{ZL.Page ", "").Replace("/}", "").Replace(" ", ","); string lblContent = ""; int NumPerPage = 500; IList <string> ContentArr = new List <string>(); if (string.IsNullOrEmpty(ilbl)) { lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}"; //默认格式的分页导航 ContentArr = this.createBll.GetContentPage(infoContent, NumPerPage); } else { string[] paArr = ilbl.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); if (paArr.Length == 0) { lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}"; //默认格式的分页导航 ContentArr = this.createBll.GetContentPage(infoContent, NumPerPage); } else { string lblname = paArr[0].Split(new char[] { '=' })[1].Replace("\"", ""); if (paArr.Length > 1) { NumPerPage = DataConverter.CLng(paArr[1].Split(new char[] { '=' })[1].Replace("\"", "")); } B_Label blbl = new B_Label(); lblContent = blbl.GetLabelXML(lblname).Content; if (string.IsNullOrEmpty(lblContent)) { lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}"; //默认格式的分页导航 } ContentArr = this.createBll.GetContentPage(infoContent, NumPerPage); } } //Response.Write(NumPerPage.ToString()); //Response.End(); if (ContentArr.Count > 0) //存在分页数据 { ContentHtml = ContentHtml.Replace(infotmp, ContentArr[Cpage - 1]); ContentHtml = ContentHtml.Replace(pagelabel, this.createBll.GetPage(lblContent, ItemID, Cpage, ContentArr.Count, NumPerPage)); } else { ContentHtml = ContentHtml.Replace(infotmp, infoContent); ContentHtml = ContentHtml.Replace(pagelabel, ""); } } } else //没有分页标签 { //如果设定了分页商品字段 将该字段商品的分页标志清除 if (!string.IsNullOrEmpty(infoContent)) { ContentHtml = ContentHtml.Replace(infotmp, infoContent); } } } /*--------------------- 分页商品处理结束-------------------------------------------------------------------------*/ Response.Write(ContentHtml); } }