public void Login()
        {
            DoctorWindow doctorWindow = new DoctorWindow(_doctor);

            Application.Current.MainWindow = doctorWindow;
            doctorWindow.Show();
        }
Ejemplo n.º 2
0
        void ShowView(object items)
        {
            object[] parameters  = items as object[];
            var      currentWind = parameters[0] as Window;

            if (ActiveUser.status == 1)
            {
                MainVM     mv = new MainVM();
                MainWindow mw = new MainWindow()
                {
                    DataContext = mv
                };
                currentWind.Close();
                mw.Show();
            }
            else if (ActiveUser.status == 2)
            {
                DoctorWindowVM dwmv = new DoctorWindowVM(ActiveUser);
                DoctorWindow   dw   = new DoctorWindow()
                {
                    DataContext = dwmv
                };
                currentWind.Close();
                dw.Show();
            }
        }
 public DoctorEditAppointmentWindow(Appointment selected, DoctorWindow parent)
 {
     this.selected = selected;
     this.parent   = parent;
     InitializeComponent();
     InitializeComboBoxes();
 }
 public DrugsPage(DoctorWindow parent)
 {
     this.parent = parent;
     InitializeComponent();
     UpdateList();
     IngredientsList.Items.Clear();
 }
Ejemplo n.º 5
0
 public DrugsValidationViewModel(DoctorWindow parent)
 {
     this.parent     = parent;
     ValidateCommand = new MyICommand(Validate_Click);
     ReturnCommand   = new MyICommand(Return_Click);
     UpdateList();
 }
Ejemplo n.º 6
0
 public static ProfilePage GetPage(DoctorWindow parent)
 {
     if (instance == null)
     {
         instance = new ProfilePage(parent);
     }
     return(instance);
 }
 public static AppointmentsViewModel GetPage(DoctorWindow parent)
 {
     if (instance == null)
     {
         instance = new AppointmentsViewModel(parent);
     }
     return(instance);
 }
Ejemplo n.º 8
0
 public static TutorialPage GetPage(DoctorWindow parent)
 {
     if (instance == null)
     {
         instance = new TutorialPage(parent);
     }
     return(instance);
 }
 public static DrugsPage GetPage(DoctorWindow parent)
 {
     if (instance == null)
     {
         instance = new DrugsPage(parent);
     }
     return(instance);
 }
Ejemplo n.º 10
0
        private void ShowDoctorView(object obj)
        {
            IView           view;
            DoctorViewModel vmodel = new DoctorViewModel();

            view = new DoctorWindow(vmodel);
            vmodel.settoClose(view);
            view.Show();
            viewToClose.Close();
        }
 public AppointmentsViewModel(DoctorWindow parent)
 {
     this.parent              = parent;
     NewAppointmentCommand    = new MyICommand(Add_Click);
     EditAppointmentCommand   = new MyICommand(Edit_Click);
     DeleteAppointmentCommand = new MyICommand(Delete_Click);
     DoubleClickComand        = new MyICommand(Double_Click);
     _statusOfAppointmentController.CheckMissedAppointments();
     UpdateTable();
 }
 public ProfilePageViewModel(DoctorWindow parent)
 {
     this.parent = parent;
     Name        = parent.Doctor.Name + " " + parent.Doctor.Surname;
     Title       = _doctorController.GetType(parent.Doctor);
     Date        = parent.Doctor.DateOfBirth.Date.ToString();
     JMBG        = parent.Doctor.JMBG;
     Address     = parent.Doctor.ResidentialAddress.ToString();
     Email       = parent.Doctor.Email;
 }
 public MedicalRecordWindow(Patient patient, DoctorWindow parent, Appointment selectedAppointment = null)
 {
     this.selected = patient;
     this.parent   = parent;
     InitializeComponent();
     FillMedicalRecord(selectedAppointment);
     WriteAllergies(selected);
     WriteHospitalisation();
     BlackOutDates();
 }
        public TutorialPageViewModel(DoctorWindow parent)
        {
            this.parent      = parent;
            StartStopCommand = new MyICommand(Start_Stop_Click);
            string projectPath = Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory()));

            mediaElementObject.Source         = new Uri(projectPath + "\\Images\\tutorial.mp4", UriKind.Absolute);
            mediaElementObject.LoadedBehavior = MediaState.Manual;
            mediaElementObject.Play();
            buttonText = "Pauziraj";
        }
        private void ShowDoctorView(object parameter)
        {
            IView           view;
            DoctorViewModel viewmodel = new DoctorViewModel();

            view = new DoctorWindow(viewmodel);

            viewmodel.settoClose(view);

            view.Show();

            viewtoClose.Close();
        }
