コード例 #1
0
ファイル: AdminTest.cs プロジェクト: shaybenh7/workshop182v3
        public void init()
        {
            WebServices.DAL.CleanDB cDB = new WebServices.DAL.CleanDB();
            cDB.emptyDB();
            ProductManager.restartInstance();
            SalesManager.restartInstance();
            StoreManagement.restartInstance();
            UserManager.restartInstance();
            UserCartsManager.restartInstance();
            BuyHistoryManager.restartInstance();
            CouponsManager.restartInstance();
            DiscountsManager.restartInstance();
            RaffleSalesManager.restartInstance();
            StorePremissionsArchive.restartInstance();
            admin = new User("admin", "123456");
            admin.register("admin", "123456");
            admin.login("admin", "123456");

            admin1 = new User("admin1", "123456");
            admin1.register("admin1", "123456");

            zahi = new User("zahi", "123456");
            zahi.register("zahi", "123456");

            itamar = new User("itamar", "123456");
            itamar.register("itamar", "123456");
            itamar.login("itamar", "123456");
            int storeId = itamar.createStore("Maria&Netta Inc.");

            store = StoreManagement.getInstance().getStore(storeId);
            niv   = new User("niv", "123456");
            niv.register("niv", "123456");
        }
コード例 #2
0
        public void init()
        {
            CleanDB cDB = new CleanDB();

            cDB.emptyDB();
            ProductManager.restartInstance();
            SalesManager.restartInstance();
            StoreManagement.restartInstance();
            UserManager.restartInstance();
            UserCartsManager.restartInstance();
            BuyHistoryManager.restartInstance();
            CouponsManager.restartInstance();
            DiscountsManager.restartInstance();
            RaffleSalesManager.restartInstance();
            StorePremissionsArchive.restartInstance();
            us   = userServices.getInstance();
            ss   = storeServices.getInstance();
            ses  = sellServices.getInstance();
            zahi = us.startSession();
            us.register(zahi, "zahi", "123456");
            us.login(zahi, "zahi", "123456");
            admin = us.startSession();
            us.register(admin, "admin", "123456");
            us.login(admin, "admin", "123456");
        }
コード例 #3
0
        public void init()
        {
            CleanDB cDB = new CleanDB();

            cDB.emptyDB();
            ProductManager.restartInstance();
            SalesManager.restartInstance();
            StoreManagement.restartInstance();
            UserManager.restartInstance();
            UserCartsManager.restartInstance();
            BuyHistoryManager.restartInstance();
            CouponsManager.restartInstance();
            DiscountsManager.restartInstance();
            RaffleSalesManager.restartInstance();
            StorePremissionsArchive.restartInstance();
            us   = userServices.getInstance();
            ss   = storeServices.getInstance();
            zahi = us.startSession();
            us.register(zahi, "zahi", "123456");
            us.login(zahi, "zahi", "123456");
            int storeid = ss.createStore("abowim", zahi);

            store = StoreManagement.getInstance().getStore(storeid);
            int c = ss.addProductInStore("cola", 3.2, 10, zahi, storeid, "Drinks");

            cola = ProductManager.getInstance().getProductInStore(c);
        }
コード例 #4
0
        public void init()
        {
            WebServices.DAL.CleanDB cDB = new WebServices.DAL.CleanDB();
            cDB.emptyDB();
            configuration.DB_MODE = "Testing";
            ProductManager.restartInstance();
            SalesManager.restartInstance();
            StoreManagement.restartInstance();
            UserManager.restartInstance();
            UserCartsManager.restartInstance();
            BuyHistoryManager.restartInstance();
            CouponsManager.restartInstance();
            DiscountsManager.restartInstance();
            RaffleSalesManager.restartInstance();
            StorePremissionsArchive.restartInstance();

            shippingProxy = new ShippingProxy();

            us    = userServices.getInstance();
            ss    = storeServices.getInstance();
            sellS = sellServices.getInstance();

            admin = us.startSession();
            us.register(admin, "admin", "123456");
            us.login(admin, "admin", "123456");

            admin1 = us.startSession();
            us.register(admin1, "admin1", "123456");

            zahi = us.startSession();
            us.register(zahi, "zahi", "123456");

            itamar = us.startSession();
            us.register(itamar, "itamar", "123456");
            us.login(itamar, "itamar", "123456");
            int storeId = ss.createStore("Maria&Netta Inc.", itamar);

            store = StoreManagement.getInstance().getStore(storeId);

            niv = us.startSession();
            us.register(niv, "niv", "123456");
            us.login(niv, "niv", "123456");

            ss.addStoreManager(storeId, "niv", itamar);

            int colaId = ss.addProductInStore("cola", 3.2, 10, itamar, storeId, "Drinks");

            cola = ProductManager.getInstance().getProductInStore(colaId);
            int spriteId = ss.addProductInStore("sprite", 5.2, 100, itamar, storeId, "Drinks");

            sprite = ProductManager.getInstance().getProductInStore(spriteId);
            ss.addSaleToStore(itamar, storeId, cola.getProductInStoreId(), 1, 10, DateTime.Now.AddMonths(10).ToString());
        }
