public void BuildStore()
 {
     marketDbMocker = new Mock <IMarketBackUpDB>();
     MarketException.SetDB(marketDbMocker.Object);
     MarketLog.SetDB(marketDbMocker.Object);
     handler     = new Mock <IStoreDL>();
     userService = new Mock <IUserSeller>();
     slave       = new GetProductInfoSlave("X", userService.Object, handler.Object);
     prod        = new Product("NEWPROD", 150, "desc");
     handler.Setup(x => x.GetStorebyName("X")).Returns(new Store("X", ""));
     handler.Setup(x => x.GetProductByNameFromStore("X", "NEWPROD")).Returns(prod);
     handler.Setup(x => x.IsStoreExistAndActive("X")).Returns(true);
 }
Exemple #2
0
        public void SearchProduct(string value, double minPrice, double maxPrice, string category)
        {
            try
            {
                MarketLog.Log("StoreCenter", "searching for a product!");
                _shopper.ValidateCanBrowseMarket();
                MarketLog.Log("StoreCenter", "User enetred the system!");
                validatePrices(minPrice, maxPrice);
                Product[] products;
                if (value.IsNullOrEmpty())
                {
                    products = _storeLogic.GetAllProducts();
                }

                else
                {
                    Product[]      productsKeyWord  = FindKeyWord(value);
                    Product[]      productsCategory = findProductsCategory(findSimilarCategories(value));
                    List <Product> product          = new List <Product>(productsKeyWord);
                    foreach (Product prod in productsCategory)
                    {
                        product.Add(prod);
                    }

                    products = product.ToArray();
                }

                products = FilterResultsByPrice(products, minPrice, maxPrice);
                products = FilterResultByCategory(products, category);

                Answer = new StoreAnswer(SearchProductStatus.Success, "Data retrieved successfully!", AddStoreToProducts(products));
            }

            catch (StoreException e)
            {
                Answer = new StoreAnswer((SearchProductStatus)e.Status, e.GetErrorMessage());
            }

            catch (DataException e)
            {
                Answer = new StoreAnswer((SearchProductStatus)e.Status, e.GetErrorMessage());
            }

            catch (MarketException)
            {
                MarketLog.Log("StoreCenter", "no premission");
                Answer = new StoreAnswer(SearchProductStatus.DidntEnterSystem,
                                         "User Didn't enter the system!");
            }
        }
Exemple #3
0
        public void MarketBuilder()
        {
            marketDbMocker = new Mock <IMarketBackUpDB>();
            MarketException.SetDB(marketDbMocker.Object);
            MarketLog.SetDB(marketDbMocker.Object);
            admin         = new Mock <IUserAdmin>();
            adminDbMocker = new Mock <IAdminDL>();
            Pair <int, DateTime> p1 = new Pair <int, DateTime>(5555, new DateTime(2018, 06, 13, 0, 0, 0, 0, 0));
            Pair <int, DateTime> p2 = new Pair <int, DateTime>(5566, new DateTime(2018, 06, 12, 0, 0, 0, 0, 0));
            Pair <int, DateTime> p3 = new Pair <int, DateTime>(5666, new DateTime(2018, 06, 12, 0, 0, 0, 0, 0));

            Pair <int, DateTime>[] report = { p1, p2, p3 };
            adminDbMocker.Setup(x => x.GetEntranceReport()).Returns(report);
        }
        public Order InitOrder(OrderItem[] items, string UserName, string UserAddress)
        {
            CheckAllItems(items);
            Order order = new Order(_orderDL.RandomOrderID(), UserName, UserAddress);

            foreach (OrderItem item in items)
            {
                order.AddOrderItem(item);
            }

            MarketLog.Log("OrderPool",
                          "User " + UserName + " successfully initialized new order " + order.GetOrderID() + ".");
            return(order);
        }
 public void MarketBuilder()
 {
     marketDbMocker = new Mock <IMarketBackUpDB>();
     MarketException.SetDB(marketDbMocker.Object);
     MarketLog.SetDB(marketDbMocker.Object);
     userDbMocker = new Mock <IUserDL>();
     guest        = new User(userDbMocker.Object, userID);
     registered   = new RegisteredUser(userDbMocker.Object, userID, "Moshe", "Here 3", "123", "12345678", new CartItem[0],
                                       new StatePolicy[0],
                                       new []
     {
         new StoreManagerPolicy("Store1", StoreManagerPolicy.StoreAction.StoreOwner),
         new StoreManagerPolicy("Store2", StoreManagerPolicy.StoreAction.StoreOwner),
     });
 }
 public void MarketBuilder()
 {
     publisherMock  = new Mock <IPublisher>();
     marketDbMocker = new Mock <IMarketBackUpDB>();
     MarketException.SetDB(marketDbMocker.Object);
     MarketLog.SetDB(marketDbMocker.Object);
     userBuyerMocker = new Mock <IUserBuyer>();
     SupplyService.Instance.FixExternal();
     PaymentService.Instance.FixExternal();
     marketSession      = MarketYard.Instance;
     userServiceSession = (UserService)marketSession.GetUserService();
     userServiceSession.EnterSystem();
     slave = new PurchaseItemSlave(userBuyerMocker.Object, new StoresSyncherHarmony(), OrderDL.Instance, publisherMock.Object, marketSession.GetPolicyChecker());
     InitPolicies();
 }
 public void BuildStore()
 {
     marketDbMocker = new Mock <IMarketBackUpDB>();
     MarketException.SetDB(marketDbMocker.Object);
     MarketLog.SetDB(marketDbMocker.Object);
     handler     = new Mock <IStoreDL>();
     userService = new Mock <IUserSeller>();
     slave       = new EditCategoryDiscountSlave("WWW", userService.Object, handler.Object);
     MarketYard.SetDateTime(new DateTime(2018, 4, 14));
     category = new Category("C0", "BLA");
     handler.Setup(x => x.GetCategoryByName("BLA")).Returns(category);
     categoryDiscount = new CategoryDiscount("d0", "BLA", "WWW", DateTime.Parse("01/01/2019"), DateTime.Parse("20/01/2019"), 10);
     handler.Setup(x => x.GetCategoryDiscount("BLA", "WWW")).Returns(categoryDiscount);
     handler.Setup(x => x.IsStoreExistAndActive("WWW")).Returns(true);
 }
