Пример #1
0
        private void InitiateOrder(int systemId, string userName, string userAddress, string userCreditCard)
        {
            var userService = EnterController.GetUserSession(systemId);

            orderService = MarketYard.Instance.GetOrderService(ref userService);
            answer       = orderService.GiveDetails(userName, userAddress, userCreditCard);
        }
Пример #2
0
        public IActionResult RemovePolicy(int systemId, string state, string type, string subject)
        {
            var adminService = MarketYard.Instance.GetSystemAdminService(EnterController.GetUserSession(systemId));
            var answer       = adminService.RemovePolicy(type, subject);

            return(RedirectToAction("PurchasePolicyPage", new { systemId, state, message = answer.Answer, valid = answer.Status == Success }));
        }
Пример #3
0
        public IActionResult EditProductPage(int systemId, string state, string message, string store, string product)
        {
            var userService            = EnterController.GetUserSession(systemId);
            var storeManagementService = MarketYard.Instance.GetStoreManagementService(userService, store);
            var answer = storeManagementService.GetProductInfo(product);

            return(View(new ProductInfoModel(systemId, state, message, store, product, answer.ReportList[0])));
        }
Пример #4
0
        public IActionResult RemovePolicy(int systemId, string state, string store, string type, string subject, string optProd)
        {
            var userService            = EnterController.GetUserSession(systemId);
            var storeManagementService = MarketYard.Instance.GetStoreManagementService(userService, store);
            var answer = storeManagementService.RemovePolicy(type, subject, optProd);

            return(RedirectToAction("StorePurchasePolicyPage", new { systemId, state, message = answer.Answer, valid = answer.Status == Success, store }));
        }
Пример #5
0
        public IActionResult EditCategoryDiscountPage(int systemId, string state, string message, string store)
        {
            var userService          = EnterController.GetUserSession(systemId);
            var storeShoppingService = MarketYard.Instance.GetStoreShoppingService(ref userService);

            string[] categories = storeShoppingService.GetAllDiscountCategoriesInStore(store).ReportList;
            return(View(new CategoryStorelistModel(systemId, state, message, store, categories)));
        }
Пример #6
0
        public IActionResult SearchProductView(int systemId, string state, string message)
        {
            var userService          = EnterController.GetUserSession(systemId);
            var storeShoppingService = MarketYard.Instance.GetStoreShoppingService(ref userService);

            string[] categories = storeShoppingService.GetAllCategoryNames().ReportList;
            return(View(new CategoryListModel(systemId, state, message, categories)));
        }
Пример #7
0
        public IActionResult HandlingCategoryView(int systemId, string state, string message, bool valid)
        {
            var          adminService = MarketYard.Instance.GetSystemAdminService(EnterController.GetUserSession(systemId));
            MarketAnswer answer       = adminService.ViewAllCategories();

            categoryList = answer.ReportList;
            return(View(new CategoryListModel(systemId, state, message, answer.ReportList, valid)));
        }
Пример #8
0
        public IActionResult RemoveCartItem(int systemId, string state, string store, string product, double unitPrice)
        {
            var userService = EnterController.GetUserSession(systemId);
            var answer      = userService.RemoveFromCart(store, product, unitPrice);
            var message     = answer.Status == 0 ? null : answer.Answer;

            return(RedirectToAction("CartManagement", new { systemId, state, message }));
        }
Пример #9
0
        public IActionResult RemovingProductCategoryPage(int systemId, string state, string message, string store, string product, bool valid)
        {
            ViewBag.valid = valid;
            var userService          = EnterController.GetUserSession(systemId);
            var storeShoppingService = MarketYard.Instance.GetStoreShoppingService(ref userService);

            string[] categories = storeShoppingService.GetAllCategoryNames().ReportList;
            return(View(new ProductInStoreCategoriesModel(systemId, state, message, store, product, categories)));
        }
