Exemple #1
0
        private void form4_FormClosing(object sender, FormClosingEventArgs e)
        {
            ActiveForm.Hide();
            Login_Page form = new Login_Page();

            form.Show();
        }
Exemple #2
0
        private void button3_Click(object sender, EventArgs e)                          //Logout
        {
            DialogResult result = MessageBox.Show("Are You Sure???", "Warning", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                ActiveForm.Hide();
                Login_Page form = new Login_Page();
                form.Show();
            }
        }
Exemple #3
0
        private void button1_Click_1(object sender, EventArgs e)                //Home
        {
            DialogResult result = MessageBox.Show("Go Home???", "Warning", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                ActiveForm.Hide();
                Login_Page form = new Login_Page();
                form.Show();
            }
        }
Exemple #4
0
        private void Admin_FormClosing(object sender, FormClosingEventArgs e)
        {
            Login_Page form = new Login_Page();

            form.Show();
        }
Exemple #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            f1 = c.name(textBox1);                  //Validation
            f2 = c.contact(textBox2);               //Validation
            f3 = c.password(textBox3);              //Validation
            f4 = c.retype(textBox4, textBox3);      //Validation
            f5 = c.mail(textBox5);                  //Validation
            f6 = c.gender(comboBox1);               //Validation
            f7 = c.date(dateTimePicker1);           //Validation
            f8 = c.address(textBox6);               //Validation


            if (f1 == 0 && f2 == 0 && f3 == 0 && f4 == 0 && f5 == 0 && f6 == 0 && f7 == 0 && f8 == 0)
            {
                c.write(textBox1, textBox2, textBox3, textBox5, comboBox1, dateTimePicker1, textBox6);          //Add Customer
                ActiveForm.Hide();
                Login_Page form = new Login_Page();                                                             //Login Page
                form.Show();
            }

            if (f8 == 1)
            {
                address.Text = "*Invalid Characters";
                address.Show();
                textBox6.ResetText();
                textBox6.Focus();
                using (StreamWriter w = File.AppendText("log.txt"))
                {
                    c.Log(address.Text, w);
                }

                using (StreamReader r = File.OpenText("log.txt"))
                {
                    c.DumpLog(r);
                }
            }
            else if (f8 == 2)
            {
                address.Text = "*Too Short";
                address.Show();
                textBox6.ResetText();
                textBox6.Focus();
                using (StreamWriter w = File.AppendText("log.txt"))
                {
                    c.Log(address.Text, w);
                }

                using (StreamReader r = File.OpenText("log.txt"))
                {
                    c.DumpLog(r);
                }
            }
            else if (f8 == 3)
            {
                address.Text = "*Input Required";
                address.Show();
                textBox6.ResetText();
                textBox6.Focus();
                using (StreamWriter w = File.AppendText("log.txt"))
                {
                    c.Log(address.Text, w);
                }

                using (StreamReader r = File.OpenText("log.txt"))
                {
                    c.DumpLog(r);
                }
            }
            else
            {
                address.Hide();
            }

            if (f7 == 1)
            {
                dateTimePicker1.ResetText();
                dateTimePicker1.Focus();
                date.Text = "*Invalid Date";
                date.Show();
                using (StreamWriter w = File.AppendText("log.txt"))
                {
                    c.Log(date.Text, w);
                }

                using (StreamReader r = File.OpenText("log.txt"))
                {
                    c.DumpLog(r);
                }
            }
            else
            {
                date.Hide();
            }

            if (f6 == 1)
            {
                comboBox1.ResetText();
                comboBox1.Focus();
                gender.Text = "*Input Required";
                gender.Show();
                using (StreamWriter w = File.AppendText("log.txt"))
                {
                    c.Log(gender.Text, w);
                }

                using (StreamReader r = File.OpenText("log.txt"))
                {
                    c.DumpLog(r);
                }
            }
            else
            {
                gender.Hide();
            }

            if (f5 == 1)
            {
                textBox5.ResetText();
                textBox5.Focus();
                mail.Text = "*Invalid Input";
                mail.Show();
                using (StreamWriter w = File.AppendText("log.txt"))
                {
                    c.Log(mail.Text, w);
                }

                using (StreamReader r = File.OpenText("log.txt"))
                {
                    c.DumpLog(r);
                }
            }
            else if (f5 == 2)
            {
                textBox5.ResetText();
                textBox5.Focus();
                mail.Text = "*Input Required";
                mail.Show();
                using (StreamWriter w = File.AppendText("log.txt"))
                {
                    c.Log(mail.Text, w);
                }

                using (StreamReader r = File.OpenText("log.txt"))
                {
                    c.DumpLog(r);
                }
            }
            else if (f5 == 3)
            {
                textBox5.ResetText();
                textBox5.Focus();
                mail.Text = "*Already Exists";
                mail.Show();
                using (StreamWriter w = File.AppendText("log.txt"))
                {
                    c.Log(mail.Text, w);
                }

                using (StreamReader r = File.OpenText("log.txt"))
                {
                    c.DumpLog(r);
                }
            }
            else
            {
                mail.Hide();
            }

            if (f4 == 1)
            {
                textBox4.ResetText();
                textBox4.Focus();
                password2.Text = "*Not Matching";
                password2.Show();
                using (StreamWriter w = File.AppendText("log.txt"))
                {
                    c.Log(password2.Text, w);
                }

                using (StreamReader r = File.OpenText("log.txt"))
                {
                    c.DumpLog(r);
                }
            }
            else if (f4 == 2)
            {
                textBox4.ResetText();
                textBox4.Focus();
                password2.Text = "*Input Required";
                password2.Show();
                using (StreamWriter w = File.AppendText("log.txt"))
                {
                    c.Log(password2.Text, w);
                }

                using (StreamReader r = File.OpenText("log.txt"))
                {
                    c.DumpLog(r);
                }
            }
            else
            {
                password2.Hide();
            }

            if (f3 == 1)
            {
                textBox3.ResetText();
                textBox4.ResetText();
                textBox3.Focus();
                password.Text = "  *Should Contain Alphabets,\nNumbers and Special Characters";
                password.Show();
                using (StreamWriter w = File.AppendText("log.txt"))
                {
                    c.Log(password.Text, w);
                }

                using (StreamReader r = File.OpenText("log.txt"))
                {
                    c.DumpLog(r);
                }
            }
            else if (f3 == 2)
            {
                textBox3.ResetText();
                textBox4.ResetText();
                textBox3.Focus();
                password.Text = "*Shouldn't Start With Number\nor Special Character";
                password.Show();
                using (StreamWriter w = File.AppendText("log.txt"))
                {
                    c.Log(password.Text, w);
                }

                using (StreamReader r = File.OpenText("log.txt"))
                {
                    c.DumpLog(r);
                }
            }
            else if (f3 == 3)
            {
                textBox3.ResetText();
                textBox4.ResetText();
                textBox3.Focus();
                password.Text = "\n*Too short";
                password.Show();
                using (StreamWriter w = File.AppendText("log.txt"))
                {
                    c.Log(password.Text, w);
                }

                using (StreamReader r = File.OpenText("log.txt"))
                {
                    c.DumpLog(r);
                }
            }
            else if (f3 == 4)
            {
                textBox3.ResetText();
                textBox4.ResetText();
                textBox3.Focus();
                password.Text = "\n*Input Required";
                password.Show();
                using (StreamWriter w = File.AppendText("log.txt"))
                {
                    c.Log(password.Text, w);
                }

                using (StreamReader r = File.OpenText("log.txt"))
                {
                    c.DumpLog(r);
                }
            }
            else if (f3 == 5)
            {
                textBox3.ResetText();
                textBox4.ResetText();
                textBox3.Focus();
                password.Text = "\n*Only !,@,#,$";
                password.Show();
                using (StreamWriter w = File.AppendText("log.txt"))
                {
                    c.Log(password.Text, w);
                }

                using (StreamReader r = File.OpenText("log.txt"))
                {
                    c.DumpLog(r);
                }
            }
            else
            {
                password.Hide();
            }

            if (f2 == 1)
            {
                textBox2.ResetText();
                textBox2.Focus();
                contact.Text = "*Only Digits";
                contact.Show();
                using (StreamWriter w = File.AppendText("log.txt"))
                {
                    c.Log(contact.Text, w);
                }

                using (StreamReader r = File.OpenText("log.txt"))
                {
                    c.DumpLog(r);
                }
            }
            else if (f2 == 2)
            {
                textBox2.ResetText();
                textBox2.Focus();
                contact.Text = "*Too short";
                contact.Show();
                using (StreamWriter w = File.AppendText("log.txt"))
                {
                    c.Log(contact.Text, w);
                }

                using (StreamReader r = File.OpenText("log.txt"))
                {
                    c.DumpLog(r);
                }
            }
            else if (f2 == 3)
            {
                textBox2.ResetText();
                textBox2.Focus();
                contact.Text = "*Input Required";
                contact.Show();
                using (StreamWriter w = File.AppendText("log.txt"))
                {
                    c.Log(contact.Text, w);
                }

                using (StreamReader r = File.OpenText("log.txt"))
                {
                    c.DumpLog(r);
                }
            }
            else
            {
                contact.Hide();
            }

            if (f1 == 1)
            {
                textBox1.ResetText();
                textBox1.Focus();
                name.Text = "*Invalid Format or Invalid Characters";
                name.Show();
                using (StreamWriter w = File.AppendText("log.txt"))
                {
                    c.Log(name.Text, w);
                }

                using (StreamReader r = File.OpenText("log.txt"))
                {
                    c.DumpLog(r);
                }
            }
            else if (f1 == 2)
            {
                textBox1.ResetText();
                textBox1.Focus();
                name.Text = "*Input Required";
                name.Show();
                using (StreamWriter w = File.AppendText("log.txt"))
                {
                    c.Log(name.Text, w);
                }

                using (StreamReader r = File.OpenText("log.txt"))
                {
                    c.DumpLog(r);
                }
            }
            else if (f1 == 3)
            {
                textBox1.ResetText();
                textBox1.Focus();
                name.Text = "*Full Name";
                name.Show();
                using (StreamWriter w = File.AppendText("log.txt"))
                {
                    c.Log(name.Text, w);
                }

                using (StreamReader r = File.OpenText("log.txt"))
                {
                    c.DumpLog(r);
                }
            }
            else
            {
                name.Hide();
            }
        }