示例#1
0
        private void Back_btn_Click(object sender, RoutedEventArgs e)
        {
            this.Hide();
            UserHomepage uhp = new UserHomepage();

            uhp.Show();
        }
示例#2
0
        private void btn_back_Click(object sender, EventArgs e)
        {
            this.Close();
            UserHomepage uhp = new UserHomepage();

            uhp.Show();
        }
        private void Account_homemenuitem_Click_1(object sender, RoutedEventArgs e)
        {
            this.Hide();
            UserHomepage uhp = new UserHomepage();

            uhp.Show();
        }
示例#4
0
        private void login_btn_Click(object sender, RoutedEventArgs e)
        {
            if (Select_Type.Text == "Admin")
            {
                string        constring = @"Data Source=DESKTOP-38D6V65;Initial Catalog=admin_login1;Integrated Security=True";
                SqlConnection con       = new SqlConnection(constring);
                con.Open();

                string     cmdstring = "select * from admin_login1 where user_name = '" + txt_username.Text + "' and passward = '" + txt_password.Password + "' and typee = '" + Select_Type.Text + "'";
                SqlCommand cmd       = new SqlCommand(cmdstring, con);

                SqlDataReader dr;
                dr = cmd.ExecuteReader();

                //con.Close();

                int count = 0;

                while (dr.Read())
                {
                    count += 1;
                }
                //con.Close();
                if (count == 1)
                {
                    // MessageBox.Show("Welcome, you are successfully logged in as an admin !!!");
                    this.Hide();
                    UserHomepage uhp = new UserHomepage();
                    uhp.Show();
                }
                else
                {
                    MessageBox.Show("Invalid Password or User Name !!!");
                }
            }
            else if (Select_Type.Text == "User")
            {
                string        constring = @"Data Source=DESKTOP-38D6V65;Initial Catalog=admin_login1;Integrated Security=True";
                SqlConnection con       = new SqlConnection(constring);
                con.Open();

                string     cmdstring = "select * from admin_login1 where user_name = '" + txt_username.Text + "' and passward = '" + txt_password.Password + "' and typee = '" + Select_Type.Text + "'";
                SqlCommand cmd       = new SqlCommand(cmdstring, con);

                SqlDataReader dr;
                dr = cmd.ExecuteReader();

                //con.Close();

                int count = 0;

                while (dr.Read())
                {
                    count += 1;
                }
                //con.Close();
                if (count == 1)
                {
                    //MessageBox.Show("Welcome, you are successfully logged in as an user !!!");
                    this.Hide();
                    AdminHomepage ahp = new AdminHomepage();
                    ahp.Show();
                }
                else
                {
                    MessageBox.Show("Invalid Password or User Name !!!");
                }
            }
            else
            {
                MessageBox.Show("A field is empty, please fill the all field");
            }

            txt_username.Text     = "";
            txt_password.Password = "";
            Select_Type.Text      = "";
        }