예제 #1
0
        public static void Seed()
        {
            var patients = PatientDb.Open();

            if (!patients.Find(p => p.Name == "Scott").Any())
            {
                var data = new List <Patient>()
                {
                    new Patient
                    {
                        Name     = "Scott",
                        Ailments = new List <Ailment>()
                        {
                            new Ailment {
                                Name = "Crazy"
                            }
                        },
                        Medications = new List <Medication>()
                        {
                            new Medication {
                                Name = "Medication1", Doses = 1
                            }
                        }
                    },
                    new Patient
                    {
                        Name     = "Joy",
                        Ailments = new List <Ailment>()
                        {
                            new Ailment {
                                Name = "Crazy"
                            }
                        },
                        Medications = new List <Medication>()
                        {
                            new Medication {
                                Name = "Medication2", Doses = 2
                            }
                        }
                    },
                    new Patient
                    {
                        Name     = "Sarah",
                        Ailments = new List <Ailment>()
                        {
                            new Ailment {
                                Name = "Crazy"
                            }
                        },
                        Medications = new List <Medication>()
                        {
                            new Medication {
                                Name = "Medication3", Doses = 3
                            }
                        }
                    }
                };
                patients.InsertMany(data);
            }
        }
예제 #2
0
        public void Test_BirthdateValidationSuccess()
        {
            var patientDb = new PatientDb();

            Assert.IsTrue(patientDb.ValidateField("birthdate", "01.01.1970"));
            Assert.IsTrue(patientDb.ValidateField("birthdate", "31.05.2018"));
        }
        private void GetAllPatient()
        {
            var patientDb = new PatientDb();

            patientDb.GetAllPatient();
            dgvPatient.DataSource = null;
            dgvPatient.DataSource = patientDb.GetAllPatient();
        }
예제 #4
0
        public static void Seed()
        {
            var patients = PatientDb.Open();

            if (!patients.AsQueryable().Any(p => p.Name == "Scott"))
            {
            }
        }
        public static void Seed()
        {
            var patients = PatientDb.Open();

            if (!patients.AsQueryable().Any(p => p.Name == "Chris"))
            {
                var data = new List <Patient>()
                {
                    new Patient {
                        Name     = "Chris",
                        Ailments = new List <Ailment>()
                        {
                            new Ailment {
                                Name = "Piracy"
                            }
                        },
                        Medications = new List <Medication>()
                        {
                            new Medication {
                                Name = "Rum", Doses = 1
                            }
                        }
                    },
                    new Patient {
                        Name     = "Hailey",
                        Ailments = new List <Ailment>()
                        {
                            new Ailment {
                                Name = "Qwerty"
                            }
                        },
                        Medications = new List <Medication>()
                        {
                            new Medication {
                                Name = "Aspirin", Doses = 200
                            }
                        }
                    },
                    new Patient {
                        Name     = "Chris",
                        Ailments = new List <Ailment>()
                        {
                            new Ailment {
                                Name = "Boring"
                            }
                        },
                        Medications = new List <Medication>()
                        {
                            new Medication {
                                Name = "Cool", Doses = 3
                            }
                        }
                    },
                };

                patients.InsertBatch(data);
            }
        }
예제 #6
0
        public static void Seed()
        {
            var patients = PatientDb.Open();

            if (!patients.AsQueryable().Any(p => p.Name == "Scott"))
            {
                var data = new List <Patient>()
                {
                    new Patient
                    {
                        Name     = "Scott",
                        Ailments = new List <Ailment>()
                        {
                            new Ailment {
                                Name = "Crazy"
                            }
                        },
                        Medications = new List <Medication> {
                            new Medication {
                                Name = "B6", Doses = 100
                            }
                        }
                    },
                    new Patient
                    {
                        Name     = "Joy",
                        Ailments = new List <Ailment>()
                        {
                            new Ailment {
                                Name = "Crazy"
                            }
                        },
                        Medications = new List <Medication> {
                            new Medication {
                                Name = "Complex B", Doses = 500
                            }
                        }
                    },
                    new Patient
                    {
                        Name     = "Sarah",
                        Ailments = new List <Ailment>()
                        {
                            new Ailment {
                                Name = "Crazy"
                            }
                        },
                        Medications = new List <Medication> {
                            new Medication {
                                Name = "Complex vitamin", Doses = 1000
                            }
                        }
                    }
                };

                patients.InsertBatch(data);
            }
        }
