Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            DataStoreAccess d = new DataStoreAccess();

            if (textBox1.Text == "" || textBox2.Text == "" || textBox6.Text == "" || textBox3.Text == "" || textBox4.Text == "" || textBox5.Text == "")
            {
                MessageBox.Show("Enter All Fields");
            }
            else
            {
                if (d.existId(textBox5.Text))
                {
                    MessageBox.Show("User Already Exists");
                }
                else
                {
                    if (textBox4.Text != textBox5.Text)
                    {
                        MessageBox.Show("Passwords Do Not Match");
                    }
                    else
                    {
                        name1  = textBox1.Text;
                        email1 = textBox2.Text;
                        emp_id = textBox6.Text;
                        p1     = encrypt.Encrypt(textBox4.Text);

                        phn_no = Convert.ToInt32(textBox3.Text);

                        string role1 = "manager";
                        d.insertstaff(name1, phn_no, email1, emp_id, role1, p1);
                        this.Hide();
                        Login j = new Login();
                        j.Show();
                    }
                }
            }
        }
Example #2
0
        private void image_Click(object sender, EventArgs e)
        {
            DataStoreAccess d = new DataStoreAccess();

            if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" || textBox5.Text == "")
            {
                MessageBox.Show("Enter All Fields");
            }
            else
            {
                if (d.existId(textBox5.Text))
                {
                    MessageBox.Show("User Already Exists");
                }
                else
                {
                    int  Num;
                    bool isNum = int.TryParse(textBox3.Text.ToString(), out Num);
                    if (isNum)
                    {
                        name1  = textBox1.Text;
                        email1 = textBox2.Text;
                        emp_id = textBox5.Text;

                        phn_no = Convert.ToInt32(textBox3.Text);
                        role1  = textBox4.Text;
                        this.Hide();
                        Form1 image = new Form1();
                        image.Show();
                    }
                    else
                    {
                        MessageBox.Show("Enter Valid Phone Number");
                    }
                }
            }
        }