Exemple #1
0
        public Model.ShopCart.Order.OrderInfo.Result GetCheckoutStatus(int invoiceId, out int?lastOrderId)
        {
            var blOrder = new BLOrder();

            lastOrderId = blOrder.GetLastOrder(invoiceId);

            if (lastOrderId == null)
            {
                return(null);
            }

            var lastOrderInfo = GetOrderInfo(lastOrderId.Value);


            if (lastOrderInfo.Order != null && (lastOrderInfo.Order.Status.ToLower() == "confirmed" || lastOrderInfo.Order.Status.ToLower() == "fulfilled"))
            {
                return(lastOrderInfo);
            }

            return(null);
        }
Exemple #2
0
        public Model.ShopCart.Checkout.Result HandelCheckout(List <VmTeamSelection> teamSelectionList, string advisorUserId)
        {
            var productCode = 0;

            var blInvoice = new BLInvoice();

            var invoiceList = blInvoice.GetInvoiceFullInfoByUserId(advisorUserId, false);

            var newShopOrder = CreateOrder();

            if (newShopOrder.Error == "0")
            {
                var blProduct   = new BLProduct();
                var productList = new List <VmProduct>();

                var blOrder = new BLOrder();

                var newOrder = new VmOrder()
                {
                    InvoiceId   = invoiceList.Id,
                    OrderDate   = DateTime.Now,
                    ShopOrderId = int.Parse(newShopOrder.Order.Id),
                    UserId      = advisorUserId,
                    Complete    = false
                };

                blOrder.CreateOrder(newOrder);

                foreach (var item in invoiceList.InvoiceDetails)
                {
                    if (item.IsChecked)
                    {
                        productCode = ProductDictionary[item.PaymentRuleId + item.FirstTeamOrExtraTeam].Id;
                        productList.Add(new VmProduct
                        {
                            Amount        = 1,
                            ShopOrderId   = int.Parse(newShopOrder.Order.Id),
                            ShopProductId = productCode
                        });

                        var orderInfo = AddProduct(newShopOrder.Order.Id, productCode.ToString());
                        if (orderInfo.Error != "0")
                        {
                            return(null);
                        }

                        if (item.ExtraParticipantCount > 0)
                        {
                            productCode = ProductDictionary["ExtraParticipant"].Id;

                            orderInfo = AddProduct(newShopOrder.Order.Id, productCode.ToString(), item.ExtraParticipantCount);

                            if (orderInfo.Error != "0")
                            {
                                return(null);
                            }
                            else
                            {
                                productList.Add(new VmProduct
                                {
                                    Amount        = item.ExtraParticipantCount,
                                    ShopOrderId   = int.Parse(newShopOrder.Order.Id),
                                    ShopProductId = productCode
                                });
                            }
                        }
                    }
                }

                blProduct.CreateBatchProduct(productList);

                return(PrepareCheckout(int.Parse(newShopOrder.Order.Id)));
            }

            return(null);
        }