예제 #7
0
        public void Test_BirthdateValidationFailure()
        {
            var patientDb = new PatientDb();

            Assert.IsFalse(patientDb.ValidateField("birthdate", ""));
            Assert.IsFalse(patientDb.ValidateField("birthdate", "invalid"));
            Assert.IsFalse(patientDb.ValidateField("birthdate", "00.00.0000"));
            Assert.IsFalse(patientDb.ValidateField("birthdate", "32.05.2018"));
        }
예제 #8
0
        public static void Seed()
        {
            var patients = PatientDb.Open();

            if (!patients.AsQueryable().Any(p => p.Name == "Scott"))
            {
                var data = new List <Patient>()
                {
                    new Patient {
                        Name     = "Scott",
                        Ailments = new List <Ailment>()
                        {
                            new Ailment {
                                Name = "Funny"
                            }
                        },
                        Medications = new List <Medication> {
                            new Medication {
                                Name = "Laughter", Doses = 2
                            }
                        }
                    },
                    new Patient {
                        Name     = "Ryan",
                        Ailments = new List <Ailment>()
                        {
                            new Ailment {
                                Name = "Crazy"
                            }
                        },
                        Medications = new List <Medication> {
                            new Medication {
                                Name = "GoofyPills", Doses = 1
                            }
                        }
                    },
                    new Patient {
                        Name     = "Chris",
                        Ailments = new List <Ailment>()
                        {
                            new Ailment {
                                Name = "Cranky"
                            }
                        },
                        Medications = new List <Medication> {
                            new Medication {
                                Name = "ChillPills", Doses = 3
                            }
                        }
                    }
                };

                patients.InsertMany(data);
            }
        }
예제 #9
0
        /// <summary>
        /// This is the old way, don't do this now, return IHttpActionResult instead of HttpResponseMessage
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public HttpResponseMessage Get(string id)
        {
            var patients = PatientDb.FindAll();
            var patient  = patients.FirstOrDefault(p => p.Id.Equals(id));

            if (patient == null)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Patient not found"));
            }

            return(Request.CreateResponse(patient));
        }
예제 #10
0
        public IHttpActionResult GetMedications(string id)
        {
            var patients = PatientDb.FindAll();
            var patient  = patients.FirstOrDefault(p => p.Id.Equals(id));

            if (patient == null)
            {
                return(NotFound());
            }

            return(Ok(patient.Medications));
        }
예제 #11
0
        public async Task <IActionResult> Post(Exam exam)
        {
            if (exam == null)
            {
                return(NotFound("Empty exam"));
            }
            UsersDb   users   = _examContext.Users.FirstOrDefault(u => u.UsersId == exam.UsersId);
            PatientDb patient = _examContext.Patient.FirstOrDefault(p => p.PatientId == exam.PatientId);
            ExamDb    newExam = new ExamDb(exam, patient, users);
            await _examContext.Exam.AddAsync(newExam);

            await _examContext.SaveChangesAsync();

            return(Ok(_examContext.Exam.ToList()));
        }
예제 #12
0
        public IActionResult Put(int id, Exam newExam)
        {
            if (newExam == null)
            {
                return(NotFound("Not found"));
            }
            UsersDb   users   = _examContext.Users.FirstOrDefault(u => u.UsersId == newExam.UsersId);
            PatientDb patient = _examContext.Patient.FirstOrDefault(p => p.PatientId == newExam.PatientId);
            ExamDb    exam    = new ExamDb(newExam, patient, users);

            exam.ExamId = id;
            _examContext.Exam.Update(exam);
            _examContext.SaveChanges();
            return(Ok(newExam));
        }