コード例 #5
0
        public void init()
        {
            CleanDB cDB = new CleanDB();

            cDB.emptyDB();
            ProductManager.restartInstance();
            SalesManager.restartInstance();
            StoreManagement.restartInstance();
            UserManager.restartInstance();
            UserCartsManager.restartInstance();
            BuyHistoryManager.restartInstance();
            CouponsManager.restartInstance();
            DiscountsManager.restartInstance();
            RaffleSalesManager.restartInstance();
            StorePremissionsArchive.restartInstance();

            us    = userServices.getInstance();
            ss    = storeServices.getInstance();
            admin = us.startSession();
            us.register(admin, "admin", "123456");
            us.login(admin, "admin", "123456");

            admin1 = us.startSession();
            us.register(admin1, "admin1", "123456");

            zahi = us.startSession();
            us.register(zahi, "zahi", "123456");
            us.login(zahi, "zahi", "123456");

            itamar = us.startSession();
            us.register(itamar, "itamar", "123456");
            us.login(itamar, "itamar", "123456");



            int storeid = ss.createStore("MariaNettaInc", itamar);

            store = StoreManagement.getInstance().getStore(storeid);

            niv = us.startSession();
            us.register(niv, "niv", "123456");
            us.login(niv, "niv", "123456");

            ss.addStoreManager(store.getStoreId(), "niv", itamar);

            int c = ss.addProductInStore("cola", 3.2, 10, itamar, storeid, "Drinks");
            int s = ss.addProductInStore("sprite", 5.3, 20, itamar, storeid, "Drinks");

            cola       = ProductManager.getInstance().getProductInStore(c);
            sprite     = ProductManager.getInstance().getProductInStore(s);
            saleId     = ss.addSaleToStore(itamar, store.getStoreId(), cola.getProductInStoreId(), 1, 1, "20.5.2018");
            raffleSale = ss.addSaleToStore(itamar, store.getStoreId(), cola.getProductInStoreId(), 3, 1, "20.5.2018");
        }
