/// <summary> /// 更新一条数据 /// </summary> public void Update(Lebi_ProPerty_Tag model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update [Lebi_ProPerty_Tag] set "); strSql.Append("Name= @Name,"); strSql.Append("Sort= @Sort,"); strSql.Append("Supplier_id= @Supplier_id,"); strSql.Append("Type_id_ProPertyType= @Type_id_ProPertyType"); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4), new SqlParameter("@Name", SqlDbType.NVarChar, 500), new SqlParameter("@Sort", SqlDbType.Int, 4), new SqlParameter("@Supplier_id", SqlDbType.Int, 4), new SqlParameter("@Type_id_ProPertyType", SqlDbType.Int, 4) }; parameters[0].Value = model.id; parameters[1].Value = model.Name; parameters[2].Value = model.Sort; parameters[3].Value = model.Supplier_id; parameters[4].Value = model.Type_id_ProPertyType; SqlUtils.SqlUtilsInstance.TextExecuteNonQuery(strSql.ToString(), parameters); }
/// <summary> /// 对象实体绑定数据 /// </summary> public Lebi_ProPerty_Tag ReaderBind(IDataReader dataReader) { Lebi_ProPerty_Tag model = new Lebi_ProPerty_Tag(); object ojb; ojb = dataReader["id"]; if (ojb != null && ojb != DBNull.Value) { model.id = (int)ojb; } model.Name = dataReader["Name"].ToString(); ojb = dataReader["Sort"]; if (ojb != null && ojb != DBNull.Value) { model.Sort = (int)ojb; } ojb = dataReader["Supplier_id"]; if (ojb != null && ojb != DBNull.Value) { model.Supplier_id = (int)ojb; } ojb = dataReader["Type_id_ProPertyType"]; if (ojb != null && ojb != DBNull.Value) { model.Type_id_ProPertyType = (int)ojb; } return(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Lebi_ProPerty_Tag model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into [Lebi_ProPerty_Tag]("); strSql.Append("Name,Sort,Supplier_id,Type_id_ProPertyType)"); strSql.Append(" values ("); strSql.Append("@Name,@Sort,@Supplier_id,@Type_id_ProPertyType)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@Name", model.Name), new SqlParameter("@Sort", model.Sort), new SqlParameter("@Supplier_id", model.Supplier_id), new SqlParameter("@Type_id_ProPertyType", model.Type_id_ProPertyType) }; object obj = SqlUtils.SqlUtilsInstance.TextExecuteNonQuery(strSql.ToString(), parameters); if (obj == null) { return(1); } else { return(Convert.ToInt32(obj)); } }
protected void Page_Load(object sender, EventArgs e) { int id = RequestTool.RequestInt("id", 0); if (!EX_Admin.Power("property_list", "属性规格列表")) { WindowNoPower(); } model = B_Lebi_ProPerty_Tag.GetModel(id); if (model == null) { model = new Lebi_ProPerty_Tag(); model.Type_id_ProPertyType = 131; } }
protected void Page_Load(object sender, EventArgs e) { int id = RequestTool.RequestInt("id", 0); if (!Power("supplier_property", "属性规格")) { WindowNoPower(); } model = B_Lebi_ProPerty_Tag.GetModel("Supplier_id = " + CurrentSupplier.id + " and id = " + id); if (model == null) { model = new Lebi_ProPerty_Tag(); model.Type_id_ProPertyType = 131; } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Lebi_ProPerty_Tag model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into [Lebi_ProPerty_Tag]("); strSql.Append("[Name],[Sort],[Supplier_id],[Type_id_ProPertyType])"); strSql.Append(" values ("); strSql.Append("@Name,@Sort,@Supplier_id,@Type_id_ProPertyType)"); OleDbParameter[] parameters = { new OleDbParameter("@Name", model.Name), new OleDbParameter("@Sort", model.Sort), new OleDbParameter("@Supplier_id", model.Supplier_id), new OleDbParameter("@Type_id_ProPertyType", model.Type_id_ProPertyType) }; AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters); return(1); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Lebi_ProPerty_Tag model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update [Lebi_ProPerty_Tag] set "); strSql.Append("[Name]=@Name,"); strSql.Append("[Sort]=@Sort,"); strSql.Append("[Supplier_id]=@Supplier_id,"); strSql.Append("[Type_id_ProPertyType]=@Type_id_ProPertyType"); strSql.Append(" where id=" + model.id); OleDbParameter[] parameters = { new OleDbParameter("@Name", model.Name), new OleDbParameter("@Sort", model.Sort), new OleDbParameter("@Supplier_id", model.Supplier_id), new OleDbParameter("@Type_id_ProPertyType", model.Type_id_ProPertyType) }; AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters); }
/// <summary> /// 安全方式绑定对象表单 /// </summary> public Lebi_ProPerty_Tag SafeBindForm(Lebi_ProPerty_Tag model) { if (HttpContext.Current.Request["Name"] != null) { model.Name = Shop.Tools.RequestTool.RequestSafeString("Name"); } if (HttpContext.Current.Request["Sort"] != null) { model.Sort = Shop.Tools.RequestTool.RequestInt("Sort", 0); } if (HttpContext.Current.Request["Supplier_id"] != null) { model.Supplier_id = Shop.Tools.RequestTool.RequestInt("Supplier_id", 0); } if (HttpContext.Current.Request["Type_id_ProPertyType"] != null) { model.Type_id_ProPertyType = Shop.Tools.RequestTool.RequestInt("Type_id_ProPertyType", 0); } return(model); }
/// <summary> /// 得到一个对象实体 by id /// </summary> public Lebi_ProPerty_Tag GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 * from [Lebi_ProPerty_Tag] "); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = id; Lebi_ProPerty_Tag model = new Lebi_ProPerty_Tag(); DataSet ds = SqlUtils.SqlUtilsInstance.TextExecuteDataset(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["id"].ToString() != "") { model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString()); } model.Name = ds.Tables[0].Rows[0]["Name"].ToString(); if (ds.Tables[0].Rows[0]["Sort"].ToString() != "") { model.Sort = int.Parse(ds.Tables[0].Rows[0]["Sort"].ToString()); } if (ds.Tables[0].Rows[0]["Supplier_id"].ToString() != "") { model.Supplier_id = int.Parse(ds.Tables[0].Rows[0]["Supplier_id"].ToString()); } if (ds.Tables[0].Rows[0]["Type_id_ProPertyType"].ToString() != "") { model.Type_id_ProPertyType = int.Parse(ds.Tables[0].Rows[0]["Type_id_ProPertyType"].ToString()); } return(model); } else { return(null); } }
/// <summary> /// 得到一个对象实体 by where条件 /// </summary> public Lebi_ProPerty_Tag GetModel(string strWhere) { if (strWhere.IndexOf("lbsql{") > 0) { SQLPara para = new SQLPara(strWhere, "", ""); return(GetModel(para)); } StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 * from [Lebi_ProPerty_Tag] "); strSql.Append(" where " + strWhere + ""); Lebi_ProPerty_Tag model = new Lebi_ProPerty_Tag(); DataSet ds = SqlUtils.SqlUtilsInstance.TextExecuteDataset(strSql.ToString()); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["id"].ToString() != "") { model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString()); } model.Name = ds.Tables[0].Rows[0]["Name"].ToString(); if (ds.Tables[0].Rows[0]["Sort"].ToString() != "") { model.Sort = int.Parse(ds.Tables[0].Rows[0]["Sort"].ToString()); } if (ds.Tables[0].Rows[0]["Supplier_id"].ToString() != "") { model.Supplier_id = int.Parse(ds.Tables[0].Rows[0]["Supplier_id"].ToString()); } if (ds.Tables[0].Rows[0]["Type_id_ProPertyType"].ToString() != "") { model.Type_id_ProPertyType = int.Parse(ds.Tables[0].Rows[0]["Type_id_ProPertyType"].ToString()); } return(model); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public static void Update(Lebi_ProPerty_Tag model) { D_Lebi_ProPerty_Tag.Instance.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public static int Add(Lebi_ProPerty_Tag model) { return(D_Lebi_ProPerty_Tag.Instance.Add(model)); }
/// <summary> /// 安全方式绑定表单数据 /// </summary> public static Lebi_ProPerty_Tag SafeBindForm(Lebi_ProPerty_Tag model) { return(D_Lebi_ProPerty_Tag.Instance.SafeBindForm(model)); }