Пример #1
0
        private void back_button_Click(object sender, EventArgs e)
        {
            E_Ballot_1 obj = new E_Ballot_1();

            this.Hide();
            obj.Show();
        }
Пример #2
0
 private void apply_button_Click(object sender, EventArgs e)
 {
     if (prov_comboBox.Text != "")
     {
         string          str   = "server=localhost;port=3308;username=root;password=;database=e_ballot";
         MySqlConnection con   = new MySqlConnection(str);
         String          query = "select PARTY_ID from party where PARTY_NAME = '" + party + "';";
         MySqlCommand    cmd   = new MySqlCommand(query, con);
         con.Open();
         MySqlDataReader reader = cmd.ExecuteReader();
         reader.Read();
         int party_id = Convert.ToInt32(reader.GetString(0));
         con.Close();
         query = "insert into senate_candidancy_request values('" + cnic + "','" + prov_comboBox.Text + "'," + party_id + ");";
         cmd   = new MySqlCommand(query, con);
         con.Open();
         cmd.ExecuteReader();
         MessageBox.Show("Application is sent for approval!");
         E_Ballot_1 obj = new E_Ballot_1();
         this.Hide();
         obj.Show();
     }
     else
     {
         MessageBox.Show("Please select a province");
     }
 }
Пример #3
0
        private void label2_Click(object sender, EventArgs e)
        {
            E_Ballot_1 obj = new E_Ballot_1();

            this.Hide();
            obj.Show();
        }
Пример #4
0
 private void login_button_Click(object sender, EventArgs e)
 {
     if (cnic_maskedTextBox.Text == "     -       -")
     {
         MessageBox.Show("Please type in CNIC!");
     }
     else
     {
         string          str = "server=localhost;port=3308;username=root;password=;database=e_ballot";
         MySqlConnection con = new MySqlConnection(str);
         con.Open();
         string Text = cnic_maskedTextBox.Text;
         Text = Text.Replace("-", "");
         String          query  = "select * from nadra_info where cnic=" + Text + "";
         MySqlCommand    cmd    = new MySqlCommand(query, con);
         MySqlDataReader reader = cmd.ExecuteReader();
         reader.Read();
         try
         {
             String     cnic = reader.GetString(1);
             E_Ballot_1 obj  = new E_Ballot_1(Text);
             this.Hide();
             obj.Show();
             con.Close();
         }
         catch
         {
             MessageBox.Show("No Record Found!");
         }
     }
 }
 private void apply_button_Click_1(object sender, EventArgs e)
 {
     if (regionid == 0)
     {
         MessageBox.Show("Please select a Region!");
     }
     else
     {
         DialogResult dialogResult = MessageBox.Show("Apply for Province : " + prov_comboBox.Text + ", District: " + dist_comboBox.Text + "" +
                                                     ", Region ID: " + regionid + ", Region number: " + reg + "", "Confirmation!", MessageBoxButtons.YesNo);
         if (dialogResult == DialogResult.Yes)
         {
             if (!seat_taken() || party_label.Text == "Independent")
             {
                 string          str   = "server=localhost;port=3308;username=root;password=;database=e_ballot";
                 MySqlConnection con   = new MySqlConnection(str);
                 String          query = "select PARTY_ID from party where PARTY_NAME = '" + party + "';";
                 MySqlCommand    cmd   = new MySqlCommand(query, con);
                 con.Open();
                 MySqlDataReader reader = cmd.ExecuteReader();
                 reader.Read();
                 int party_id = Convert.ToInt32(reader.GetString(0));
                 con.Close();
                 if (desg_comboBox.Text == "MPA")
                 {
                     query = "insert into candidancy_request values(" + Convert.ToInt64(cnic) + "," + regionid + ",NULL," + party_id + ");";
                 }
                 else if (desg_comboBox.Text == "MNA")
                 {
                     query = "insert into candidancy_request values(" + Convert.ToInt64(cnic) + ",NULL," + regionid + "," + party_id + ");";
                 }
                 cmd = new MySqlCommand(query, con);
                 con.Open();
                 cmd.ExecuteReader();
                 MessageBox.Show("Application is sent for approval!");
                 E_Ballot_1 obj = new E_Ballot_1();
                 this.Hide();
                 obj.Show();
             }
             else
             {
                 MessageBox.Show("There is already a candidate on this seat with same party!");
             }
         }
     }
 }
        private void apply_button_Click(object sender, EventArgs e)
        {
            if (desg_comboBox.Text == "" || type_comboBox.Text == "" || prov_comboBox.Text == "")
            {
                check = false;
            }

            if (prov_comboBox.Enabled == false && desg_comboBox.Text != "" && type_comboBox.Text != "")
            {
                check = true;
            }

            if (prov_comboBox.Enabled == true && desg_comboBox.Text != "" && type_comboBox.Text != "" && prov_comboBox.Text != "")
            {
                check = true;
            }

            if (type_comboBox.Text == "W" && gender != "Female")
            {
                MessageBox.Show("You can't apply in this category!(Not Woman)");
                return;
            }

            if (check)
            {
                string          str   = "server=localhost;port=3308;username=root;password=;database=e_ballot";
                MySqlConnection con   = new MySqlConnection(str);
                String          query = "select PARTY_ID from party where PARTY_NAME = '" + party + "';";
                MySqlCommand    cmd   = new MySqlCommand(query, con);
                con.Open();
                MySqlDataReader reader = cmd.ExecuteReader();
                reader.Read();
                int party_id = Convert.ToInt32(reader.GetString(0));
                con.Close();
                if (desg_comboBox.Text == "MPA")
                {
                    query = "insert into reserved_candidancy_request values('" + cnic + "','" + prov_comboBox.Text + "',NULL,'" + party_id + "','" + type_comboBox.Text + "');";
                }
                else if (desg_comboBox.Text == "MNA")
                {
                    if (type_comboBox.Text == "NM")
                    {
                        query = "insert into reserved_candidancy_request values('" + cnic + "',NULL,'ALL','" + party_id + "','" + type_comboBox.Text + "');";
                    }
                    else
                    {
                        query = "insert into reserved_candidancy_request values('" + cnic + "',NULL,'" + prov_comboBox.Text + "','" + party_id + "','" + type_comboBox.Text + "');";
                    }
                }
                cmd = new MySqlCommand(query, con);
                con.Open();
                cmd.ExecuteReader();
                MessageBox.Show("Application is sent for approval!");
                E_Ballot_1 obj = new E_Ballot_1();
                this.Hide();
                obj.Show();
            }
            else
            {
                MessageBox.Show("Please fill all teh fields!");
            }
        }