Пример #1
0
 public StoreManager(UserInfo user, string store, bool[] privileges, StoreOwner owner)
 {
     p0         = privileges[0]; p1 = privileges[1]; p2 = privileges[2]; p3 = privileges[3];
     p4         = privileges[4]; p5 = privileges[5]; p6 = privileges[6];
     this.user  = user;
     this.store = store;
     this.owner = owner.userName;
     userName   = user.GetUserName();
 }
Пример #2
0
        public bool AddStoreManager(string store, UserInfo user, bool[] privileges)
        {
            StoreOwner s = GetOwner(store);

            if (s == null)
            {
                throw new ErrorMessageException("This user isnt a store owner/manager of store [" + store + "]");
            }
            return(s.AddManager(user, privileges));
        }
Пример #3
0
        public bool DeclineOwner(string store, UserInfo user)
        {
            StoreOwner s = GetOwner(store);

            if (s == null)
            {
                throw new ErrorMessageException("This user isnt a store owner/manager of store [" + store + "]");
            }
            return(s.DeclineOwner(user));
        }
Пример #4
0
        public bool RemoveStoreManager(string store, UserInfo user)
        {
            StoreOwner owner = GetOwner(store);

            if (owner == null)
            {
                throw new ErrorMessageException("This user isnt a store owner/manager of store [" + store + "]");
            }
            return(owner.RemoveAppointedManager(user));

            throw new ErrorMessageException("The given user isnt a store manager of store [" + store + "]");
        }
Пример #5
0
        public bool AddProducts(string store, Product product, int amount)
        {
            StoreOwner   owner   = GetOwner(store);
            StoreManager manager = GetManager(store);

            if (owner != null)
            {
                return(owner.AddProducts(product, amount));
            }
            if (manager != null)
            {
                return(manager.AddProducts(product, amount));
            }
            throw new ErrorMessageException("This user isnt a store owner/manager of store [" + store + "]");
        }
Пример #6
0
        public bool RemoveSellingPolicy(string store, int productId)
        {
            StoreOwner   owner   = GetOwner(store);
            StoreManager manager = GetManager(store);

            if (owner != null)
            {
                return(owner.RemoveSellingPolicy(productId));
            }
            if (manager != null)
            {
                return(manager.RemoveSellingPolicy(productId));
            }
            throw new ErrorMessageException("This user isnt a store owner/manager of store [" + store + "]");
        }
Пример #7
0
        public bool AddSellingPolicy(string store, LinkedList <string> policy)
        {
            StoreOwner   owner   = GetOwner(store);
            StoreManager manager = GetManager(store);

            if (owner != null)
            {
                return(owner.AddSellingPolicy(policy));
            }
            if (manager != null)
            {
                return(manager.AddSellingPolicy(policy));
            }
            throw new ErrorMessageException("This user isnt a store owner/manager of store [" + store + "]");
        }
Пример #8
0
        public bool EditProduct(string store, int productId, string name, string category, int price, int amount)
        {
            StoreOwner   owner   = GetOwner(store);
            StoreManager manager = GetManager(store);

            if (owner != null)
            {
                return(owner.EditProduct(productId, name, category, price, amount));
            }
            if (manager != null)
            {
                return(manager.EditProduct(productId, name, category, price, amount));
            }
            throw new ErrorMessageException("This user isnt a store owner/manager of store [" + store + "]");
        }
Пример #9
0
 public StoreOwnersOfStore(StoreOwner owner)
 {
     store       = owner.GetStore();
     storeOwners = new LinkedList <StoreOwner>();
     storeOwners.AddFirst(owner);
 }