コード例 #6
0
        public void init()
        {
            CleanDB cDB = new CleanDB();

            cDB.emptyDB();
            ProductManager.restartInstance();
            SalesManager.restartInstance();
            StoreManagement.restartInstance();
            UserManager.restartInstance();
            UserCartsManager.restartInstance();
            StorePremissionsArchive.restartInstance();

            BuyHistoryManager.restartInstance();
            CouponsManager.restartInstance();
            DiscountsManager.restartInstance();
            RaffleSalesManager.restartInstance();
            StorePremissionsArchive.restartInstance();
            us   = userServices.getInstance();
            zahi = us.startSession();
            us.register(zahi, "zahi", "123456");
            us.login(zahi, "zahi", "123456");
            aviad = us.startSession();
            us.register(aviad, "aviad", "123456");
            us.login(aviad, "aviad", "123456");
            shay = us.startSession();
            us.register(shay, "shay", "123456");
            us.login(shay, "shay", "123456");
            itamar = new User("itamar", "123456");
            niv    = us.startSession();
            us.register(niv, "niv", "123456");
            ss    = storeServices.getInstance();
            store = StoreManagement.getInstance().getStore(ss.createStore("abowim", zahi));
            ss.addStoreManager(store.getStoreId(), "aviad", zahi);
            niv.logOut();
            //ADD ALL PERMISSIONS
            ss.addManagerPermission("addProductInStore", store.getStoreId(), "aviad", zahi);
            ss.addManagerPermission("editProductInStore", store.getStoreId(), "aviad", zahi);
            ss.addManagerPermission("removeProductFromStore", store.getStoreId(), "aviad", zahi);
            ss.addManagerPermission("addStoreManager", store.getStoreId(), aviad.getUserName(), zahi);
            ss.addManagerPermission("removeStoreManager", store.getStoreId(), aviad.getUserName(), zahi);
            ss.addManagerPermission("addManagerPermission", store.getStoreId(), aviad.getUserName(), zahi);
            ss.addManagerPermission("removeManagerPermission", store.getStoreId(), aviad.getUserName(), zahi);
            ss.addManagerPermission("addSaleToStore", store.getStoreId(), aviad.getUserName(), zahi);
            ss.addManagerPermission("removeSaleFromStore", store.getStoreId(), aviad.getUserName(), zahi);
            ss.addManagerPermission("editSale", store.getStoreId(), aviad.getUserName(), zahi);
            ss.addManagerPermission("addDiscount", store.getStoreId(), aviad.getUserName(), zahi);
            ss.addManagerPermission("removeDiscount", store.getStoreId(), aviad.getUserName(), zahi);
            ss.addManagerPermission("addNewCoupon", store.getStoreId(), aviad.getUserName(), zahi);
            ss.addManagerPermission("removeCoupon", store.getStoreId(), aviad.getUserName(), zahi);
        }
コード例 #7
0
        public void init()
        {
            WebServices.DAL.CleanDB cDB = new WebServices.DAL.CleanDB();
            cDB.emptyDB();
            ProductManager.restartInstance();
            SalesManager.restartInstance();
            StoreManagement.restartInstance();
            UserManager.restartInstance();
            UserCartsManager.restartInstance();
            BuyHistoryManager.restartInstance();
            CouponsManager.restartInstance();
            DiscountsManager.restartInstance();
            RaffleSalesManager.restartInstance();
            StorePremissionsArchive.restartInstance();

            us    = userServices.getInstance();
            ss    = storeServices.getInstance();
            sellS = sellServices.getInstance();

            admin = us.startSession();
            us.register(admin, "admin", "123456");
            us.login(admin, "admin", "123456");

            admin1 = us.startSession();
            us.register(admin1, "admin1", "123456");

            zahi = us.startSession();
            us.register(zahi, "zahi", "123456");
            us.login(zahi, "zahi", "123456");
            store2 = ss.createStore("Darkness Inc.", zahi);

            itamar = us.startSession();
            us.register(itamar, "itamar", "123456");
            us.login(itamar, "itamar", "123456");
            store = ss.createStore("Maria&Netta Inc.", itamar);

            niv = us.startSession();
            us.register(niv, "niv", "123456");
            us.login(niv, "niv", "123456");

            ss.addStoreManager(store, "niv", itamar);

            cola    = ss.addProductInStore("cola", 3.2, 10, itamar, store, "drinks");
            sprite  = ss.addProductInStore("sprite", 5.3, 20, itamar, store, "drinks");
            chicken = ss.addProductInStore("chicken", 50, 20, zahi, store2, "drinks");
            cow     = ss.addProductInStore("cow", 80, 40, zahi, store2, "food");
            saleId1 = ss.addSaleToStore(itamar, store, cola, 1, 5, "20/5/2018");
            saleId2 = ss.addSaleToStore(zahi, store2, chicken, 1, 15, "20/7/2019");
        }
コード例 #8
0
 public void init()
 {
     ProductManager.restartInstance();
     SalesManager.restartInstance();
     StoreManagement.restartInstance();
     UserManager.restartInstance();
     UserCartsManager.restartInstance();
     BuyHistoryManager.restartInstance();
     CouponsManager.restartInstance();
     DiscountsManager.restartInstance();
     RaffleSalesManager.restartInstance();
     StorePremissionsArchive.restartInstance();
     PurchasePolicyManager.restartInstance();
     NotificationManager.restartInstance();
 }
