예제 #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Manager   manager   = new Manager();
            Secretary secretary = new Secretary();
            Doctor    doctor    = new Doctor();
            bool      loggedIn  = false;
            ObservableCollection <Account> accounts = AccountController.GetInstance().GetAllAccounts();

            for (int i = 0; i < accounts.Count; i++)
            {
                if (usernameTextBox.Text.TrimEnd() == accounts[i].Username & passwordTextBox.Password.TrimEnd() == accounts[i].Password)
                {
                    if (accounts[i].Person.GetType() == manager.GetType())
                    {
                        loggedIn = true;
                        ManagerMainWindow window = ManagerMainWindow.getInstance();
                        window.Show();
                        //this.Hide();
                    }
                    else if (accounts[i].Person.GetType() == secretary.GetType())
                    {
                        loggedIn = true;
                        MainPatientManagement.Instance.Show();
                        //this.Hide();
                    }
                    else if (accounts[i].Person.GetType() == doctor.GetType())
                    {
                        loggedIn = true;
                        person   = accounts[i].Person;
                        DoctorMainWindow window = DoctorMainWindow.GetInstance((Doctor)person);
                        window.Show();
                        //this.Hide();
                    }
                    else
                    {
                        loggedIn = true;
                        Patient rightPatient = null;
                        foreach (var patient in PatientController.getInstance().getPatient())
                        {
                            if (((Patient)accounts[i].Person).Jmbg == patient.Jmbg)
                            {
                                rightPatient = patient;
                            }
                        }
                        person = accounts[i].Person;
                        PatientMainWindow.GetInstance(rightPatient).Show();
                    }
                }
            }
            if (!loggedIn)
            {
                MessageBox.Show("Lozinka ili korisničko ime nisu validni.", "Greška", MessageBoxButton.OK, MessageBoxImage.Information);
                passwordTextBox.Clear();
            }
        }
예제 #2
0
        private void Window_KeyDown(object sender, KeyEventArgs e)
        {
            if (Keyboard.Modifiers == ModifierKeys.Control && e.Key == Key.B)
            {
                var s = new FirstPage();
                gridMain.Children.Clear();
                gridMain.Children.Add(s);
            }
            else if (Keyboard.Modifiers == ModifierKeys.Control && e.Key == Key.H)
            {
                MessageBox.Show(

                    "- Use CTRL + B to return to the first page of the application.\n" +
                    "- Use  ARROW DOWN to select doctor from checkbox.\n" +
                    "- Use TAB to select table.\n" +
                    "- Use AAROWS to move within field in table.\n" +
                    "- Use TAB to focus wanted mark.\n" +
                    "- Use SPACE to select wanted mark.\n" +

                    "- Use  CTRL + O  to select menu bar.\n" +

                    "- Use ENTER/SPACE to close this message.\n", "HELP");
            }
            else if (Keyboard.Modifiers == ModifierKeys.Control && e.Key == Key.LeftCtrl)
            {
                if (doctorCombo.IsFocused)
                {
                    confirmButton.Focus();
                }
                else if (confirmButton.IsFocused)
                {
                    backButton.Focus();
                }
                else if (helpButton.IsFocused)
                {
                    doctorCombo.Focus();
                }
            }

            else if (Keyboard.Modifiers == ModifierKeys.Control && e.Key == Key.RightCtrl)
            {
                if (confirmButton.IsFocused)
                {
                    doctorCombo.Focus();
                }
                else if (backButton.IsFocused)
                {
                    confirmButton.Focus();
                }

                else if (doctorCombo.IsFocused)
                {
                    helpButton.Focus();
                }
            }
            else if (Keyboard.Modifiers == ModifierKeys.Control && e.Key == Key.O)
            {
                File_Name.Focus();
            }
            else if (Keyboard.Modifiers == ModifierKeys.Control && e.Key == Key.Q)
            {
                var s = new AccountSettings();
                gridMain.Children.Clear();
                gridMain.Children.Add(s);
            }
            else if (Keyboard.Modifiers == ModifierKeys.Control && e.Key == Key.W)
            {
                var s = new Settings();
                gridMain.Children.Clear();
                gridMain.Children.Add(s);
            }



            else if (Keyboard.Modifiers == ModifierKeys.Control && e.Key == Key.K)
            {
                var s = new Help();
                gridMain.Children.Clear();
                gridMain.Children.Add(s);
            }
            else if (Keyboard.Modifiers == ModifierKeys.Control && e.Key == Key.A)
            {
                var s = new AskAQuestion();
                gridMain.Children.Clear();
                gridMain.Children.Add(s);
            }
            else if (Keyboard.Modifiers == ModifierKeys.Control && e.Key == Key.F)
            {
                var s = new FillInAQuestionarie();
                gridMain.Children.Clear();
                gridMain.Children.Add(s);
            }
            else if (Keyboard.Modifiers == ModifierKeys.Control && e.Key == Key.D)
            {
                string sMessageBoxText = "Are you sure you want to log out?";
                string sCaption        = "Log out";

                MessageBoxButton btnMessageBox = MessageBoxButton.YesNoCancel;
                MessageBoxImage  icnMessageBox = MessageBoxImage.Warning;

                MessageBoxResult rsltMessageBox = MessageBox.Show(sMessageBoxText, sCaption, btnMessageBox, icnMessageBox);

                switch (rsltMessageBox)
                {
                case MessageBoxResult.Yes:
                    var s = new PatientMainWindow();
                    s.Show();
                    break;

                case MessageBoxResult.No:

                    break;

                case MessageBoxResult.Cancel:

                    break;
                }
            }
            else if (Keyboard.Modifiers == ModifierKeys.Control && e.Key == Key.Z)
            {
                var s = new MyAppointments();
                gridMain.Children.Clear();
                gridMain.Children.Add(s);
            }
            else if (Keyboard.Modifiers == ModifierKeys.Control && e.Key == Key.X)
            {
                var s = new MedicalHistory();
                gridMain.Children.Clear();
                gridMain.Children.Add(s);
            }
            else if (Keyboard.Modifiers == ModifierKeys.Control && e.Key == Key.L)
            {
                var s = new MedicalTherapyOnAWeeklyBasis();
                s.Show();
            }
            else if (Keyboard.Modifiers == ModifierKeys.Control && e.Key == Key.V)
            {
                var s = new EmergencyPhoneNumbers();
                gridMain.Children.Clear();
                gridMain.Children.Add(s);
            }
            else if (Keyboard.Modifiers == ModifierKeys.Control && e.Key == Key.N)
            {
                var s = new Notification();
                gridMain.Children.Clear();
                gridMain.Children.Add(s);
            }
            else if (Keyboard.Modifiers == ModifierKeys.Control && e.Key == Key.M)
            {
                var s = new MakeAnAppointment();
                gridMain.Children.Clear();
                gridMain.Children.Add(s);
            }
        }