Exemplo n.º 1
0
        private void dGoBack_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            this.Hide();
            Admin_Page login = new Admin_Page();

            login.Show();
        }
        public void login_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "" || textBox2.Text == "")
            {
                string user = "******";
                string pass = "******";

                // int? user = Convert.ToInt32("textBox1.Text");
                // int? pass = Convert.ToInt32("textBox2.Text");

                null_check(user, pass);
                return;
            }


            else if (textBox1.Text != "" || textBox2.Text != "")
            {
                try
                {
                    SqlCommand cmd = new SqlCommand("Select status from Log where username='******' and password='******' ", dt.conn);
                    //  SqlCommand cmd = new SqlCommand("Select status from Log where username='******' and password='******' ", dt.conn);
                    dt.conn.Open();

                    SqlDataAdapter adapt = new SqlDataAdapter(cmd);

                    DataTable dtab = new DataTable();
                    adapt.Fill(dtab);
                    dt.conn.Close();

                    if (dtab.Rows.Count == 1)
                    {
                        if (dtab.Rows[0][0].ToString() == "admin")
                        {
                            MessageBox.Show("Login Successful!");
                            this.Hide();
                            Admin_Page fm1 = new Admin_Page();
                            fm1.Show();
                        }
                    }

                    else
                    {
                        MessageBox.Show("Login Failed!");
                    }
                }


                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }

            string u = textBox1.Text;
            string p = textBox2.Text;

            AreEq(u, p);
            AreNotEq(u, p);
            AreGrtr(u, p);
        }
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            this.Hide();
            Admin_Page Ad = new Admin_Page();

            Ad.Show();
        }
Exemplo n.º 4
0
        private void login_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "" || textBox2.Text == "")
            {
                MessageBox.Show("Please provide UserName and Password");
                return;
            }
            try
            {
                SqlCommand cmd = new SqlCommand("Select status from Login where username='******' and password='******' ", dt.conn);

                dt.conn.Open();

                SqlDataAdapter adapt = new SqlDataAdapter(cmd);


                DataTable dtab = new DataTable();
                adapt.Fill(dtab);
                dt.conn.Close();

                if (dtab.Rows.Count == 1)
                {
                    if (dtab.Rows[0][0].ToString() == "admin")
                    {
                        MessageBox.Show("Login Successful!");
                        this.Hide();
                        Admin_Page fm1 = new Admin_Page();
                        fm1.Show();
                    }


                    else if (dtab.Rows[0][0].ToString() == "patient")
                    {
                        MessageBox.Show("Login Successful!");
                        this.Hide();
                        Patient_Page fm2 = new Patient_Page();
                        fm2.Show();
                    }
                }

                else
                {
                    MessageBox.Show("Login Failed!");
                }
            }



            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }