Ejemplo n.º 1
0
        private static void SeedDatabase(ClinicsDB db)
        {
            var proc1 = new Procedure() { Name = "Blood test", Price = 50.00m };
            var proc2 = new Procedure() { Name = "MRI", Price = 1000.00m };

            var specialty = new Specialty() { Name = "Internist" };

            var specialist = new Specialist()
            {
                FirstName = "Gregory",
                LastName = "House",
                SpecialtyId = specialty.Id
            };

            var manip = new Manipulation()
            {
                Date = DateTime.Now,
                SpecialistId = specialist.Id
            };

            manip.Procedures.Add(proc1);
            manip.Procedures.Add(proc2);

            db.Procedures.Add(proc1);
            db.Procedures.Add(proc2);
            db.Specialties.Add(specialty);
            db.Specialists.Add(specialist);
            db.Manipulations.Add(manip);

            SaveChanges(db);
        }
Ejemplo n.º 2
0
        private Manipulation CreateNewManipulation(IClinicsData data, string currentReportDate, DataRow row, Patient currentPatient)
        {
            var procedureName = row["Procedure"].ToString();
            var specialistUin = row["SpecialistUIN"].ToString();
            var information = row["Information"].ToString();

            var specialist = data
                .Specialists.All()
                .Where(s => s.Uin == specialistUin)
                .FirstOrDefault();

            var procedure = data
                .Procedures.All()
                .Where(pr => pr.Name == procedureName)
                .FirstOrDefault();

            Manipulation currentManipulation = new Manipulation()
            {
                Id = Guid.NewGuid(),
                PatientId = currentPatient.Id,
                SpecialistId = specialist.Id,
                ProcedureId = procedure.Id,
                Information = information,
                Date = DateTime.ParseExact(currentReportDate, "dd-MM-yyyy",  CultureInfo.InvariantCulture)
            };
            return currentManipulation;
        }