/// <summary> /// 安全方式绑定对象表单 /// </summary> public Lebi_Product_Stock_Log SafeBindForm(Lebi_Product_Stock_Log model) { if (HttpContext.Current.Request["Product_id"] != null) { model.Product_id = Shop.Tools.RequestTool.RequestInt("Product_id", 0); } if (HttpContext.Current.Request["Count"] != null) { model.Count = Shop.Tools.RequestTool.RequestDecimal("Count", 0); } if (HttpContext.Current.Request["Type_id_Stock"] != null) { model.Type_id_Stock = Shop.Tools.RequestTool.RequestInt("Type_id_Stock", 0); } if (HttpContext.Current.Request["Time_Add"] != null) { model.Time_Add = Shop.Tools.RequestTool.RequestTime("Time_Add", System.DateTime.Now); } if (HttpContext.Current.Request["Order_Code"] != null) { model.Order_Code = Shop.Tools.RequestTool.RequestSafeString("Order_Code"); } if (HttpContext.Current.Request["Order_id"] != null) { model.Order_id = Shop.Tools.RequestTool.RequestInt("Order_id", 0); } if (HttpContext.Current.Request["Remark"] != null) { model.Remark = Shop.Tools.RequestTool.RequestSafeString("Remark"); } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Lebi_Product_Stock_Log model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update [Lebi_Product_Stock_Log] set "); strSql.Append("[Product_id]=@Product_id,"); strSql.Append("[Count]=@Count,"); strSql.Append("[Type_id_Stock]=@Type_id_Stock,"); strSql.Append("[Time_Add]=@Time_Add,"); strSql.Append("[Order_Code]=@Order_Code,"); strSql.Append("[Order_id]=@Order_id,"); strSql.Append("[Remark]=@Remark"); strSql.Append(" where id=" + model.id); OleDbParameter[] parameters = { new OleDbParameter("@Product_id", model.Product_id), new OleDbParameter("@Count", model.Count), new OleDbParameter("@Type_id_Stock", model.Type_id_Stock), new OleDbParameter("@Time_Add", model.Time_Add.ToString("yyyy-MM-dd hh:mm:ss")), new OleDbParameter("@Order_Code", model.Order_Code), new OleDbParameter("@Order_id", model.Order_id), new OleDbParameter("@Remark", model.Remark) }; AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Lebi_Product_Stock_Log model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update [Lebi_Product_Stock_Log] set "); strSql.Append("Product_id= @Product_id,"); strSql.Append("Count= @Count,"); strSql.Append("Type_id_Stock= @Type_id_Stock,"); strSql.Append("Time_Add= @Time_Add,"); strSql.Append("Order_Code= @Order_Code,"); strSql.Append("Order_id= @Order_id,"); strSql.Append("Remark= @Remark"); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4), new SqlParameter("@Product_id", SqlDbType.Int, 4), new SqlParameter("@Count", SqlDbType.Decimal, 9), new SqlParameter("@Type_id_Stock", SqlDbType.Int, 4), new SqlParameter("@Time_Add", SqlDbType.DateTime), new SqlParameter("@Order_Code", SqlDbType.NVarChar, 50), new SqlParameter("@Order_id", SqlDbType.Int, 4), new SqlParameter("@Remark", SqlDbType.NVarChar, 100) }; parameters[0].Value = model.id; parameters[1].Value = model.Product_id; parameters[2].Value = model.Count; parameters[3].Value = model.Type_id_Stock; parameters[4].Value = model.Time_Add; parameters[5].Value = model.Order_Code; parameters[6].Value = model.Order_id; parameters[7].Value = model.Remark; SqlUtils.SqlUtilsInstance.TextExecuteNonQuery(strSql.ToString(), parameters); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Lebi_Product_Stock_Log model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into [Lebi_Product_Stock_Log]("); strSql.Append("Product_id,Count,Type_id_Stock,Time_Add,Order_Code,Order_id,Remark)"); strSql.Append(" values ("); strSql.Append("@Product_id,@Count,@Type_id_Stock,@Time_Add,@Order_Code,@Order_id,@Remark)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@Product_id", model.Product_id), new SqlParameter("@Count", model.Count), new SqlParameter("@Type_id_Stock", model.Type_id_Stock), new SqlParameter("@Time_Add", model.Time_Add), new SqlParameter("@Order_Code", model.Order_Code), new SqlParameter("@Order_id", model.Order_id), new SqlParameter("@Remark", model.Remark) }; object obj = SqlUtils.SqlUtilsInstance.TextExecuteNonQuery(strSql.ToString(), parameters); if (obj == null) { return(1); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 得到一个对象实体 by id /// </summary> public Lebi_Product_Stock_Log GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 * from [Lebi_Product_Stock_Log] "); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = id; Lebi_Product_Stock_Log model = new Lebi_Product_Stock_Log(); 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()); } if (ds.Tables[0].Rows[0]["Product_id"].ToString() != "") { model.Product_id = int.Parse(ds.Tables[0].Rows[0]["Product_id"].ToString()); } if (ds.Tables[0].Rows[0]["Count"].ToString() != "") { model.Count = decimal.Parse(ds.Tables[0].Rows[0]["Count"].ToString()); } if (ds.Tables[0].Rows[0]["Type_id_Stock"].ToString() != "") { model.Type_id_Stock = int.Parse(ds.Tables[0].Rows[0]["Type_id_Stock"].ToString()); } if (ds.Tables[0].Rows[0]["Time_Add"].ToString() != "") { model.Time_Add = DateTime.Parse(ds.Tables[0].Rows[0]["Time_Add"].ToString()); } model.Order_Code = ds.Tables[0].Rows[0]["Order_Code"].ToString(); if (ds.Tables[0].Rows[0]["Order_id"].ToString() != "") { model.Order_id = int.Parse(ds.Tables[0].Rows[0]["Order_id"].ToString()); } model.Remark = ds.Tables[0].Rows[0]["Remark"].ToString(); return(model); } else { return(null); } }
/// <summary> /// 得到一个对象实体 by where条件 /// </summary> public Lebi_Product_Stock_Log 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_Product_Stock_Log] "); strSql.Append(" where " + strWhere + ""); Lebi_Product_Stock_Log model = new Lebi_Product_Stock_Log(); 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()); } if (ds.Tables[0].Rows[0]["Product_id"].ToString() != "") { model.Product_id = int.Parse(ds.Tables[0].Rows[0]["Product_id"].ToString()); } if (ds.Tables[0].Rows[0]["Count"].ToString() != "") { model.Count = decimal.Parse(ds.Tables[0].Rows[0]["Count"].ToString()); } if (ds.Tables[0].Rows[0]["Type_id_Stock"].ToString() != "") { model.Type_id_Stock = int.Parse(ds.Tables[0].Rows[0]["Type_id_Stock"].ToString()); } if (ds.Tables[0].Rows[0]["Time_Add"].ToString() != "") { model.Time_Add = DateTime.Parse(ds.Tables[0].Rows[0]["Time_Add"].ToString()); } model.Order_Code = ds.Tables[0].Rows[0]["Order_Code"].ToString(); if (ds.Tables[0].Rows[0]["Order_id"].ToString() != "") { model.Order_id = int.Parse(ds.Tables[0].Rows[0]["Order_id"].ToString()); } model.Remark = ds.Tables[0].Rows[0]["Remark"].ToString(); return(model); } else { return(null); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Lebi_Product_Stock_Log model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into [Lebi_Product_Stock_Log]("); strSql.Append("[Product_id],[Count],[Type_id_Stock],[Time_Add],[Order_Code],[Order_id],[Remark])"); strSql.Append(" values ("); strSql.Append("@Product_id,@Count,@Type_id_Stock,@Time_Add,@Order_Code,@Order_id,@Remark)"); OleDbParameter[] parameters = { new OleDbParameter("@Product_id", model.Product_id), new OleDbParameter("@Count", model.Count), new OleDbParameter("@Type_id_Stock", model.Type_id_Stock), new OleDbParameter("@Time_Add", model.Time_Add.ToString("yyyy-MM-dd hh:mm:ss")), new OleDbParameter("@Order_Code", model.Order_Code), new OleDbParameter("@Order_id", model.Order_id), new OleDbParameter("@Remark", model.Remark) }; AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters); return(1); }
/// <summary> /// 对象实体绑定数据 /// </summary> public Lebi_Product_Stock_Log ReaderBind(IDataReader dataReader) { Lebi_Product_Stock_Log model = new Lebi_Product_Stock_Log(); object ojb; ojb = dataReader["id"]; if (ojb != null && ojb != DBNull.Value) { model.id = (int)ojb; } ojb = dataReader["Product_id"]; if (ojb != null && ojb != DBNull.Value) { model.Product_id = (int)ojb; } ojb = dataReader["Count"]; if (ojb != null && ojb != DBNull.Value) { model.Count = (decimal)ojb; } ojb = dataReader["Type_id_Stock"]; if (ojb != null && ojb != DBNull.Value) { model.Type_id_Stock = (int)ojb; } ojb = dataReader["Time_Add"]; if (ojb != null && ojb != DBNull.Value) { model.Time_Add = (DateTime)ojb; } model.Order_Code = dataReader["Order_Code"].ToString(); ojb = dataReader["Order_id"]; if (ojb != null && ojb != DBNull.Value) { model.Order_id = (int)ojb; } model.Remark = dataReader["Remark"].ToString(); return(model); }
/// <summary> /// 更新一条数据 /// </summary> public static void Update(Lebi_Product_Stock_Log model) { D_Lebi_Product_Stock_Log.Instance.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public static int Add(Lebi_Product_Stock_Log model) { return(D_Lebi_Product_Stock_Log.Instance.Add(model)); }
/// <summary> /// 安全方式绑定表单数据 /// </summary> public static Lebi_Product_Stock_Log SafeBindForm(Lebi_Product_Stock_Log model) { return(D_Lebi_Product_Stock_Log.Instance.SafeBindForm(model)); }