Example #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);
    }
Example #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            var ocModule = AttachedModules.GetModules(AttachedModules.EModuleType.OrderConfirmation).FirstOrDefault();
            if (ocModule != null)
            {
                var classInstance = (IOrderConfirmation)Activator.CreateInstance(ocModule, null);
                if (classInstance.IsActive && classInstance.CheckAlive() && !string.IsNullOrEmpty(classInstance.FileUserControlOrderConfirmation))
                {
                    Redirect("orderconfirmationmodule.aspx", true);
                }
            }
        }

        var shoppingCart = ShoppingCartService.CurrentShoppingCart;

        PageData = LoadOrderConfirmationData(CustomerSession.CustomerId);

        if (!shoppingCart.CanOrder && (PageData.OrderConfirmationData.ActiveTab != EnActiveTab.FinalTab))
        {
            Redirect("shoppingcart.aspx", true);
        }

        //check current step and save state in db
        var activeT = EnActiveTab.NoTab;

        if (!IsPostBack)
        {
            Enum.TryParse(Request["tab"], true, out activeT);

            if (activeT != PageData.OrderConfirmationData.ActiveTab)
            {
                if (activeT < PageData.OrderConfirmationData.ActiveTab)
                {
                    PageData.OrderConfirmationData.ActiveTab = activeT;
                }
                Redirect(PageData);
            }
        }
        if (PageData.OrderConfirmationData.ActiveTab == EnActiveTab.FinalTab)
        {
            OrderConfirmationService.Delete(CustomerSession.CustomerId);
            LoadOrderConfirmationData(CustomerSession.CustomerId);
        }

        if (PageData.OrderConfirmationData.ActiveTab == EnActiveTab.NoTab)
        {
            //ShowTab(PageData.OrderConfirmationData.UserType == EnUserType.RegistredUser ? EnActiveTab.UserTab : EnActiveTab.DefaultTab);
            //Changed by Evgeni to prevent user registration
            ShowTab(EnActiveTab.UserTab);
        }
        else
        {
            ShowTab(PageData.OrderConfirmationData.ActiveTab);
        }

        SetMeta(new MetaInfo(string.Format("{0} - {1}", Resource.Client_OrderConfirmation_DrawUpOrder, SettingsMain.ShopName)), string.Empty);
    }
Example #3
0
 public static void Update(OrderConfirmation item)
 {
     SQLDataAccess.ExecuteNonQuery(
         "Update [Order].OrderConfirmation set OrderConfirmationData=@OrderConfirmationData,LastUpdate=GetDate() where CustomerId=@CustomerId",
         CommandType.Text,
         new SqlParameter("@CustomerId", item.CustomerId),
         new SqlParameter("@OrderConfirmationData", JsonConvert.SerializeObject(item.OrderConfirmationData)));
 }
Example #4
0
 public static void Add(OrderConfirmation item)
 {
     SQLDataAccess.ExecuteNonQuery(
         "Insert into [Order].OrderConfirmation ([CustomerId],[OrderConfirmationData],LastUpdate) values (@CustomerId,@OrderConfirmationData,GetDate())",
         CommandType.Text,
         new SqlParameter("@CustomerId", item.CustomerId),
         new SqlParameter("@OrderConfirmationData", JsonConvert.SerializeObject(item.OrderConfirmationData)));
 }
 public static void Update(OrderConfirmation item)
 {
     SQLDataAccess.ExecuteNonQuery("update [Order].OrderConfirmation set OrderConfirmationData=@OrderConfirmationData,LastUpdate=GetDate() where CustomerId=@CustomerId",
                                     CommandType.Text,
                                     new SqlParameter { ParameterName = "@CustomerId", Value = item.CustomerId },
                                     new SqlParameter { ParameterName = "@OrderConfirmationData", Value = JsonConvert.SerializeObject(item.OrderConfirmationData) }
                                     );
 }
 public static void Add(OrderConfirmation item)
 {
     SQLDataAccess.ExecuteNonQuery("insert into [Order].OrderConfirmation ([CustomerId],[OrderConfirmationData],LastUpdate) values (@CustomerId,@OrderConfirmationData,GetDate())",
                                       CommandType.Text,
                                       new SqlParameter { ParameterName = "@CustomerId", Value = item.CustomerId },
                                       new SqlParameter { ParameterName = "@OrderConfirmationData", Value = JsonConvert.SerializeObject(item.OrderConfirmationData) }
                                       );
 }
Example #7
0
 private void Redirect(AdvantShop.Orders.OrderConfirmation data)
 {
     if (Request.UrlReferrer != null && !Request.UrlReferrer.AbsoluteUri.Contains("orderconfirmation"))
     {
         PageData.OrderConfirmationData.ActiveTab = EnActiveTab.UserTab;
     }
     OrderConfirmationService.Update(PageData);
     Response.Redirect("orderconfirmation.aspx?tab=" + PageData.OrderConfirmationData.ActiveTab.ToString());
 }
        protected void Page_PreLoad(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var showConfirmButtons = true;
                foreach (var module in AttachedModules.GetModules <IRenderIntoShoppingCart>())
                {
                    var moduleObject = (IRenderIntoShoppingCart)Activator.CreateInstance(module, null);
                    showConfirmButtons &= moduleObject.ShowConfirmButtons;
                }

                if (!showConfirmButtons && !string.Equals(Request["tab"], "FinalTab"))
                {
                    Response.Redirect("shoppingcart.aspx");
                }

                if (OrderConfirmationService.OrderID != 0 && string.Equals(Request["tab"], "FinalTab"))
                {
                    mvOrderConfirm.SetActiveView(ViewOrderConfirmationFinal);
                    StepSuccess.OrderID = OrderConfirmationService.OrderID;
                    OrderConfirmationService.OrderID = 0;
                    return;
                }
            }
            var shoppingCart = ShoppingCartService.CurrentShoppingCart;

            PageData = LoadOrderConfirmationData(CustomerContext.CustomerId);

            if (!shoppingCart.CanOrder && (PageData.OrderConfirmationData.ActiveTab != EnActiveTab.FinalTab))
            {
                Response.Redirect("shoppingcart.aspx");
                return;
            }

            if (PageData.OrderConfirmationData.ActiveTab == EnActiveTab.FinalTab)
            {
                OrderConfirmationService.Delete(CustomerContext.CustomerId);
                LoadOrderConfirmationData(CustomerContext.CustomerId);
            }

            ShowTab(PageData.OrderConfirmationData.ActiveTab);
        }
        /// <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);
        }