예제 #1
0
 private void LoginBtn_Click(object sender, EventArgs e)
 {
     accountManager.VerifyUserAccount(loginTb.Text, passwordTb.Text);
     if (userStatus.GetUserStatus())
     {
         AgendaWindow agendaWindow = new AgendaWindow();
         agendaWindow.Show();
         agendaWindow.BringToFront();
         Close();
     }
     else
     {
         MessageBox.Show("Błąd logowania");
     }
 }
예제 #2
0
        private void Login()
        {
            // for test purposes
            //MonthHelper.CreateMonth(DateTime.Now);

            string pass = "";

            Guid Salt;

            User u = allUser.Where(x => x.Pseudo == Pseudo).FirstOrDefault();

            if (u != null)
            {
                Salt = u.Salt;

                pass = PasswordHasher.Hash(Password, Salt);

                if (allUser.Where(x => x.Password == pass).FirstOrDefault() != null)
                {
                    SessionManager.CurrentUser = u;

                    //NE PAS TOUCHER !!!!!!!!

                    AgendaViewModelCollection avm = AgendaViewModelCollection.Instance;

                    avm.LoadEvent.Invoke(this, EventArgs.Empty);

                    AgendaWindow window = new AgendaWindow
                    {
                        DataContext = avm
                    };

                    //avm. = AgendaRepo.Instance.GetAll().Where(x => x.UserId == u.UserId).FirstOrDefault().AgendaId;
                    //avm.Date = DateTime.Now;



                    CloseWindow();

                    window.Show();
                }

                else
                {
                    Warning = WarningUtils.ErrorCodes.Where(x => x.Key == "DontExist").FirstOrDefault().Value;
                }
            }


            else
            {
                Warning = WarningUtils.ErrorCodes.Where(x => x.Key == "DontExist").FirstOrDefault().Value;

                if (string.IsNullOrEmpty(Pseudo))
                {
                    Warning = WarningUtils.ErrorCodes.Where(x => x.Key == "Null").FirstOrDefault().Value;
                }

                if (StringChecker.HasSpaces(Pseudo))
                {
                    Warning = WarningUtils.ErrorCodes.Where(x => x.Key == "NoSpace").FirstOrDefault().Value;
                }
            }
        }