/// <summary> /// 保存信息 /// </summary> protected void Save() { ShowShop.Common.SysParameter sp = new ShowShop.Common.SysParameter(); ShowShop.BLL.Product.ProductBrand bll = new ShowShop.BLL.Product.ProductBrand(); ShowShop.Model.Product.ProductBrand model = new ShowShop.Model.Product.ProductBrand(); model.Name = txtName.Text.Trim(); if (string.IsNullOrEmpty(txtSort.Text.Trim())) { model.Sort = 0; } else { model.Sort = Convert.ToInt32(txtSort.Text.Trim()); } if (ViewState["ID"] != null) { model.ID = int.Parse(ViewState["ID"].ToString()); bll.Update(model); ChangeHope.WebPage.BasePage.PageRight("信息已修改。", "productbrand_list.aspx"); } else { int bId = bll.Add(model); if (bId > 0) { ChangeHope.WebPage.BasePage.PageRight("信息已保存,您还可以继续添加。", "productbrand_edit.aspx"); } } }
/// <summary> /// 获取所有记录List /// </summary> /// <remarks></remarks> public List<ShowShop.Model.Product.ProductBrand> GetDTList(string strBrandId) { List<ShowShop.Model.Product.ProductBrand> list = new List<ShowShop.Model.Product.ProductBrand>(); string strSql = this.SelectSequel; if (strBrandId != "" && strBrandId != string.Empty) { strSql += " where bid in(" + strBrandId + ")"; } using (SqlDataReader reader = ChangeHope.DataBase.SQLServerHelper.ExecuteReader(strSql.ToString())) { while (reader.Read()) { ShowShop.Model.Product.ProductBrand model = new ShowShop.Model.Product.ProductBrand(); model.ID = Convert.ToInt32(reader["bid"]); model.Name = reader["name"].ToString(); model.Sort =Convert.ToInt32(reader["sort"].ToString()); list.Add(model); } } return list; }
/// <summary> /// 返回数据 /// </summary> /// <param name="row"></param> /// <returns></returns> public ShowShop.Model.Product.ProductBrand GetModel(System.Data.DataRow row) { ShowShop.Model.Product.ProductBrand model = new ShowShop.Model.Product.ProductBrand(); if (row != null) { model.ID = int.Parse(row["bid"].ToString()); model.Name = row["name"].ToString(); model.CommonTypes =int.Parse(row["commontypes"].ToString()); model.Sort = int.Parse(row["sort"].ToString()); //model.Description = row["description"].ToString(); //model.Attirbute = row["attirbute"].ToString(); //model.Images = row["image"].ToString(); //model.Isrecommend = int.Parse(row["isrecommend"].ToString()); return model; } else { return null; } }
public List<ShowShop.Model.Product.ProductBrand> GetCommonTypes() { List<ShowShop.Model.Product.ProductBrand> list = new List<ShowShop.Model.Product.ProductBrand>(); string strSql = this.SelectSequel + " where commontypes=0"; using (SqlDataReader reader = ChangeHope.DataBase.SQLServerHelper.ExecuteReader(strSql.ToString())) { while (reader.Read()) { ShowShop.Model.Product.ProductBrand model = new ShowShop.Model.Product.ProductBrand(); model.ID = Convert.ToInt32(reader["bid"]); model.Name = reader["name"].ToString(); list.Add(model); } } return list; }