public void editProduct()
        {
            frmProductDetail ProductDetail = new frmProductDetail(true, this);

            ProductDetail.setUpdateState(true);
            if (bool.Parse(form.getStatusProduct().Text))
            {
                ProductDetail.getRadioButtonTrue().Checked = true;
            }
            else
            {
                ProductDetail.getRadioButtonFalse().Checked = true;
            }
            ProductDetail.getPrice().Text                     = form.getPriceProduct().Text;
            ProductDetail.getProductName().Text               = form.getNameProduct().Text;
            ProductDetail.getQuantity().Text                  = form.getQuantityProduct().Text;
            ProductDetail.getComboBoxCategory().DataSource    = bindingSourceCategory;
            ProductDetail.getComboBoxCategory().DisplayMember = "name";
            ProductDetail.getComboBoxCategory().ValueMember   = "idCategory";
            DataTable dataTableCategory  = (DataTable)bindingSourceCategory.DataSource;
            var       selectedIdCategory = "";

            foreach (DataRow row in dataTableCategory.Rows)
            {
                if (row["name"].ToString().Equals(form.getCategoryProduct().Text))
                {
                    selectedIdCategory = row["idCategory"].ToString();
                }
            }
            ProductDetail.getComboBoxCategory().SelectedValue = selectedIdCategory;
            ProductDetail.ShowDialog();
        }
        public void addProduct()
        {
            frmProductDetail ProductDetail = new frmProductDetail(true, this);

            ProductDetail.setUpdateState(false);
            ProductDetail.getComboBoxCategory().DataSource    = bindingSourceCategory;
            ProductDetail.getComboBoxCategory().DisplayMember = "name";
            ProductDetail.getComboBoxCategory().ValueMember   = "idCategory";
            ProductDetail.getRadioButtonTrue().Checked        = true;
            ProductDetail.getRadioButtonFalse().Visible       = false;
            ProductDetail.ShowDialog();
        }
        public void saveProduct(frmProductDetail frmProductDetail)
        {
            if (!validateProduct(frmProductDetail))
            {
                return;
            }
            TblProductsDTO tblProductsDTO = new TblProductsDTO();

            tblProductsDTO.price      = float.Parse(frmProductDetail.getPrice().Text);
            tblProductsDTO.name       = frmProductDetail.getProductName().Text;
            tblProductsDTO.quantity   = int.Parse(frmProductDetail.getQuantity().Text);
            tblProductsDTO.idCategory = frmProductDetail.getComboBoxCategory().SelectedValue.ToString();
            if (frmProductDetail.getRadioButtonFalse().Checked)
            {
                tblProductsDTO.status = false;
            }
            else
            {
                tblProductsDTO.status = true;
            }
            if (!frmProductDetail.getUpdateState())
            {
                if (productModel.addProduct(tblProductsDTO))
                {
                    MessageBox.Show(MessageUtil.SAVE_SUCCESS);
                    getAllProduct();
                }
                else
                {
                    MessageBox.Show(MessageUtil.ERROR + " save Product");
                }
            }
            else
            {
                tblProductsDTO.idProduct = form.getIdProduct().Text;
                if (productModel.updateProduct(tblProductsDTO))
                {
                    MessageBox.Show(MessageUtil.SAVE_SUCCESS);
                    getAllProduct();
                }
                else
                {
                    MessageBox.Show(MessageUtil.ERROR + " save Product");
                }
            }
        }