Esempio n. 1
0
        private void btnNext_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                int q;
                if (selectedProduct == null)
                {
                    MessageBox.Show("No selection has been made");
                    cmbProducts.Focus();
                    return ;

                }
                if( String.IsNullOrWhiteSpace(txtQuantity.Text))
                {
                    MessageBox.Show("Please specify the quantity");
                    txtQuantity.Focus();
                    return ;
                }
                if(!Int32.TryParse(txtQuantity.Text,out q ))
                {
                    MessageBox.Show("Invalid Quantity");
                    txtQuantity.Focus();
                    return;
                }
                newSales.name = selectedProduct.name;
                newSales.quantity = Convert.ToInt32(txtQuantity.Text);
                newSales.sale_amount = selectedProduct.sale_amount * newSales.quantity;
                    grandTotal += newSales.sale_amount;
                    
                    salesDetail.Add(newSales);
                    grdSale.ItemsSource = salesDetail;
                    newSales = new ProductModel();
                    txtQuantity.Text = null;
                    cmbProducts.SelectedItem = null;
                    selectedProduct = null;
                
            }
            catch
            {

            }
        }
Esempio n. 2
0
        private void cmbProducts_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                selectedProduct = (Products)cmbProducts.SelectedItem;
                newSales =  new ProductModel ();
                txtQuantity.Focus();
            }
            catch
            {

            }
            
            
        }