public static bool UpdateProductPriorityAreaOilByPkid(SqlConnection conn, ProductPriorityAreaOil model) { string sql = @"UPDATE BaoYang..ProductPriority_Area_Oil SET NewViscosity = @NewViscosity , LastUpdateDateTime = GETDATE() , VehicleId = @VehicleId , Viscosity = @Viscosity , IsEnabled = @IsEnabled , IsDeleted = 0 , Grade = @Grade WHERE PKID = @pkid;"; SqlParameter[] parameter = new SqlParameter[] { new SqlParameter("@PkId", model.PKID), new SqlParameter("@NewViscosity", model.NewViscosity ?? string.Empty), new SqlParameter("@IsEnabled", model.IsEnabled), new SqlParameter("@VehicleId", model.VehicleId), new SqlParameter("@Grade", model.Grade), new SqlParameter("@Viscosity", model.Viscosity), }; return(SqlHelper.ExecuteNonQuery(conn, CommandType.Text, sql, parameter) > 0); }
/// <summary> /// 添加特殊车型机油推荐 /// </summary> /// <param name="conn"></param> /// <param name="productPriorityAreaOil"></param> /// <returns></returns> public static int InsertProductPriorityAreaOil(SqlConnection conn, ProductPriorityAreaOil productPriorityAreaOil) { string sql = @"INSERT INTO BaoYang..ProductPriority_Area_Oil ( AreaId , VehicleId , Viscosity , Grade , NewViscosity , IsEnabled, IsDeleted, CreateDateTime , LastUpdateDateTime ) OUTPUT Inserted.PKID VALUES ( @AreaId , @VehicleId , @Viscosity , @Grade , @NewViscosity , @IsEnabled , 0 , GETDATE() , GETDATE() );"; SqlParameter[] parameter = new SqlParameter[] { new SqlParameter("@AreaId", productPriorityAreaOil.AreaId), new SqlParameter("@VehicleId", productPriorityAreaOil.VehicleId), new SqlParameter("@Viscosity", productPriorityAreaOil.Viscosity), new SqlParameter("@IsEnabled", productPriorityAreaOil.IsEnabled), new SqlParameter("@Grade", productPriorityAreaOil.Grade), new SqlParameter("@NewViscosity", productPriorityAreaOil.NewViscosity ?? string.Empty) }; return(Convert.ToInt32(SqlHelper.ExecuteScalar(conn, CommandType.Text, sql, parameter))); }