예제 #1
0
        public void TestFetchPatientInfoFromBedIdReturnsBedObjectForBedIdExists()
        {
            var patientData = new PatientDataRepository(Context);
            var response    = patientData.FetchPatientInfoFromBedId("1A1");

            Assert.NotNull(response);
        }
예제 #2
0
        public void TestFetchBedInfoFromPatientIdSuccessful()
        {
            var patientData = new PatientDataRepository(Context);

            patientData.FetchBedInfoFromPatientId(1);
            Assert.NotNull(patientData);
        }
예제 #3
0
        public void CheckIfPatientIsDeletedWhenDoesNotExist()
        {
            PatientDataRepository patientDataRepository = new PatientDataRepository();
            var response = patientDataRepository.DischargePatient(8);

            Assert.AreEqual(false, response);
        }
예제 #4
0
        public void GetPatientDetailsWhenPatientDoesNotExist()
        {
            PatientDataRepository patientDataRepository = new PatientDataRepository();
            var response = patientDataRepository.GetPatient(126);

            Assert.AreEqual(null, response);
        }
예제 #5
0
        public void GetAllPatientWhenICUDoesntExist()
        {
            PatientDataRepository patientDataRepository = new PatientDataRepository();
            var response = patientDataRepository.GetAllPatientsInTheICU(139);

            Assert.AreEqual(0, response.Count);
        }
예제 #6
0
        public void GetAllPatientWhenPatientsArePresent()
        {
            PatientDataRepository patientDataRepository = new PatientDataRepository();
            var response = patientDataRepository.GetAllPatientsInTheICU(1);

            Assert.AreEqual("ana", response[0].Name);
            Assert.AreEqual(6, response[0].Id);
        }
예제 #7
0
        public void GetPatientDetailsWhenPatientExists()
        {
            PatientDataRepository patientDataRepository = new PatientDataRepository();
            var response = patientDataRepository.GetPatient(6);

            Assert.AreEqual("ana", response.Name);
            Assert.AreEqual("b+", response.BloodGroup);
        }
예제 #8
0
        public void TestFreeTheBedRemovePatientEntry()
        {
            var patientData = new PatientDataRepository(Context);
            var bed         = Context.BedInformation.First
                                  (p => p.PatientId == 1);

            patientData.RemovePatientFromBed(1);
            Assert.Null(bed.PatientId);
        }
예제 #9
0
        public void TestAllotBedToPatientSuccessful()
        {
            var patientData = new PatientDataRepository(Context);
            var allotBed    = new BedAllotmentModel {
                Department = "Dept", PatientId = 10
            };

            patientData.AllotBedToPatient(allotBed);
            var patientDataInDb = Context.BedInformation.First(bed => bed.WardNumber == "1B");

            Assert.Equal(10, patientDataInDb.PatientId);
        }
예제 #10
0
        public void WhenICUIsFullStatusNotFound()
        {
            PatientDataRepository patientDataRepository = new PatientDataRepository();
            PatientDetailsInput   patientDetailsInput   = new PatientDetailsInput();

            patientDetailsInput.address    = "kolkata";
            patientDetailsInput.age        = 45;
            patientDetailsInput.bloodGroup = "o+";
            patientDetailsInput.name       = "venu";
            var response = patientDataRepository.AddNewPatient(1, patientDetailsInput);

            Assert.AreEqual(false, response);
        }
예제 #11
0
        public void CheckIfPatientIsDeletedWhenExists()
        {
            string           cs  = @"URI=file:\a\alert-to-care-s22b8\alert-to-care-s22b8\Alert-to-Care\Patient.db";
            SQLiteConnection con = new SQLiteConnection(cs, true);

            con.Open();
            using var cmd   = new SQLiteCommand(con);
            cmd.CommandText = @"INSERT INTO Patient(Id, Name, Age, BloodGroup, Address, IcuId, BedNumber) VALUES('200', 'ananya', '90', 'B+', 'Bihar', '2', '2')";
            cmd.ExecuteNonQuery();
            PatientDataRepository patientDataRepository = new PatientDataRepository();
            var response = patientDataRepository.DischargePatient(200);

            Assert.AreEqual(true, response);
        }
