private void button1_Click(object sender, EventArgs e)
        {
            VotingFormMainUI vfmui = new VotingFormMainUI();

            vfmui.Show();
            this.Hide();
        }
Example #2
0
        private void button26_Click(object sender, EventArgs e)
        {
            String totalNames = "";

            if (btn1 == true)
            {
                totalNames = totalNames + button1.Text + "♥";
            }
            if (btn2 == true)
            {
                totalNames = totalNames + button2.Text + "♥";
            }
            if (btn3 == true)
            {
                totalNames = totalNames + button3.Text + "♥";
            }
            if (btn4 == true)
            {
                totalNames = totalNames + button4.Text + "♥";
            }
            if (btn5 == true)
            {
                totalNames = totalNames + button5.Text + "♥";
            }
            if (btn6 == true)
            {
                totalNames = totalNames + button6.Text + "♥";
            }
            if (btn7 == true)
            {
                totalNames = totalNames + button7.Text + "♥";
            }
            if (btn8 == true)
            {
                totalNames = totalNames + button8.Text + "♥";
            }
            if (btn9 == true)
            {
                totalNames = totalNames + button9.Text + "♥";
            }
            if (btn10 == true)
            {
                totalNames = totalNames + button10.Text + "♥";
            }
            if (btn11 == true)
            {
                totalNames = totalNames + button11.Text + "♥";
            }
            if (btn12 == true)
            {
                totalNames = totalNames + button12.Text + "♥";
            }
            if (btn13 == true)
            {
                totalNames = totalNames + button13.Text + "♥";
            }
            if (btn14 == true)
            {
                totalNames = totalNames + button14.Text + "♥";
            }
            if (btn15 == true)
            {
                totalNames = totalNames + button15.Text + "♥";
            }
            if (btn16 == true)
            {
                totalNames = totalNames + button16.Text + "♥";
            }
            if (btn17 == true)
            {
                totalNames = totalNames + button17.Text + "♥";
            }
            if (btn18 == true)
            {
                totalNames = totalNames + button18.Text + "♥";
            }
            if (btn19 == true)
            {
                totalNames = totalNames + button19.Text + "♥";
            }
            if (btn20 == true)
            {
                totalNames = totalNames + button20.Text + "♥";
            }
            if (btn21 == true)
            {
                totalNames = totalNames + button21.Text + "♥";
            }
            if (btn22 == true)
            {
                totalNames = totalNames + button22.Text + "♥";
            }
            if (btn23 == true)
            {
                totalNames = totalNames + button23.Text + "♥";
            }
            if (btn24 == true)
            {
                totalNames = totalNames + button24.Text + "♥";
            }
            if (btn25 == true)
            {
                totalNames = totalNames + button25.Text + "♥";
            }
            totalNames = totalNames.Substring(0, totalNames.Length - 1);
            System.IO.Directory.CreateDirectory("Votes");
            System.IO.Directory.CreateDirectory("Results");
            String localLocation = Directory.GetCurrentDirectory() + "//Results";

            String[] names = totalNames.Split('♥');
            for (int i = 0; i < names.Length; i++)
            {
                if (File.Exists(localLocation + "//" + names[i] + ".db"))
                {
                    string readText = File.ReadAllText(localLocation + "//" + names[i] + ".db");
                    int    counter  = int.Parse(readText);
                    counter++;
                    File.WriteAllText(localLocation + "//" + names[i] + ".db", mb.Encrypt(counter.ToString()));
                }
                else
                {
                    string createText = "1";
                    File.WriteAllText(localLocation + "//" + names[i] + ".db", mb.Encrypt(createText));
                }
                VotingFormMainUI vfmUI = new VotingFormMainUI();
                vfmUI.Show();
                this.Hide();
            }
        }