コード例 #9
0
 public void init()
 {
     WebServices.DAL.CleanDB cDB = new WebServices.DAL.CleanDB();
     cDB.emptyDB();
     ProductManager.restartInstance();
     SalesManager.restartInstance();
     StoreManagement.restartInstance();
     UserManager.restartInstance();
     UserCartsManager.restartInstance();
     BuyHistoryManager.restartInstance();
     CouponsManager.restartInstance();
     DiscountsManager.restartInstance();
     RaffleSalesManager.restartInstance();
     StorePremissionsArchive.restartInstance();
 }
コード例 #10
0
        public void init()
        {
            CleanDB cDB = new CleanDB();

            cDB.emptyDB();
            ProductManager.restartInstance();
            SalesManager.restartInstance();
            StoreManagement.restartInstance();
            UserManager.restartInstance();
            UserCartsManager.restartInstance();
            BuyHistoryManager.restartInstance();
            CouponsManager.restartInstance();
            DiscountsManager.restartInstance();
            RaffleSalesManager.restartInstance();
            StorePremissionsArchive.restartInstance();

            us  = userServices.getInstance();
            ss  = storeServices.getInstance();
            ses = sellServices.getInstance();

            zahi = us.startSession();
            us.register(zahi, "zahi", "123456");
            us.login(zahi, "zahi", "123456");
            itamar = us.startSession();
            us.register(itamar, "itamar", "123456");
            us.login(itamar, "itamar", "123456");

            int storeid = ss.createStore("abowim", zahi);

            store = StoreManagement.getInstance().getStore(storeid);

            int colaId = ss.addProductInStore("cola", 10, 100, zahi, storeid, "Drinks");

            cola = ProductManager.getInstance().getProductInStore(colaId);

            ss.addSaleToStore(zahi, store.getStoreId(), cola.getProductInStoreId(), 1, 20, "20/8/2018");

            LinkedList <Sale> SL = ss.viewSalesByStore(store.getStoreId());

            foreach (Sale sale in SL)
            {
                if (sale.ProductInStoreId == cola.getProductInStoreId())
                {
                    colaSale = sale;
                }
            }
        }
コード例 #11
0
 public void init()
 {
     //              ARCHIVE INIT
     WebServices.DAL.CleanDB cDB = new WebServices.DAL.CleanDB();
     cDB.emptyDB();
     PurchasePolicyManager.restartInstance();
     SalesManager.restartInstance();
     DiscountsManager.restartInstance();
     CouponsManager.restartInstance();
     StoreManagement.restartInstance();
     UserManager.restartInstance();
     ProductManager.restartInstance();
     UserCartsManager.restartInstance();
     purchasePolicyArchive = PurchasePolicyManager.getInstance();
     salesArchive          = SalesManager.getInstance();
     discountsArchive      = DiscountsManager.getInstance();
     couponsArchive        = CouponsManager.getInstance();
     productArchive        = ProductManager.getInstance();
     StoreManagement       = StoreManagement.getInstance();
     userArchive           = UserManager.getInstance();
     //              USERS INIT
     admin = new User("admin", "123456");
     admin.register("admin", "123456");
     admin.login("admin", "123456");
     storeOwner = new User("owner", "123456");
     storeOwner.register("owner", "123456");
     storeOwner.login("owner", "123456");
     itamar = new User("itamar", "123456");
     itamar.register("itamar", "123456");
     itamar.login("itamar", "123456");
     shay = new User("shay", "123456");
     shay.register("shay", "123456");
     shay.login("shay", "123456");
     //             PRODUCTS INIT
     cola   = productArchive.addProduct("cola");
     sprite = productArchive.addProduct("sprite");
     //             STORES AND PRODUCTS IN STORES
     store         = StoreManagement.addStore("samsung", storeOwner);
     colaInStore   = productArchive.addProductInStore(cola, store, 200, 500, "cola category");
     spriteInStore = productArchive.addProductInStore(sprite, store, 100, 200, "sprite category");
     //             SALES INIT
     colaRegularSale  = salesArchive.addSale(colaInStore.getProductInStoreId(), regularSale, 50, DateTime.Now.AddDays(10).ToString());
     spriteRaffleSale = salesArchive.addSale(spriteInStore.getProductInStoreId(), raffleSale, 3, DateTime.Now.AddDays(20).ToString());
 }
