private void btnHome_Click(object sender, RoutedEventArgs e)
        {
            Rental_Page RP = new Rental_Page(UName, UserType);

            this.Close();
            RP.Show();
        }
Exemple #2
0
        private void btnLogin_Click(object sender, RoutedEventArgs e)
        {
            if (txtUserName.Text != "" && pbPassword.Password != "")
            {
                DataTable DT = objDB.Login(txtUserName.Text, pbPassword.Password);
                if (DT != null && DT.Rows.Count > 0)
                {
                    DataRow row        = DT.Rows[0];
                    String  First_Name = row["FirstName"].ToString();
                    String  Last_Name  = row["LastName"].ToString();
                    String  User_Type  = row["UserType"].ToString();
                    //MessageBox.Show(First_Name + Last_Name + User_Type);
                    txtUserName.Clear();
                    pbPassword.Clear();
                    txtUserName.Focus();

                    Rental_Page rent = new Rental_Page(First_Name, User_Type);
                    this.Hide();
                    rent.ShowDialog();
                }
                else
                {
                    MessageBox.Show(" Login Failed. Try Again");
                    txtUserName.Clear();
                    pbPassword.Clear();
                    txtUserName.Focus();
                }
            }
            else
            {
                MessageBox.Show("Enter User Name or Password");
                txtUserName.Focus();
            }
        }