Exemple #1
0
 public static void UpdateFlatrateShipping(long profileid, decimal?[] shipping_cost, int?[] shipping_destination, long subdomainid)
 {
     using (var repository = new TradelrRepository())
     {
         repository.DeleteShippingRules(profileid, subdomainid);
         for (int i = 0; i < shipping_destination.Length; i++)
         {
             var dest = shipping_destination[i];
             var cost = shipping_cost[i];
             if (cost.HasValue)
             {
                 var rule = new shippingRule()
                 {
                     cost          = cost.Value,
                     secondaryCost = cost.Value,
                     country       = dest,
                     matchvalue    = 0,
                     name          = ShippingProfileType.FLATRATE.ToDescriptionString(),
                     profileid     = profileid,
                     ruletype      = (byte)RuleType.PRICE,
                     state         = ""
                 };
                 repository.AddShippingRule(rule);
             }
         }
     }
 }