public IActionResult OnGet(int id)
 {
     Patient = patientData.GetPatientById(id);
     if (Patient == null)
     {
         return(RedirectToPage("~/NotFound"));
     }
     return(Page());
 }
Beispiel #2
0
 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;
     }
 }
Beispiel #3
0
        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>()));
        }
Beispiel #4
0
 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;
     }
 }
Beispiel #5
0
        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;
        }
Beispiel #6
0
        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()]);
            }
        }
Beispiel #7
0
        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;
        }
Beispiel #8
0
        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());
        }
Beispiel #9
0
        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();
        }
Beispiel #10
0
        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);
                }
            }
        }