public static List <GradeDeliveryFeeRule> GetGradeDeliveryFeeRule(GradeDeliveryFeeRule model) { const string sql = @"SELECT PKID , Grade ,--会员等级 ProductType ,--商品类别,0 轮胎 / 轮毂 1 车品 / 保养 IsShopInstall ,--是否到店,0 到家 ;1到店 Price ,--包邮金额 IsFreeInstall ,--是否包安装 Content ,--包邮的话语 CreateDateTime , LastUpdateDateTime , [ContainInstall] , [NoContainInstall] , CASE WHEN UserType = 2 THEN UserType ELSE 1 END AS UserType FROM Configuration..tbl_GradeDeliveryFeeRule WITH ( NOLOCK ) WHERE IsShopInstall=@IsShopInstall AND ProductType=@ProductType"; var sqlParameter = new SqlParameter[] { new SqlParameter("@ProductType", model.ProductType), new SqlParameter("@IsShopInstall", model.IsShopInstall) }; return(SqlHelper.ExecuteDataTable(connOnRead, CommandType.Text, sql, sqlParameter).ConvertTo <GradeDeliveryFeeRule>().ToList()); }
public static bool UpdateGradeDeliveryFeeRule(GradeDeliveryFeeRule model) { const string sql = @"UPDATE Configuration.dbo.tbl_GradeDeliveryFeeRule SET Price = @Price , IsFreeInstall = @IsFreeInstall , Content = @Content , ContainInstall=@ContainInstall , NoContainInstall=@NoContainInstall, LastUpdateDateTime = GETDATE(), UserType = @UserType WHERE PKID = @PKID "; var sqlParameters = new SqlParameter[] { new SqlParameter("@Content", model.Content), new SqlParameter("@Grade", model.Grade), new SqlParameter("@IsFreeInstall", model.IsFreeInstall), new SqlParameter("@IsShopInstall", model.IsShopInstall), new SqlParameter("@Price", model.Price), new SqlParameter("@ProductType", model.ProductType), new SqlParameter("@PKID", model.PKID), new SqlParameter("@ContainInstall", model.ContainInstall), new SqlParameter("@NoContainInstall", model.NoContainInstall), new SqlParameter("@UserType", model.UserType) }; return(SqlHelper.ExecuteNonQuery(conn, CommandType.Text, sql, sqlParameters) > 0); }
public static bool DeleteGradeDeliveryFeeRule(GradeDeliveryFeeRule model) { const string sql = @"DELETE FROM [Configuration].[dbo].[tbl_GradeDeliveryFeeRule] WHERE IsShopInstall=@IsShopInstall AND ProductType=@ProductType AND Grade IS NOT NULL AND Grade <> '' "; var sqlParameters = new SqlParameter[] { new SqlParameter("@IsShopInstall", model.IsShopInstall), new SqlParameter("@ProductType", model.ProductType), }; return(SqlHelper.ExecuteNonQuery(conn, CommandType.Text, sql, sqlParameters) > 0); }
public ActionResult Hub(GradeDeliveryFeeRule rule) { rule.ProductType = 1; ViewBag.GradeDeliveryFeeRule = ShippingManager.GradeDeliveryFeeRule(rule); var model = ShippingManager.SelectShippingRule().Where(m => (m.Types & 64) == 64); if (Request.QueryString.ToString().Contains("home")) { ViewBag.Where = "home"; model = model.Where(m => (m.Types & 4) == 0); } else { model = model.Where(m => (m.Types & 4) == 4); } return(View(model)); }
public static bool InsertGradeDeliveryFeeRule(GradeDeliveryFeeRule model) { const string sql = @"INSERT INTO Configuration..tbl_GradeDeliveryFeeRule ( Grade ,--会员等级 ProductType ,--商品类别,0 轮胎 / 轮毂 1 车品 / 保养 IsShopInstall ,--是否到店,0 到家 ;1到店 Price ,--包邮金额 IsFreeInstall ,--是否包安装 Content ,--包邮的话语 CreateDateTime , LastUpdateDateTime, [ContainInstall], [NoContainInstall], UserType ) VALUES ( @Grade , @ProductType , @IsShopInstall , @Price , @IsFreeInstall , @Content , GETDATE() , GETDATE(), @ContainInstall, @NoContainInstall, @UserType ) "; var sqlParameters = new SqlParameter[] { new SqlParameter("@Content", model.Content), new SqlParameter("@Grade", model.Grade), new SqlParameter("@IsFreeInstall", model.IsFreeInstall), new SqlParameter("@IsShopInstall", model.IsShopInstall), new SqlParameter("@Price", model.Price), new SqlParameter("@ProductType", model.ProductType), new SqlParameter("@ContainInstall", model.ContainInstall), new SqlParameter("@NoContainInstall", model.NoContainInstall), new SqlParameter("@UserType", model.UserType) }; return(SqlHelper.ExecuteNonQuery(conn, CommandType.Text, sql, sqlParameters) > 0); }
public ActionResult InsertAndUpdateaRule(string data, string rank, bool status, bool IsShopInstall, int ProductType) { IEnumerable <ShippingModel> list = JsonConvert.DeserializeObject <List <ShippingModel> >(data); ShippingManager.InsertAndUpdateaRule(list); try { if (!string.IsNullOrWhiteSpace(rank)) { List <GradeDeliveryFeeRule> rankList = JsonConvert.DeserializeObject <List <GradeDeliveryFeeRule> >(rank); foreach (var item in rankList) { if (item.PKID != 0) { ShippingManager.UpdateGradeDeliveryFeeRule(item); } else { ShippingManager.InsertGradeDeliveryFeeRule(item); } } } if (!status) { GradeDeliveryFeeRule model = new GradeDeliveryFeeRule(); model.IsShopInstall = IsShopInstall; model.ProductType = ProductType; ShippingManager.DeleteGradeDeliveryFeeRule(model); } return(Json(true)); } catch (System.Exception ex) { return(Json(false)); throw ex; } }
public static bool DeleteGradeDeliveryFeeRule(GradeDeliveryFeeRule model) { return(DALShipping.DeleteGradeDeliveryFeeRule(model)); }
public static bool InsertGradeDeliveryFeeRule(GradeDeliveryFeeRule model) { return(DALShipping.InsertGradeDeliveryFeeRule(model)); }
public static List <GradeDeliveryFeeRule> GradeDeliveryFeeRule(GradeDeliveryFeeRule model) { return(DALShipping.GetGradeDeliveryFeeRule(model)); }