Exemplo n.º 1
0
 public object GetCustomerCart(ShoppingCart cartObj)
 {
     try
     {
         cartObj.logDetails             = new LogDetails();
         cartObj.logDetails.CreatedDate = _commonBusiness.GetCurrentDateTime();
         List <ShoppingCartViewModel> Locations = Mapper.Map <List <ShoppingCart>, List <ShoppingCartViewModel> >(_cart_WishlistBusiness.GetCustomerShoppingCart(cartObj));
         if (Locations.Count == 0)
         {
             throw new Exception(constants.NoItems);
         }
         return(JsonConvert.SerializeObject(new { Result = true, Records = Locations }));
     }
     catch (Exception ex)
     {
         return(JsonConvert.SerializeObject(new { Result = false, Message = ex.Message }));
     }
 }
Exemplo n.º 2
0
 public string GetCustomerShoppingCart(ShoppingCart cartObj)
 {
     try
     {
         cartObj.logDetails             = new LogDetails();
         cartObj.logDetails.CreatedDate = _commonBusiness.GetCurrentDateTime();
         cartObj.LocationID             = 0;
         List <ShoppingCartViewModel> eventsLogList = Mapper.Map <List <ShoppingCart>, List <ShoppingCartViewModel> >(_cartWishlistBusiness.GetCustomerShoppingCart(cartObj));
         return(JsonConvert.SerializeObject(new { Result = "OK", Records = eventsLogList }));
     }
     catch (Exception ex)
     {
         return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = ex.Message }));
     }
 }
Exemplo n.º 3
0
        public OperationsStatus InsertOrderForApp(Order orderObj)
        {
            OperationsStatus operationsStatusObj = null;

            try
            {
                ShoppingCart cartObj = new ShoppingCart();
                cartObj.CustomerID             = orderObj.CustomerID;
                cartObj.LocationID             = orderObj.shippingLocationID;
                cartObj.logDetails             = new LogDetails();
                cartObj.logDetails.CreatedDate = orderObj.commonObj.CreatedDate;

                List <OrderDetail>  OrderDetaillist = new List <OrderDetail>();
                List <ShoppingCart> cartlist        = null;
                cartlist = _Cart_WishlistBusiness.GetCustomerShoppingCart(cartObj);
                for (int i = 0; i < cartlist.Count; i++)
                {
                    if (cartlist[i].FreeDeliveryYN == true)
                    {
                        cartlist[i].ShippingCharge = 0;
                    }
                }


                foreach (var i in cartlist)
                {
                    OrderDetail orderDetailObj = new OrderDetail();

                    orderDetailObj.ItemID         = i.ItemID;
                    orderDetailObj.ProductID      = i.ProductID;
                    orderDetailObj.ProductSpecXML = i.ProductSpecXML;//check if the value passed is correct
                    orderDetailObj.ItemStatus     = "1";
                    orderDetailObj.Qty            = i.Qty;
                    orderDetailObj.Price          = i.CurrentPrice;
                    orderDetailObj.TaxAmt         = orderDetailObj.TaxAmt;
                    orderDetailObj.DiscountAmt    = i.Discount;
                    orderDetailObj.CartId         = i.ID;//For Cart Status Update
                    if (i.StockAvailableYN == true)
                    {
                        OrderDetaillist.Add(orderDetailObj);
                    }
                    else
                    {
                        _Cart_WishlistBusiness.RemoveProductFromCart(i.ID);//Updating Shopping Cart Status as DisCard.
                    }
                }
                if (OrderDetaillist.Count > 0)
                {
                    orderObj.OrderDetailsList = OrderDetaillist;
                    orderObj.OrderStatus      = "1";
                    orderObj.CurrencyCode     = "QAR";
                    operationsStatusObj       = InsertOrderHeaderForApp(orderObj);
                    if (operationsStatusObj.StatusCode == 1)
                    {
                        if (orderObj.OrderDetailsList != null)
                        {
                            foreach (var i in orderObj.OrderDetailsList)
                            {
                                i.OrderID   = int.Parse(operationsStatusObj.ReturnValues.ToString());
                                i.commonObj = orderObj.commonObj;
                                InsertOrderDetail(i);
                                _Cart_WishlistBusiness.UpdateShoppingCartStatus(i.CartId);//Updating Shopping Cart Status as Purchased.
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(operationsStatusObj);
        }