public IActionResult OnGet(int id) { Patient = patientData.GetPatientById(id); if (Patient == null) { return(RedirectToPage("~/NotFound")); } return(Page()); }
private void SetPersonProperties(Core.Patient person, UserViewModel newUser, SystemUser systemUser) { if (person != null) { person.Department = context.Nurses.Include(n => n.Department).FirstOrDefault().Department; person.FirstName = newUser.FirstName; person.SecondName = newUser.SecondName; person.SystemUser = systemUser; } }
public void SearchReturnPatient() { var patients = new Core.Patient(mock.Object).SearchPatient(new Core.DAO.SearchCriteria { SearchPattern = "Test1" }); Assert.AreEqual(1, patients.Count); mock.Verify(p => p.SearchPatient(It.IsAny <Data.DAO.SearchCriteria>())); }
private void LnkNewRecord_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { using (var frm = new PatientInfoDialog()) { if (frm.ShowDialog(this) != DialogResult.OK) { return; } SelectedPatient = frm.PatientItem; DialogResult = DialogResult.OK; } }
private static void DisplayToGridRow(Core.Patient patient, DataGridViewRow row) { row.Cells["Id"].Value = patient.Id; row.Cells["Name"].Value = patient.Fullname; row.Cells["Gender"].Value = patient.Gender; row.Cells["BloodType"].Value = patient.BloodType; row.Cells["Age"].Value = patient.Age; row.Tag = patient; }
private void BtnAdd_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; var newItem = new Core.Patient(); using (var frm = new PatientInfoDialog()) { frm.PatientItem = newItem; if (frm.ShowDialog(this) != DialogResult.OK) { return; } DisplayToGridRow(newItem, Grid.Rows[Grid.Rows.Add()]); } }
private void BtnOpen_Click(object sender, EventArgs e) { if (!int.TryParse(txtId.Text, out var id)) { ShowError(txtId, "Enter Valid Id"); return; } SelectedPatient = new Core.Patient(); if (!SelectedPatient.LoadById(id)) { ShowError(txtId, "Invalid Id"); return; } DialogResult = DialogResult.OK; }
public IActionResult OnGet(int?id) { if (id.HasValue) { Patient = patientData.GetPatientById(id.Value); if (Patient == null) { return(RedirectToPage("./NotFound")); } } else { Patient = new Core.Patient(); } var doctors = doctorData.GetDoctors().ToList().Select(d => new { Id = d.Id, Display = $"{d.FirstName} {d.LastName}" }); Doctors = new SelectList(doctors, "Id", "Display"); Gender = htmlHelper.GetEnumSelectList <Gender>(); return(Page()); }
public void AddPatient(UserViewModel newUser) { var systemUser = new SystemUser { UserName = newUser.UserName, Email = newUser.Email, PhoneNumber = newUser.PhoneNumber }; var passHash = userManager.PasswordHasher.HashPassword(systemUser, newUser.Password); systemUser.PasswordHash = passHash; userManager.CreateAsync(systemUser).Wait(); var role = UserRoleTypes.Patient.ToString(); userManager.AddToRoleAsync(systemUser, role).Wait(); var person = new Core.Patient(); SetPersonProperties(person, newUser, systemUser); context.Patients.Add(person); context.SaveChanges(); }
private void BtnSearch_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; lnkHistory.Enabled = false; using (var frm = new PatientSearchDialog()) { if (frm.ShowDialog(this) != DialogResult.OK) { return; } _selectedPatient = frm.SelectedPatient; DisplayPatientInfo(); lnkHistory.Enabled = true; if (_historyDialog != null && _historyDialog.Visible) { _selectedPatient.LoadTreatmentHistory(); _historyDialog.Show(); _historyDialog.RefreshData(_selectedPatient.TreatmentHistoryItems); } } }