public NewPatientWindow(Nurse sessionDoctor, WorkingWindow window) { InitializeComponent(); this.window = window; this.sessionDoctor = sessionDoctor; NewPatViewModel viewModel = new NewPatViewModel(sessionDoctor); this.DataContext = viewModel; viewModel.addNewPatCompleted += AddNewPatView; }
public NewDoctorWindow(HeadPhysician sessionDoctor, WorkingWindow window) { InitializeComponent(); this.window = window; this.sessionDoctor = sessionDoctor; NewDocViewModel viewModel = new NewDocViewModel(sessionDoctor); this.DataContext = viewModel; viewModel.addDocCompleted += AddNewDocView; }
private void LoginFunction(object sender, RoutedEventArgs e) { string login = LoginField.Text; string password = PasswordField.Password; string query = "SELECT password, retired, post from Worker where cast(id as TEXT) = @login"; Dictionary <string, object> parameters = new Dictionary <string, object> { { "login", login } }; Dictionary <int, object> reader = DBConnector.queryExecuteSingleResult(query, parameters); if (reader.Count != 0 && password == Convert.ToString(reader[0]) && Convert.ToInt32(reader[1]) == 0) { int post = Convert.ToInt32(reader[2]); Nurse sessionDoctor; if (post == 1) { sessionDoctor = new Doctor(); } else if (post == 2) { sessionDoctor = new HeadPhysician(); } else { sessionDoctor = new Nurse(); } ((IDatabaseCommutable)sessionDoctor).LoadFromDb(Int32.Parse(login)); WorkingWindow workingWindow = new WorkingWindow(sessionDoctor); workingWindow.Show(); this.Close(); } else { wrongDataText.Visibility = Visibility.Visible; LoginField.Foreground = Brushes.Red; PasswordField.Foreground = Brushes.Red; } }