Ejemplo n.º 1
0
        /// <summary>
        /// Sự kiện onClick
        /// </summary>
        /// <param name="sender"></param>
        public void onClick(VIEW view)
        {
            if (view.getID() == R.layout.CATEGORY_SAMPLES)
            {
                vax = dataManager.findProductFollowCategory(((tabCategorySamples)view.obj).danhMuc.Loai);
                asyncShowProductTask(view.obj);
            }
            else if (view.getID() == R.layout.PRODUCT_SAMPLES)
            {
                showDetailsProducts(view.obj);
            }
            else if (view.getID() == R.layout.TAB_GOOD)
            {
                if (((tabGood)view.obj).isRemove)
                {
                    billManager.deleteBill(((tabGood)view.obj).sanPham);
                }
                updateBill(true);
            }
            else if (view.getID() == R.layout.TAB_ORDER)
            {
                orderChoosedBillList();
            }

            else if (view.getID() == R.id.CHOOSE_TO_BUY_PRODUCT)
            {
                buyChoosedProduct();
            }
            else if (view.getID() == R.id.CHOOSE_HOME_PAGE)
            {
                pageProducts.BringToFront();
            }
            else if (view.getID() == R.id.CONFIRM_INFO_CUSTOMER)
            {
                tabChoosePayMethod.BringToFront();
            }
            else if (view.getID() == R.id.CHOOSE_PAY_METHOD_BUY)
            {
                tabThankyou1.BringToFront();
            }
            else if (view.getID() == R.id.CHOOSE_HOME_PAGE)
            {
                pageProducts.BringToFront();
            }
            else if (view.getID() == R.id.REGISTER_USER)
            {
                formRegister = new frmRegister();
                formRegister.setOnClickListener(this);
                formRegister.Show();
            }
            else if (view.getID() == R.id.REQUEST_LOGIN)
            {
                //Kiểm tra đăng nhập tại đây
                pageLogin pl = (pageLogin)view.obj;
                handleLogin(pl.userName, pl.password);
            }
            else if (view.getID() == R.id.REQUEST_UPDATE_INFO_USER)
            {
                handleUpdateCustomer(((tabInfoUser)view.obj).customer);
            }
            else if (view.getID() == R.id.FILTER_PRICE_LOW_TO_HIGTH)
            {
                showPriceProductLowToHight(view.obj);
            }
            else if (view.getID() == R.id.FILTER_PRICE_HIGH_TO_LOW)
            {
                showPriceProductHightToLow(view.obj);
            }

            //Đoạn này cần xử lý với dữ liệu, tao bắt sự kiện sẵn rồi
            else if (view.getID() == R.id.FILTER_FOLLOW_RATE)
            {
                FilterProduct filterProduct = ((tabFilterProducts)view.obj).filterProduct;
                //Xử lý lọc theo sao tại đây
                int rate = filterProduct.rate;
                showProductFollowRate(view.obj, rate);
            }
            else if (view.getID() == R.id.FILTER_FOLLOW_ABOUT_PRICE)
            {
                FilterProduct filterProduct = ((tabFilterProducts)view.obj).filterProduct;
                //Xử lý lọc theo khoảng giá tại đây
                double from = filterProduct.price1;
                double to   = filterProduct.price2;
                showProductAboutPrice(from + to, from, to);
            }
            else if (view.getID() == R.id.FILTER_FOLLOW_TEXT)
            {
                FilterProduct filterProduct = ((pageProducts)view.obj).filterProduct;
                string        content       = filterProduct.Content;
                //Xử lý lọc theo hàng theo nội dung tìm kiếm tại đây với nôi dung
                //là biến content ở trên
                showProductFollowText(content, content);
            }
            else if (view.getID() == R.id.FILTER_FOLLOW_HOT_PRODUCT)
            {
                //Xử lý lọc theo hàng bán chạy tại đây
            }
            else if (view.getID() == R.id.FILTER_FOLLOW_NEW_PRODUCT)
            {
                //Xử lý lọc theo hàng mới tại đây
            }
            else if (view.getID() == R.id.FILTER_FOLLOW_SALE_PRODUCT)
            {
                //Xử lý lọc theo hàng giảm giá nhiều tại đây
                showProductFollowSale(view.obj);
            }
            else if (view.getID() == R.id.SEARCH_BY_CODE)
            {
                //Xử lý tìm sản phẩm theo mã code với mã
                string stringCode = ((tabInfoUser)view.obj).stringCode;
            }
            else if (view.getID() == R.id.SEARCH_BY_IMAGE_CODE ||
                     view.getID() == R.id.SEARCH_BY_CAMERA_CODE)
            {
                string stringCode = null;
                while (stringCode == null)
                {
                    stringCode = ((tabInfoUser)view.obj).stringCode;
                }

                MessageBox.Show(stringCode);
                //Xử lý tìm sản phẩm theo mã code với mã
                //PictureBox imageCode = ((tabInfoUser)view.obj).imageCode;
            }
        }