Esempio n. 1
0
 private void InvCustomerList_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         InvItemList.Focus();
         InvItemList.ShowPopup();
     }
 }
Esempio n. 2
0
        private void InvoiceAddList()
        {
            try
            {
                if (string.IsNullOrEmpty(InvItemList.Text) || string.IsNullOrEmpty(InvQty.Text))
                {
                    MessageBox.Show("Error! Please select an item & enter the quantity");
                    return;
                }
                else
                {
                    //  DataClasses1DataContext db = new DataClasses1DataContext();



                    //this.dispatchInvoingItemsWithStockTableAdapter.Fill(this.dataSet1.DispatchInvoingItemsWithStock, Convert.ToInt32(textBox2.Text));


                    if (InvQty.Text == "0")
                    {
                        MessageBox.Show("Stock of this Item is already 0! Please Check");
                    }
                    else
                    {
                        if (Convert.ToInt32(txtStocks.Text) >= Convert.ToInt32(InvQty.Text))
                        {
                            string getPID     = "";
                            string getCity    = "";
                            string getAddress = "";



                            dataGridView4.Rows.Add(null, InvItemList.EditValue, InvItemList.Text, InvQty.Text, searchLookUpEdit1.Text, txtAmount.Text);
                            invoicinggridSumCalculator();



                            //  }



                            //   }

                            object marketId  = this.InvItemList.Properties.View.GetFocusedRowCellValue("QTY");
                            object rateid    = this.InvItemList.Properties.View.GetFocusedRowCellValue("Rate");
                            object ProductID = this.InvItemList.Properties.View.GetFocusedRowCellValue("ProductID");

                            string gridProduct = ProductID.ToString();
                            string gridrate    = rateid.ToString();

                            for (int j = 0; j < this.dataSet1.DispatchInvoingItemsWithStock.Rows.Count; j++)
                            {
                                string DatatableProduct = this.dataSet1.DispatchInvoingItemsWithStock.Rows[j]["ProductID"].ToString();
                                string datatablerate    = this.dataSet1.DispatchInvoingItemsWithStock.Rows[j]["Rate"].ToString();
                                if (DatatableProduct == gridProduct)
                                {
                                    if (datatablerate == gridrate)
                                    {
                                        this.dataSet1.DispatchInvoingItemsWithStock.Rows[j]["QTY"] = Convert.ToDecimal(marketId) - Convert.ToDecimal(InvQty.Text);
                                        break;
                                    }
                                }
                            }


                            txtStocks.Text         = "";
                            InvItemList.Text       = "";
                            InvQty.Text            = "";
                            searchLookUpEdit1.Text = "";
                            txtAmount.Text         = "";



                            InvItemList.Focus();
                            InvItemList.ShowPopup();
                        }
                        else
                        {
                            MessageBox.Show("You cannot add more then the stock");
                        }
                    }

                    //db.Dispose();
                }
            }
            catch (Exception err)
            {
                MessageBox.Show("Error " + err);
            }
        }