private void BtnUpdate_Click(object sender, EventArgs e)
 {
     if (index == -1)
     {
         MessageBox.Show("please choose a product by click to it to update", "Warning");
     }
     else
     {
         if (string.IsNullOrEmpty(txtProductName.Text))
         {
             MessageBox.Show("please input name of product", "Warning");
         }
         else if (string.IsNullOrEmpty(txtPricePack.Text))
         {
             MessageBox.Show("please input price export a package to udpate", "Warning");
         }
         else if (!ProDAO.checkFloat(txtPricePack.Text) || float.Parse(txtPricePack.Text) <= 0)
         {
             MessageBox.Show("Price must be a possible number and greater than 0", "Warning");
         }
         else if (string.IsNullOrEmpty(txtPriceSub.Text))
         {
             MessageBox.Show("please input price export a package to udpate", "Warning");
         }
         else if (!ProDAO.checkFloat(txtPriceSub.Text) || float.Parse(txtPriceSub.Text) < 0)
         {
             MessageBox.Show("Price must be a possible number and greater than 0", "Warning");
         }
         else
         {
             bool check = ProDAO.updatePriceExportByID(listPro.ElementAt(index).ProductID, float.Parse(txtPricePack.Text), float.Parse(txtPriceSub.Text), txtProductName.Text, txtDescription.Text);
             if (check)
             {
                 MessageBox.Show("Update successfull", "Notification");
                 listPro = ProDAO.getListProduct();
                 loadData(listPro);
                 index               = -1;
                 txtPricePack.Text   = "";
                 txtPriceSub.Text    = "";
                 txtProductName.Text = "";
                 txtDescription.Text = "";
             }
             else
             {
                 MessageBox.Show("Update fail", "Notification");
                 index               = -1;
                 txtPricePack.Text   = "";
                 txtPriceSub.Text    = "";
                 txtProductName.Text = "";
                 txtDescription.Text = "";
             }
         }
     }
 }
 private void TxtPrice_Validating(object sender, CancelEventArgs e)
 {
     if (string.IsNullOrEmpty(txtPrice.Text))
     {
         e.Cancel = true;
         errorProvider.SetError(txtPrice, "Please input price of one package");
     }
     else if (!ProDAO.checkFloat(txtPrice.Text) || int.Parse(txtPrice.Text) <= 0)
     {
         e.Cancel = true;
         errorProvider.SetError(txtPrice, "Price must be number and greater than 0");
     }
     else
     {
         e.Cancel = false;
         errorProvider.SetError(txtPrice, null);
     }
 }