Пример #10
0
        public IActionResult AddQuanitityToProduct(int systemId, string state, string store, string product, int quantity)

        {
            var userService            = EnterController.GetUserSession(systemId);
            var storeManagementService = MarketYard.Instance.GetStoreManagementService(userService, store);
            var answer = storeManagementService.AddQuanitityToProduct(product, quantity);

            return(answer.Status == Success?
                   RedirectToAction("ManageProducts", new { systemId, state, message = answer.Answer, store }) :
                       RedirectToAction("StoreControl", new { systemId, state, message = answer.Answer }));
        }
Пример #11
0
        public IActionResult EditProduct(int systemId, string state, string store, string product, string productNewName,
                                         string basePrice, string description)
        {
            var userService            = EnterController.GetUserSession(systemId);
            var storeManagementService = MarketYard.Instance.GetStoreManagementService(userService, store);
            var answer = storeManagementService.EditProduct(product, productNewName, basePrice, description);

            return(answer.Status == Success?
                   RedirectToAction("ManageProducts", new { systemId, state, message = answer.Answer, store }) :
                       RedirectToAction("EditProductPage", new { systemId, state, message = answer.Answer, store, product }));
        }
Пример #12
0
        public IActionResult RemoveCategory(int systemId, string state, string category)
        {
            var adminService = MarketYard.Instance.GetSystemAdminService(EnterController.GetUserSession(systemId));
            var answer       = adminService.RemoveCategory(category);

            if (answer.Status == Success)
            {
                return(RedirectToAction("HandlingCategoryView", new { systemId, state, message = answer.Answer, valid = true }));
            }
            return(RedirectToAction("HandlingCategoryView", new { systemId, state, message = answer.Answer, valid = false }));
        }
Пример #13
0
        public IActionResult RemoveCategoryDiscount(int systemId, string state, string store, string categoryName)
        {
            var userService            = EnterController.GetUserSession(systemId);
            var storeManagementService = MarketYard.Instance.GetStoreManagementService(userService, store);
            var answer = storeManagementService.RemoveCategoryDiscount(categoryName);

            if (answer.Status != Success)
            {
                return(RedirectToAction("RemoveCategoryDiscountPage", new { systemId, state, message = answer.Answer, store, valid = false }));
            }
            return(RedirectToAction("CategoryDiscountMenu", new { systemId, state, message = answer.Answer, store, valid = true }));
        }
Пример #14
0
        public IActionResult RemoveCategoryProduct(int systemId, string state, string store, string product, string category)
        {
            var userService            = EnterController.GetUserSession(systemId);
            var storeManagementService = MarketYard.Instance.GetStoreManagementService(userService, store);
            var answer = storeManagementService.RemoveProductFromCategory(category, product);

            if (answer.Status == Success)
            {
                return(RedirectToAction("RemovingProductCategoryPage", new { systemId, state, message = answer.Answer, store, product, valid = true }));
            }
            return(RedirectToAction("RemovingProductCategoryPage", new { systemId, state, message = answer.Answer, store, product, valid = false }));
        }
Пример #15
0
        public IActionResult SearchProduct(int systemId, string state, string value, double minPrice, double maxPrice, string category)
        {
            var userService          = EnterController.GetUserSession(systemId);
            var storeShoppingService = MarketYard.Instance.GetStoreShoppingService(ref userService);
            var answer = storeShoppingService.SearchProduct(value, minPrice, maxPrice, category);

            if (answer.Status == 0)
            {
                return(RedirectToAction("ProductsView", new { systemId, state, results = answer.ReportList }));
            }
            return(RedirectToAction("SearchProductView", new { systemId, state, message = answer.Answer, results = answer.ReportList }));
        }
Пример #16
0
        public IActionResult RemoveDiscount(int systemId, string state, string store, string product)
        {
            var userService            = EnterController.GetUserSession(systemId);
            var storeManagementService = MarketYard.Instance.GetStoreManagementService(userService, store);
            var answer = storeManagementService.RemoveDiscountFromProduct(product);

            if (answer.Status != Success)
            {
                return(RedirectToAction("DeclareDiscountPolicy", new { systemId, state, message = answer.Answer, store, product, valid = false }));
            }
            return(RedirectToAction("DeclareDiscountPolicy", new { systemId, state, message = answer.Answer, store, product, valid = true }));
        }
