static public void Delete(System.Int32 id, esSqlAccessType sqlAccessType)
        {
            var obj = new ShippingService();

            obj.Id = id;
            obj.AcceptChanges();
            obj.MarkAsDeleted();
            obj.Save(sqlAccessType);
        }
Beispiel #2
0
        public static ShippingService FindOrCreateNew(int storeId, ShippingProviderType providerType)
        {
            var service = Find(storeId, providerType);

            if (service == null)
            {
                service         = new ShippingService();
                service.StoreId = storeId;
                service.ShippingProviderType = (short)providerType;
                service.Save();
            }
            return(service);
        }
        private static DataModel.Store CreateInitialStoreForPortal(PortalSettings portalSettings)
        {
            //--- Create the Store for this Portal
            DataModel.Store newStore = new DataModel.Store();
            newStore.PortalId = portalSettings.PortalId;
            newStore.Name     = portalSettings.PortalName;
            newStore.Save();

            //--- Set some sensible default settings
            newStore.UpdateSetting(StoreSettingNames.OrderCompletedEmailRecipient, portalSettings.Email);
            newStore.UpdateSetting(StoreSettingNames.CustomerServiceEmailAddress, portalSettings.Email);

            //--- Copy over the default email templates
            newStore.AddMissingEmailTemplates();

            //--- Set the default payment processor to 'CardCaptureOnly'
            CardCaptureOnlyPaymentProvider cardCapturePaymentProvider = new CardCaptureOnlyPaymentProvider(newStore.GetPaymentProviderConfig(PaymentProviderName.CardCaptureOnly));

            cardCapturePaymentProvider.IsEnabled = true;
            newStore.UpdatePaymentProviderConfig(cardCapturePaymentProvider.GetConfiguration());


            //--- Add a default shipping service and rate type
            var newShippingService = new DataModel.ShippingService();

            newShippingService.StoreId = newStore.Id.Value;
            newShippingService.ShippingProviderType = (short)ShippingProviderType.CustomShipping;
            newShippingService.Save();
            Dictionary <string, string> settings = newShippingService.GetSettingsDictionary();

            settings["IsEnabled"] = true.ToString();
            newShippingService.UpdateSettingsDictionary(settings);
            var newRateType = new DataModel.ShippingServiceRateType();

            newRateType.ShippingServiceId = newShippingService.Id.Value;
            newRateType.Name        = "Standard";
            newRateType.DisplayName = "Standard";
            newRateType.Save();

            var fedexService = new DataModel.ShippingService();

            fedexService.StoreId = newStore.Id.Value;
            fedexService.ShippingProviderType = (short)ShippingProviderType.FedEx;
            fedexService.Save();
            Dictionary <string, string> fedexSettings = fedexService.GetSettingsDictionary();

            fedexSettings["IsEnabled"] = false.ToString();
            fedexService.UpdateSettingsDictionary(fedexSettings);

            return(newStore);
        }