Exemple #1
0
    // load or create new data for current state
    private AdvantShop.Orders.OrderConfirmation LoadOrderConfirmationData(Guid id)
    {
        AdvantShop.Orders.OrderConfirmation res;

        if (!OrderConfirmationService.IsExist(id))
        {
            res = new AdvantShop.Orders.OrderConfirmation
            {
                CustomerId            = id,
                OrderConfirmationData = new OrderConfirmationData {
                    UserType = EnUserType.NoUser, BillingIsShipping = true
                }
            };
            // if we have user
            if (CustomerSession.CurrentCustomer.RegistredUser)
            {
                res.OrderConfirmationData.UserType = EnUserType.RegistredUser;
            }
            OrderConfirmationService.Add(res);
        }
        else
        {
            res = OrderConfirmationService.Get(id);
        }

        return(res);
    }
        /// <summary>
        /// Load or create new order confirmation data for current state
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        private AdvantShop.Orders.OrderConfirmation LoadOrderConfirmationData(Guid id)
        {
            if (OrderConfirmationService.IsExist(id))
            {
                return(OrderConfirmationService.Get(id));
            }

            var res = new AdvantShop.Orders.OrderConfirmation
            {
                CustomerId            = id,
                OrderConfirmationData = new OrderConfirmationData
                {
                    UserType          = CustomerContext.CurrentCustomer.RegistredUser ? EnUserType.RegisteredUser : EnUserType.NoUser,
                    BillingIsShipping = true
                }
            };

            OrderConfirmationService.Add(res);
            return(res);
        }