コード例 #12
0
        public void init()
        {
            WebServices.DAL.CleanDB cDB = new WebServices.DAL.CleanDB();
            cDB.emptyDB();
            ProductManager.restartInstance();
            SalesManager.restartInstance();
            StoreManagement.restartInstance();
            UserManager.restartInstance();
            UserCartsManager.restartInstance();
            BuyHistoryManager.restartInstance();
            CouponsManager.restartInstance();
            DiscountsManager.restartInstance();
            RaffleSalesManager.restartInstance();
            StorePremissionsArchive.restartInstance();

            us   = userServices.getInstance();
            ss   = storeServices.getInstance();
            sell = sellServices.getInstance();

            admin = us.startSession();
            us.register(admin, "admin", "123456");
            us.login(admin, "admin", "123456");

            admin1 = us.startSession();
            us.register(admin1, "admin1", "123456");

            zahi = us.startSession();
            us.register(zahi, "zahi", "123456");

            itamar = us.startSession();
            us.register(itamar, "itamar", "123456");
            us.login(itamar, "itamar", "123456");
            store = ss.createStore("Maria&Netta Inc.", itamar);

            niv = us.startSession();
            us.register(niv, "niv", "123456");
            us.login(niv, "niv", "123456");

            ss.addStoreManager(store, "niv", itamar);

            cola       = ss.addProductInStore("cola", 3.2, 10, itamar, store, "drinks");
            saleId     = ss.addSaleToStore(itamar, store, cola, 1, 1, "20.5.2018");
            raffleSale = ss.addSaleToStore(itamar, store, cola, 3, 1, "20.5.2018");
        }
コード例 #13
0
        public void init()
        {
            WebServices.DAL.CleanDB cDB = new WebServices.DAL.CleanDB();
            cDB.emptyDB();
            ProductManager.restartInstance();
            SalesManager.restartInstance();
            StoreManagement.restartInstance();
            UserManager.restartInstance();
            UserCartsManager.restartInstance();
            StorePremissionsArchive.restartInstance();

            BuyHistoryManager.restartInstance();
            CouponsManager.restartInstance();
            DiscountsManager.restartInstance();
            RaffleSalesManager.restartInstance();
            StorePremissionsArchive.restartInstance();
            zahi = new User("zahi", "123456");
            zahi.register("zahi", "123456");
            zahi.login("zahi", "123456");
            aviad = new User("aviad", "123456");
            aviad.register("aviad", "123456");
            aviad.login("aviad", "123456");
            shay = new User("shay", "123456");
            shay.register("shay", "123456");
            shay.login("shay", "123456");
            itamar = new User("itamar", "123456");
            niv    = new User("niv", "123456");
            niv.register("niv", "123456");
            int storeId = zahi.createStore("abowim");

            store = StoreManagement.getInstance().getStore(storeId);
            int storeId2 = zahi.createStore("broes");

            store2    = StoreManagement.getInstance().getStore(storeId2);
            zahiOwner = new StoreOwner(zahi, store);

            aviadManeger = new StoreManager(aviad, store);
            zahiOwner.addStoreManager(zahi, store, "aviad");
            niv.logOut();
            int colaId = zahiOwner.addProductInStore(zahi, store, "cola", 3.2, 40, "Drinks");

            cola = ProductManager.getInstance().getProductInStore(colaId);
        }
