Esempio n. 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();
                    }
                }
            }
        }
Esempio n. 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");
                    }
                }
            }
        }
Esempio n. 3
0
        // save the image
        private void button1_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("Are You Sure To Save The Current Image", "Title", MessageBoxButtons.YesNoCancel,
                                              MessageBoxIcon.Information);

            if (dr == DialogResult.Yes)
            {
                if (check > 0)
                {
                    var faceToSave = new Image <Gray, byte>(sample.Image.Bitmap);

                    Byte[]           file;
                    IDataStoreAccess dataStore = new DataStoreAccess();
                    var username = emp_id;

                    var filePath = Application.StartupPath + String.Format("/{0}.bmp", username);

                    faceToSave.Save(filePath);
                    using (var stream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
                    {
                        using (var reader = new BinaryReader(stream))
                        {
                            file = reader.ReadBytes((int)stream.Length);
                        }
                    }
                    if (check == 1)
                    {
                        dataStore.insertuser(name1, phnno, email1, emp_id, role1);
                    }
                    dataStore.SaveFace(username, file);
                }
                else
                {
                    MessageBox.Show("Take Atleast One Image");
                }
            }
        }
Esempio n. 4
0
        public void get_name()
        {
            DataStoreAccess ds = new DataStoreAccess();

            Assert.AreEqual("Jathusan", ds.get_name("1"));
        }