Пример #1
0
        public void ChangeLocalization(OrderInfo order, ILocalization localization)
        {
            if (order.Status != OrderStatus.Incomplete)
            {
                Log.Instance.LogError("ChangeLocalization for NOT incomplete order: " + order.UniqueOrderId + " status: " + order.Status);
            }
            order.Localization = localization;
            order.AddStore(localization.Store);

            ReloadOrderData(order, localization);
        }
Пример #2
0
        public OrderInfo CreateOrder(Store store)
        {
            if (store == null)
            {
                throw new Exception("Trying to create order without store");
            }
            if (string.IsNullOrEmpty(store.Alias))
            {
                throw new Exception("Store without alias. Please (re)publish store and re-index examine External index");
            }

            var order = new OrderInfo();

            order.CreatedInTestMode = store.EnableTestmode;
            order.CustomerInfo.CustomerIPAddress = HttpContext.Current.Request.UserHostAddress;

            order.ShippingCostsMightBeOutdated = true;

            order.VATCheckService = IO.Container.Resolve <IVATCheckService>();
            InitializeNewOrder(order);
            UseDatabaseDiscounts(order);

            order.CustomerInfo.CountryCode = !string.IsNullOrEmpty(store.DefaultCountryCode) ? store.DefaultCountryCode : store.CountryCode;

            var currentMember = Membership.GetUser();             // TODO: dip

            if (currentMember != null)
            {
                //uWebshopOrders.SetCustomer(order.UniqueOrderId, currentMember.UserName); heeft toch geen effect (geen row in db)
                order.CustomerInfo.LoginName = currentMember.UserName;
                if (currentMember.ProviderUserKey != null)
                {
                    //uWebshopOrders.SetCustomerId(order.UniqueOrderId, (int)currentMember.ProviderUserKey); heeft toch geen effect (geen row in db)
                    order.CustomerInfo.CustomerId = (int)currentMember.ProviderUserKey;
                }
            }

            order.Localization = StoreHelper.CurrentLocalization;             // todo clean
            order.AddStore(store);

            order.Save();

            return(order);
        }
Пример #3
0
		public OrderInfo CreateOrder(Store store)
		{
			if (store == null)
			{
				throw new Exception("Trying to create order without store");
			}
			if (string.IsNullOrEmpty(store.Alias))
			{
				throw new Exception("Store without alias. Please (re)publish store and re-index examine External index");
			}

			var order = new OrderInfo();

			order.CreatedInTestMode = store.EnableTestmode;
			order.CustomerInfo.CustomerIPAddress = HttpContext.Current.Request.UserHostAddress;

			order.ShippingCostsMightBeOutdated = true;

			order.VATCheckService = IO.Container.Resolve<IVATCheckService>();
			InitializeNewOrder(order);
			UseDatabaseDiscounts(order);

			order.CustomerInfo.CountryCode = !string.IsNullOrEmpty(store.DefaultCountryCode) ? store.DefaultCountryCode : store.CountryCode;

			var currentMember = Membership.GetUser(); // TODO: dip

			if (currentMember != null)
			{
				//uWebshopOrders.SetCustomer(order.UniqueOrderId, currentMember.UserName); heeft toch geen effect (geen row in db)
				order.CustomerInfo.LoginName = currentMember.UserName;
				if (currentMember.ProviderUserKey != null)
				{
					//uWebshopOrders.SetCustomerId(order.UniqueOrderId, (int)currentMember.ProviderUserKey); heeft toch geen effect (geen row in db)
					order.CustomerInfo.CustomerId = (int)currentMember.ProviderUserKey;
				}
			}

			order.Localization = StoreHelper.CurrentLocalization; // todo clean
			order.AddStore(store);

			order.Save();

			return order;
		}
		public void ChangeLocalization(OrderInfo order, ILocalization localization)
		{
			if (order.Status != OrderStatus.Incomplete)
			{
				Log.Instance.LogError("ChangeLocalization for NOT incomplete order: " + order.UniqueOrderId + " status: " + order.Status);
			}
			order.Localization = localization;
			order.AddStore(localization.Store);

			ReloadOrderData(order, localization);
		}