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