예제 #13
0
        public static void Seed()
        {
            var patients = PatientDb.Open();

            if (!patients.AsQueryable().Any(p => p.Name == "Scott"))
            {
                var data = new List <Patient>
                {
                    new Patient {
                        Name = "Scott", Ailments = new List <Ailment> {
                            new Ailment {
                                Name = "Bald"
                            }
                        }, Medications = new List <Medication> {
                            new Medication {
                                Name = "Mioxil", Dosage = "100mg"
                            }
                        }
                    },
                    new Patient {
                        Name = "Mili", Ailments = new List <Ailment> {
                            new Ailment {
                                Name = "Crazy"
                            }
                        }, Medications = new List <Medication> {
                            new Medication {
                                Name = "Symbicort", Dosage = "100mg"
                            }
                        }
                    },
                    new Patient {
                        Name = "Baldie", Ailments = new List <Ailment> {
                            new Ailment {
                                Name = "Balding"
                            }
                        }, Medications = new List <Medication> {
                            new Medication {
                                Name = "Rogaine", Dosage = "100mg"
                            }
                        }
                    }
                };

                patients.InsertMany(data);
            }
        }
예제 #14
0
        public static void Seed()
        {
            var patients = PatientDb.Open();

            if (!patients.AsQueryable().Any(p => p.Name == "dodo"))
            {
                var data = new List <Patient>()
                {
                    new Patient
                    {
                        Name     = "dodo",
                        Ailments = new List <Ailment> ()
                        {
                            new Ailment {
                                Name = "Crazyyyy"
                            }
                        },
                        Medications = new List <Medication>()
                    },
                    new Patient
                    {
                        Name     = "toto",
                        Ailments = new List <Ailment> ()
                        {
                            new Ailment {
                                Name = "Biiitch"
                            }
                        },
                        Medications = new List <Medication>()
                        {
                            new Medication {
                                Name = "Hard core", Doses = 100
                            }
                        }
                    }
                };

                patients.InsertMany(data);
            }
        }
예제 #15
0
        public static void Seed()
        {
            var patients = PatientDb.Open();

            if (!patients.AsQueryable().Any(p => p.Name == "Prajat"))
            {
                var data = new List <Patient>()
                {
                    new Patient()
                    {
                        Name = "Rajat", Ailments = new List <Ailment>()
                        {
                            new Ailment()
                            {
                                Name = "gastro"
                            }, new Ailment()
                            {
                                Name = "sex"
                            }
                        },
                        Medications = new List <Medication>()
                        {
                            new Medication()
                            {
                                Name = "juiefcjhb", Doses = 2
                            },
                            new Medication()
                            {
                                Name = "jfljslvjk", Doses = 3
                            }
                        }
                    },
                    new Patient()
                    {
                        Name = "Prajat", Ailments = new List <Ailment>()
                        {
                            new Ailment()
                            {
                                Name = "gastro"
                            }, new Ailment()
                            {
                                Name = "sex"
                            }
                        },
                        Medications = new List <Medication>()
                        {
                            new Medication()
                            {
                                Name = "juiefcjhb", Doses = 2
                            },
                            new Medication()
                            {
                                Name = "jfljslvjk", Doses = 3
                            }
                        }
                    },

                    new Patient()
                    {
                        Name = "efwfwf", Ailments = new List <Ailment>()
                        {
                            new Ailment()
                            {
                                Name = "gastro"
                            }, new Ailment()
                            {
                                Name = "sex"
                            }
                        },
                        Medications = new List <Medication>()
                        {
                            new Medication()
                            {
                                Name = "juiefcjhb", Doses = 2
                            },
                            new Medication()
                            {
                                Name = "jfljslvjk", Doses = 3
                            }
                        }
                    }
                };

                patients.InsertMany(data);
            }
        }