Пример #17
0
        public IActionResult RemoveProduct(int systemId, string state, string store, string product)
        {
            var userService            = EnterController.GetUserSession(systemId);
            var storeManagementService = MarketYard.Instance.GetStoreManagementService(userService, store);
            var answer = storeManagementService.RemoveProduct(product);

            if (answer.Status == Success)
            {
                return(RedirectToAction("ManageProducts", new { systemId, state, store }));
            }

            return(RedirectToAction("StoreControl", new { systemId, state, message = answer.Answer }));
        }
Пример #18
0
        public IActionResult ToRemoveUser(int systemId, string state, string toDeleteName)
        {
            var adminService = MarketYard.Instance.GetSystemAdminService(EnterController.GetUserSession(systemId));
            var answer       = adminService.RemoveUser(toDeleteName);

            return(RedirectToAction("RemoveUserView", new
            {
                systemId,
                state,
                message = answer.Answer,
                valid = answer.Status == Success
            }));
        }
Пример #19
0
        public IActionResult ViewErrors(int systemId, string state)
        {
            var adminService = MarketYard.Instance.GetSystemAdminService(EnterController.GetUserSession(systemId));
            var answer       = adminService.ViewError();

            if (answer.Status == Success)
            {
                return(View(new ErrorLogModel(systemId, state, answer.ReportList)));
            }

            return(RedirectToAction("MainLobby", "Home",
                                    new { systemId, state, message = answer.Answer }));
        }
Пример #20
0
        public IActionResult ManageProducts(int systemId, string state, string message, string store)
        {
            var userService          = EnterController.GetUserSession(systemId);
            var storeShoppingService = MarketYard.Instance.GetStoreShoppingService(ref userService);
            var answer = storeShoppingService.ViewStoreStockAll(store);

            if (answer.Status == Success)
            {
                return(View(new StorePorductListModel(systemId, state, message, store, answer.ReportList)));
            }

            return(RedirectToAction("StoreControl", new { systemId, state, message = answer.Answer }));
        }
Пример #21
0
        public IActionResult ViewPromotionHistory(int systemId, string state, string store)
        {
            var userService            = EnterController.GetUserSession(systemId);
            var storeManagementService = MarketYard.Instance.GetStoreManagementService(userService, store);
            var answer = storeManagementService.ViewPromotionHistory();

            if (answer.Status == Success)
            {
                return(View(new PromotionHistoryModel(systemId, state, store, answer.ReportList)));
            }

            return(RedirectToAction("StoreControl", new { systemId, state, message = answer.Answer }));
        }
Пример #22
0
        public IActionResult ViewStoreStock(int systemId, string state, string store, bool valid, string message)
        {
            var userService          = EnterController.GetUserSession(systemId);
            var storeShoppingService = MarketYard.Instance.GetStoreShoppingService(ref userService);
            var answer = storeShoppingService.ViewStoreStock(store);

            ViewBag.valid = valid;
            if (answer.Status == 0)
            {
                return(View(new StorePorductListModel(systemId, state, message, store, answer.ReportList)));
            }
            return(RedirectToAction("BrowseMarket", new { systemId, state, answer.Answer }));
        }
Пример #23
0
        public IActionResult SubmitSignUp(int systemId, string usernameEntry, string addressEntry,
                                          string passwordEntry, string creditCardEntry)
        {
            var userService = EnterController.GetUserSession(systemId);
            var answer      = userService.SignUp(usernameEntry, addressEntry, passwordEntry, creditCardEntry);

            if (answer.Status == Success)
            {
                return(RedirectToAction("MainLobby", new { systemId, state = "Registered", message = answer.Answer }));
            }

            return(RedirectToAction("SignUp", new { systemId, state = "Guest", message = answer.Answer }));
        }
Пример #24
0
        public IActionResult OpenStore(int systemId, string state, string storeName, string storeAddress)
        {
            var userService          = EnterController.GetUserSession(systemId);
            var storeShoppingService = MarketYard.Instance.GetStoreShoppingService(ref userService);
            var answer = storeShoppingService.OpenStore(storeName, storeAddress);

            if (answer.Status == Success)
            {
                return(RedirectToAction("StoreControl", new { systemId, state, message = answer.Answer, valid = true }));
            }

            return(RedirectToAction("OpenStoreView", new { systemId, state, message = answer.Answer }));
        }
