Esempio n. 1
0
        private void updateDb(string s_name, int s_age, string s_anum, long s_acard, string s_add, long s_contact, string s_dis, string s_hosp, string gdr, long s_aadhar, int s_amt)
        {
            DbAccess      db = new DbAccess();
            DataTable     dt = new DataTable();
            int           final_amt;
            string        query  = "UPDATE claimants set name = @name, age = @age, address = @add, a_card = @ac, contact = @con, d_desc = @ddes, hosp_name = @hname,gender = @gdr,aadhar = @adhr,amount = @amt WHERE anum = @anum";
            SqlCommand    comm   = new SqlCommand(query);
            string        qry    = "SELECT amount from claimants where anum = '" + s_anum + "';";
            SqlDataReader reader = db.readDatathroughReader(qry);

            reader.Read();
            int result = reader.GetInt32(0);

            final_amt = result - s_amt;
            SqlCommand com2 = new SqlCommand("UPDATE members set insurance_amt = insurance_amt + " + final_amt + " where anum = '" + s_anum + "';");

            reader.Close();
            comm.Parameters.AddWithValue("@name", s_name);
            comm.Parameters.AddWithValue("@age", s_age);
            comm.Parameters.AddWithValue("@add", s_add);
            comm.Parameters.AddWithValue("@ac", s_acard);
            comm.Parameters.AddWithValue("@con", s_contact);
            comm.Parameters.AddWithValue("@ddes", s_dis);
            comm.Parameters.AddWithValue("@hname", s_hosp);
            comm.Parameters.AddWithValue("@anum", s_anum);
            comm.Parameters.AddWithValue("@gdr", gdr);
            comm.Parameters.AddWithValue("@adhr", s_aadhar);
            comm.Parameters.AddWithValue("@amt", s_amt);
            try
            {
                db.executeQuery(comm);
                db.executeQuery(com2);
                MessageBox.Show("Updation Successfull", "Mcs-Arogya", MessageBoxButtons.OK, MessageBoxIcon.Information);

                this.Hide();
                viewclaim vc = new viewclaim();
                vc.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Something Went Wrong!!", "Mcs-Arogya", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 2
0
        private void button3_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("Do You Want To Delete Application Number : " + viewclaim.db_anum, "MCS-Arogya", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);

            if (dr == DialogResult.Yes)
            {
                DbAccess   db   = new DbAccess();
                SqlCommand comm = new SqlCommand("DELETE FROM CLAIMANTS WHERE anum = '" + viewclaim.db_anum + "';");
                SqlCommand com2 = new SqlCommand("UPDATE members set insurance_amt = insurance_amt + " + int.Parse(amount.Text.ToString()) + " where anum = '" + anum.Text.ToString() + "';");
                int        res  = db.executeQuery(comm);
                int        res2 = db.executeQuery(com2);
                if (res > 0 && res2 > 0)
                {
                    MessageBox.Show("Application number : " + viewclaim.db_anum + " removed from database", "MCS-Arogya", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                viewclaim vc = new viewclaim();
                this.Hide();
                vc.Show();
            }
        }
Esempio n. 3
0
        private void button4_Click(object sender, EventArgs e)
        {
            viewclaim vc = new viewclaim();

            vc.Show();
        }