Esempio n. 1
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(this.txtTypeName.Text.Trim()))
     {
         MessageBox.ShowFailTip(this, "商品类型名称不能为空,长度限制在1-50个字符之间!");
     }
     else
     {
         string text = this.txtTypeName.Text;
         string str2 = this.txtRemark.Text;
         IList<int> list = new List<int>();
         foreach (ListItem item in this.chkBrandsCheckBox.Items)
         {
             if (item.Selected)
             {
                 list.Add(int.Parse(item.Value));
             }
         }
         Maticsoft.Model.Shop.Products.ProductType model = new Maticsoft.Model.Shop.Products.ProductType {
             TypeName = text,
             Remark = str2,
             BrandsTypes = list,
             TypeId = this.ProductTypeId
         };
         int typeid = 0;
         if (this.bll.ProductTypeManage(model, DataProviderAction.Update, out typeid))
         {
             MessageBox.ShowSuccessTip(this, "基本设置信息保存成功!");
         }
         else
         {
             MessageBox.ShowFailTip(this, "保存失败,正在返回商品类别列表页!", "list.aspx");
         }
     }
 }
Esempio n. 2
0
 public List<Maticsoft.Model.Shop.Products.ProductType> DataTableToList(DataTable dt)
 {
     List<Maticsoft.Model.Shop.Products.ProductType> list = new List<Maticsoft.Model.Shop.Products.ProductType>();
     int count = dt.Rows.Count;
     if (count > 0)
     {
         for (int i = 0; i < count; i++)
         {
             Maticsoft.Model.Shop.Products.ProductType item = new Maticsoft.Model.Shop.Products.ProductType();
             if ((dt.Rows[i]["TypeId"] != null) && (dt.Rows[i]["TypeId"].ToString() != ""))
             {
                 item.TypeId = int.Parse(dt.Rows[i]["TypeId"].ToString());
             }
             if ((dt.Rows[i]["TypeName"] != null) && (dt.Rows[i]["TypeName"].ToString() != ""))
             {
                 item.TypeName = dt.Rows[i]["TypeName"].ToString();
             }
             if ((dt.Rows[i]["Remark"] != null) && (dt.Rows[i]["Remark"].ToString() != ""))
             {
                 item.Remark = dt.Rows[i]["Remark"].ToString();
             }
             list.Add(item);
         }
     }
     return list;
 }
Esempio n. 3
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(this.txtTypeName.Text.Trim()))
     {
         MessageBox.ShowFailTip(this, "商品类型名称不能为空,长度限制在1-50个字符之间!");
     }
     else
     {
         string text = this.txtTypeName.Text;
         string str2 = this.txtRemark.Text;
         IList<int> list = new List<int>();
         foreach (ListItem item in this.chkBrandsCheckBox.Items)
         {
             if (item.Selected)
             {
                 list.Add(int.Parse(item.Value));
             }
         }
         Maticsoft.Model.Shop.Products.ProductType model = new Maticsoft.Model.Shop.Products.ProductType {
             TypeName = text,
             Remark = str2,
             BrandsTypes = list
         };
         int typeid = 0;
         if (this.bll.ProductTypeManage(model, DataProviderAction.Create, out typeid))
         {
             this.btnCancle.Enabled = false;
             this.btnSave.Enabled = false;
             base.Response.Redirect("Step2.aspx?tid=" + typeid);
         }
         else
         {
             MessageBox.ShowFailTip(this, "保存失败!", "list.aspx");
         }
     }
 }
Esempio n. 4
0
 public List<Maticsoft.Model.Shop.Products.ProductType> GetProductTypes()
 {
     List<Maticsoft.Model.Shop.Products.ProductType> list = new List<Maticsoft.Model.Shop.Products.ProductType>();
     StringBuilder builder = new StringBuilder();
     builder.Append("SELECT * FROM Shop_ProductTypes");
     DataSet set = DbHelperSQL.Query(builder.ToString());
     if ((set != null) && (set.Tables[0].Rows.Count > 0))
     {
         foreach (DataRow row in set.Tables[0].Rows)
         {
             Maticsoft.Model.Shop.Products.ProductType model = new Maticsoft.Model.Shop.Products.ProductType();
             this.LoadEntityData(ref model, row);
             list.Add(model);
         }
     }
     return list;
 }
Esempio n. 5
0
 public Maticsoft.Model.Shop.Products.ProductType GetModel(int TypeId)
 {
     StringBuilder builder = new StringBuilder();
     builder.Append("SELECT  TOP 1 TypeId,TypeName,Remark FROM Shop_ProductTypes ");
     builder.Append(" WHERE TypeId=@TypeId");
     SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@TypeId", SqlDbType.Int, 4) };
     cmdParms[0].Value = TypeId;
     Maticsoft.Model.Shop.Products.ProductType type = new Maticsoft.Model.Shop.Products.ProductType();
     DataSet set = DbHelperSQL.Query(builder.ToString(), cmdParms);
     if (set.Tables[0].Rows.Count <= 0)
     {
         return null;
     }
     if ((set.Tables[0].Rows[0]["TypeId"] != null) && (set.Tables[0].Rows[0]["TypeId"].ToString() != ""))
     {
         type.TypeId = int.Parse(set.Tables[0].Rows[0]["TypeId"].ToString());
     }
     if ((set.Tables[0].Rows[0]["TypeName"] != null) && (set.Tables[0].Rows[0]["TypeName"].ToString() != ""))
     {
         type.TypeName = set.Tables[0].Rows[0]["TypeName"].ToString();
     }
     if ((set.Tables[0].Rows[0]["Remark"] != null) && (set.Tables[0].Rows[0]["Remark"].ToString() != ""))
     {
         type.Remark = set.Tables[0].Rows[0]["Remark"].ToString();
     }
     return type;
 }