protected string outputNewsSites() { Cms.DAL.Channel dal = new Cms.DAL.Channel(); StringBuilder strTxt = new StringBuilder(); DataSet newsDS = dal.GetNewsClassList(""); DataTable tbl = newsDS.Tables[0]; if (tbl.Rows.Count > 0) { for (int j = 0; j < tbl.Rows.Count; j++) { DataRow dr = tbl.Rows[j]; if ((j + 1) % 6 == 0) { strTxt.Append("</br>"); } strTxt.Append("<a class=\"siteLink\" href=\"News.aspx?classID=" + dr["ClassID"].ToString() + "\">" + dr["Title"].ToString() + "</a> "); } } else { strTxt.Append("暂无活动栏目!"); } return(strTxt.ToString()); }
public static string adviseProductList() { Cms.DAL.ProductInfo dal = new Cms.DAL.ProductInfo(); Cms.DAL.Channel chnDal = new Cms.DAL.Channel(); StringBuilder strTxt = new StringBuilder(); DataSet proSpecDS = dal.GetTopProductList(5, "", " order by Click desc"); DataTable proSpecTBL = proSpecDS.Tables[0]; if (proSpecTBL.Rows.Count > 0) { strTxt.Append("<dl>"); for (int j = 0; j < proSpecTBL.Rows.Count; j++) { DataRow proRow = proSpecTBL.Rows[j]; int brandId = int.Parse(proRow["BrandID"].ToString()); string title = chnDal.GetProductBrandTitle(brandId) + " " + proRow["Specifications"].ToString(); strTxt.Append("<dd style=\"height: 22px;\">"); strTxt.Append("<a class=\"productClass02\" href=\"productView.aspx?specID=" + proRow["SpecificationsId"].ToString() + "\" style=\"position: relative; top: 5px; left: 15px;\">" + title + "</a>"); strTxt.Append("</dd>"); } strTxt.Append("</dl>"); } else { strTxt.Append("暂无推荐产品!"); } return(strTxt.ToString()); }
public static string adviseProductList() { Cms.DAL.ProductInfo dal = new Cms.DAL.ProductInfo(); Cms.DAL.Channel chnDal = new Cms.DAL.Channel(); StringBuilder strTxt = new StringBuilder(); DataSet proSpecDS = dal.GetTopProductList(5, "", " order by Click desc"); DataTable proSpecTBL = proSpecDS.Tables[0]; if (proSpecTBL.Rows.Count > 0) { strTxt.Append("<dl>"); for (int j = 0; j < proSpecTBL.Rows.Count; j++) { DataRow proRow = proSpecTBL.Rows[j]; int brandId = int.Parse(proRow["BrandID"].ToString()); string title = chnDal.GetProductBrandTitle(brandId) + " " + proRow["Specifications"].ToString(); strTxt.Append("<dd style=\"height: 22px;\">"); strTxt.Append("<a class=\"productClass02\" href=\"productView.aspx?specID=" + proRow["SpecificationsId"].ToString() + "\" style=\"position: relative; top: 5px; left: 15px;\">" + title + "</a>"); strTxt.Append("</dd>"); } strTxt.Append("</dl>"); } else strTxt.Append("暂无推荐产品!"); return strTxt.ToString(); }
public static string newsClassList() { Cms.DAL.Channel dal = new Cms.DAL.Channel(); StringBuilder strTxt = new StringBuilder(); DataSet newsDS = dal.GetNewsClassList(""); DataTable tbl = newsDS.Tables[0]; if (tbl.Rows.Count > 0) { strTxt.Append("<dl>"); for (int j = 0; j < tbl.Rows.Count; j++) { DataRow dr = tbl.Rows[j]; strTxt.Append("<dd style=\"background-color: rgb(239,239,239); height: 26px;\">"); strTxt.Append("<a class=\"channelClass01\" href=\"News.aspx?classID=" + dr["ClassID"].ToString() + "\" style=\"position: relative;top: 8px; left: 15px;\">" + dr["Title"].ToString() + "</a>"); strTxt.Append("</dd>"); } strTxt.Append("</dl>"); } else { strTxt.Append("暂无活动栏目!"); } return(strTxt.ToString()); }
public static string ViewProductListTitle(int typeId, int brandID, int nameID) { StringBuilder strTxt = new StringBuilder(); Cms.DAL.Channel dal = new Cms.DAL.Channel(); if (dal.ExistsProductType(typeId)) { if (dal.ExistsProductBrand(brandID)) { strTxt.Append("<a class=\"navLink\" href=\"ProductList.aspx?typeID=" + typeId.ToString() + "\">" + dal.GetProductTypeTitle(typeId) + "</a>"); if (dal.ExistsProductName(nameID)) { strTxt.Append("><a class=\"navLink\" href=\"ProductList.aspx?typeID=" + typeId.ToString() + "&brandID=" + brandID.ToString() + "\">" + dal.GetProductBrandTitle(brandID) + "</a>"); strTxt.Append(">" + dal.GetProductNameTitle(nameID)); } else { strTxt.Append(">" + dal.GetProductBrandTitle(brandID)); } } else { strTxt.Append(dal.GetProductTypeTitle(typeId)); } } else { strTxt.Append("所有列表"); } return(strTxt.ToString()); }
protected string outputProductSites() { Cms.DAL.Channel dal = new Cms.DAL.Channel(); StringBuilder strTxt = new StringBuilder(); DataSet brandDS = dal.GetProductBrandList(""); DataTable tbl = brandDS.Tables[0]; if (tbl.Rows.Count > 0) { for (int j = 0; j < tbl.Rows.Count; j++) { DataRow dr = tbl.Rows[j]; if ((j + 1) % 6 == 0) { strTxt.Append("</br>"); } strTxt.Append("<a class=\"siteLink\" href=\"ProductList.aspx?brandID=" + dr["BrandID"].ToString() + "\">" + dr["Brand"].ToString() + "</a> "); } } else { strTxt.Append("暂无品牌!"); } return(strTxt.ToString()); }
//取得产品名字名称 protected string GetNameTitle(int nameId) { Cms.DAL.Channel dal = new Cms.DAL.Channel(); string title = dal.GetProductNameTitle(nameId); if (string.IsNullOrEmpty(title)) title = "No Name"; return title; }
//取得产品分类名称 protected string GetTypeTitle(int typeId) { Cms.DAL.Channel dal = new Cms.DAL.Channel(); string title = dal.GetProductTypeTitle(typeId); if (string.IsNullOrEmpty( title )) title = "No Type"; return title; }
protected int specId; //全局变量Id #endregion Fields #region Methods //取得产品品牌名称 protected string GetBrandTitle(int brandId) { Cms.DAL.Channel dal = new Cms.DAL.Channel(); string title = dal.GetProductBrandTitle(brandId); if (string.IsNullOrEmpty(title)) title = "No Brand"; return title; }
public static string productClassList() { Cms.DAL.Channel dal = new Cms.DAL.Channel(); StringBuilder strTxt = new StringBuilder(); DataSet proTypeDS = dal.GetProductTypeList(""); DataTable proTypeTBL = proTypeDS.Tables[0]; if (proTypeTBL.Rows.Count > 0) { for (int i = 0; i < proTypeTBL.Rows.Count; i++) { // 产品分类 DataRow typeRow = proTypeTBL.Rows[i]; strTxt.Append("<dl>"); strTxt.Append("<dt class=\"productGroup01\" style=\"height: 26px;\">"); strTxt.Append("<a class=\"productClass01\" href=\"ProductList.aspx?typeID=" + typeRow["TypeId"].ToString() + "\" style=\"position: relative; top: 5px; left: 10px;\">" + typeRow["ComoditiesType"].ToString() + "</a>"); strTxt.Append("</dt>"); //产品品牌 DataSet proBrandDS = dal.GetProductBrandList("TypeID = " + typeRow["TypeId"].ToString()); DataTable proBrandTBL = proBrandDS.Tables[0]; for (int j = 0; j < proBrandTBL.Rows.Count; j++) { DataRow brandRow = proBrandTBL.Rows[j]; strTxt.Append("<dd>"); strTxt.Append("<dl>"); strTxt.Append("<dt class=\"productGroup02\" style=\"height: 22px;\">"); strTxt.Append("<a class=\"productClass02\" href=\"ProductList.aspx?typeID=" + typeRow["TypeId"].ToString() + "&brandID=" + brandRow["brandID"].ToString() + "\" style=\"position: relative; top: 5px; left: 20px;\"><strong>" + brandRow["Brand"].ToString() + "</strong></a>"); strTxt.Append("</dt>"); //产品名称 DataSet proNameDS = dal.GetProductNameList("TypeID = " + typeRow["TypeId"].ToString() + "AND brandID = " + brandRow["brandID"].ToString()); DataTable proNameTBL = proNameDS.Tables[0]; for (int k = 0; k < proNameTBL.Rows.Count; k++) { DataRow nameRow = proNameTBL.Rows[k]; strTxt.Append("<dd style=\"height: 22px;\">"); strTxt.Append("<a class=\"productClass03\" href=\"ProductList.aspx?typeID=" + typeRow["TypeId"].ToString() + "&brandID=" + brandRow["brandID"].ToString() + "&nameID=" + nameRow["ComoditiesNameID"].ToString() + "\" style=\"position: relative; top: 5px; left: 30px;\">" + nameRow["ComoditiesName"].ToString() + "</a>"); strTxt.Append("</dd>"); } if (j < proBrandTBL.Rows.Count - 1) { strTxt.Append("<dd class=\"productGroup03\"></dd>"); } strTxt.Append("<dl>"); strTxt.Append("</dd>"); } strTxt.Append("</dl>"); } } else { strTxt.Append("暂无产品分类!"); } return(strTxt.ToString()); }
public static string productClassList() { Cms.DAL.Channel dal = new Cms.DAL.Channel(); StringBuilder strTxt = new StringBuilder(); DataSet proTypeDS = dal.GetProductTypeList(""); DataTable proTypeTBL = proTypeDS.Tables[0]; if (proTypeTBL.Rows.Count > 0) { for (int i = 0; i < proTypeTBL.Rows.Count; i++) { // 产品分类 DataRow typeRow = proTypeTBL.Rows[i]; strTxt.Append("<dl>"); strTxt.Append("<dt class=\"productGroup01\" style=\"height: 26px;\">"); strTxt.Append("<a class=\"productClass01\" href=\"ProductList.aspx?typeID=" + typeRow["TypeId"].ToString() + "\" style=\"position: relative; top: 5px; left: 10px;\">" + typeRow["ComoditiesType"].ToString() + "</a>"); strTxt.Append("</dt>"); //产品品牌 DataSet proBrandDS = dal.GetProductBrandList("TypeID = " + typeRow["TypeId"].ToString()); DataTable proBrandTBL = proBrandDS.Tables[0]; for (int j = 0; j < proBrandTBL.Rows.Count; j++) { DataRow brandRow = proBrandTBL.Rows[j]; strTxt.Append("<dd>"); strTxt.Append("<dl>"); strTxt.Append("<dt class=\"productGroup02\" style=\"height: 22px;\">"); strTxt.Append("<a class=\"productClass02\" href=\"ProductList.aspx?typeID=" + typeRow["TypeId"].ToString() + "&brandID=" + brandRow["brandID"].ToString() + "\" style=\"position: relative; top: 5px; left: 20px;\"><strong>" + brandRow["Brand"].ToString() + "</strong></a>"); strTxt.Append("</dt>"); //产品名称 DataSet proNameDS = dal.GetProductNameList("TypeID = " + typeRow["TypeId"].ToString() + "AND brandID = " + brandRow["brandID"].ToString()); DataTable proNameTBL = proNameDS.Tables[0]; for (int k = 0; k < proNameTBL.Rows.Count; k++) { DataRow nameRow = proNameTBL.Rows[k]; strTxt.Append("<dd style=\"height: 22px;\">"); strTxt.Append("<a class=\"productClass03\" href=\"ProductList.aspx?typeID=" + typeRow["TypeId"].ToString() + "&brandID=" + brandRow["brandID"].ToString() + "&nameID=" + nameRow["ComoditiesNameID"].ToString() + "\" style=\"position: relative; top: 5px; left: 30px;\">" + nameRow["ComoditiesName"].ToString() + "</a>"); strTxt.Append("</dd>"); } if (j < proBrandTBL.Rows.Count - 1) { strTxt.Append("<dd class=\"productGroup03\"></dd>"); } strTxt.Append("<dl>"); strTxt.Append("</dd>"); } strTxt.Append("</dl>"); } } else strTxt.Append("暂无产品分类!"); return strTxt.ToString(); }
//取得产品分类名称 protected string GetTypeTitle(int typeId) { Cms.DAL.Channel dal = new Cms.DAL.Channel(); string title = dal.GetProductTypeTitle(typeId); if (string.IsNullOrEmpty(title)) { title = "No Type"; } return(title); }
//取得产品品牌名称 protected string GetBrandTitle(int brandId) { Cms.DAL.Channel dal = new Cms.DAL.Channel(); string title = dal.GetProductBrandTitle(brandId); if (string.IsNullOrEmpty(title)) { title = "No Brand"; } return(title); }
//取得产品名字名称 protected string GetNameTitle(int nameId) { Cms.DAL.Channel dal = new Cms.DAL.Channel(); string title = dal.GetProductNameTitle(nameId); if (string.IsNullOrEmpty(title)) { title = "No Name"; } return(title); }
/// <summary> /// 绑定类别DropDownList控制 /// </summary> /// <param name="parentId">父类ID</param> /// /// <param name="firstItemTxt">第一项显示的文字</param> /// <param name="kindId">大类ID</param> /// <param name="ddl">要绑定的DropDownList控件</param> protected void NewsClassTreeBind(string firstItemTxt, DropDownList ddl) { Cms.DAL.Channel dal = new Cms.DAL.Channel(); DataSet newsDS = dal.GetNewsClassList(""); DataTable dt = newsDS.Tables[0]; ddl.Items.Clear(); ddl.Items.Add(new ListItem(firstItemTxt, "")); foreach (DataRow dr in dt.Rows) { string Id = dr["ClassID"].ToString(); string Title = dr["Title"].ToString().Trim(); Title = "├ " + Title; ddl.Items.Add(new ListItem(Title, Id)); } }
public static string ViewNewsListTitle(int classId) { StringBuilder strTxt = new StringBuilder(); Cms.DAL.Channel dal = new Cms.DAL.Channel(); if (dal.ExistsNewsClass(classId)) { strTxt.Append(dal.GetNewsClassTitle(classId)); } else { strTxt.Append("所有列表"); } return(strTxt.ToString()); }
//赋值 private void ShowInfo(int Id) { Cms.DAL.ProductInfo dal = new Cms.DAL.ProductInfo(); Cms.Model.ProductInfo model = dal.GetModel(Id); Cms.DAL.Channel chnDal = new Cms.DAL.Channel(); this.lblId.Text = model.SpecId.ToString(); this.lblType.Text = chnDal.GetProductTypeTitle(model.TypeId); this.lblBrand.Text = chnDal.GetProductBrandTitle(model.BrandId); this.lblName.Text = chnDal.GetProductNameTitle(model.NameId); this.lblSpec.Text = model.Specifications; this.lblContent.Text =Cms.Common.Utils.ToTxt(model.Description); this.lblClick.Text = model.Click.ToString(); this.lblIsTop.Text = model.IsTop.ToString(); this.lblPubTime.Text = model.PubTime.ToString(); }
/// <summary> /// 绑定类别DropDownList控制 /// </summary> /// <param name="parentId">父类ID</param> /// /// <param name="firstItemTxt">第一项显示的文字</param> /// <param name="kindId">大类ID</param> /// <param name="ddl">要绑定的DropDownList控件</param> protected void ProductNameTreeBind(string firstItemTxt, DropDownList ddl, string where) { Cms.DAL.Channel dal = new Cms.DAL.Channel(); DataSet newsDS = dal.GetProductNameList(where); DataTable dt = newsDS.Tables[0]; ddl.Items.Clear(); ddl.Items.Add(new ListItem(firstItemTxt, "")); foreach (DataRow dr in dt.Rows) { string Id = dr["ComoditiesNameID"].ToString(); string Title = dr["ComoditiesName"].ToString().Trim(); Title = "├ " + Title; ddl.Items.Add(new ListItem(Title, Id)); } }
//赋值 private void ShowInfo(int Id) { Cms.DAL.ProductInfo dal = new Cms.DAL.ProductInfo(); Cms.Model.ProductInfo model = dal.GetModel(Id); Cms.DAL.Channel chnDal = new Cms.DAL.Channel(); this.lblId.Text = model.SpecId.ToString(); this.lblType.Text = chnDal.GetProductTypeTitle(model.TypeId); this.lblBrand.Text = chnDal.GetProductBrandTitle(model.BrandId); this.lblName.Text = chnDal.GetProductNameTitle(model.NameId); this.lblSpec.Text = model.Specifications; this.lblContent.Text = Cms.Common.Utils.ToTxt(model.Description); this.lblClick.Text = model.Click.ToString(); this.lblIsTop.Text = model.IsTop.ToString(); this.lblPubTime.Text = model.PubTime.ToString(); }
protected string outputProductSites() { Cms.DAL.Channel dal = new Cms.DAL.Channel(); StringBuilder strTxt = new StringBuilder(); DataSet brandDS = dal.GetProductBrandList(""); DataTable tbl = brandDS.Tables[0]; if (tbl.Rows.Count > 0) { for (int j = 0; j < tbl.Rows.Count; j++) { DataRow dr = tbl.Rows[j]; if ((j + 1) % 6 == 0) strTxt.Append("</br>"); strTxt.Append("<a class=\"siteLink\" href=\"ProductList.aspx?brandID=" + dr["BrandID"].ToString() + "\">" + dr["Brand"].ToString() + "</a> "); } } else strTxt.Append("暂无品牌!"); return strTxt.ToString(); }
protected string outputNewsSites() { Cms.DAL.Channel dal = new Cms.DAL.Channel(); StringBuilder strTxt = new StringBuilder(); DataSet newsDS = dal.GetNewsClassList(""); DataTable tbl = newsDS.Tables[0]; if (tbl.Rows.Count > 0) { for (int j = 0; j < tbl.Rows.Count; j++) { DataRow dr = tbl.Rows[j]; if ((j + 1) % 6 == 0) strTxt.Append("</br>"); strTxt.Append("<a class=\"siteLink\" href=\"News.aspx?classID=" + dr["ClassID"].ToString() + "\">" + dr["Title"].ToString() + "</a> "); } } else strTxt.Append("暂无活动栏目!"); return strTxt.ToString(); }
public static string newsClassList() { Cms.DAL.Channel dal = new Cms.DAL.Channel(); StringBuilder strTxt = new StringBuilder(); DataSet newsDS = dal.GetNewsClassList(""); DataTable tbl = newsDS.Tables[0]; if (tbl.Rows.Count > 0) { strTxt.Append("<dl>"); for (int j = 0; j < tbl.Rows.Count; j++) { DataRow dr = tbl.Rows[j]; strTxt.Append("<dd style=\"background-color: rgb(239,239,239); height: 26px;\">"); strTxt.Append("<a class=\"channelClass01\" href=\"News.aspx?classID=" + dr["ClassID"].ToString() + "\" style=\"position: relative;top: 8px; left: 15px;\">" + dr["Title"].ToString() + "</a>"); strTxt.Append("</dd>"); } strTxt.Append("</dl>"); } else strTxt.Append("暂无活动栏目!"); return strTxt.ToString(); }
protected void btnSelect_Click(object sender, EventArgs e) { string strsql = ""; string SupplierName = this.txtKeywords.Text.Trim(); if (SupplierName != "") { strsql += "Specifications like '%" + SupplierName + "%'"; } else { return; } //匹配类型名 Cms.DAL.Channel dal = new Cms.DAL.Channel(); DataSet ds = dal.GetProductTypeList("ComoditiesType like '%" + SupplierName + "%'"); DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { strsql += "OR TypeID in ("; for (int i = 0; i < dt.Rows.Count; ++i) { DataRow dr = dt.Rows[i]; string Id = dr["TypeId"].ToString(); strsql += Id; if (i != dt.Rows.Count - 1) { strsql += ","; } } strsql += ")"; } //匹配品牌名 ds = dal.GetProductBrandList("Brand like '%" + SupplierName + "%'"); dt = ds.Tables[0]; if (dt.Rows.Count > 0) { strsql += "OR BrandID in ("; for (int i = 0; i < dt.Rows.Count; ++i) { DataRow dr = dt.Rows[i]; string Id = dr["BrandID"].ToString(); strsql += Id; if (i != dt.Rows.Count - 1) { strsql += ","; } } strsql += ")"; } ds = dal.GetProductNameList("ComoditiesName like '%" + SupplierName + "%'"); dt = ds.Tables[0]; if (dt.Rows.Count > 0) { strsql += "OR ComoditiesNameID in ("; for (int i = 0; i < dt.Rows.Count; ++i) { DataRow dr = dt.Rows[i]; string Id = dr["ComoditiesNameID"].ToString(); strsql += Id; if (i != dt.Rows.Count - 1) { strsql += ","; } } strsql += ")"; } if (strsql != "") { Session["strWhereProduct"] = strsql; } else { Session["strWhereProduct"] = ""; } //重新绑定数据 RptBind(); }
protected void lbtnImport_Click(object sender, EventArgs e) { string fullPath = HttpContext.Current.Server.MapPath(importFilePath.Text); if (!File.Exists(fullPath)) { //保存日志 MessageBox.Show(this, "请上传导入文件!"); return; } DataSet ds = ExcelToDS(fullPath); DataTable tb = ds.Tables[0]; if (tb.Rows.Count > 0) { Cms.DAL.Channel dal = new Cms.DAL.Channel(); Cms.DAL.ProductInfo proDAL = new Cms.DAL.ProductInfo(); for (int i = 0; i < tb.Rows.Count; i++) { DataRow proRow = tb.Rows[i]; string type = proRow["商品类型"].ToString(); string brand = proRow["商品品牌"].ToString(); string name = proRow["商品名称"].ToString(); string spec = proRow["商品型号"].ToString(); int procNum = int.Parse(proRow["数量"].ToString()); int typeID = dal.GetProductTypeID(type); if (typeID == -1) { typeID = dal.AddProductType(type); } int brandID = dal.GetProductBrandID(brand, typeID); if (brandID == -1) { brandID = dal.AddProductBrand(brand, typeID); } int nameID = dal.GetProductNameID(name, typeID, brandID); if (nameID == -1) { nameID = dal.AddProductName(name, typeID, brandID); } int specID = 0; if (!proDAL.Exists(spec, typeID, brandID, nameID)) { Cms.Model.ProductInfo model = new Cms.Model.ProductInfo(); model.Specifications = spec; model.ImgUrl = ""; model.SmallImgUrl = ""; model.Description = ""; model.Click = 0; model.PubTime = DateTime.Now; model.IsTop = 0; model.TypeId = typeID; model.BrandId = brandID; model.NameId = nameID; specID = proDAL.Add(model); } if (specID > 0) { proDAL.AddStock(typeID, brandID, nameID, specID, procNum, procNum); } } } File.Delete(fullPath); //保存日志 MessageBox.Show(this, "数据导入成功!"); }
/// <summary> /// 热卖产品图片列表 /// </summary> /// <returns></returns> public static string hotProdcutList() { Cms.DAL.ProductInfo dal = new Cms.DAL.ProductInfo(); Cms.DAL.Channel chnDal = new Cms.DAL.Channel(); StringBuilder strTxt = new StringBuilder(); DataSet proSpecDS = dal.GetTopProductList(6, "IsTop > 0", " order by SpecificationsOrder"); DataTable proSpecTBL = proSpecDS.Tables[0]; if (proSpecTBL.Rows.Count > 0) { int colum = 1; for (int i = 0; i < proSpecTBL.Rows.Count; i++) { DataRow proRow = proSpecTBL.Rows[i]; //标题 int brandId = int.Parse(proRow["BrandID"].ToString()); string title = chnDal.GetProductBrandTitle(brandId) + " " + proRow["Specifications"].ToString(); //内容 int nameId = int.Parse(proRow["ComoditiesNameId"].ToString()); string content = "商品名字:" + chnDal.GetProductNameTitle(nameId) + "<BR/>"; if (colum == 1) { strTxt.Append("<tr>"); } strTxt.Append("<td width=\"310\" height=\"60\">"); strTxt.Append("<table cellpadding=\"1\" cellspacing=\"1\">"); strTxt.Append("<td>"); strTxt.Append("<a href=\"productView.aspx?specId=" + proRow["SpecificationsId"].ToString() + "\">"); strTxt.Append("<img src=\"Tools/Http_ImgLoad.ashx?w=80&h=60&gurl=" + proRow["SmallImgUrl"].ToString() + "\" height=\"60\" width=\"80\" border=\"1\"/>"); strTxt.Append("</a>"); strTxt.Append("</td>"); strTxt.Append("<td width=\"220\">"); strTxt.Append("<table cellpadding=\"1\" cellspacing=\"1\" style=\"position:relative;left:10px; width:210px; top: 0px;\">"); strTxt.Append("<tr>"); strTxt.Append(""); strTxt.Append("<td style=\"height:15px;\">"); strTxt.Append("<strong>" + title + "</strong>"); strTxt.Append("</td>"); strTxt.Append("</tr>"); strTxt.Append("<tr>"); strTxt.Append("<td align=\"left\" valign=\"top\">"); strTxt.Append(content + "[<a href=\"productView.aspx?specId=" + proRow["SpecificationsId"].ToString() + "\"><U>详细</U></a>]"); strTxt.Append("</td>"); strTxt.Append("</tr>"); strTxt.Append("</table>"); strTxt.Append("</td>"); strTxt.Append("</table>"); strTxt.Append("</td>"); if (colum == 2) { strTxt.Append("</tr>"); colum = 1; } else { ++colum; } } if (colum == 2) { strTxt.Append("</tr>"); colum = 1; } } else { strTxt.Append("暂无热卖产品。"); } return(strTxt.ToString()); }
public static string ViewNewsListTitle(int classId) { StringBuilder strTxt = new StringBuilder(); Cms.DAL.Channel dal = new Cms.DAL.Channel(); if (dal.ExistsNewsClass(classId)) { strTxt.Append(dal.GetNewsClassTitle(classId)); } else strTxt.Append("所有列表"); return strTxt.ToString(); }
public static string ViewProductListTitle(int typeId, int brandID, int nameID) { StringBuilder strTxt = new StringBuilder(); Cms.DAL.Channel dal = new Cms.DAL.Channel(); if (dal.ExistsProductType(typeId)) { if (dal.ExistsProductBrand(brandID)) { strTxt.Append("<a class=\"navLink\" href=\"ProductList.aspx?typeID=" + typeId.ToString() + "\">" + dal.GetProductTypeTitle(typeId) + "</a>"); if (dal.ExistsProductName(nameID)) { strTxt.Append("><a class=\"navLink\" href=\"ProductList.aspx?typeID=" + typeId.ToString() + "&brandID=" + brandID.ToString() + "\">" + dal.GetProductBrandTitle(brandID) + "</a>"); strTxt.Append(">" + dal.GetProductNameTitle(nameID)); } else strTxt.Append(">" + dal.GetProductBrandTitle(brandID)); } else strTxt.Append(dal.GetProductTypeTitle(typeId)); } else strTxt.Append( "所有列表"); return strTxt.ToString(); }
protected void btnSelect_Click(object sender, EventArgs e) { string strsql = ""; string SupplierName = this.txtKeywords.Text.Trim(); if (SupplierName != "") { strsql += "Specifications like '%" + SupplierName + "%'"; } else { return; } //匹配类型名 Cms.DAL.Channel dal = new Cms.DAL.Channel(); DataSet ds = dal.GetProductTypeList("ComoditiesType like '%" + SupplierName + "%'"); DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { strsql += "OR TypeID in ("; for (int i =0; i < dt.Rows.Count; ++i) { DataRow dr = dt.Rows[i]; string Id = dr["TypeId"].ToString(); strsql += Id; if (i != dt.Rows.Count - 1) strsql += ","; } strsql += ")"; } //匹配品牌名 ds = dal.GetProductBrandList("Brand like '%" + SupplierName + "%'"); dt = ds.Tables[0]; if (dt.Rows.Count > 0) { strsql += "OR BrandID in ("; for (int i = 0; i < dt.Rows.Count; ++i) { DataRow dr = dt.Rows[i]; string Id = dr["BrandID"].ToString(); strsql += Id; if (i != dt.Rows.Count - 1) strsql += ","; } strsql += ")"; } ds = dal.GetProductNameList("ComoditiesName like '%" + SupplierName + "%'"); dt = ds.Tables[0]; if (dt.Rows.Count > 0) { strsql += "OR ComoditiesNameID in ("; for (int i = 0; i < dt.Rows.Count; ++i) { DataRow dr = dt.Rows[i]; string Id = dr["ComoditiesNameID"].ToString(); strsql += Id; if (i != dt.Rows.Count - 1) strsql += ","; } strsql += ")"; } if (strsql != "") { Session["strWhereProduct"] = strsql; } else { Session["strWhereProduct"] = ""; } //重新绑定数据 RptBind(); }
/// <summary> /// 绑定类别DropDownList控制 /// </summary> /// <param name="parentId">父类ID</param> /// /// <param name="firstItemTxt">第一项显示的文字</param> /// <param name="kindId">大类ID</param> /// <param name="ddl">要绑定的DropDownList控件</param> protected void ProductTypeTreeBind(string firstItemTxt, DropDownList ddl) { Cms.DAL.Channel dal = new Cms.DAL.Channel(); DataSet newsDS = dal.GetProductTypeList(""); DataTable dt = newsDS.Tables[0]; ddl.Items.Clear(); ddl.Items.Add(new ListItem(firstItemTxt, "")); foreach (DataRow dr in dt.Rows) { string Id = dr["TypeId"].ToString(); string Title = dr["ComoditiesType"].ToString().Trim(); Title = "├ " + Title; ddl.Items.Add(new ListItem(Title, Id)); } }
/// <summary> /// 绑定类别DropDownList控制 /// </summary> /// <param name="parentId">父类ID</param> /// /// <param name="firstItemTxt">第一项显示的文字</param> /// <param name="kindId">大类ID</param> /// <param name="ddl">要绑定的DropDownList控件</param> protected void ProductBrandTreeBind(string firstItemTxt, DropDownList ddl, string where) { Cms.DAL.Channel dal = new Cms.DAL.Channel(); DataSet newsDS = dal.GetProductBrandList(where); DataTable dt = newsDS.Tables[0]; ddl.Items.Clear(); ddl.Items.Add(new ListItem(firstItemTxt, "")); foreach (DataRow dr in dt.Rows) { string Id = dr["brandID"].ToString(); string Title = dr["Brand"].ToString().Trim(); Title = "├ " + Title; ddl.Items.Add(new ListItem(Title, Id)); } }
/// <summary> /// 热卖产品图片列表 /// </summary> /// <returns></returns> public static string hotProdcutList() { Cms.DAL.ProductInfo dal = new Cms.DAL.ProductInfo(); Cms.DAL.Channel chnDal = new Cms.DAL.Channel(); StringBuilder strTxt = new StringBuilder(); DataSet proSpecDS = dal.GetTopProductList(6, "IsTop > 0", " order by SpecificationsOrder"); DataTable proSpecTBL = proSpecDS.Tables[0]; if (proSpecTBL.Rows.Count > 0) { int colum = 1; for (int i = 0; i < proSpecTBL.Rows.Count; i++) { DataRow proRow = proSpecTBL.Rows[i]; //标题 int brandId = int.Parse(proRow["BrandID"].ToString()); string title = chnDal.GetProductBrandTitle(brandId) + " " + proRow["Specifications"].ToString(); //内容 int nameId = int.Parse(proRow["ComoditiesNameId"].ToString()); string content = "商品名字:" + chnDal.GetProductNameTitle(nameId) + "<BR/>"; if (colum == 1) { strTxt.Append("<tr>"); } strTxt.Append("<td width=\"310\" height=\"60\">"); strTxt.Append("<table cellpadding=\"1\" cellspacing=\"1\">"); strTxt.Append("<td>"); strTxt.Append("<a href=\"productView.aspx?specId=" + proRow["SpecificationsId"].ToString() + "\">"); strTxt.Append("<img src=\"Tools/Http_ImgLoad.ashx?w=80&h=60&gurl=" + proRow["SmallImgUrl"].ToString() + "\" height=\"60\" width=\"80\" border=\"1\"/>"); strTxt.Append("</a>"); strTxt.Append("</td>"); strTxt.Append("<td width=\"220\">"); strTxt.Append("<table cellpadding=\"1\" cellspacing=\"1\" style=\"position:relative;left:10px; width:210px; top: 0px;\">"); strTxt.Append("<tr>"); strTxt.Append(""); strTxt.Append("<td style=\"height:15px;\">"); strTxt.Append("<strong>" + title + "</strong>"); strTxt.Append("</td>"); strTxt.Append("</tr>"); strTxt.Append("<tr>"); strTxt.Append("<td align=\"left\" valign=\"top\">"); strTxt.Append(content + "[<a href=\"productView.aspx?specId=" + proRow["SpecificationsId"].ToString() + "\"><U>详细</U></a>]"); strTxt.Append("</td>"); strTxt.Append("</tr>"); strTxt.Append("</table>"); strTxt.Append("</td>"); strTxt.Append("</table>"); strTxt.Append("</td>"); if (colum == 2) { strTxt.Append("</tr>"); colum = 1; } else ++colum; } if (colum == 2) { strTxt.Append("</tr>"); colum = 1; } } else strTxt.Append("暂无热卖产品。"); return strTxt.ToString(); }
protected void lbtnImport_Click(object sender, EventArgs e) { string fullPath = HttpContext.Current.Server.MapPath(importFilePath.Text); if (!File.Exists(fullPath)) { //保存日志 MessageBox.Show(this, "请上传导入文件!"); return; } DataSet ds = ExcelToDS( fullPath ); DataTable tb = ds.Tables[0]; if (tb.Rows.Count > 0) { Cms.DAL.Channel dal = new Cms.DAL.Channel(); Cms.DAL.ProductInfo proDAL = new Cms.DAL.ProductInfo(); for (int i = 0; i < tb.Rows.Count; i++) { DataRow proRow = tb.Rows[i]; string type = proRow["商品类型"].ToString(); string brand = proRow["商品品牌"].ToString(); string name = proRow["商品名称"].ToString(); string spec = proRow["商品型号"].ToString(); int procNum = int.Parse(proRow["数量"].ToString()); int typeID = dal.GetProductTypeID(type); if (typeID == -1) typeID = dal.AddProductType(type); int brandID = dal.GetProductBrandID(brand, typeID); if (brandID == -1) brandID = dal.AddProductBrand(brand, typeID); int nameID = dal.GetProductNameID(name, typeID, brandID); if (nameID == -1) nameID = dal.AddProductName(name, typeID, brandID); int specID = 0; if (!proDAL.Exists(spec, typeID, brandID, nameID)) { Cms.Model.ProductInfo model = new Cms.Model.ProductInfo(); model.Specifications = spec; model.ImgUrl = ""; model.SmallImgUrl = ""; model.Description = ""; model.Click = 0; model.PubTime = DateTime.Now; model.IsTop = 0; model.TypeId = typeID; model.BrandId = brandID; model.NameId = nameID; specID = proDAL.Add(model); } if (specID > 0) { proDAL.AddStock(typeID, brandID, nameID, specID, procNum, procNum); } } } File.Delete( fullPath ); //保存日志 MessageBox.Show(this, "数据导入成功!"); }