Exemple #8
0
 public void CreateDelivery(Order order)
 {
     if (sock == null)
     {
         throw new SupplyException(SupplyStatus.NoSupplySystem, "Failed, No supply system found.");
     }
     MarketLog.Log("SupplyPoint", "Attempting to create delivery for order ID: " + order.GetOrderID());
     CheckOrderDetails(order);
     if (sock.ProcessDelivery(order.GetOrderID(), order.GetUserName(), order.GetShippingAddress()))
     {
         MarketLog.Log("SupplyPoint", "Delivery for order ID: " + order.GetOrderID() + " was successufully assigned.");
         return;
     }
     throw new SupplyException(SupplyStatus.SupplySystemError, "Failed, an error in the supply system occured.");
 }
Exemple #9
0
        private PolicyType GetPolicyType(string type)
        {
            switch (type)
            {
            case "StockItem":
                return(PolicyType.StockItem);

            case "Store":
                return(PolicyType.Store);

            default:
                MarketLog.Log("StoreCenter", " Removing policy failed, invalid data.");
                throw new StoreException(EditStorePolicyStatus.InvalidPolicyData, "Invalid Policy data");
            }
        }
Exemple #10
0
 public void MarketBuilder()
 {
     marketDbMocker = new Mock <IMarketBackUpDB>();
     MarketException.SetDB(marketDbMocker.Object);
     MarketLog.SetDB(marketDbMocker.Object);
     orderDbMocker    = new Mock <IOrderDL>();
     userBuyerMocker  = new Mock <IUserBuyer>();
     storeSyncherMock = new Mock <IStoresSyncher>();
     publisherMock    = new Mock <IPublisher>();
     policyMock       = new Mock <IPolicyChecker>();
     item1            = new OrderItem("Cluckin Bell", null, "#9", 5.00, 2);
     item2            = new OrderItem("Cluckin Bell", null, "#9 Large", 7.00, 1);
     SupplyService.Instance.FixExternal();
     PaymentService.Instance.FixExternal();
 }
Exemple #11
0
 public void ProccesPayment(Order order, string creditCardetails)
 {
     if (sock == null)
     {
         throw new WalleterException(WalleterStatus.NoPaymentSystem, "Failed, an error in the payment system occured.");
     }
     MarketLog.Log("Walleter", "Attempting to proccess payment for order ID: " + order.GetOrderID());
     CheckCreditCard(creditCardetails);
     if (sock.ProccessPayment(creditCardetails, order.GetPrice()))
     {
         MarketLog.Log("Walleter", "Payment for order ID: " + order.GetOrderID() + " was completed.");
         return;
     }
     throw new WalleterException(WalleterStatus.PaymentSystemError, "Failed, an error in the payment system occured.");
 }