Ejemplo n.º 16
0
 public DoctorWindowViewModel(Doctor doctor, DoctorWindow parent)
 {
     this.Doctor         = doctor;
     this.parent         = parent;
     parent.Title        = doctor.Name + " " + doctor.Surname;
     parent.Main.Content = ProfilePage.GetPage(parent);
     PatientsCommand     = new MyICommand(Patients_Click);
     AppointmentsCommand = new MyICommand(Appointments_Click);
     MedicineCommand     = new MyICommand(Medicine_Click);
     TutorialCommand     = new MyICommand(Tutorial_Click);
     ProfileCommand      = new MyICommand(Profile_Click);
     LogoutCommand       = new MyICommand(Logout_Click);
     FeedbackCommand     = new MyICommand(Feedback_Click);
 }
Ejemplo n.º 17
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (Username.Text.Equals("sekretar") && Password.Password.Equals("123"))
     {
         AllPatientsWindow window = new AllPatientsWindow();
         Close();
         window.Show();
     }
     else if (Username.Text.Equals("upravnik") && Password.Password.Equals("123"))
     {
         WindowsManager window = new WindowsManager();
         Close();
         window.Show();
     }
     else if (Username.Text.Equals("lekar") && Password.Password.Equals("123"))
     {
         Windows.Doctor1.DoctorWindow window = new DoctorWindow();
         Close();
         window.Show();
     }
     else
     {
         List <Patient> patients = sc.GetAllPatients();
         string         username;
         string         password;
         enteredUsername = Username.Text;
         string enteredPassword = Password.Password;
         for (int i = 0; i < patients.Count; i++)
         {
             username = patients[i].Username;
             password = patients[i].Password;
             if (enteredUsername == username && enteredPassword == password)
             {
                 WindowPatient window = new WindowPatient();
                 Close();
                 window.Show();
             }
         }
         InvalidInfoLabel.Content = "* invalid username or password";
     }
 }
