public ThreadShippingRate(ShippingMethod method, int index, string countryName, string countryIso2, string zipTo, string cityTo, string regionTo, string currencyIso3, ShoppingCart shoppingCart, float totalPrice, float totalDiscount, int distance) { _method = method; _index = index; _countryName = countryName; _countryIso2 = countryIso2; _currencyIso3 = currencyIso3; _zipTo = zipTo; _cityTo = cityTo; _regionTo = regionTo; _shoppingCart = shoppingCart; _totalPrice = totalPrice; _totalDiscount = totalDiscount; _distance = distance; _shippingRates = new List<ShippingListItem>(); }
public ThreadShippingRate(ShippingMethod method, int index, string countryName, string countryIso2, string zipTo, string cityTo, string regionTo, string currencyIso3, ShoppingCart shoppingCart, float totalPrice, float totalDiscount, int distance, int pickupId = 0, List <OrderItem> orderItems = null) { _method = method; _index = index; _countryName = countryName; _countryIso2 = countryIso2; _currencyIso3 = currencyIso3; _zipTo = zipTo; _cityTo = cityTo; _regionTo = regionTo; _shoppingCart = shoppingCart; _totalPrice = totalPrice; _totalDiscount = totalDiscount; _distance = distance; _pickupId = pickupId; _shippingRates = new List <ShippingItem>(); _orderItems = orderItems; }
/// <summary> /// update shipping method bu id /// </summary> /// <param name="item"></param> /// <returns>return 1 if sucsess and -1 when error</returns> public static bool UpdateShippingMethod(ShippingMethod item) { string cmd = item.Type == ShippingType.None ? "UPDATE [Order].[ShippingMethod] SET [Name] = @Name,[Description] = @Description,[Enabled] = @Enabled,[SortOrder] = @SortOrder WHERE ShippingMethodID=@ShippingMethodID" : "UPDATE [Order].[ShippingMethod] SET [ShippingType] = @ShippingType,[Name] = @Name,[Description] = @Description,[Enabled] = @Enabled,[SortOrder] = @SortOrder WHERE ShippingMethodID=@ShippingMethodID"; SQLDataAccess.ExecuteNonQuery(cmd, CommandType.Text, new SqlParameter("@ShippingType", (int)item.Type), new SqlParameter("@Name", item.Name), new SqlParameter("@Description", item.Description), new SqlParameter("@Enabled", item.Enabled), new SqlParameter("@SortOrder", item.SortOrder), new SqlParameter("@ShippingMethodID", item.ShippingMethodId)); return true; }
public static int InsertShippingMethod(ShippingMethod item) { return SQLDataAccess.ExecuteScalar<int>("INSERT INTO [Order].[ShippingMethod] ([ShippingType],[Name],[Description],[Enabled],[SortOrder]) VALUES (@ShippingType,@Name,@Description,@Enabled,@SortOrder); SELECT scope_identity();", CommandType.Text, new SqlParameter("@ShippingType", (int)item.Type), new SqlParameter("@Name", item.Name), new SqlParameter("@Description", item.Description), new SqlParameter("@Enabled", item.Enabled), new SqlParameter("@SortOrder", item.SortOrder)); }
private static IEnumerable <string> GetEnabledDomesticService(Dictionary <string, string> items) { if (ShippingMethod.GetBooleanParam(items, UspsTemplate.FirstClass)) { yield return(UspsTemplate.FirstClass); } if (ShippingMethod.GetBooleanParam(items, UspsTemplate.ExpressMailSundayHolidayGuarantee)) { yield return(UspsTemplate.ExpressMailSundayHolidayGuarantee); } if (ShippingMethod.GetBooleanParam(items, UspsTemplate.ExpressMailFlatRateEnvelopeSundayHolidayGuarantee)) { yield return(UspsTemplate.ExpressMailFlatRateEnvelopeSundayHolidayGuarantee); } if (ShippingMethod.GetBooleanParam(items, UspsTemplate.ExpressMailHoldForPickup)) { yield return(UspsTemplate.ExpressMailHoldForPickup); } if (ShippingMethod.GetBooleanParam(items, UspsTemplate.ExpressMailFlatRateEnvelopeHoldForPickup)) { yield return(UspsTemplate.ExpressMailFlatRateEnvelopeHoldForPickup); } if (ShippingMethod.GetBooleanParam(items, UspsTemplate.ExpresMail)) { yield return(UspsTemplate.ExpresMail); } if (ShippingMethod.GetBooleanParam(items, UspsTemplate.ExpressMailFlatRateEnvelope)) { yield return(UspsTemplate.ExpressMailFlatRateEnvelope); } if (ShippingMethod.GetBooleanParam(items, UspsTemplate.PriorityMail)) { yield return(UspsTemplate.PriorityMail); } if (ShippingMethod.GetBooleanParam(items, UspsTemplate.PriorityMailFlatRateEnvelope)) { yield return(UspsTemplate.PriorityMailFlatRateEnvelope); } if (ShippingMethod.GetBooleanParam(items, UspsTemplate.PriorityMailSmallFlatRateBox)) { yield return(UspsTemplate.PriorityMailSmallFlatRateBox); } if (ShippingMethod.GetBooleanParam(items, UspsTemplate.PriorityMailMediumFlatRateBox)) { yield return(UspsTemplate.PriorityMailMediumFlatRateBox); } if (ShippingMethod.GetBooleanParam(items, UspsTemplate.PriorityMailLargeFlatRateBox)) { yield return(UspsTemplate.PriorityMailLargeFlatRateBox); } if (ShippingMethod.GetBooleanParam(items, UspsTemplate.ParcelPost)) { yield return(UspsTemplate.ParcelPost); } if (ShippingMethod.GetBooleanParam(items, UspsTemplate.BoundPrintedMatter)) { yield return(UspsTemplate.BoundPrintedMatter); } if (ShippingMethod.GetBooleanParam(items, UspsTemplate.MediaMail)) { yield return(UspsTemplate.MediaMail); } if (ShippingMethod.GetBooleanParam(items, UspsTemplate.LibraryMail)) { yield return(UspsTemplate.LibraryMail); } }
public ShippingManager(ShippingMethod item) { _listMethod = new List <ShippingMethod> { item }; }
private static string GetEnabledService(Dictionary <string, string> items) { var res = new StringBuilder(); if (ShippingMethod.GetBooleanParam(items, UpsTemplate.UpsNextDayAir)) { res.Append(UpsTemplate.UpsNextDayAir + ";"); } if (ShippingMethod.GetBooleanParam(items, UpsTemplate.Ups2NdDayAir)) { res.Append(UpsTemplate.Ups2NdDayAir + ";"); } if (ShippingMethod.GetBooleanParam(items, UpsTemplate.UpsGround)) { res.Append(UpsTemplate.UpsGround + ";"); } if (ShippingMethod.GetBooleanParam(items, UpsTemplate.UpsWorldwideExpress)) { res.Append(UpsTemplate.UpsWorldwideExpress + ";"); } if (ShippingMethod.GetBooleanParam(items, UpsTemplate.UpsWorldwideExpedited)) { res.Append(UpsTemplate.UpsWorldwideExpedited + ";"); } if (ShippingMethod.GetBooleanParam(items, UpsTemplate.UpsStandard)) { res.Append(UpsTemplate.UpsStandard + ";"); } if (ShippingMethod.GetBooleanParam(items, UpsTemplate.Ups3DaySelect)) { res.Append(UpsTemplate.Ups3DaySelect + ";"); } if (ShippingMethod.GetBooleanParam(items, UpsTemplate.UpsNextDayAirSaver)) { res.Append(UpsTemplate.UpsNextDayAirSaver + ";"); } if (ShippingMethod.GetBooleanParam(items, UpsTemplate.UpsNextDayAirEarlyAm)) { res.Append(UpsTemplate.UpsNextDayAirEarlyAm + ";"); } if (ShippingMethod.GetBooleanParam(items, UpsTemplate.UpsWorldwideExpressPlus)) { res.Append(UpsTemplate.UpsWorldwideExpressPlus + ";"); } if (ShippingMethod.GetBooleanParam(items, UpsTemplate.Ups2NdDayAirAm)) { res.Append(UpsTemplate.Ups2NdDayAirAm + ";"); } if (ShippingMethod.GetBooleanParam(items, UpsTemplate.UpsSaver)) { res.Append(UpsTemplate.UpsSaver + ";"); } if (ShippingMethod.GetBooleanParam(items, UpsTemplate.UpsTodayStandard)) { res.Append(UpsTemplate.UpsTodayStandard + ";"); } if (ShippingMethod.GetBooleanParam(items, UpsTemplate.UpsTodayDedicatedCourrier)) { res.Append(UpsTemplate.UpsTodayDedicatedCourrier + ";"); } if (ShippingMethod.GetBooleanParam(items, UpsTemplate.UpsTodayExpress)) { res.Append(UpsTemplate.UpsTodayExpress + ";"); } if (ShippingMethod.GetBooleanParam(items, UpsTemplate.UpsTodayExpressSaver)) { res.Append(UpsTemplate.UpsTodayExpressSaver + ";"); } return(res.ToString()); }
private static string GetEnabledService(Dictionary <string, string> items) { var res = new StringBuilder(); if (ShippingMethod.GetBooleanParam(items, FedExTemplate.EuropeFirstInternationalPriority)) { res.Append(FedExTemplate.EuropeFirstInternationalPriority + ";"); } if (ShippingMethod.GetBooleanParam(items, FedExTemplate.Fedex1DayFreight)) { res.Append(FedExTemplate.Fedex1DayFreight + ";"); } if (ShippingMethod.GetBooleanParam(items, FedExTemplate.Fedex2Day)) { res.Append(FedExTemplate.Fedex2Day + ";"); } if (ShippingMethod.GetBooleanParam(items, FedExTemplate.Fedex2DayFreight)) { res.Append(FedExTemplate.Fedex2DayFreight + ";"); } if (ShippingMethod.GetBooleanParam(items, FedExTemplate.Fedex3DayFreight)) { res.Append(FedExTemplate.Fedex3DayFreight + ";"); } if (ShippingMethod.GetBooleanParam(items, FedExTemplate.FedexExpressSaver)) { res.Append(FedExTemplate.FedexExpressSaver + ";"); } if (ShippingMethod.GetBooleanParam(items, FedExTemplate.FedexGround)) { res.Append(FedExTemplate.FedexGround + ";"); } if (ShippingMethod.GetBooleanParam(items, FedExTemplate.FirstOvernight)) { res.Append(FedExTemplate.FirstOvernight + ";"); } if (ShippingMethod.GetBooleanParam(items, FedExTemplate.GroundHomeDelivery)) { res.Append(FedExTemplate.GroundHomeDelivery + ";"); } if (ShippingMethod.GetBooleanParam(items, FedExTemplate.InternationalDistributionFreight)) { res.Append(FedExTemplate.InternationalDistributionFreight + ";"); } if (ShippingMethod.GetBooleanParam(items, FedExTemplate.InternationalEconomy)) { res.Append(FedExTemplate.InternationalEconomy + ";"); } if (ShippingMethod.GetBooleanParam(items, FedExTemplate.InternationalEconomyDistribution)) { res.Append(FedExTemplate.InternationalEconomyDistribution + ";"); } if (ShippingMethod.GetBooleanParam(items, FedExTemplate.InternationalEconomyFreight)) { res.Append(FedExTemplate.InternationalEconomyFreight + ";"); } if (ShippingMethod.GetBooleanParam(items, FedExTemplate.InternationalFirst)) { res.Append(FedExTemplate.InternationalFirst + ";"); } if (ShippingMethod.GetBooleanParam(items, FedExTemplate.InternationalPriority)) { res.Append(FedExTemplate.InternationalPriority + ";"); } if (ShippingMethod.GetBooleanParam(items, FedExTemplate.InternationalPriorityFreight)) { res.Append(FedExTemplate.InternationalPriorityFreight + ";"); } if (ShippingMethod.GetBooleanParam(items, FedExTemplate.PriorityOvernight)) { res.Append(FedExTemplate.PriorityOvernight + ";"); } if (ShippingMethod.GetBooleanParam(items, FedExTemplate.SmartPost)) { res.Append(FedExTemplate.SmartPost + ";"); } if (ShippingMethod.GetBooleanParam(items, FedExTemplate.StandardOvernight)) { res.Append(FedExTemplate.StandardOvernight + ";"); } if (ShippingMethod.GetBooleanParam(items, FedExTemplate.FedexFreight)) { res.Append(FedExTemplate.FedexFreight + ";"); } if (ShippingMethod.GetBooleanParam(items, FedExTemplate.FedexNationalFreight)) { res.Append(FedExTemplate.FedexNationalFreight + ";"); } return(res.ToString()); }
public new void SaveData() { var sm = ShippingMethodService.GetShippingMethodByName(chbPickup.Text); if (sm != null) ShippingMethodService.DeleteShippingMethod(sm.ShippingMethodId); if (chbPickup.Checked) { var method = new ShippingMethod { Type = ShippingType.FreeShipping, Name = chbPickup.Text, Description = string.Empty, Enabled = true, SortOrder = 0 }; ShippingMethodService.InsertShippingMethod(method); } sm = ShippingMethodService.GetShippingMethodByName(chbCourier.Text); if (sm != null) ShippingMethodService.DeleteShippingMethod(sm.ShippingMethodId); if (chbCourier.Checked) { var method = new ShippingMethod { Type = ShippingType.FixedRate, Name = chbCourier.Text, Description = string.Empty, Enabled = true, SortOrder = 1 }; var id = ShippingMethodService.InsertShippingMethod(method); var parameters = new Dictionary<string, string> { {FixeRateShippingTemplate.ShippingPrice, txtCourier.Text}, {FixeRateShippingTemplate.Extracharge, "0"}, }; ShippingMethodService.UpdateShippingParams(id, parameters); } sm = ShippingMethodService.GetShippingMethodByName(chbeDost.Text); if (sm != null) ShippingMethodService.DeleteShippingMethod(sm.ShippingMethodId); if (chbeDost.Checked) { var method = new ShippingMethod { Type = ShippingType.eDost, Name = chbeDost.Text, Description = string.Empty, Enabled = true, SortOrder = 2 }; var id = ShippingMethodService.InsertShippingMethod(method); var parameters = new Dictionary<string, string> { {EdostTemplate.ShopId, txteDostNumer.Text}, {EdostTemplate.Password, txteDostPass.Text}, }; ShippingMethodService.UpdateShippingParams(id, parameters); } }
protected void btnSave_Click(object sender, EventArgs e) { if (!Visible) return; if (!ValidateFormData()) return; var parameters = _ucSpecific == null ? null : _ucSpecific.Parameters; if (parameters == null) return; var method = new ShippingMethod { Type = ShippingType, ShippingMethodId = ShippingMethodID, Name = txtName.Text, Description = txtDescription.Text, SortOrder = txtSortOrder.Text.TryParseInt(), Enabled = chkEnabled.Checked && (_ucSpecific == null || _ucSpecific.Parameters != null) }; if (!ShippingMethodService.UpdateShippingMethod(method)) return; if (ShippingType == ShippingType.eDost) { //COD if (SQLDataHelper.GetBoolean(parameters[EdostTemplate.EnabledCOD])) { int idShip = 0; Int32.TryParse(parameters[EdostTemplate.ShipIdCOD], out idShip); var payment = PaymentService.GetPaymentMethod(idShip); if (payment == null) { var payMethod = PaymentMethod.Create(PaymentType.CashOnDelivery); payMethod.Name = Resource.CashOnDeliveryName; payMethod.Enabled = true; if (payMethod.Parameters.ContainsKey(CashOnDelivery.ShippingMethodTemplate)) { payMethod.Parameters[CashOnDelivery.ShippingMethodTemplate] = ShippingMethodID.ToString(); } else { payMethod.Parameters.Add(CashOnDelivery.ShippingMethodTemplate, ShippingMethodID.ToString()); } var id = PaymentService.AddPaymentMethod(payMethod); parameters[EdostTemplate.ShipIdCOD] = id.ToString(); } } else { int idShip = 0; Int32.TryParse(parameters[EdostTemplate.ShipIdCOD], out idShip); PaymentService.DeletePaymentMethod(idShip); } //PickPoint if (SQLDataHelper.GetBoolean(parameters[EdostTemplate.EnabledPickPoint])) { int idShip = 0; Int32.TryParse(parameters[EdostTemplate.ShipIdPickPoint], out idShip); var payment = PaymentService.GetPaymentMethod(idShip); if (payment == null) { var payMethod = PaymentMethod.Create(PaymentType.PickPoint); payMethod.Name = Resource.OrderPickPointMessage; payMethod.Enabled = true; if (payMethod.Parameters.ContainsKey(PickPoint.ShippingMethodTemplate)) { payMethod.Parameters[PickPoint.ShippingMethodTemplate] = ShippingMethodID.ToString(); } else { payMethod.Parameters.Add(PickPoint.ShippingMethodTemplate, ShippingMethodID.ToString()); } var id = PaymentService.AddPaymentMethod(payMethod); parameters[EdostTemplate.ShipIdPickPoint] = id.ToString(); } } else { int idShip = 0; Int32.TryParse(parameters[EdostTemplate.ShipIdPickPoint], out idShip); PaymentService.DeletePaymentMethod(idShip); } } var payments = new System.Collections.Generic.List<int>(); foreach (RepeaterItem item in rptrPayments.Items) { if (!((CheckBox)item.FindControl("ckbUsePayment")).Checked) { payments.Add(SQLDataHelper.GetInt(((HiddenField)item.FindControl("hfPaymentId")).Value)); } } ShippingMethodService.UpdateShippingPayments(ShippingMethodID, payments); if (ShippingMethodService.UpdateShippingParams(method.ShippingMethodId, parameters)) { Method = ShippingMethodService.GetShippingMethod(method.ShippingMethodId); LoadFormData(_ucSpecific != null && _ucSpecific.Parameters != null); OnSaved(new SavedEventArgs { Enabled = method.Enabled, Name = method.Name }); } }
public ShippingManager(ShippingMethod item) { _listMethod = new List<ShippingMethod> { item }; }