public static decimal CalcFreight_ShipppingTemplate(int regionId, int shippingTemplateId, int quantity = 1, decimal weight = default(decimal), decimal volume = default(decimal), decimal amount = default(decimal)) { decimal result = default(decimal); decimal num = default(decimal); decimal num2 = default(decimal); decimal num3 = default(decimal); decimal num4 = default(decimal); ShippingTemplateInfo shippingTemplateInfo = (ShippingTemplateInfo)HiCache.Get($"DataCache-ShippingModeInfoCacheKey-{shippingTemplateId}"); if (shippingTemplateInfo == null) { shippingTemplateInfo = new ShippingModeDao().GetShippingTemplate(shippingTemplateId, true); HiCache.Insert($"DataCache-ShippingModeInfoCacheKey-{shippingTemplateId}", shippingTemplateInfo, 1800); } if (shippingTemplateInfo != null) { if (shippingTemplateInfo.IsFreeShipping) { return(decimal.Zero); } num = shippingTemplateInfo.DefaultNumber; num2 = (shippingTemplateInfo.AddNumber.HasValue ? shippingTemplateInfo.AddNumber.Value : decimal.Zero); num3 = shippingTemplateInfo.Price; num4 = (shippingTemplateInfo.AddPrice.HasValue ? shippingTemplateInfo.AddPrice.Value : decimal.Zero); if (regionId > 0) { string fullPath = RegionHelper.GetFullPath(regionId, true); if (!string.IsNullOrEmpty(fullPath)) { string[] array = fullPath.Split(','); int num5 = 0; int num6 = 0; if (array.Length >= 2) { num5 = array[0].ToInt(0); num6 = array[1].ToInt(0); regionId = ((array.Length >= 3) ? array[2].ToInt(0) : 0); ShippingTemplateGroupMode shippingTemplateParam_RegionId = ShoppingProcessor.GetShippingTemplateParam_RegionId(shippingTemplateInfo, num5, num6, regionId); ShippingTemplateFreeGroupMode shippingTemplateFreeParam_RegionId = ShoppingProcessor.GetShippingTemplateFreeParam_RegionId(shippingTemplateInfo, num5, num6, regionId); if (shippingTemplateFreeParam_RegionId != null) { int conditionType = shippingTemplateFreeParam_RegionId.ConditionType; ConditionType conditionType2 = ConditionType.Number; if (conditionType == conditionType2.GetHashCode()) { if (quantity >= shippingTemplateFreeParam_RegionId.ConditionNumber.ToInt(0)) { return(decimal.Zero); } } else { int conditionType3 = shippingTemplateFreeParam_RegionId.ConditionType; conditionType2 = ConditionType.Amount; if (conditionType3 == conditionType2.GetHashCode()) { if (amount >= shippingTemplateFreeParam_RegionId.ConditionNumber.ToDecimal(0)) { return(decimal.Zero); } } else { int conditionType4 = shippingTemplateFreeParam_RegionId.ConditionType; conditionType2 = ConditionType.NumberAndAmount; if (conditionType4 == conditionType2.GetHashCode() && quantity >= shippingTemplateFreeParam_RegionId.ConditionNumber.Split('$')[0].ToInt(0) && amount >= shippingTemplateFreeParam_RegionId.ConditionNumber.Split('$')[1].ToDecimal(0)) { return(decimal.Zero); } } } } if (shippingTemplateParam_RegionId != null) { num = shippingTemplateParam_RegionId.DefaultNumber; num2 = shippingTemplateParam_RegionId.AddNumber; num3 = shippingTemplateParam_RegionId.DefaultPrice; num4 = shippingTemplateParam_RegionId.AddPrice; } } } } if (shippingTemplateInfo.ValuationMethod == ValuationMethods.Number) { result = ShoppingProcessor.CalcFreight(quantity, num3, num4, num, num2); } else if (shippingTemplateInfo.ValuationMethod == ValuationMethods.Volume) { result = ShoppingProcessor.CalcFreight(volume, num3, num4, num, num2); } else if (shippingTemplateInfo.ValuationMethod == ValuationMethods.Weight) { result = ShoppingProcessor.CalcFreight(weight, num3, num4, num, num2); } } return(result); }