/// <summary> /// 更新一条数据 /// </summary> public void Update(Lebi_Supplier_ProPerty model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update [Lebi_Supplier_ProPerty] set "); strSql.Append("ProPerty= @ProPerty,"); strSql.Append("Pro_Type_id= @Pro_Type_id,"); 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("@ProPerty", SqlDbType.NVarChar, 2000), new SqlParameter("@Pro_Type_id", 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.ProPerty; parameters[2].Value = model.Pro_Type_id; parameters[3].Value = model.Supplier_id; parameters[4].Value = model.Type_id_ProPertyType; SqlUtils.SqlUtilsInstance.TextExecuteNonQuery(strSql.ToString(), parameters); }
/// <summary> /// 对象实体绑定数据 /// </summary> public Lebi_Supplier_ProPerty ReaderBind(IDataReader dataReader) { Lebi_Supplier_ProPerty model = new Lebi_Supplier_ProPerty(); object ojb; ojb = dataReader["id"]; if (ojb != null && ojb != DBNull.Value) { model.id = (int)ojb; } model.ProPerty = dataReader["ProPerty"].ToString(); ojb = dataReader["Pro_Type_id"]; if (ojb != null && ojb != DBNull.Value) { model.Pro_Type_id = (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_Supplier_ProPerty model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into [Lebi_Supplier_ProPerty]("); strSql.Append("ProPerty,Pro_Type_id,Supplier_id,Type_id_ProPertyType)"); strSql.Append(" values ("); strSql.Append("@ProPerty,@Pro_Type_id,@Supplier_id,@Type_id_ProPertyType)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@ProPerty", model.ProPerty), new SqlParameter("@Pro_Type_id", model.Pro_Type_id), 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)); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Lebi_Supplier_ProPerty model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into [Lebi_Supplier_ProPerty]("); strSql.Append("[ProPerty],[Pro_Type_id],[Supplier_id],[Type_id_ProPertyType])"); strSql.Append(" values ("); strSql.Append("@ProPerty,@Pro_Type_id,@Supplier_id,@Type_id_ProPertyType)"); OleDbParameter[] parameters = { new OleDbParameter("@ProPerty", model.ProPerty), new OleDbParameter("@Pro_Type_id", model.Pro_Type_id), 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_Supplier_ProPerty model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update [Lebi_Supplier_ProPerty] set "); strSql.Append("[ProPerty]=@ProPerty,"); strSql.Append("[Pro_Type_id]=@Pro_Type_id,"); strSql.Append("[Supplier_id]=@Supplier_id,"); strSql.Append("[Type_id_ProPertyType]=@Type_id_ProPertyType"); strSql.Append(" where id=" + model.id); OleDbParameter[] parameters = { new OleDbParameter("@ProPerty", model.ProPerty), new OleDbParameter("@Pro_Type_id", model.Pro_Type_id), 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_Supplier_ProPerty SafeBindForm(Lebi_Supplier_ProPerty model) { if (HttpContext.Current.Request["ProPerty"] != null) { model.ProPerty = Shop.Tools.RequestTool.RequestSafeString("ProPerty"); } if (HttpContext.Current.Request["Pro_Type_id"] != null) { model.Pro_Type_id = Shop.Tools.RequestTool.RequestInt("Pro_Type_id", 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_Supplier_ProPerty GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 * from [Lebi_Supplier_ProPerty] "); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = id; Lebi_Supplier_ProPerty model = new Lebi_Supplier_ProPerty(); 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.ProPerty = ds.Tables[0].Rows[0]["ProPerty"].ToString(); if (ds.Tables[0].Rows[0]["Pro_Type_id"].ToString() != "") { model.Pro_Type_id = int.Parse(ds.Tables[0].Rows[0]["Pro_Type_id"].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_Supplier_ProPerty 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_Supplier_ProPerty] "); strSql.Append(" where " + strWhere + ""); Lebi_Supplier_ProPerty model = new Lebi_Supplier_ProPerty(); 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.ProPerty = ds.Tables[0].Rows[0]["ProPerty"].ToString(); if (ds.Tables[0].Rows[0]["Pro_Type_id"].ToString() != "") { model.Pro_Type_id = int.Parse(ds.Tables[0].Rows[0]["Pro_Type_id"].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_Supplier_ProPerty model) { D_Lebi_Supplier_ProPerty.Instance.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public static int Add(Lebi_Supplier_ProPerty model) { return(D_Lebi_Supplier_ProPerty.Instance.Add(model)); }
/// <summary> /// 安全方式绑定表单数据 /// </summary> public static Lebi_Supplier_ProPerty SafeBindForm(Lebi_Supplier_ProPerty model) { return(D_Lebi_Supplier_ProPerty.Instance.SafeBindForm(model)); }