Example #1
0
 public bool ChangeProductInfo(int storeId, int productId, string name, string desc, double price, string category, int amount)
 {
     if (!loggedIn)
     {
         notLoggedInException();
     }
     return(StoreService.ChangeProductInfo(user, storeId, productId, name, desc, price, category, amount));
 }
Example #2
0
 public bool RemoveProductFromStore(int storeId, int productId)
 {
     if (!loggedIn)
     {
         notLoggedInException();
     }
     return(StoreService.RemoveProductFromStore(user, storeId, productId));
 }
Example #3
0
 public int AddProductToStore(int storeId, string name, string desc, double price, string category)
 {
     if (!loggedIn)
     {
         notLoggedInException();
     }
     return(StoreService.AddProductToStore(user, storeId, name, desc, price, category));
 }
Example #4
0
 public bool AddProductToStock(int storeId, int productId, int amount)
 {
     if (!loggedIn)
     {
         notLoggedInException();
     }
     return(StoreService.AddProductToStock(user, storeId, productId, amount));
 }
Example #5
0
 public bool closeStore(int storeID)
 {
     if (!loggedIn)
     {
         notLoggedInException();
     }
     return(StoreService.CloseStore(user, storeID));
 }
Example #6
0
        public int AddStore(string storeName)
        {
            if (!loggedIn)
            {
                notLoggedInException();
            }

            return(StoreService.AddStore(user, storeName));
        }
Example #7
0
        public List <Product> getAllProductsForStore(int storeId)
        {
            Store storeAns = StoreService.GetStore(storeId);

            if (storeAns == null)
            {
                return(new List <Product>());
            }
            else
            {
                return(storeAns.getAllProducst());
            }
        }
Example #8
0
        public string GetStore(int storeId)
        {
            Store storeAnse = StoreService.GetStore(storeId);

            if (storeAnse == null)
            {
                throw new Exception("store not found");
            }
            else
            {
                return(JsonHandler.SerializeObject(storeAnse));
            }
        }
Example #9
0
        public string GetProductInfo(int productId)
        {
            Product ret;

            try
            {
                ret = StoreService.GetProductInfo(productId);
                return(objDynamicJson(ret));
            }
            catch (Exception e)
            {
                return(generateMessageFormatJason(e.Message));
            }
        }
Example #10
0
        public string SearchProducts(string name, string category, string keyword, double startPrice, double endPrice, int productRank, int storeRank)
        {
            List <Product> ret;

            try
            {
                ret = StoreService.SearchProducts(name, category, keyword, startPrice, endPrice, productRank, storeRank);
                return(objDynamicJson(ret));
            }
            catch (Exception e)
            {
                return(generateMessageFormatJason(e.Message));
            }
        }
Example #11
0
        public string GetStore(int storeId)
        {
            Store ret;

            try
            {
                ret = StoreService.GetStore(storeId);
                return(objDynamicJson(ret));
            }
            catch (Exception e)
            {
                return(generateMessageFormatJason(e.Message));
            }
        }
Example #12
0
        public string GetAllOwners(int storeId)
        {
            List <Member> ret;

            try
            {
                ret = StoreService.getAllManagers(storeId);
                return(objDynamicJson(ret));
            }
            catch (Exception e)
            {
                return(generateMessageFormatJason(e.Message));
            }
        }
Example #13
0
        public string GetAllStores()
        {
            List <Store> ret;

            try
            {
                ret = StoreService.GetAllStores();
                return(objDynamicJson(ret));
            }
            catch (Exception e)
            {
                return(generateMessageFormatJason(e.Message));
            }
        }
Example #14
0
        public string AddProductToStock(int storeId, int productId, int amount)
        {
            if (!loggedIn)
            {
                return(notLoggedInError());
            }
            bool ret;

            try
            {
                ret = StoreService.AddProductToStock(user, storeId, productId, amount);
                return(resultJson(ret));
            }
            catch (Exception e)
            {
                return(generateMessageFormatJason(e.Message));
            }
        }
