public void AddStore()
 {
     try
     {
         Store toAdd = new Store(2, "apply", itamar);
         storeDB.Add(toAdd);
         li = storeDB.Get();
         Assert.AreEqual(li.Count, 2);
     }
     catch (Exception e)
     { Assert.AreEqual(true, false, "there was a connection error to the testing db"); }
 }
Beispiel #2
0
        private StoreManagement()
        {
            SDB     = new StoreDB(configuration.DB_MODE);
            SRDDB   = new StoreRoleDictionaryDB(configuration.DB_MODE);
            stores  = SDB.Get();
            archive = new Dictionary <int, Dictionary <String, StoreRole> >();
            LinkedList <Tuple <int, String, String, String, String> > temp = SRDDB.Get();

            foreach (Tuple <int, String, String, String, String> t in temp)
            {
                StoreRole sr = null;
                if (t.Item3 == "Manager")
                {
                    sr = new StoreManager(UserManager.getInstance().getUser(t.Item2), getStore(t.Item1), t.Item4, t.Item5);
                }
                else if (t.Item3 == "Owner")
                {
                    sr = new StoreOwner(UserManager.getInstance().getUser(t.Item2), getStore(t.Item1), t.Item4, t.Item5);
                }
                else if (t.Item3 == "Customer")
                {
                    sr = new Customer(UserManager.getInstance().getUser(t.Item2), getStore(t.Item1), "customer");
                }
                try
                {
                    archive.Add(t.Item1, new Dictionary <String, StoreRole>());
                    archive[t.Item1].Add(t.Item2, sr);
                }
                catch (Exception) {
                    archive[t.Item1].Add(t.Item2, sr);
                };
            }

            storeIndex = currIndex();
        }
Beispiel #3
0
        public int currIndex()
        {
            LinkedList <Store> temp = SDB.Get();
            int index = 0;

            foreach (Store s in temp)
            {
                if (s.getStoreId() > index)
                {
                    index = s.getStoreId();
                }
            }
            return(index);
        }