예제 #16
0
 public IEnumerable <Patient> Get()
 {
     return(PatientDb.FindAll());
 }
예제 #17
0
        internal static void SeedDatabase()
        {
            var db = PatientDb.Open();

            if (!db.AsQueryable().Any(p => p.Name == "Scott"))
            {
                var patients = new List <Patient>()
                {
                    new Patient {
                        Name     = "Scott",
                        Ailments = new List <Ailment>()
                        {
                            new Ailment {
                                Name = "Crazy"
                            }, new Ailment {
                                Name = "Old"
                            }
                        },
                        Medications = new List <Medication> {
                            new Medication {
                                Name = "Aspirin", Dosage = 2
                            }
                        }
                    },
                    new Patient {
                        Name     = "Alex",
                        Ailments = new List <Ailment>()
                        {
                            new Ailment {
                                Name = "Crazy"
                            }, new Ailment {
                                Name = "Old"
                            }
                        },
                        Medications = new List <Medication> {
                            new Medication {
                                Name = "Aspirin", Dosage = 2
                            }
                        }
                    },
                    new Patient {
                        Name     = "Chris",
                        Ailments = new List <Ailment>()
                        {
                            new Ailment {
                                Name = "Crazy"
                            }, new Ailment {
                                Name = "Old"
                            }
                        },
                        Medications = new List <Medication> {
                            new Medication {
                                Name = "Aspirin", Dosage = 2
                            }
                        }
                    }
                };

                db.InsertBatch(patients);
            }
        }
    public void SavePatient(Patient unencryptedPatient)
    {
        var encrypted = Crypto.EncryptPatient(unencryptedPatient);

        PatientDb.SavePatient(encrypted);
    }
예제 #19
0
 public PatientsController()
 {
     Patients = PatientDb.Open();
 }
