/// <summary>
 /// 更新权重值
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public static int UpdateGuidePara(BaoYangPriceWeight model)
 {
     using (var dbHelper = new SqlDbHelper(ConnectionHelper.GetDecryptConn("Gungnir")))
     {
         return(dbHelper.ExecuteNonQuery(@"UPDATE Tuhu_productcatalog.dbo.tbl_BaoYangPriceWeight SET WeightValue=@Value,UpdateTime=GETDATE() WHERE PKID=@PKID", CommandType.Text, new SqlParameter[] { new SqlParameter("@Value", model.WeightValue), new SqlParameter("@PKID", model.PKID) }));
     }
 }
 public int SavePriceWeight(BaoYangPriceWeight model)
 {
     if (model.PKID.GetValueOrDefault(0) > 0)
     {
         if (model.WeightValue.GetValueOrDefault(0) == 0 && model.WeightType != "Base")
         {
             return(DalBaoYangPriceGuide.DeleteGuidePara(model.PKID.Value));
         }
         else
         {
             return(DalBaoYangPriceGuide.UpdateGuidePara(model));
         }
     }
     else
     {
         if (model.WeightValue.GetValueOrDefault(0) != 0)
         {
             return(DalBaoYangPriceGuide.InsertGuidePara(model));
         }
         else
         {
             return(99);
         }
     }
 }
 /// <summary>
 /// 插入权重配置
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public static int InsertGuidePara(BaoYangPriceWeight model)
 {
     using (var dbHelper = new SqlDbHelper(ConnectionHelper.GetDecryptConn("Gungnir")))
     {
         return(dbHelper.ExecuteNonQuery(@"INSERT INTO Tuhu_productcatalog.dbo.tbl_BaoYangPriceWeight
                                                 ( WeightType, WeightName, WeightValue, CategoryName )
                                           VALUES	( @Type, @Item, @Value, @CategoryName )"    , CommandType.Text, new SqlParameter[] {
             new SqlParameter("@Value", model.WeightValue),
             new SqlParameter("@Type", model.WeightType),
             new SqlParameter("@Item", model.WeightName),
             new SqlParameter("@CategoryName", model.CategoryName)
         }));
     }
 }
Ejemplo n.º 4
0
        public JsonResult SaveGuidePara(BaoYangPriceWeight model, string prevValue)
        {
            var manager = new BaoYangPriceGuideManager();
            var result  = manager.SavePriceWeight(model);

            if (result > 0 && result != 99)
            {
                string operation;
                if (model.WeightType.Equals("Brand"))
                {
                    operation = model.WeightType + "|" + model.CategoryName + "|" +
                                HttpUtility.UrlDecode(model.WeightName);
                }
                else
                {
                    operation = model.WeightType + "|" + HttpUtility.UrlDecode(model.WeightName);
                }
                AddOprLog(prevValue, model.WeightValue.GetValueOrDefault(0).ToString(), "ByWeight", operation);
            }

            return(Json(result));
        }