Exemple #12
0
 public void BuildStore()
 {
     marketDbMocker = new Mock <IMarketBackUpDB>();
     MarketException.SetDB(marketDbMocker.Object);
     MarketLog.SetDB(marketDbMocker.Object);
     handler     = new Mock <IStoreDL>();
     userService = new Mock <IUserShopper>();
     MarketYard.SetDateTime(new DateTime(2018, 4, 14));
     prod = new Product("item", 1, "des");
     handler.Setup(x => x.GetStorebyName("X")).Returns(new Store("X", ""));
     handler.Setup(x => x.GetProductByNameFromStore("X", "item")).Returns(prod);
     handler.Setup(x => x.IsStoreExistAndActive("X")).Returns(true);
     handler.Setup(x => x.GetProductFromStore("X", "item")).Returns(new StockListItem(4, prod, null, PurchaseEnum.Immediate, "100"));
     slave = new AddProductToCartSlave(userService.Object, handler.Object);
 }
 private void CheckifQuantityIsOK(int quantity, StockListItem stockListItem)
 {
     MarketLog.Log("StoreCenter", "checking that the required quantity is not too big");
     if (quantity > stockListItem.Quantity)
     {
         MarketLog.Log("StoreCenter", "required quantity is not too big");
         throw new StoreException(StoreEnum.QuantityIsTooBig, "required quantity is not too big");
     }
     MarketLog.Log("StoreCenter", "checking that the required quantity is not negative or zero");
     if (quantity > 0)
     {
         return;
     }
     MarketLog.Log("StoreCenter", "required quantity is negative or zero");
     throw new StoreException(StoreEnum.QuantityIsNegative, "required quantity is negative");
 }
Exemple #14
0
        private Discount CheckIfDiscountExistsPrivateMethod(string productName)
        {
            StockListItem stockListItem = DataLayerInstance.GetProductFromStore(_storeName, productName);

            MarketLog.Log("StoreCenter", " Product exists");
            MarketLog.Log("StoreCenter", "checking that the product has a discount");
            Discount discount = stockListItem.Discount;

            if (discount == null)
            {
                MarketLog.Log("StoreCenter", "product does not exists");
                throw new StoreException(DiscountStatus.DiscountNotFound, "there is no discount at this product");
            }
            MarketLog.Log("StoreCenter", " check what you want to edit");
            return(discount);
        }
Exemple #15
0
 public void Refund(double sum, string creditCardetails, string username)
 {
     if (sock == null)
     {
         throw new WalleterException(WalleterStatus.NoPaymentSystem, "Failed, an error in the payment system occured.");
     }
     MarketLog.Log("Walleter", "Attempting to make a refund for user: "******"Walleter", "Refund for user: "******" was completed !");
         return;
     }
     throw new WalleterException(WalleterStatus.PaymentSystemError, "Failed, an error in the payment system occured.");
 }
