Exemple #1
0
 /// <summary>
 /// 获取赠品销售数量
 /// </summary>
 /// <param name="pid"></param>
 /// <returns></returns>
 public static int SelectGiftStock(string pid)
 {
     if (!string.IsNullOrEmpty(pid) && pid == "initial")
     {
         var datas =
             SE_GiftManageConfigDAL.SelectAllGiftManageConfigModels(ProcessConnection.OpenConfigurationReadOnly);
         {
             foreach (var model in datas)
             {
                 try
                 {
                     SE_GiftManageConfigDAL.DeleteGiftProductConfig(model.Id);
                     if (model.GiftProducts != null && model.GiftProducts.Any())
                     {
                         var giftProductModels =
                             JsonConvert.DeserializeObject <List <GiftStockModel2> >(model.GiftProducts);
                         foreach (var g in giftProductModels)
                         {
                             g.IsRetrieve = g.IsRetrieve ?? 0;
                             g.RuleId     = model.Id;
                             SE_GiftManageConfigDAL.InsertGiftProductConfig(g);
                         }
                     }
                 }
                 catch (Exception e)
                 {
                     throw e;
                 }
             }
         }
     }
     return(SE_GiftManageConfigDAL.SelectGiftStock(pid));
 }