Ejemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            this.Hide();
            var vl = new VoterLogin();

            vl.Closed += (s, args) => this.Close();
            vl.Show();
        }
Ejemplo n.º 2
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         DialogResult dialogResult = MessageBox.Show("Sure", "Add New Vote", MessageBoxButtons.YesNo);
         if (dialogResult == DialogResult.Yes)
         {
             string squery = "INSERT INTO vote (eid, vid, cid) values('" + eid + "','" + vidd + "', '" + cid + "')";
             if (con.State == ConnectionState.Closed)
             {
                 con.Open();
             }
             msc = new MySqlCommand(squery, con);
             try
             {
                 if (msc.ExecuteNonQuery() == 1)
                 {
                     MessageBox.Show("Vote is Added");
                     if (vid2 != 0)
                     {
                         this.Hide();
                         var v1 = new VoterLogin();
                         v1.Closed += (s, args) => this.Close();
                         v1.Show();
                     }
                     else
                     {
                         this.Hide();
                         var v1 = new Vote();
                         v1.Closed += (s, args) => this.Close();
                         v1.Show();
                     }
                 }
                 else
                 {
                     MessageBox.Show("Vote is not added");
                     if (vid2 != 0)
                     {
                         this.Hide();
                         var v1 = new VoterLogin();
                         v1.Closed += (s, args) => this.Close();
                         v1.Show();
                     }
                     else
                     {
                         this.Hide();
                         var v1 = new Vote();
                         v1.Closed += (s, args) => this.Close();
                         v1.Show();
                     }
                 }
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message);
             }
             con.Close();
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Error.");
     }
 }