Exemple #16
0
 public void BuildStore()
 {
     marketDbMocker = new Mock <IMarketBackUpDB>();
     MarketException.SetDB(marketDbMocker.Object);
     MarketLog.SetDB(marketDbMocker.Object);
     handler     = new Mock <IStoreDL>();
     userService = new Mock <IUserSeller>();
     prod        = new Product("NEWPROD", 150, "desc");
     discount    = new Discount(DiscountTypeEnum.Visible, DateTime.Parse("03/05/2020"), DateTime.Parse("30/06/2020"), 50, true);
     stock       = new StockListItem(10, prod, discount, PurchaseEnum.Immediate, "BLA");
     handler.Setup(x => x.GetStorebyName("X")).Returns(new Store("X", ""));
     handler.Setup(x => x.GetProductByNameFromStore("X", "NEWPROD")).Returns(prod);
     handler.Setup(x => x.IsStoreExistAndActive("X")).Returns(true);
     handler.Setup(x => x.GetProductFromStore("X", "NEWPROD")).Returns(stock);
     slave = new EditDiscountSlave("X", userService.Object, handler.Object);
 }
        public Discount AddDiscountToProduct(string productName, DateTime startDate, DateTime endDate,
                                             int discountAmount, string discountType, bool presenteges)
        {
            try
            {
                MarketLog.Log("StoreCenter", "trying to add discount to product in store");
                MarketLog.Log("StoreCenter", "check if store exists");
                CheckIfStoreExistsAndActiveDiscount();
                MarketLog.Log("StoreCenter", " store exists");
                MarketLog.Log("StoreCenter", " check if has premmision to edit products");
                _storeManager.CanDeclareDiscountPolicy();
                MarketLog.Log("StoreCenter", " has premmission");
                MarketLog.Log("StoreCenter", " check if product name exists in the store " + _storeName);
                Product product = DataLayerInstance.GetProductByNameFromStore(_storeName, productName);
                CheckifProductExistsDiscount(product);
                MarketLog.Log("StoreCenter", "check if dates are OK");
                CheckIfDatesOK(startDate, endDate);
                MarketLog.Log("StoreCenter", "check that discount amount is OK");
                CheckPresentegesAndAmountOK(discountAmount, presenteges, product);
                StockListItem stockListItem = DataLayerInstance.GetProductFromStore(_storeName, product.Name);
                MarketLog.Log("StoreCenter", "check that the product don't have another discount");
                CheckHasNoExistsDiscount(stockListItem);
                Discount discount = new Discount(EnumStringConverter.GetdiscountTypeEnumString(discountType), startDate,
                                                 endDate, discountAmount, presenteges);
                stockListItem.Discount = discount;
                DataLayerInstance.AddDiscount(discount);
                DataLayerInstance.EditStockInDatabase(stockListItem);
                MarketLog.Log("StoreCenter", "discount added successfully");
                string[] coupon = { discount.discountCode };
                answer = new StoreAnswer(DiscountStatus.Success, "discount added successfully", coupon);
                return(discount);
            }
            catch (StoreException exe)
            {
                answer = new StoreAnswer((StoreEnum)exe.Status, exe.GetErrorMessage());
            }
            catch (DataException e)
            {
                answer = new StoreAnswer((StoreEnum)e.Status, e.GetErrorMessage());
            }
            catch (MarketException)
            {
                answer = new StoreAnswer(StoreEnum.NoPermission, "you have no premmision to do that");
            }

            return(null);
        }
Exemple #18
0
        public void MarketBuilder()
        {
            marketDbMocker = new Mock <IMarketBackUpDB>();
            MarketException.SetDB(marketDbMocker.Object);
            MarketLog.SetDB(marketDbMocker.Object);
            userDbMocker = new Mock <IUserDL>();
            userDbMocker.Setup(x => x.LoadUser(It.IsAny <object[]>(), It.IsAny <CartItem[]>()))
            .Returns(new RegisteredUser(userDbMocker.Object, registeredUserID, registeredUserName, registeredUserAddress,
                                        encryptedUserPassword, registeredUserCreditCard, new CartItem[0],
                                        new[] { new StatePolicy(StatePolicy.State.RegisteredUser) }, new StoreManagerPolicy[0]));
            guestUser = new User(userDbMocker.Object, registeredUserID);
            userDbMocker.Setup(x => x.UserNamesInSystem()).Returns(new[] { "MaorLogin" });
            userDbMocker.Setup(x => x.FindRegisteredUserData(registeredUserName, registeredUserPassword))
            .Returns(new object[0]);

            slave = new SignInSlave(guestUser, userDbMocker.Object);
        }
Exemple #19
0
        public void IntegrationFeedTestsBuilder()
        {
            var marketDbMocker = new Mock <IMarketBackUpDB>();

            MarketException.SetDB(marketDbMocker.Object);
            MarketLog.SetDB(marketDbMocker.Object);
            countMessagesToServer = 0;
            serverMocker          = new Mock <IListener>();
            messengerMocker       = new Mock <IMarketMessenger>();
            messengerMocker.Setup(x => x.SendMessage(receiverId1, It.IsAny <string>())).Callback(SendMessageToReceiver1);
            messengerMocker.Setup(x => x.SendMessage(receiverId2, It.IsAny <string>())).Callback(SendMessageToReceiver2);
            serverMocker.Setup(x => x.GetMessage(receiverId1.ToString(), "You have got new message pending in your mailbox!"))
            .Callback(SendMessageToServer);
            serverMocker.Setup(x => x.GetMessage(receiverId2.ToString(), "You have got new message pending in your mailbox!"))
            .Callback(SendMessageToServer);
            MarketDB.Instance.InsertByForce();
        }