Ejemplo n.º 18
0
        private void SaveExecute(object parametar)
        {
            var passwordBox = parametar as PasswordBox;
            var password    = passwordBox.Password;

            Doctor.DoctorPassword = password;
            try
            {
                if (service.AddDoctor(Doctor) != null)
                {
                    //isUpdateDoctor = true;
                    DoctorWindow window = new DoctorWindow(Doctor);
                    window.Show();
                    addDoctor.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
        public void ShowView(object parameter)
        {
            if (AdminRights)
            {
                AdminViewModel adminViewModel = new AdminViewModel();
                IView          adminView      = new AdminWindow(adminViewModel);
                adminViewModel.settoClose(adminView);
                adminView.Show();
                toClose.Close();
            }

            else if (DoctorRights)
            {
                DoctorViewModel doctorViewModel = new DoctorViewModel();
                IView           doctorView      = new DoctorWindow(doctorViewModel);
                doctorViewModel.settoClose(doctorView);
                doctorView.Show();
                toClose.Close();
            }

            else if (PatientRights)
            {
                PatientViewModel patientViewModel = new PatientViewModel();
                IView            patientView      = new PatientWindow(patientViewModel);
                patientViewModel.settoClose(patientView);
                patientView.Show();
                toClose.Close();
            }

            else
            {
                IView authenticationWindow        = null;
                AuthenticationViewModel viewModel = new AuthenticationViewModel(new AuthenticationService());
                authenticationWindow = new AuthenticationWindow(viewModel);
                viewModel.settoClose(authenticationWindow);
                authenticationWindow.Show();
                toClose.Close();
            }
        }
        private void ShowView(object obj)
        {
            if (DoctorRights)
            {
                IView           view;
                DoctorViewModel vmodel = new DoctorViewModel();

                view = new DoctorWindow(vmodel);
                vmodel.settoClose(view);
                view.Show();
                viewToClose.Close();
            }
            else
            {
                IView            view;
                PatientViewModel vmodel = new PatientViewModel();

                view = new PatientWindow(vmodel);
                vmodel.settoClose(view);
                view.Show();
                viewToClose.Close();
            }
        }
Ejemplo n.º 21
0
        private void LoginExecute(object parametar)
        {
            try
            {
                var         passwordBox = parametar as PasswordBox;
                var         password    = passwordBox.Password;
                ServiceCode service     = new ServiceCode();

                Doctor doctor = service.LoginDoctor(Username, password);
                if (doctor == null)
                {
                    Patient patient = service.LoginPatient(Username, password);

                    if (patient == null)
                    {
                        MessageBox.Show("Uneti korisnik ne postoji!");
                    }
                    else
                    {
                        PatientWindow patientWindow = new PatientWindow(patient);
                        patientWindow.Show();
                        main.Close();
                    }
                }
                else
                {
                    DoctorWindow window = new DoctorWindow(doctor);
                    window.Show();
                    main.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Ejemplo n.º 22
0
 public DoctorAddAppointmentWindow(DoctorWindow parent)
 {
     this.parent = parent;
     InitializeComponent();
     InitializeComboBoxes();
 }
Ejemplo n.º 23
0
 public DoctorViewModel(Doctor doctor, DoctorWindow docWindow)
 {
     this.docWindow = docWindow;
     this.doctor    = doctor;
     RequestList    = new ObservableCollection <vwRequest>(service.GetAllRequestByDoctor(doctor.DoctorId));
 }
 public AppointmentsPage(DoctorWindow parent)
 {
     InitializeComponent();
     this.DataContext = new AppointmentsViewModel(parent);
     _statusOfAppointmentController.CheckMissedAppointments();
 }
Ejemplo n.º 25
0
 public TutorialPage(DoctorWindow parent)
 {
     this.parent = parent;
     InitializeComponent();
     this.DataContext = new TutorialPageViewModel(parent);
 }
Ejemplo n.º 26
0
 public DoctorPatientsViewModel(DoctorWindow parent)
 {
     this.parent          = parent;
     MedicalRecordCommand = new MyICommand(Medical_Record_Click);
     UpdateTable();
 }
 public DoctorPatientsPage(DoctorWindow parent)
 {
     this.parent = parent;
     InitializeComponent();
     this.DataContext = new DoctorPatientsViewModel(parent);
 }
Ejemplo n.º 28
0
 public DoctorFeedbackPage(DoctorWindow parent)
 {
     InitializeComponent();
     this.DataContext = new FeedbackViewModel(parent.Doctor.Username);
 }
 public DrugsValidationWindow(DoctorWindow parent)
 {
     InitializeComponent();
     this.DataContext = new DrugsValidationViewModel(parent);
 }
Ejemplo n.º 30
0
        // DataBase command. Auth

        static public void Auth(string table, string id, string password)
        {
            int    count    = 0;
            string position = "";
            bool   isAuth   = false;

            //NpgsqlConnection connect = new NpgsqlConnection() { ConnectionString = DataBase.connect_params };

            string query = string.Format(@"SELECT * FROM {0} WHERE id='{1}' AND password='******';", table, id, password);

            NpgsqlCommand command = new NpgsqlCommand(query, DataBase.connect);

            DataBase.connect.Open();
            try
            {
                command.ExecuteNonQuery();
                NpgsqlDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    count++;
                    if (table != "client" && table == "employee")
                    {
                        position = reader["position"].ToString();
                    }
                }
                reader.Close();
                if (count == 1)
                {
                    MessageBox.Show("Вы успешно авторизировались");
                    isAuth = true;
                }
                else
                {
                    MessageBox.Show("Неправильный ID или пароль");
                    isAuth = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                DataBase.connect.Close();
            }

            if (table == "client" && isAuth == true)
            {
                App.Current.MainWindow.Hide();
                int x;
                x = Convert.ToInt32(id);
                ClientViewModel.Client_Id = x;
                ClientWindow clientWindow = new ClientWindow();
                clientWindow.Show();
            }
            else
            {
                if (table == "employee" && isAuth == true)
                {
                    if (position.Contains("Инструктор"))
                    {
                        int x;
                        x = Convert.ToInt32(id);
                        InstructorViewModel.Employee_Id = x;
                        InstructorWindow instWindow = new InstructorWindow();
                        instWindow.Show();
                    }
                    if (position == "Врач")
                    {
                        int x;
                        x = Convert.ToInt32(id);
                        DoctorViewModel.Employee_Id = x;
                        DoctorWindow doctorWindow = new DoctorWindow();
                        doctorWindow.Show();
                    }
                    if (position == "Администратор")
                    {
                        int x;
                        x = Convert.ToInt32(id);
                        AdminViewModel.Employee_Id = x;
                        AdminWindow admWindow = new AdminWindow();
                        admWindow.Show();
                    }
                    App.Current.MainWindow.Hide();
                }
            }
        }