Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox3.Text.ToString() == "")
            {
                MessageBox.Show("As of this version, Please fill in all the information", "Error");
            }
            if (textBox4.Text.ToString() == "")
            {
                MessageBox.Show("As of this version, Please fill in all the information", "Error");
            }
            if (textBox5.Text.ToString() == "")
            {
                MessageBox.Show("As of this version, Please fill in all the information", "Error");
            }
            if (textBox6.Text.ToString() == "")
            {
                MessageBox.Show("As of this version, Please fill in all the information", "Error");
            }

            String seperation = "♥";
            String collect    = textBox3.Text.ToString() + seperation + textBox4.Text.ToString() + seperation + textBox5.Text.ToString() + seperation + textBox6.Text.ToString();
            string createText = mb.Encrypt(collect);

            File.WriteAllText(localLocation + "//vote.db", createText);
            RegistrationSettings rs = new RegistrationSettings();

            rs.Show();
            rs.sendData(localLocation);
            this.Hide();
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            //Register Person
            String localLocation = Directory.GetCurrentDirectory() + "//Registrations";

            if (File.Exists(localLocation))
            {
            }
            else
            {
                System.IO.Directory.CreateDirectory(localLocation);
            }
            bool detectEmpty = false;

            if (String.IsNullOrEmpty(lblName.Text))
            {
                detectEmpty = true;
            }
            if (String.IsNullOrEmpty(txbSurname.Text))
            {
                detectEmpty = true;
            }
            if (String.IsNullOrEmpty(groupVal.Text))
            {
                detectEmpty = true;
            }
            if (String.IsNullOrEmpty(txfID.Text))
            {
                detectEmpty = true;
            }
            if (String.IsNullOrEmpty(txfEligible.Text))
            {
                detectEmpty = true;
            }
            if (String.IsNullOrEmpty(txfGender.Text))
            {
                detectEmpty = true;
            }
            string path        = localLocation + "//" + lblName.Text.ToString().Trim() + " " + txbSurname.Text.ToString().Trim() + ".db";
            String seperation  = "♥";
            String storageData = lblName.Text.ToString().Trim() + seperation + txbSurname.Text.ToString().Trim() + seperation + groupVal.Text.ToString() + seperation + txfID.Text.ToString().Trim() + seperation + txfEligible.Text.ToString() + seperation + txfGender.Text.ToString();


            if (detectEmpty == true)
            {
                MessageBox.Show("Error, Please make sure all data is filled in", "Error");
                detectEmpty = false;
            }
            else
            {
                if (!File.Exists(path))
                {
                    File.Create(path).Dispose();
                    using (TextWriter tw = new StreamWriter(path))
                    {
                        tw.WriteLine(mb.Encrypt(storageData));
                        MessageBox.Show(lblName.Text.ToString().Trim() + " " + txbSurname.Text.ToString().Trim() + " Has been Registered Successfully", "Success");
                    }
                }
                else if (File.Exists(path))
                {
                    MessageBox.Show("Error, Please Not\n" + lblName.Text.ToString().Trim() + " " + txbSurname.Text.ToString().Trim() + " Already Exists In The System", "Error");
                }
            }
        }
Пример #3
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();
            }
        }