Example #1
0
        //############################################ Product Change Index event ############################//
        private void comboProduct_SelectedIndexChanged_1(object sender, EventArgs e)
        {
            if (comboProduct.Text == "Cotton Oil" || comboProduct.Text == "Cotton Dirty")
            {
                frmCottonOil frm = new frmCottonOil();
                frm.ShowDialog();

            }

            if (comboProduct.Text == "Cotton Cake")
            {
                string sql = "select * from CottonCake_tb";
                reader = db.selectQuery(sql);
                if (reader.Read())
                {
                    txtRate.Text = reader[1].ToString();
                }
                db.ConnectionClose();
            }
        }
Example #2
0
 private void GetRecord(Int32 VocNo)
 {
     frmCottonOil frm = new frmCottonOil();
     SqlDataReader redr;
     try
     {
         string sql = "select * from OilSales where OilID=" + VocNo + "";
         redr = db.selectQuery(sql);
         if (redr.Read())
         {
             frm.txtInvoiceId.Text = redr["OilID"].ToString();
             frm.dpInvoice.Value = Convert.ToDateTime(redr["InvoiceDate"]);
             frm.txtCusID.Text = redr["CusID"].ToString();
             frm.comboCusName.Text = redr["CustomerName"].ToString();
             frm.comboProduct.Text = redr["ProductName"].ToString();
             frm.txtRate.Text = redr["Rate"].ToString();
             frm.txtWeight.Text = redr["Weight"].ToString();
             frm.txtOilTotalAmount.Text = redr["Amount"].ToString();
             frm.txtCommission.Text = redr["OilCommision"].ToString();
             frm.txtAmount.Text = redr["TotalAmount"].ToString();
             frm.txtOilPayment.Text = redr["Payment"].ToString();
             frm.txtDuepayment.Text = redr["DuePayment"].ToString();
         }
         else
         {
             MessageBox.Show("Record not Found !!!", "Record Found Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         redr.Close();
         // db.ConnectionClose();
         frm.btnUpdate.Enabled = true;
         frm.btnDelete.Enabled = true;
         frm.btnSave.Enabled = false;
         frm.ShowDialog();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }