/// <summary> /// 更新一条数据 /// </summary> public static bool Update(EtNet_Models.InformationSort model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update InformationSort set "); strSql.Append(" txt = @txt "); strSql.Append(" where id=@id "); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4), new SqlParameter("@txt", SqlDbType.VarChar, 20) }; 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 bool Add(EtNet_Models.InformationSort model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into InformationSort("); strSql.Append("txt"); strSql.Append(") values ("); strSql.Append("@txt"); strSql.Append(") "); SqlParameter[] parameters = { new SqlParameter("@txt", SqlDbType.VarChar, 20) }; parameters[0].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.InformationSort GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select id, txt "); strSql.Append(" from InformationSort "); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = id; EtNet_Models.InformationSort model = new EtNet_Models.InformationSort(); 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.InformationSort model) { return(EtNet_DAL.InformationSortService.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public static bool Add(EtNet_Models.InformationSort model) { return(EtNet_DAL.InformationSortService.Add(model)); }