public int Add(ProductBrandInfo entity) { using (var conn = new SqlConnection(connectString)) { string sql = @"INSERT INTO ProductBrand( Name,Spelling,ImageUrl,LinkUrl,Remark,OrderId,IsTop) VALUES(@Name,@Spelling,@ImageUrl,@LinkUrl,@Remark,@OrderId,@IsTop); select SCOPE_IDENTITY()"; return(conn.Query <int>(sql, entity).Single()); } }
public void UpdateProductBrand(ProductBrandInfo productBrand) { SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@id", SqlDbType.Int), new SqlParameter("@name", SqlDbType.NVarChar), new SqlParameter("@logo", SqlDbType.NVarChar), new SqlParameter("@url", SqlDbType.NVarChar), new SqlParameter("@description", SqlDbType.NText), new SqlParameter("@isTop", SqlDbType.Int) }; pt[0].Value = productBrand.ID; pt[1].Value = productBrand.Name; pt[2].Value = productBrand.Logo; pt[3].Value = productBrand.Url; pt[4].Value = productBrand.Description; pt[5].Value = productBrand.IsTop; ShopMssqlHelper.ExecuteNonQuery(ShopMssqlHelper.TablePrefix + "UpdateProductBrand", pt); }
protected string GetBrandList(string ids) { string brandStr = string.Empty; string[] idArr = ids.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); foreach (string id in idArr) { ProductBrandInfo brand = ProductBrandBLL.Read(Convert.ToInt32(id)); brandStr += brand.Name + ";"; } return(brandStr); }
public int AddProductBrand(ProductBrandInfo productBrand) { SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@name", SqlDbType.NVarChar), new SqlParameter("@logo", SqlDbType.NVarChar), new SqlParameter("@url", SqlDbType.NVarChar), new SqlParameter("@description", SqlDbType.NText), new SqlParameter("@orderID", SqlDbType.Int), new SqlParameter("@isTop", SqlDbType.Int), new SqlParameter("@productCount", SqlDbType.Int) }; pt[0].Value = productBrand.Name; pt[1].Value = productBrand.Logo; pt[2].Value = productBrand.Url; pt[3].Value = productBrand.Description; pt[4].Value = productBrand.OrderID; pt[5].Value = productBrand.IsTop; pt[6].Value = productBrand.ProductCount; return(Convert.ToInt32(ShopMssqlHelper.ExecuteScalar(ShopMssqlHelper.TablePrefix + "AddProductBrand", pt))); }
public static ProductBrandInfo ReadProductBrandCache(int id) { ProductBrandInfo info = new ProductBrandInfo(); List <ProductBrandInfo> list = ReadProductBrandCacheList(); foreach (ProductBrandInfo info2 in list) { if (info2.ID == id) { return(info2); } } return(info); }
public void PrepareProductBrandModel(SqlDataReader dr, List <ProductBrandInfo> productBrandList) { while (dr.Read()) { ProductBrandInfo item = new ProductBrandInfo(); item.ID = dr.GetInt32(0); item.Name = dr[1].ToString(); item.Logo = dr[2].ToString(); item.Url = dr[3].ToString(); item.Description = dr[4].ToString(); item.OrderID = dr.GetInt32(5); item.IsTop = dr.GetInt32(6); item.ProductCount = dr.GetInt32(7); productBrandList.Add(item); } }
protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { int queryString = RequestHelper.GetQueryString <int>("ID"); if (queryString != -2147483648) { base.CheckAdminPower("ReadProductBrand", PowerCheckType.Single); ProductBrandInfo info = ProductBrandBLL.ReadProductBrandCache(queryString); this.Name.Text = info.Name; this.Logo.Text = info.Logo; this.Url.Text = info.Url; this.Description.Text = info.Description; this.IsTop.Text = info.IsTop.ToString(); } } }
protected override void PageLoad() { base.PageLoad(); int id = RequestHelper.GetQueryString <int>("id"); product = ProductBLL.Read(id); if (product.IsSale == (int)BoolType.False) { ScriptHelper.AlertFront("该产品未上市,不能查看"); } //如果为移动端单独设置了内容,则取移动端内容 if (!string.IsNullOrEmpty(product.Introduction1_Mobile)) { product.Introduction1 = product.Introduction1_Mobile; } if (!string.IsNullOrEmpty(product.Introduction2_Mobile)) { product.Introduction2 = product.Introduction2_Mobile; } if (!string.IsNullOrEmpty(product.Introduction3_Mobile)) { product.Introduction3 = product.Introduction3_Mobile; } //更新查看数量 Dictionary <string, object> dict = new Dictionary <string, object>(); dict.Add("ViewCount", product.ViewCount + 1); ProductBLL.UpdatePart(ProductInfo.TABLENAME, dict, id); if (product.BrandId > 0) { productBrand = ProductBrandBLL.Read(product.BrandId); } productPhotoList = ProductPhotoBLL.ReadList(id, 0); attributeRecords = ProductTypeAttributeRecordBLL.ReadList(id); standardRecords = ProductTypeStandardRecordBLL.ReadList(id); //搜索优化 Title = product.Name; Keywords = string.IsNullOrEmpty(product.Keywords) ? product.Name : product.Keywords; Description = string.IsNullOrEmpty(product.Summary) ? StringHelper.Substring(StringHelper.KillHTML(product.Introduction1), 200) : product.Summary; }
/// <summary> /// 提交按钮点击方法 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void SubmitButton_Click(object sender, EventArgs e) { ProductBrandInfo productBrand = new ProductBrandInfo(); productBrand.Id = RequestHelper.GetQueryString <int>("ID"); productBrand.Name = Name.Text; var _brand = ProductBrandBLL.Read(productBrand.Name); if ((productBrand.Id > 0 && _brand.Id > 0 && _brand.Id != productBrand.Id) || (productBrand.Id <= 0 && _brand.Id > 0)) { ScriptHelper.Alert("该品牌已存在,请重新输入", RequestHelper.RawUrl); } else { productBrand.ImageUrl = Logo.Text; productBrand.LinkUrl = Url.Text; productBrand.Remark = Description.Text; productBrand.IsTop = Convert.ToInt32(IsTop.Checked); productBrand.OrderId = Convert.ToInt32(OrderID.Text); string alertMessage = ShopLanguage.ReadLanguage("AddOK"); if (productBrand.Id == int.MinValue) { CheckAdminPower("AddProductBrand", PowerCheckType.Single); productBrand.Spelling = ChineseCharacterHelper.GetChineseSpell(Name.Text.Trim()); int id = ProductBrandBLL.Add(productBrand); AdminLogBLL.Add(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("ProductBrand"), id); } else { CheckAdminPower("UpdateProductBrand", PowerCheckType.Single); productBrand.Spelling = Spelling.Text; ProductBrandBLL.Update(productBrand); AdminLogBLL.Add(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("ProductBrand"), productBrand.Id); alertMessage = ShopLanguage.ReadLanguage("UpdateOK"); } ScriptHelper.Alert(alertMessage, RequestHelper.RawUrl); } }
protected override void PageLoad() { base.PageLoad(); string action = RequestHelper.GetQueryString <string>("Action"); switch (action) { case "GetStandardPrice": GetStandardPrice(); break; case "Like": Like(); break; case "Collect": Collect(); break; } int id = RequestHelper.GetQueryString <int>("id"); product = ProductBLL.Read(id); if (product.IsSale == (int)BoolType.False) { ScriptHelper.AlertFront("该产品未上市,不能查看"); } //更新查看数量 Dictionary <string, object> dict = new Dictionary <string, object>(); dict.Add("ViewCount", product.ViewCount + 1); ProductBLL.UpdatePart(ProductInfo.TABLENAME, dict, id); if (product.BrandId > 0) { productBrand = ProductBrandBLL.Read(product.BrandId); } if (product.ShopId > 0) { shop = UserBLL.Read(product.ShopId); } productPhotoList = ProductPhotoBLL.ReadList(id, 0); attributeRecords = ProductTypeAttributeRecordBLL.ReadList(id); standardRecords = ProductTypeStandardRecordBLL.ReadList(id); //导航路径 listPaths = ProductClassBLL.ReadNavigationPath(product.ClassId); listPaths.ForEach(k => paths += string.Format(k[0], k[1], k[2])); //排行榜 //按销量倒序 int count = 0; topProductList = ProductBLL.SearchList(1, 6, new ProductSearchInfo { ClassId = product.ClassId, IsSale = (int)BoolType.True, ProductOrderType = "SendCount", OrderType = OrderType.Desc }, ref count); //同类推荐 classProductList = ProductBLL.SearchList(1, 3, new ProductSearchInfo { ClassId = product.ClassId, IsSale = (int)BoolType.True, IsTop = (int)BoolType.True }, ref count); //搜索优化 Title = product.Name; Keywords = string.IsNullOrEmpty(product.Keywords) ? product.Name : product.Keywords; Description = string.IsNullOrEmpty(product.Summary) ? StringHelper.Substring(StringHelper.KillHTML(product.Introduction1), 200) : product.Summary; }
public static void Update(ProductBrandInfo entity) { dal.Update(entity); CacheHelper.Remove(cacheKey); }
public static int Add(ProductBrandInfo entity) { entity.Id = dal.Add(entity); CacheHelper.Remove(cacheKey); return(entity.Id); }
public static void UpdateProductBrand(ProductBrandInfo productBrand) { dal.UpdateProductBrand(productBrand); UploadBLL.UpdateUpload(TableID, 0, productBrand.ID, Cookies.Admin.GetRandomNumber(false)); CacheHelper.Remove(cacheKey); }