/// <summary> /// 更新一条数据 /// </summary> public static bool Update(EtNet_Models.StaffPapersSort model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update StaffPapersSort set "); strSql.Append("txt=@txt"); strSql.Append(" where id=@id "); SqlParameter[] parameters = { new SqlParameter("@txt", SqlDbType.VarChar, 40), new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = model.txt; parameters[1].Value = model.id; int result = EtNet_DAL.DBHelper.ExecuteCommand(strSql.ToString(), parameters); if (result >= 1) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public static bool Add(EtNet_Models.StaffPapersSort model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into StaffPapersSort("); strSql.Append("id,txt)"); strSql.Append(" values ("); strSql.Append("@id,@txt)"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4), new SqlParameter("@txt", SqlDbType.VarChar, 40) }; parameters[0].Value = model.id; parameters[1].Value = model.txt; int result = EtNet_DAL.DBHelper.ExecuteCommand(strSql.ToString(), parameters); if (result >= 1) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public static EtNet_Models.StaffPapersSort GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 id,txt from StaffPapersSort "); strSql.Append(" where id=@id "); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = id; EtNet_Models.StaffPapersSort model = new EtNet_Models.StaffPapersSort(); DataTable tbl = EtNet_DAL.DBHelper.GetDataSet(strSql.ToString(), parameters); if (tbl.Rows.Count > 0) { model.id = int.Parse(tbl.Rows[0]["id"].ToString()); model.txt = tbl.Rows[0]["txt"].ToString(); return(model); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public static bool Update(EtNet_Models.StaffPapersSort model) { return(EtNet_DAL.StaffPapersSortService.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public static bool Add(EtNet_Models.StaffPapersSort model) { return(EtNet_DAL.StaffPapersSortService.Add(model)); }