/// <summary> /// 更新一条数据 /// </summary> public static bool Update(SqlConnection sqlcon, ProductLibraryConfigModel model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update Configuration..SE_ProductLibraryConfig set "); strSql.Append("Oid=@Oid,"); strSql.Append("PID=@PID,"); strSql.Append("CouponIds=@CouponIds,"); strSql.Append("State=@State,"); strSql.Append("CreateTime=@CreateTime"); strSql.Append(" where Id=@Id "); SqlParameter[] parameters = { new SqlParameter("@Oid", SqlDbType.Int), new SqlParameter("@PID", SqlDbType.NVarChar), new SqlParameter("@CouponIds", SqlDbType.NVarChar), new SqlParameter("@State", SqlDbType.Int), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@Id", SqlDbType.Int) }; parameters[0].Value = model.Oid; parameters[1].Value = model.PID; parameters[2].Value = model.CouponIds; parameters[3].Value = model.State; parameters[4].Value = model.CreateTime; parameters[5].Value = model.Id; return(SqlHelper.ExecuteNonQuery(sqlcon, CommandType.Text, strSql.ToString(), parameters) > 0); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(ProductLibraryConfigModel model) { try { return(handler.Update(model)); } catch (Exception ex) { logger.Log(Level.Error, ex.ToString()); return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public static bool Add(SqlConnection sqlcon, ProductLibraryConfigModel model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Configuration..SE_ProductLibraryConfig("); strSql.Append("Oid,PID,CouponIds,State,CreateTime)"); strSql.Append(" values ("); strSql.Append("@Oid,@PID,@CouponIds,@State,@CreateTime)"); SqlParameter[] parameters = { new SqlParameter("@Oid", SqlDbType.Int), new SqlParameter("@PID", SqlDbType.NVarChar), new SqlParameter("@CouponIds", SqlDbType.NVarChar), new SqlParameter("@State", SqlDbType.Int), new SqlParameter("@CreateTime", SqlDbType.DateTime) }; parameters[1].Value = model.Oid; parameters[2].Value = model.PID; parameters[3].Value = model.CouponIds; parameters[4].Value = model.State; parameters[5].Value = model.CreateTime; return(SqlHelper.ExecuteNonQuery(sqlcon, CommandType.Text, strSql.ToString(), parameters) > 0); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(ProductLibraryConfigModel model) { Func <SqlConnection, bool> action = (connection) => ProductLibraryConfigDAL.Update(connection, model); return(dbManager.Execute(action)); }