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