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