Exemplo n.º 1
0
        //UPdate Balance
        void UpdateBalance()
        {
            string        updateBillString;
            SqlConnection con;

            selectClass.selectPatDetailsFromBill(txtPatID.Text);
            double PatBills      = selectClass.PatBill;
            double PatCurBalance = PatBills + double.Parse(textBox2.Text);

            // SqlCommand cmd;
            try
            {
                con = new SqlConnection(varinsert.dbPath);
                con.Open();
                updateBillString = "update tblPatientBill set Amts = '" + PatCurBalance + "' where patID = '" + txtPatID.Text + "'And  patName= '" + textBox1.Text.Trim() + "'";
                SqlCommand cmd = new SqlCommand(updateBillString, con);
                try
                {
                    cmd.ExecuteNonQuery();

                    MessageBox.Show("Payment updated successfully", "Save Data - Onana HMS", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                con.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 private void txtPatID_TextChanged(object sender, EventArgs e)
 {
     if (txtPatID.Text.Trim() != "")
     {
         if (txtPatID.Text.Length >= 4)
         {
             selectClass.selectPatDetailsFromBill(txtPatID.Text);
             txtPatName.Text = selectClass.fullName;
             txtAmt.Text     = selectClass.PatBill.ToString();
         }
     }
 }