예제 #20
0
        public static void Seed()
        {
            var patients = PatientDb.Open();

            if (!patients.AsQueryable().Any(p => p.Name == "Scott"))
            {
                var data = new List <Patient>()
                {
                    new Patient
                    {
                        Name     = "Scott",
                        Ailments = new List <Ailment>()
                        {
                            new Ailment()
                            {
                                Name = "Crazy Eyes"
                            }
                        },
                        Medications = new List <Medication>()
                        {
                            new Medication()
                            {
                                Name = "Aderall", Doses = 2
                            }
                        }
                    },
                    new Patient
                    {
                        Name     = "Joy",
                        Ailments = new List <Ailment>()
                        {
                            new Ailment()
                            {
                                Name = "Crazy Eyes"
                            }
                        },
                        Medications = new List <Medication>()
                        {
                            new Medication()
                            {
                                Name = "Aderall", Doses = 2
                            }
                        }
                    },
                    new Patient
                    {
                        Name     = "Sarah",
                        Ailments = new List <Ailment>()
                        {
                            new Ailment()
                            {
                                Name = "Crazy Eyes"
                            }
                        },
                        Medications = new List <Medication>()
                        {
                            new Medication()
                            {
                                Name = "Aderall", Doses = 2
                            }
                        }
                    }
                };

                patients.InsertMany(data);
            }
        }
        private void buttonRegister_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection();

            con.ConnectionString = connectionString;

            var numberOfEffectedRow = 0;

            if (con.State != ConnectionState.Open)
            {
                con.Open();
            }

            if (string.IsNullOrEmpty(tbPatientCivilizationNumber.Text) || string.IsNullOrEmpty(tbPatientAge.Text) || string.IsNullOrEmpty(tbPatientName.Text) || string.IsNullOrEmpty(tbPatientSurname.Text))
            {
                MessageBox.Show("Please don't left empty places");
            }
            else if (cbPatientGender.SelectedIndex == 0 || cbDoctorName.SelectedIndex == 0 || cbDoctorDepartment.SelectedIndex == 0)
            {
                MessageBox.Show("Please don't left selected default value");
            }
            else
            {
                // Patient Add
                if (string.IsNullOrEmpty(tbPatientId.Text))
                {
                    var patientDb = new PatientDb();
                    var patient   = new Patient();
                    var doctor    = new Doctor();
                    patient.CivilizationNumber = Convert.ToInt64(tbPatientCivilizationNumber.Text);
                    patient.Name         = tbPatientName.Text;
                    patient.Surname      = tbPatientSurname.Text;
                    patient.Age          = Convert.ToInt32(tbPatientAge.Text);
                    patient.Gender       = cbPatientGender.Text;
                    patient.Complaint    = tbPatientComplaintDescription.Text;
                    patient.RegisterTime = dtpRegisterDate.Value;
                    doctor.ID            = (int)cbDoctorName.SelectedValue;
                    patient = patientDb.AddNewPatient(patient, doctor);
                    numberOfEffectedRow++;
                }
                // Patient update
                else
                {
                    var patientDb = new PatientDb();
                    var patient   = new Patient();
                    var doctor    = new Doctor();
                    patient.ID = Convert.ToInt32(tbPatientId.Text);
                    patient.CivilizationNumber = Convert.ToInt64(tbPatientCivilizationNumber.Text);
                    patient.Name         = tbPatientName.Text;
                    patient.Surname      = tbPatientSurname.Text;
                    patient.Age          = Convert.ToInt32(tbPatientAge.Text);
                    patient.Gender       = cbPatientGender.Text;
                    patient.Complaint    = tbPatientComplaintDescription.Text;
                    patient.RegisterTime = dtpRegisterDate.Value;
                    doctor.ID            = (int)cbDoctorName.SelectedValue;
                    patient = patientDb.UpdatePatient(patient, doctor);
                    numberOfEffectedRow++;
                }
                GetAllPatient();
                MessageBox.Show(numberOfEffectedRow > 0 ? "Success" : "Failed!");
                ChangeColumnsName();
                FormClear();
            }
        }
예제 #22
0
 public PatientController()
 {
     _db = PatientDb.Open();
 }
예제 #23
0
        public static void Seed()
        {
            MongoCollection <Patient> patients = PatientDb.Open();

            if (!patients.AsQueryable().Any(p => p.Name == "Scott"))
            {
                var data = new List <Patient>
                {
                    new Patient
                    {
                        Name     = "Scott",
                        Ailments = new List <Ailment> {
                            new Ailment {
                                Name = "Crazy"
                            }, new Ailment {
                                Name = "Old"
                            }
                        },
                        Medications = new List <Medication> {
                            new Medication {
                                Name = "Aspirin", Doses = 2
                            }
                        }
                    },
                    new Patient
                    {
                        Name     = "Joy",
                        Ailments = new List <Ailment> {
                            new Ailment {
                                Name = "Crazy"
                            }, new Ailment {
                                Name = "Young"
                            }
                        },
                        Medications = new List <Medication> {
                            new Medication {
                                Name = "Aspirin", Doses = 2
                            }
                        }
                    },
                    new Patient
                    {
                        Name     = "Sarah",
                        Ailments = new List <Ailment> {
                            new Ailment {
                                Name = "Crazy"
                            }, new Ailment {
                                Name = "Youngest"
                            }
                        },
                        Medications = new List <Medication> {
                            new Medication {
                                Name = "Aspirin", Doses = 2
                            }
                        }
                    }
                };

                patients.InsertBatch(data);
            }
        }
예제 #24
0
 public PatientController()
 {
     _patients = PatientDb.Open();
 }
예제 #25
0
 public PatientController()
 {
     ThePatientCollection = PatientDb.Open();
 }