示例#1
0
        //not implemented
        // new Addition for version 2 - need to handle addDiscount function
        // type: 1 for discount on productsInStore, 2 for discount on category, 3 for discount on entire product (in product archive)
        public int addDiscounts(User session, int storeId, List <int> productInStores, int type,
                                int percentage, List <string> categorysOrProductsName, string dueDate, string restrictions)
        {
            if (type == 3)
            {
                return(DiscountsManager.getInstance().addNewDiscounts(type, productInStores, categorysOrProductsName, percentage, dueDate, restrictions));
            }
            Store     s  = StoreManagement.getInstance().getStore(storeId);
            StoreRole sR = StoreRole.getStoreRole(s, session);

            if (sR == null)
            {
                return(-1);
            }
            return(sR.addDiscounts(session, storeId, productInStores, type, percentage, categorysOrProductsName
                                   , dueDate, restrictions));
        }