Ejemplo n.º 1
0
        private void HandleState(string json)
        {
            Opcode opcode = handler.GetOpCode(json);

            switch (opcode)
            {
            case Opcode.LOGIN:
                handler.HandleLogin(json);
                break;

            case Opcode.LOGOUT:
                handler.HandleLogoutToInit(json);
                break;

            case Opcode.REGISTER:
                handler.HandleRegister(json);
                break;

            case Opcode.ALL_STORES:
                handler.HandleGetAllStores(json);
                break;

            case Opcode.PRODUCTS_OF_STORE:
                handler.HandleGetProductsOfStore(json);
                break;

            case Opcode.PROD_INFO:
                handler.HandleGetProductDetails(json);
                break;

            case Opcode.PURCHASE:
                handler.HandlePurchase(json);
                break;

            case Opcode.USER_CART:
                handler.HandleGetCart(json);
                break;

            case Opcode.SEARCH_PROD:
                handler.HandleSearchProduct(json);
                break;

            case Opcode.OPEN_STORE:
                handler.HandleOpenStore(json);
                break;

            case Opcode.BUYER_HISTORY:
                handler.HandleBuyerHistory(json);
                break;

            case Opcode.APPOINT_MANAGER:
                handler.HandleAppointManager(json);
                break;

            case Opcode.APPOINT_OWNER:
                handler.HandleAppointOwner(json);
                break;

            case Opcode.DEMOTE_MANAGER:
                handler.HandleDemoteManager(json);
                break;

            case Opcode.DEMOTE_OWNER:
                handler.HandleDemoteOwner(json);
                break;

            case Opcode.LOGIN_AS_GUEST:
                handler.HandleLoginAsGuest(json);
                break;

            case Opcode.REMOVE_PRODUCT_FROM_CART:
                handler.HandleRemovePoductFromCart(json);
                break;

            case Opcode.UPDATE_DISCOUNT_POLICY:
                handler.HandleUpdateDiscountPolicy(json);
                break;

            case Opcode.UPDATE_PURCHASE_POLICY:
                handler.HandleUpdatePurchasePolicy(json);
                break;

            case Opcode.STORES_OWNED_BY:
                handler.HandleGetStoresOwnedBy(json);
                break;

            case Opcode.GET_ALL_REGISTERED_USERS:
                handler.HandleGetAllRegisteredUsers(json);
                break;

            case Opcode.ADD_PRODUCT_TO_CART:
                handler.HandleAddProductToCart(json);
                break;

            case Opcode.CHANGE_PRODUCT_AMOUNT_CART:
                handler.HandleChangeProductAmountInCart(json);
                break;

            case Opcode.GET_STAFF_OF_STORE:
                handler.HandleGetStaffOfStore(json);
                break;

            case Opcode.GET_AVAILABLE_DISCOUNTS:
                handler.HandleGetAvailableDiscounts(json);
                break;

            case Opcode.ADD_PRODUCT_TO_STORE:
                handler.HandleAddProductToStore(json);
                break;

            case Opcode.REMOVE_PRODUCT_FROM_STORE:
                handler.HandleRemoveProductFromStore(json);
                break;

            case Opcode.UPDATE_PRODUCT_OF_STORE:
                handler.HandleUpdateProductOfStore(json);
                break;

            case Opcode.STORE_HISTORY:
                handler.HandleGetStoreHistory(json);
                break;

            case Opcode.ALL_STORE_HISTORY:
                handler.HandleGetAllStoresHistory(json);
                break;


            case Opcode.ALL_BUYERS_HISTORY:
                handler.HandleGetAllUsersHistory(json);
                break;

            case Opcode.STORE_BY_ID:
                handler.HandleGetStoreById(json);
                break;


            case Opcode.INCREASE_PRODUCT_AMOUNT:
                handler.HandleIncreaseProductAmount(json);
                break;

            case Opcode.DECREASE_PRODUCT_AMOUNT:
                handler.HandleDecreaseProductAmount(json);
                break;

            case Opcode.MAKE_ADMIN:
                handler.HandleMakeAdmin(json);
                break;

            case Opcode.CHANGE_PERMISSIONS:
                handler.HandleChangePermissions(json);
                break;

            default:
                break;
            }
        }