Пример #1
0
        private void register_Click(object sender, RoutedEventArgs e)
        {
            bool done = false;

            using (TaxiDBEntities2 context = new TaxiDBEntities2())
            {
                Passenger passenger = context.Passengers.FirstOrDefault(c => c.Username == regUser.Text);
                if (passenger != null)
                {
                    labelErrReg.Content = "The username is already taken";
                    done = true;
                }
            }
            if (string.IsNullOrWhiteSpace(regUser.Text) || string.IsNullOrWhiteSpace(regPass.Text))
            {
                labelErrReg.Content = "You must enter all required fields";
                done = true;
            }
            else if (regPass.Text != regPassRep.Text)
            {
                labelErrReg.Content = "Passwords entered do not match";
                done = true;
            }
            if (!done)
            {
                systemWindow win = new systemWindow(registerAcc());
                win.Show();
                this.Close();
            }
        }
Пример #2
0
 private void login_Click(object sender, RoutedEventArgs e)
 {
     using (TaxiDBEntities2 context = new TaxiDBEntities2())
     {
         Passenger passenger = context.Passengers.FirstOrDefault(c => c.Username == loginUser.Text && c.Password == loginPass.Text);
         if (passenger != null)
         {
             systemWindow win = new systemWindow(passenger.Username);
             win.Show();
             this.Close();
         }
     }
 }