예제 #1
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();
        }
 public void init()
 {
     WebServices.DAL.CleanDB cDB = new WebServices.DAL.CleanDB();
     cDB.emptyDB();
     configuration.DB_MODE = testing;
     strldDB = new StoreRoleDictionaryDB(testing);
     li      = new LinkedList <Tuple <int, String, String, String, String> >();//storeId,username,storeRole,addedy,timeadded
     strldDB.Add(Tuple.Create(1, "itamar", "Owner", "yossi", "03/03/2030"));
 }