Exemple #20
0
 public void MarketBuilder()
 {
     publisherMock  = new Mock <IPublisher>();
     marketDbMocker = new Mock <IMarketBackUpDB>();
     MarketException.SetDB(marketDbMocker.Object);
     MarketLog.SetDB(marketDbMocker.Object);
     orderDbMocker    = new Mock <IOrderDL>();
     userBuyerMocker  = new Mock <IUserBuyer>();
     storeSyncherMock = new Mock <IStoresSyncher>();
     checkerMock      = new Mock <IPolicyChecker>();
     checkerMock.Setup(x => x.CheckRelevantPolicies(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <List <string> >(),
                                                    It.IsAny <string>(),
                                                    It.IsAny <string>(), It.IsAny <int>(), It.IsAny <double>())).Returns(true);
     item = new OrderItem("Cluckin Bell", null, "#9 Large", 7.00, 1);
     SupplyService.Instance.FixExternal();
     PaymentService.Instance.FixExternal();
 }
Exemple #21
0
 public void MarketBuilder()
 {
     marketDbMocker    = new Mock <IMarketBackUpDB>();
     publisherMocker   = new Mock <IPublisher>();
     counterQueueAdded = 0;
     publisherMocker.Setup(x => x.AddFeedQueue(It.IsAny <int>())).Callback(addQueueCheck);
     MarketException.SetDB(marketDbMocker.Object);
     MarketLog.SetDB(marketDbMocker.Object);
     userDbMocker = new Mock <IUserDL>();
     userDbMocker.Setup(x => x.RegisterUser(It.IsAny <int>(), It.IsAny <string>(),
                                            It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <CartItem[]>()))
     .Returns(new RegisteredUser(userDbMocker.Object, registeredUserID, registeredUserName, registeredUserAddress,
                                 encryptedUserPassword, registeredUserCreditCard, new CartItem[0]));
     userDbMocker.Setup(x => x.IsUserNameExist(It.IsAny <string>())).Returns(false);
     guestUser = new User(userDbMocker.Object, registeredUserID);
     slave     = new SignUpSlave(guestUser, userDbMocker.Object, publisherMocker.Object);
 }
 public void ViewStores()
 {
     try
     {
         MarketLog.Log("UserSpot", "User " + userID + " attempting to view all store names...");
         ApproveEnetered();
         var storeNames = _userDB.GetAllActiveStoreNames();
         Answer = new UserAnswer(ViewStoresStatus.Success, "you've got all the store names!", storeNames);
     }
     catch (UserException)
     {
         Answer = new UserAnswer(ViewStoresStatus.NoPermission, "The operation didn't succeed!");
     }
     catch (DataException e)
     {
         Answer = new UserAnswer((GetControlledStoresStatus)e.Status, e.GetErrorMessage());
     }
 }
        public void BuildStore()
        {
            marketDbMocker = new Mock <IMarketBackUpDB>();
            MarketException.SetDB(marketDbMocker.Object);
            MarketLog.SetDB(marketDbMocker.Object);
            handler     = new Mock <IStoreDL>();
            userService = new Mock <IUserSeller>();
            slave       = new ChangeProductPurchaseWayToLotterySlave("X", userService.Object, handler.Object);
            MarketYard.SetDateTime(new DateTime(2018, 4, 14));
            prod = new Product("item", 1, "des");
            Discount discount = new Discount(DiscountTypeEnum.Visible, DateTime.Parse("03/05/2020"), DateTime.Parse("30/06/2020"), 50, false);

            stock = new StockListItem(10, prod, discount, PurchaseEnum.Immediate, "BLA");
            handler.Setup(x => x.GetStorebyName("X")).Returns(new Store("X", ""));
            handler.Setup(x => x.GetProductByNameFromStore("X", "item")).Returns(prod);
            handler.Setup(x => x.IsStoreExistAndActive("X")).Returns(true);
            handler.Setup(x => x.GetProductFromStore("X", "item")).Returns(stock);
        }
Exemple #24
0
        private OperatorType GetOperand(string op)
        {
            switch (op)
            {
            case "AND":
                return(OperatorType.AND);

            case "OR":
                return(OperatorType.OR);

            case "NOT":
                return(OperatorType.NOT);

            default:
                MarketLog.Log("StoreCenter", " Adding policy failed, invalid data.");
                throw new StoreException(EditStorePolicyStatus.InvalidPolicyData, "Invalid Policy data");
            }
        }