Пример #25
0
        public IActionResult ChartsView(int systemId, string state)
        {
            var    adminService = MarketYard.Instance.GetSystemAdminService(EnterController.GetUserSession(systemId));
            var    answer       = adminService.GetEntranceDetails();
            string message      = null;

            if (answer.Status != Success)
            {
                message = answer.Answer;
            }


            return(View(new UserModel(systemId, state, message)));
        }
Пример #26
0
        public IActionResult ViewStoreInfo(int systemId, string state, string store)
        {
            var userService          = EnterController.GetUserSession(systemId);
            var storeShoppingService = MarketYard.Instance.GetStoreShoppingService(ref userService);
            var answer = storeShoppingService.ViewStoreInfo(store);

            if (answer.Status != 0)
            {
                return(RedirectToAction("BrowseMarket", new { systemId, state, answer.Answer }));
            }
            var storeInfo = "Name : " + answer.ReportList[0] + " Address : " + answer.ReportList[1];

            return(View(new StoreDetailsModel(systemId, state, answer.Answer, storeInfo)));
        }
Пример #27
0
        public IActionResult ManageStore(int systemId, string state, string store, string option)
        {
            var userService = EnterController.GetUserSession(systemId);
            var answer      = userService.GetStoreManagerPolicies(store);

            string[] userPolicies = answer.ReportList;
            if (userPolicies.Contains(option) || userPolicies.Contains("StoreOwner"))
            {
                return(RedirectToAction(SetPermissionNameToActionName(option), new { systemId, state, store }));
            }

            return(RedirectToAction("ManageStoreOptions",
                                    new { systemId, state, message = "The user doesn't have the permission to operate this action!", store }));
        }
Пример #28
0
        public IActionResult AddNewLottery(int systemId, string state, string store, string product, double price,
                                           string description, DateTime startDate, DateTime endDate)
        {
            var userService            = EnterController.GetUserSession(systemId);
            var storeManagementService = MarketYard.Instance.GetStoreManagementService(userService, store);
            var answer = storeManagementService.AddNewLottery(product, price, description, startDate, endDate);

            if (answer.Status == 0)
            {
                return(RedirectToAction("ManageProducts", new { systemId, state, message = answer.Answer, store }));
            }

            return(RedirectToAction("AddNewLotteryPage", new { systemId, state, message = answer.Answer, store }));
        }
Пример #29
0
        public IActionResult EditDiscount(int systemId, string state, string store, string product,
                                          string discountCode, bool isHidden, string startDate, string endDate, string discountAmount, bool isPercentage)
        {
            var userService            = EnterController.GetUserSession(systemId);
            var storeManagementService = MarketYard.Instance.GetStoreManagementService(userService, store);
            var answer = storeManagementService.EditDiscount(product, null, isHidden, startDate, endDate, discountAmount, isPercentage);

            if (answer.Status == Success)
            {
                return(RedirectToAction("DeclareDiscountPolicy", new { systemId, state, message = answer.Answer, store, valid = true }));
            }

            return(RedirectToAction("EditDiscountPage", new { systemId, state, message = answer.Answer, store, product }));
        }
Пример #30
0
        public IActionResult AddCategoryDiscount(int systemId, string state, string store, string categoryName,
                                                 DateTime startDate, DateTime endDate, int discountAmount)
        {
            var userService            = EnterController.GetUserSession(systemId);
            var storeManagementService = MarketYard.Instance.GetStoreManagementService(userService, store);
            var answer = storeManagementService.AddCategoryDiscount(categoryName, startDate, endDate, discountAmount);

            if (answer.Status == Success)
            {
                return(RedirectToAction("CategoryDiscountMenu", new { systemId, state, message = answer.Answer, store, valid = true }));
            }

            return(RedirectToAction("AddCategoryDiscountPage", new { systemId, state, message = answer.Answer, store }));
        }