コード例 #14
0
        public void init()
        {
            WebServices.DAL.CleanDB cDB = new WebServices.DAL.CleanDB();
            cDB.emptyDB();
            ProductManager.restartInstance();
            SalesManager.restartInstance();
            StoreManagement.restartInstance();
            UserManager.restartInstance();
            UserCartsManager.restartInstance();
            BuyHistoryManager.restartInstance();
            CouponsManager.restartInstance();
            DiscountsManager.restartInstance();
            RaffleSalesManager.restartInstance();
            StorePremissionsArchive.restartInstance();
            us = userServices.getInstance();
            ss = storeServices.getInstance();

            partislav = us.startSession();
            us.register(partislav, "partislav", "123456");
            us.login(partislav, "partislav", "123456");

            manager1 = us.startSession();
            us.register(manager1, "manager1", "123456");
            us.login(manager1, "manager1", "123456");

            manager2 = us.startSession();
            us.register(manager2, "manager2", "123456");
            us.login(manager2, "manager2", "123456");

            int sId  = ss.createStore("makolet", partislav);
            int s2Id = ss.createStore("makolet", partislav);

            s  = StoreManagement.getInstance().getStore(sId);
            s2 = StoreManagement.getInstance().getStore(s2Id);

            ownerRole  = StoreRole.getStoreRole(s, partislav);
            ownerRole2 = StoreRole.getStoreRole(s, partislav);

            ownerRole.addStoreManager(partislav, s, "manager1");
            ownerRole.addStoreManager(partislav, s, "manager2");
            ownerRole.addStoreManager(partislav, s2, "manager1");
            ownerRole.addStoreManager(partislav, s2, "manager2");
        }
コード例 #15
0
        public void init()
        {
            WebServices.DAL.CleanDB cDB = new WebServices.DAL.CleanDB();
            cDB.emptyDB();
            ProductManager.restartInstance();
            SalesManager.restartInstance();
            StoreManagement.restartInstance();
            UserManager.restartInstance();
            UserCartsManager.restartInstance();
            DiscountsManager.restartInstance();
            CouponsManager.restartInstance();
            RaffleSalesManager.restartInstance();
            pA        = ProductManager.getInstance();
            saleA     = SalesManager.getInstance();
            storeA    = StoreManagement.getInstance();
            userA     = UserManager.getInstance();
            userCartA = UserCartsManager.getInstance();
            discountA = DiscountsManager.getInstance();
            couponA   = CouponsManager.getInstance();
            raffleA   = RaffleSalesManager.getInstance();

            p1 = pA.addProduct("Milk");
            p2 = pA.addProduct("Bread");
            p3 = pA.addProduct("T.V");

            zahi  = new User("zahi", "123456");
            aviad = new User("aviad", "123456");
            aviad.register("aviad", "123456");
            zahi.register("zahi", "123456");

            store = storeA.addStore("zahi inc", zahi);

            pis1 = ProductManager.getInstance().addProductInStore(p1, store, 20, 10);
            pis2 = ProductManager.getInstance().addProductInStore(p2, store, 30, 15);
            pis3 = ProductManager.getInstance().addProductInStore(p3, store, 40, 50);

            sale1 = saleA.addSale(pis1.getProductInStoreId(), 1, 10, "1/5/2020");
            sale2 = saleA.addSale(pis2.getProductInStoreId(), 1, 10, "1/5/2020");
            sale3 = saleA.addSale(pis3.getProductInStoreId(), 3, 1, "1/5/2020");

            cart = new ShoppingCart();
        }
コード例 #16
0
        public void init()
        {
            CleanDB cDB = new CleanDB();

            cDB.emptyDB();
            ProductManager.restartInstance();
            SalesManager.restartInstance();
            StoreManagement.restartInstance();
            UserManager.restartInstance();
            UserCartsManager.restartInstance();
            BuyHistoryManager.restartInstance();
            CouponsManager.restartInstance();
            DiscountsManager.restartInstance();
            RaffleSalesManager.restartInstance();
            StorePremissionsArchive.restartInstance();
            us    = userServices.getInstance();
            ss    = storeServices.getInstance();
            admin = us.startSession();
            us.register(admin, "admin", "123456");
            us.login(admin, "admin", "123456");

            admin1 = us.startSession();
            us.register(admin1, "admin1", "123456");

            zahi = us.startSession();
            us.register(zahi, "zahi", "123456");
            zahi.login("zahi", "123456");

            itamar = us.startSession();
            us.register(itamar, "itamar", "123456");
            itamar.login("itamar", "123456");
            store = StoreManagement.getInstance().getStore(itamar.createStore("Maria&Netta Inc."));

            niv = us.startSession();
            us.register(niv, "niv", "123456");
            niv.login("niv", "123456");

            ss.addStoreManager(store.getStoreId(), "niv", itamar);
        }