Beispiel #1
0
 private void UpdateProduct_button_Click(object sender, EventArgs e)
 {
     try
     {
         if (!string.IsNullOrWhiteSpace(ProductId_textBox.Text) && !string.IsNullOrWhiteSpace(ProductName_textBox.Text) &&
             !string.IsNullOrWhiteSpace(Quantity_Textbox.Text) && !string.IsNullOrWhiteSpace(RetailPrice_Textbox.Text) &&
             !string.IsNullOrWhiteSpace(WholesalePrice_Textbox.Text) && !string.IsNullOrWhiteSpace(CreditPrice_Textbox.Text) &&
             !string.IsNullOrWhiteSpace(BuyingPrice_Textbox.Text) &&
             GST_ComboBox.SelectedItem != null && !string.IsNullOrWhiteSpace(GST_ComboBox.SelectedItem.ToString()))
         {
             selectedGst = Convert.ToInt32(GST_ComboBox.SelectedItem);
             CreateProgressInstance();
             progressBar.worker.DoWork             += UpdateProductDetails;
             progressBar.worker.RunWorkerCompleted += UpdateProcductDetailsCompleted;
             progressBar.worker.RunWorkerAsync();
         }
         else
         {
             MessageBox.Show(Constants.ENTER_ALL_TEXTFIELD_MESSAGE);
             ProductName_textBox.Focus();
         }
     }
     catch (Exception ex)
     {
         this.Invoke((System.Action)(() => { progressBar.Close(); }), null);
         MessageBox.Show(ex.StackTrace.ToString(), "Error Occured at AddStockPage", MessageBoxButtons.OK);
     }
 }
Beispiel #2
0
        private void UpdateProcductDetailsCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            bool isCashierUpdatedConformation = (bool)e.Result;

            if (isCashierUpdatedConformation)
            {
                AllProduct_ListView.Items.Clear();
                LoadAllProductDetails(sender, null);
                AddProductDetailsToListView(sender, e);
                EnableDisableFormControls();
                MessageBox.Show(Constants.PRODUCT_DETAILS_UPDATED);
            }
            else
            {
                this.Invoke((System.Action)(() => { progressBar.Close(); }), null);
                MessageBox.Show(Constants.PRODUCT_DETAILS_UPDATE_ERROR_MESSAGE);
                ProductName_textBox.Focus();
            }
        }