Esempio n. 1
0
        public static void Get()
        {
            ImadHealthRepository <Appointment> appointments = new madHealthRepository <Appointment>(Help.Context);
            ImadHealthRepository <Patient>     patients     = new madHealthRepository <Patient>(Help.Context);

            DataTable rawData = Help.OpenExcel("Appointments");
            int       N       = 0;

            foreach (DataRow row in rawData.Rows)
            {
                int         oldId   = Help.getInteger(row, 0);
                int         patient = Help.getInteger(row, 2);
                Patient     pat     = patients.Get().FirstOrDefault(x => x.Id == patient);
                Appointment appt    = new Appointment()
                {
                    Date    = Help.getDate(row, 1),
                    Patient = pat,
                };
                N++;
                appointments.Insert(appt);
                appointments.Commit();
                Help.dicAppt.Add(oldId, appt.Id);
            }
            Console.WriteLine(N);
        }
Esempio n. 2
0
        public static void Get()
        {
            ImadHealthRepository <AnalysisResult> analysisresults = new madHealthRepository <AnalysisResult>(Help.Context);
            ImadHealthRepository <AnalysisType>   analysistypes   = new madHealthRepository <AnalysisType>(Help.Context);
            DataTable rawData = Help.OpenExcel("AnalysisResults");
            int       N       = 1;

            foreach (DataRow row in rawData.Rows)
            {
                int            oldId  = Help.getInteger(row, 0);
                int            typeID = Help.getInteger(row, 4);
                AnalysisType   atype  = analysistypes.Get().FirstOrDefault(x => x.Id == typeID);
                AnalysisResult result = new AnalysisResult()
                {
                    Title         = Help.getString(row, 1),
                    Type          = atype,
                    Description   = Help.getString(row, 3),
                    Status        = (AnalysisStatus)Help.getInteger(row, 2),
                    AppointmentID = Help.getInteger(row, 5)
                };
                N++;
                analysisresults.Insert(result);
                analysisresults.Commit();
                Help.dicARes.Add(oldId, result.Id);
            }
            Console.WriteLine(N);
        }