Example #1
0
        public void removeAllManagers_test()
        {
            try
            {
                Init();
                //create one owner
                StoreManager storeManagerFirstOwner = storeOwner.getStoreManagerOb(store);
                storeManagerFirstOwner.CreateNewManager(storeOwner2, ownerRoles);
                storeManagerFirstOwner.CreateNewManager(storeManager, ownerRoles);
                //create one manager sub the new owner
                StoreManager storeManagerSecondOwner = storeOwner2.getStoreManagerOb(store);
                try
                {
                    storeManagerSecondOwner.CreateNewManager(storeManager2, ownerRoles);
                    Assert.IsTrue(false);
                } catch (Exception ex)
                {
                    Assert.IsTrue(true);
                }
                //delete the owner see if he and is sub are removed

                storeManagerFirstOwner.removeAllManagers();


                //Assert.IsTrue(storeManagerSecondOwner.subManagers.Count == 0);
                //Assert.IsTrue(storeManagerFirstOwner.subManagers.Count == 0);
            }
            finally
            {
                Cealup();
            }
        }
Example #2
0
        public bool makeStoreOwner(string username, Roles role, int StoreID)
        {
            Store        store        = GetStore(StoreID);
            StoreManager myStoreRoles = getStoreManagerOb(store);
            Member       candidate    = ConnectionStubTemp.getMember(username);

            if (candidate.isStoresManagers())
            {
                try
                {
                    candidate.GetStore(StoreID);
                }
                catch (WorkShopDbException dbExc)
                {
                    throw dbExc;
                }
                catch (Exception ex)
                {
                    myStoreRoles.CreateNewManager(candidate, role);
                }
            }
            else
            {
                myStoreRoles.CreateNewManager(candidate, role);
            }
            StoreManager candidateStoreManager = candidate.getStoreManagerOb(store);

            candidateStoreManager.SetStoreOwnerTrue();
            ConnectionStubTemp.Update(ConnectionStubTemp.getMember(username));//shira
            return(true);
        }
Example #3
0
        public void CreateNewManager_test()
        {
            StoreManager storeManagerFirstOwner = storeOwner.getStoreManagerOb(store);

            storeManagerFirstOwner.CreateNewManager(someMember, ownerRoles);

            Assert.IsTrue(someMember.getStoreManagerRoles(store).isStoreOwner());
            Assert.IsTrue(someMember.getStoreManagerOb(store).GetFather().GetStore().Id == storeId);
        }
Example #4
0
        public bool addManager(string username, Roles role, int StoreID)
        {
            Store        store        = GetStore(StoreID);
            StoreManager myStoreRoles = getStoreManagerOb(store);
            bool         ret          = myStoreRoles.CreateNewManager(ConnectionStubTemp.getMember(username), role);

            ConnectionStubTemp.Update(ConnectionStubTemp.getMember(username));
            return(ret);
        }
Example #5
0
        public void CreateNewManager_test()
        {
            try
            {
                Init();
                StoreManager storeManagerFirstOwner = storeOwner.getStoreManagerOb(store);
                storeManagerFirstOwner.CreateNewManager(storeOwner2, ownerRoles);

                Assert.IsTrue(storeManagerFirstOwner.isStoreOwner());
                Assert.IsTrue(storeOwner2.getStoreManagerOb(store).GetFather().GetStore().id == storeId);
            }
            finally
            {
                Cealup();
            }
        }
Example #6
0
        public bool addManager(string username, Roles role, Store store)
        {
            StoreManager myStoreRoles = getStoreManagerOb(store);

            return(myStoreRoles.CreateNewManager(ConnectionStubTemp.getMember(username), role));
        }