Exemple #25
0
 public void ViewPurchaseHistoryByStore(string storeName)
 {
     try
     {
         MarketLog.Log("AdminView", "System Admin " + adminSystemID +
                       " attempting to view purchase history of Store " + storeName + " ...");
         ValidateStoreNameExistInPurchaseHistory(storeName);
         ViewPurchaseHistory("Store", storeName);
     }
     catch (AdminException e)
     {
         Answer = new AdminAnswer((ViewPurchaseHistoryStatus)e.Status, e.GetErrorMessage(), null);
     }
     catch (DataException e)
     {
         Answer = new AdminAnswer((ViewPurchaseHistoryStatus)e.Status, e.GetErrorMessage(), null);
     }
 }
Exemple #26
0
        private PolicyType GetPolicyType(string type)
        {
            switch (type)
            {
            case "Global":
                return(PolicyType.Global);

            case "Product":
                return(PolicyType.Product);

            case "Category":
                return(PolicyType.Category);

            default:
                MarketLog.Log("AdminView", " Removing policy failed, invalid data.");
                throw new AdminException(EditPolicyStatus.InvalidPolicyData, "Invalid Policy data");
            }
        }
 private static void CheckPresentegesAndAmountOK(int discountAmount, bool presenteges, Product product)
 {
     if (presenteges && (discountAmount >= 100))
     {
         MarketLog.Log("StoreCenter", "discount amount is >=100%");
         throw new StoreException(DiscountStatus.AmountIsHundredAndpresenteges, "DiscountAmount is >= 100%");
     }
     if (!presenteges && (discountAmount > product.BasePrice))
     {
         MarketLog.Log("StoreCenter", "discount amount is >= product price");
         throw new StoreException(DiscountStatus.DiscountGreaterThenProductPrice, "DiscountAmount is > then product price");
     }
     if (discountAmount <= 0)
     {
         MarketLog.Log("StoreCenter", "discount amount <=0");
         throw new StoreException(DiscountStatus.DiscountAmountIsNegativeOrZero, "DiscountAmount is >= 100%");
     }
 }
        public void BuildStore()
        {
            marketDbMocker = new Mock <IMarketBackUpDB>();
            MarketException.SetDB(marketDbMocker.Object);
            MarketLog.SetDB(marketDbMocker.Object);
            handler     = new Mock <IStoreDL>();
            userService = new Mock <IUserShopper>();
            handler.Setup(x => x.GetStorebyName("X")).Returns(new Store("X", ""));
            handler.Setup(x => x.IsStoreExistAndActive("X")).Returns(true);
            ids = new []
            {
                "S-4"
            };
            handler.Setup(x => x.GetAllStoreProductsID("S-4")).Returns(ids);


            slave = new ViewStoreStockSlave(userService.Object, handler.Object);
        }
Exemple #29
0
 public void SaveFullPolicy()
 {
     try
     {
         MarketLog.Log("StoreCenter", "Checking store manager status.");
         _storeManager.CanDeclarePurchasePolicy();
         _manager.AddPolicy(_manager.GetSessionPolicies().Length - 1);
         MarketLog.Log("StoreCenter", "Policy saved.");
         Answer = new StoreAnswer(EditStorePolicyStatus.Success, "Policy saved.");
     }
     catch (StoreException e)
     {
         Answer = new StoreAnswer((EditStorePolicyStatus)e.Status, e.GetErrorMessage());
     }
     catch (MarketException e)
     {
         Answer = new StoreAnswer(EditStorePolicyStatus.NoAuthority, e.GetErrorMessage());
     }
 }
Exemple #30
0
 public void ViewCart()
 {
     try
     {
         MarketLog.Log("UserSpot", "User " + userID + " attempting to view his cart...");
         ApproveEnetered();
         MarketLog.Log("UserSpot", "User " + userID + " has successfully retrieved his cart info...");
         Answer = new UserAnswer(ViewCartStatus.Success, "View of the user's cart has been granted successfully!",
                                 _user.Cart.GetCartStorageToString());
     }
     catch (UserException e)
     {
         Answer = new UserAnswer((ViewCartStatus)e.Status, e.GetErrorMessage(), null);
     }
     catch (DataException e)
     {
         Answer = new UserAnswer((ViewCartStatus)e.Status, e.GetErrorMessage(), null);
     }
 }