private void button1_Click(object sender, EventArgs e)
        {
            if (UNAME.Text != "" & PWD.Text != "" & FPNT.Text != "" & UTYPE.Text != "")
            {

                if (UTYPE.SelectedItem.ToString() == "ADMIN")
                {
                    ADMIN_PURPOSE a = new ADMIN_PURPOSE();
                    a.Show();
                    this.Hide();
                }
                if (UTYPE.SelectedItem.ToString() == "FACULTY")
                {
                    FACULTY_PURPOSE f = new FACULTY_PURPOSE();
                    f.Show();
                    this.Hide();
                }
                if (UTYPE.SelectedItem.ToString() == "STUDENT")
                {
                    STUDENT_PURPOSE s = new STUDENT_PURPOSE();
                    this.Hide();
                    s.Show();
                }
                if (UTYPE.SelectedItem.ToString() == "OTHERS")
                {
                    OTERS_PURPOSE o = new OTERS_PURPOSE();
                    this.Hide();
                    o.Show();
                }

            /*
            SIGN_IN s1 = new SIGN_IN();
            this.Hide();
            s1.Show();
             * */

            }
            else
            {
                MessageBox.Show(" PLEASE..... \n FILL ALL THE ENTERIES !!! ");
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            name = UNAME.Text;
            role = UTYPE.SelectedItem.ToString();
            string str = UNAME.Text;
            if (UNAME.Text != "" & pictureBox1.Image != null & pictureBox2.Image != null & UTYPE.Text != "")
            {

                com.Connection = con;

                Bitmap img1, img2;
                int count2 = 0, count1 = 0;
                bool flag = true;
                progressBar1.Visible = true;
                string img1_ref, img2_ref;
                img1 = new Bitmap(fname1);
                img2 = new Bitmap(fname2);
                progressBar1.Maximum = img1.Width;
                if (img1.Width == img2.Width && img1.Height == img2.Height)
                {
                    for (int i = 0; i < img1.Width; i++)
                    {
                        for (int j = 0; j < img1.Height; j++)
                        {
                            img1_ref = img1.GetPixel(i, j).ToString();
                            img2_ref = img2.GetPixel(i, j).ToString();
                            if (img1_ref != img2_ref)
                            {
                                count2++;
                                flag = false;
                                break;
                            }
                            count1++;
                        }
                        progressBar1.Value++;
                    }
                    if (flag == false)
                        MessageBox.Show("SORRY, \n YOUR FINGERPRINT DOES NOT MATCHED ");
                    else
                    {
                        MessageBox.Show(" YOUR FINGER PRINT IS MATCHED");
                        //  HOME a2 = new HOME();
                        //this.Hide();
                        //a2.Show();
                        if (UTYPE.SelectedItem.ToString() == "ADMIN")
                        {
                            com.CommandText = "Select Uname from Admin_Info where paswrd='" + PWD.Text + "'";
                            Int32 nam = Convert.ToInt32(UNAME.Text);
                            Int32 count = Convert.ToInt32(com.ExecuteScalar());
                            if (count == nam)
                            {
                                // MessageBox.Show("okkk");
                                ADMIN_PURPOSE adm = new ADMIN_PURPOSE();// STUDENT_PURPOSE ob = new STUDENT_PURPOSE();
                                adm.passvalue(str);
                                adm.Show();
                                Hide();
                            }
                        }
                            if (UTYPE.SelectedItem.ToString() == "FACULTY")
                            {
                                com.CommandText = "Select Uname from Faculty_Info where paswrd='" + PWD.Text + "'";
                                Int32 nam1 = Convert.ToInt32(UNAME.Text);
                                Int32 count3 = Convert.ToInt32(com.ExecuteScalar());
                                if (count3 == nam1)
                                {
                                    FACULTY_PURPOSE adm = new FACULTY_PURPOSE();
                                    adm.passvalue(str);
                                    adm.Show();
                                    Hide();
                                }
                            }

                            if (UTYPE.SelectedItem.ToString() == "STUDENT")
                              {
                                com.CommandText = "Select Uname from Student_Info where paswrd='" + PWD.Text + "'";
                                Int32 nam1 = Convert.ToInt32(UNAME.Text);
                                Int32 count3 = Convert.ToInt32(com.ExecuteScalar());
                                if (count3 == nam1)
                                {
                                    STUDENT_PURPOSE adm = new STUDENT_PURPOSE();
                                    adm.passvalue(str);
                                    adm.Show();
                                    Hide();
                                }
                            }

                            if (UTYPE.SelectedItem.ToString() == "OTHERS")
                            {
                                com.CommandText = "Select Uname from Others_Info where paswrd='" + PWD.Text + "'";
                                Int32 nam1 = Convert.ToInt32(UNAME.Text);
                                Int32 count3 = Convert.ToInt32(com.ExecuteScalar());
                                if (count3 == nam1)
                                {
                                    OTHERS_PURPOSE adm = new OTHERS_PURPOSE();
                                    adm.passvalue(str);
                                    adm.Show();
                                    Hide();
                                }
                            }
                      }
                }
                else
                {
                    MessageBox.Show("can not compare this images");
                    this.Dispose();
                }
               }
                else
                {
                    MessageBox.Show(" PLEASE..... \n FILL ALL THE ENTERIES !!! ");
                }

               //     }
               //     if (flag == false)
               //         MessageBox.Show("SORRY, \n YOUR FINGERPRINT DOES NOT MATCHED ");
               //     else
               //     {
               //         MessageBox.Show(" YOUR FINGER PRINT IS MATCHED");
               //         HOME a2 = new HOME();
               //         this.Hide();
               //         a2.Show();
               //      /*  ..... if (UTYPE.SelectedItem.ToString() == "ADMIN")
               //     {
               //         ADMIN_PURPOSE a = new ADMIN_PURPOSE();
               //          this.Hide();
               //         a.Show();
               //         //    impliment these also for logintome
               //         // com.CommandText = "Select Uname from Admin_Info where Utype='" + UTYPE.Text + "'";
               //         // Int32 nam = Convert.ToInt32(UNAME.Text);
               //         //Int32 count = Convert.ToInt32(com.ExecuteScalar());
               //         //if (count == nam)
               //         //{
               //         //   MessageBox.Show("okkk");
               //         //    ADMIN_PURPOSE a = new ADMIN_PURPOSE();// STUDENT_PURPOSE ob = new STUDENT_PURPOSE();
               //         //    a.passvalue(str);
               //         //    a.Show();
               //         //    Hide();

               //         //    //a.Show();
               //         //    //this.Hide();
               //         //}
               //         //else
               //         //{
               //         //    MessageBox.Show("wrong");
               //         //}

               //     }*/

               //     }
               // }
               // else
               // {
               //     MessageBox.Show("can not compare this images");
               //     this.Dispose();
               // }

               //// name = UNAME.Text;
               ////// MessageBox.Show("YOU are logout !!!");
               //// DateTime now = DateTime.Now;
               ////  MessageBox.Show("Current time: " + now);
               //// com.Connection = con;
               //// com.CommandText = "insert into mytime values ('" + uname + "','" + now + "')";
               //// //  com.ExecuteNonQuery();
               //// com.Dispose();

               //// HOME l1 = new HOME();
               //// this.Hide();
               //// l1.Show();
        }