Esempio n. 1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Do you want to delete your Account?", "Delete Account", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                string q  = "delete from Company where Email='" + this.Email + "' ";
                string q1 = "delete from UserTable where Email='" + this.Email + "' ";
                try
                {
                    DataAccess.ExecuteQuery(q);
                    DataAccess.ExecuteQuery(q1);

                    MessageBox.Show("Deleted Successfully");
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }

                Welcome f = new Welcome();

                f.Show();
                this.Hide();
            }
        }
Esempio n. 2
0
 private void btnBack_Click(object sender, EventArgs e)
 {
     Welcome w = new Welcome();
     w.Show();
     this.Hide();
 }
Esempio n. 3
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Do you want to delete your Account?", "Delete Account", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                SqlConnection con = new SqlConnection(@"Data Source = DESKTOP-1CCJE90\SAMIA; Initial Catalog = ProjectOOP2; Integrated Security = True");
                con.Open();

                string q = "delete from Address where Email='" + this.Email + "' ;";

                string q2  = "delete from ClientCareer where Email='" + this.Email + "' ";
                string q3  = "delete from ClientPersonalDetails where Email='" + this.Email + "' ";
                string q4  = "delete from EmploymentHistory where Email='" + this.Email + "' ";
                string q5  = "delete from Languages where Email='" + this.Email + "' ";
                string q6  = "delete from PerQualification where Email='" + this.Email + "' ";
                string q7  = "delete from Photograph where Email='" + this.Email + "' ";
                string q8  = "delete from Refer where Email='" + this.Email + "' ";
                string q9  = "delete from Specialization where Email='" + this.Email + "' ";
                string q10 = "delete from ClientHistory where Email='" + this.Email + "' ";
                string q11 = "delete from UserTable where Email='" + this.Email + "' ";


                try
                {
                    SqlCommand cmd = new SqlCommand(q, con);
                    cmd.ExecuteNonQuery();


                    SqlCommand cmd2 = new SqlCommand(q2, con);
                    cmd2.ExecuteNonQuery();

                    SqlCommand cmd3 = new SqlCommand(q3, con);
                    cmd3.ExecuteNonQuery();

                    SqlCommand cmd4 = new SqlCommand(q4, con);
                    cmd4.ExecuteNonQuery();

                    SqlCommand cmd5 = new SqlCommand(q5, con);
                    cmd5.ExecuteNonQuery();

                    SqlCommand cmd6 = new SqlCommand(q6, con);
                    cmd6.ExecuteNonQuery();

                    SqlCommand cmd7 = new SqlCommand(q7, con);
                    cmd7.ExecuteNonQuery();

                    SqlCommand cmd8 = new SqlCommand(q8, con);
                    cmd8.ExecuteNonQuery();

                    SqlCommand cmd9 = new SqlCommand(q9, con);
                    cmd9.ExecuteNonQuery();


                    SqlCommand cmd10 = new SqlCommand(q10, con);
                    cmd10.ExecuteNonQuery();


                    SqlCommand cmd11 = new SqlCommand(q11, con);
                    cmd11.ExecuteNonQuery();
                    con.Close();


                    MessageBox.Show("Deleted Successfully");
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }

                Welcome f = new Welcome();

                f.Show();
                this.Hide();
            }
        }