Ejemplo n.º 1
0
        void Reset_Click(object sender, RoutedEventArgs e)
        {
            if (Login.Text == "" || Password.Password == "" || TryPassword.Password == "" || Password.Password != TryPassword.Password)
            {
                Error.Content = "Error: Entry login, password, email, trypassword, password != trypassword"; return;
            }
            var users = QueryBD.bd.Users.Where(u => u.Login == Login.Text && u.Email == Email.Text);

            if (users.Count() == 0)
            {
                Error.Content = "Error: неверные данные."; return;
            }
            QueryBD.user          = users.First();
            QueryBD.user.Password = QueryBD.GetMd5Hash(Password.Password);
            QueryBD.bd.SaveChanges();
            QueryBD.Navigate(QueryBD.log);
        }
Ejemplo n.º 2
0
 void Reg_Click(object sender, RoutedEventArgs e)
 {
     if (Login.Text == "" || Email.Text == "" || Password.Password == "" || TryPassword.Password == "" || Password.Password != TryPassword.Password)
     {
         Error.Content = "Error: Entry login, email, password, trypassword, password != trypassword"; return;
     }
     if (QueryBD.bd.Users.Where(u => u.Login == Login.Text).Count() != 0)
     {
         Error.Content = "Error: такой логин существует."; return;
     }
     QueryBD.user = new User()
     {
         Login = Login.Text, Email = Email.Text, Password = QueryBD.GetMd5Hash(Password.Password)
     };
     QueryBD.bd.Users.Add(QueryBD.user);
     QueryBD.bd.SaveChanges();
     QueryBD.Navigate(QueryBD.log);
 }
Ejemplo n.º 3
0
        void Login_Click(object o, RoutedEventArgs e)
        {
            if (login.Text == "" || Password.Password == "")
            {
                return;
            }
            var pass = QueryBD.GetMd5Hash(Password.Password);
            var uses = QueryBD.bd.Users.Where(u => u.Login == login.Text && u.Password == pass);

            if (uses.Count() != 0)
            {
                QueryBD.user = uses.First();
                if (QueryBD.mainctrl == null)
                {
                    QueryBD.mainctrl = new MainCtrl();
                }
                QueryBD.Navigate(QueryBD.mainctrl);
            }
        }