Example #1
0
 void Refresh()
 {
     cname.Enabled = true;
     //cname.Items.Clear();
     cPackingStock.Items.Clear();
     //cPackingStock.Text = "";
     //pname.Items.Clear();
     //pname.Text = "";
     rent.Text       = "";
     GrandTotal.Text = "0.0";
     GrandTax.Text   = "0.0";
     Paid.Text       = "0.0";
     cnic.Items.Clear();
     CAddress.Text = "";
     Status.Text   = "";
     unpaid.Clear();
     Type.Clear();
     UnitPrice.Clear();
     Area.Text    = "0";
     RenedBy.Text = "0";
     PID.Text     = "id";
     CID.Text     = "id";
     Qty.Text     = "0";
     listView1.Items.Clear();
 }
Example #2
0
        private void pname_SelectedValueChanged(object sender, EventArgs e)
        {
            if (cname.SelectedItem == null)
            {
                MessageBox.Show("Please Select Customer First!");
                return;
            }
            cname.Enabled = false;
            Type.Clear();
            UnitPrice.Clear();
            rent.Clear();
            cPackingStock.Items.Clear();
            string strSQL = "select packname from productname where productname='" + pname.SelectedItem.ToString() + "'";

            using (OleDbConnection connection = new OleDbConnection(connectionString))
            {
                OleDbCommand command = new OleDbCommand(strSQL, connection);
                try
                {
                    connection.Open();
                    using (OleDbDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            cPackingStock.Items.Add(reader[0].ToString());
                        }

                        if (reader.HasRows)
                        {
                            cPackingStock.SelectedIndex = 0;
                        }
                        if (cPackingStock.Items.Count == 1)
                        {
                            cname.Enabled = false;
                            Type.Clear();
                            UnitPrice.Clear();
                            rent.Clear();
                            if (pname.SelectedItem != null)
                            {
                                GetProd(pname.SelectedItem.ToString(), cPackingStock.SelectedItem.ToString());
                                GetStock(pname.SelectedItem.ToString(), cPackingStock.SelectedItem.ToString());
                            }
                        }
                    }
                    connection.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            if (cPackingStock.SelectedItem != null)
            {
                GetProd(pname.SelectedItem.ToString(), cPackingStock.SelectedItem.ToString());
                GetStock(pname.SelectedItem.ToString(), cPackingStock.SelectedItem.ToString());
            }
        }
Example #3
0
 private void cPackingStock_SelectedValueChanged(object sender, EventArgs e)
 {
     cname.Enabled = false;
     Type.Clear();
     UnitPrice.Clear();
     rent.Clear();
     if (pname.SelectedItem != null)
     {
         GetProd(pname.SelectedItem.ToString(), cPackingStock.SelectedItem.ToString());
         GetStock(pname.SelectedItem.ToString(), cPackingStock.SelectedItem.ToString());
     }
 }