Example #1
0
        private void LoginSubmitButton_Click(object sender, RoutedEventArgs e)
        {
            User user = new User()
            {
                Login    = loginTextBox.Text,
                Password = passwordTextBox.Text //do hash password
            };

            //authentication TBD
            using (SQLiteConnection connection = new SQLiteConnection(StaticDetails.userDatabasePath))
            {
                connection.CreateTable <User>();
                var loggingUser = connection.Table <User>().Where(u => u.Login == user.Login && u.Password == user.Password && u.isActive).FirstOrDefault();

                if (loggingUser != null)
                {
                    user = loggingUser;
                }
                else
                {
                    loginTextBox.Clear();
                    passwordTextBox.Clear();
                    MessageBox.Show("Podano nieprawidłowe dane do logowania!", "Błąd logowania", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }

            //if (user.Id != 0)
            //{
            //DoctorsWindow doctorsWindow = new DoctorsWindow(user.Id);
            DoctorsWindow doctorsWindow = new DoctorsWindow();

            doctorsWindow.Show();
            this.Close();
            //}
        }
Example #2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            //Create custom principal with an anonymous identity
            CustomPrincipal customPrincipal = new CustomPrincipal();

            AppDomain.CurrentDomain.SetThreadPrincipal(customPrincipal);
            IocKernel.Initialize(new IocConfiguration());
            base.OnStartup(e);

            IQueueServiceAPI queueServiceApi = new QueueServiceAPI();
            IView            doctorsWindow   = new DoctorsWindow(new DoctorsWindowVM(queueServiceApi));

            doctorsWindow.Show();

            //Show login view
            //LoginVM VM = new LoginVM(new AuthenticationService(queueServiceApi));
            //IView loginWindow = new LoginWindow(VM);
            //loginWindow.Show();
        }