예제 #12
0
        public void TestAddPatientSuccessful()
        {
            var dummyPatient = new PatientDataModel
            {
                PatientName = "Patient1",
                Address     = "Address",
                Mobile      = "98989898989",
                Email       = "*****@*****.**"
            };
            var patientData = new PatientDataRepository(Context);

            patientData.AddPatient(dummyPatient);
            var patientDataInDb = Context.PatientInfo.First
                                      (p => p.PatientName == "Patient1");

            Assert.NotNull(patientDataInDb);
        }
예제 #13
0
        private void RegisterPatientButtonClick(object sender, RoutedEventArgs e)
        {
            if (noOfErrorsOnScreen > 0)
            {
                errorLabel.Visibility = System.Windows.Visibility.Visible;
                return;
            }

            bool isMale = false;

            try
            {
                if (rdMale.IsChecked != null && bool.Parse(rdMale.IsChecked.ToString()))
                {
                    isMale = true;
                }
                var patientDataRepository = new PatientDataRepository();
                patientDataRepository.SavePatientRecord(new Patient
                {
                    FirstName    = txtFirstName.Text.Trim(),
                    LastName     = txtLastName.Text.Trim(),
                    MiddleName   = txtMiddleName.Text.Trim(),
                    Address      = txtAddress.Text.Trim(),
                    Gender       = isMale,
                    DOB          = dtPicker.SelectedDate.Value,
                    EmailAddress = txtEmailAddress.Text.Trim(),
                    UserName     = txtUserName.Text.Trim(),
                    Password     = EncryptDecrypt.EncryptData(passWordBox.Password),
                    PhoneNumber  = txtPhoneNumber.Text.Trim()
                });
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            this.Hide();
            var mainWindow = new MainWindow();

            mainWindow.ShowDialog();
            this.Close();
        }
        private bool validateUser(string username, string password)
        {
            var patientDataRepository = new PatientDataRepository();

            password = EncryptDecrypt.EncryptData(password);
            var patient = patientDataRepository.GetPatientByUserNamePassword(username, password);

            if (patient != null)
            {
                if (patient.UserName.Equals(username) && patient.Password.Equals(password))
                {
                    EHealthCareDesktopApp.Properties.Settings.Default.PatientID        = patient.PatientId;
                    EHealthCareDesktopApp.Properties.Settings.Default.PatientName      = patient.FirstName + "  " + patient.LastName;
                    EHealthCareDesktopApp.Properties.Settings.Default.UniqueIdentifier = patient.UniqueIdentifier;
                    EHealthCareDesktopApp.Properties.Settings.Default.Save();
                    return(true);
                }
            }

            return(false);
        }
예제 #15
0
 public PatientViewModel()
 {
     _collectionsManagerService = new CollectionsManagerService();
     _patientDataRepository     = new PatientDataRepository();
     PatientSummary             = new ObservableCollection <PatientModel>();
     Diagnostics  = new ObservableCollection <string>();
     Allergies    = new ObservableCollection <string>();
     Model        = new PatientModel();
     PicturePath  = Path.GetFullPath(Environment.CurrentDirectory + "/Images");
     MyVisibility = Visibility.Hidden;
     LoadPatient();
     GenerateDiagnosticsSummaryText();
     GenerateAllergiesSummaryText();
     _closeAndSaveCommand                = new DelegateCommand(a => SaveAndClose());
     _addDiagnosticsCommand              = new DelegateCommand(b => AddDiagnostics());
     _removeDiagnosticsCommand           = new DelegateCommand(c => RemoveDiagnostics());
     _addAllergiesCommand                = new DelegateCommand(d => AddAllergies());
     _removeAllergiesCommand             = new DelegateCommand(e => RemoveAllergies());
     _openExplorerToChangePictureCommand = new DelegateCommand(f => OpenExplorerToChangePicture());
     DiagnosticsAddButtonName            = "Add";
     AllergiesAddButtonName              = "Add";
     CommaDelimitedDiagnostics           = string.Empty;
 }