Example #15
0
        public string closeStore(int storeID)
        {
            if (!loggedIn)
            {
                return(notLoggedInError());
            }
            bool ret;

            try
            {
                ret = StoreService.CloseStore(user, storeID);
                return(resultJson(ret));
            }
            catch (Exception e)
            {
                return(generateMessageFormatJason(e.Message));
            }
        }
Example #16
0
        public string RemoveProductFromStore(int storeId, int productId)
        {
            if (!loggedIn)
            {
                return(notLoggedInError());
            }
            bool ret;

            try
            {
                ret = StoreService.RemoveProductFromStore(user, storeId, productId);
                return(resultJson(ret));
            }
            catch (Exception e)
            {
                return(generateMessageFormatJason(e.Message));
            }
        }
Example #17
0
        public string ChangeProductInfo(int storeId, int productId, string name, string desc, double price, string category, int amount)
        {
            if (!loggedIn)
            {
                return(notLoggedInError());
            }
            bool ret;

            try
            {
                ret = StoreService.ChangeProductInfo(user, storeId, productId, name, desc, price, category, amount);
                return(resultJson(ret));
            }
            catch (Exception e)
            {
                return(generateMessageFormatJason(e.Message));
            }
        }
Example #18
0
        public string AddProductToStore(int storeId, string name, string desc, double price, string category)
        {
            if (!loggedIn)
            {
                return(notLoggedInError());
            }
            int ret;

            try
            {
                ret = StoreService.AddProductToStore(user, storeId, name, desc, price, category);
                return(intJson(ret));
            }
            catch (Exception e)
            {
                return(generateMessageFormatJason(e.Message));
            }
        }
Example #19
0
        public string AddStore(string storeName)
        {
            if (!loggedIn)
            {
                return(notLoggedInError());
            }
            int ret;

            try
            {
                ret = StoreService.AddStore(user, storeName);
                return(intJson(ret));
            }
            catch (Exception e)
            {
                return(generateMessageFormatJason(e.Message));
            }
        }
Example #20
0
 public static void openStore(string[] fullcommand)
 {
     if (fullcommand.Length == 3)
     {
         string username  = fullcommand[1];
         string storeName = fullcommand[2];
         try
         {
             User user = getUser(username, users[username]);
             StoreService.AddStore(user, storeName);
             Logger.Log("event", logLevel.INFO, $"Init system: user {username} open the store {storeName}");
         }
         catch (Exception e)
         {
             Logger.Log("error", logLevel.ERROR, $"Init system: open store {e.Data}");
         }
     }
     else
     {
         Logger.Log("error", logLevel.ERROR, "Init system: open store bad input");
     }
 }
Example #21
0
        public string GetAllStores()
        {
            //Store s2 = StoreService.GetStore(2);
            //foreach (Stock st in s2.Stocks)
            //{
            //    int i = st.id;
            //}

            /*
             * List<Store> ls = StoreService.GetAllStores();
             * //jonathan: i just wrote this for debug
             * foreach (Store s in ls)
             * {
             *  foreach (Stock st in s.Stocks)
             *  {
             *      int i = st.id;
             *  }
             * }
             */

            List <Store> ls = StoreService.GetAllStores();

            return(JsonHandler.SerializeObject(ls));
        }
Example #22
0
 public string GetProductInfo(int productId)
 {
     return(JsonHandler.SerializeObject(StoreService.GetProductInfo(productId)));
 }
Example #23
0
 public List <Product> SearchProducts(string name, string category, string keyword, double startPrice, double endPrice, int productRank, int storeRank)
 {
     return(StoreService.SearchProducts(name, category, keyword, startPrice, endPrice, productRank, storeRank));
 }
Example #24
0
 //TODO wolf delete?
 public List <Member> GetAllOwners(int storeId)
 {
     return(StoreService.getAllManagers(storeId));
 }