197 lines
7.4 KiB
C#
197 lines
7.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.ServiceModel;
|
|
|
|
namespace EHEC_Server
|
|
{
|
|
public partial class GenerateDataBuilder
|
|
{
|
|
|
|
//dieses file wird im moment nicht benötigt, da alles im global benutzt wird, bitte so belassen für den moment
|
|
private static List<Doctor> Doctors = new List<Doctor>();
|
|
private static List<Patient> Patients = new List<Patient>();
|
|
private static List<Origin> Origins = new List<Origin>();
|
|
private static List<Result> Results = new List<Result>();
|
|
private static List<Exam> Exams = new List<Exam>();
|
|
private static Random Rnd = new Random();
|
|
|
|
|
|
private static List<string> FirstNames = new List<string>(new string[]
|
|
{
|
|
"Michael", "Andreas", "Stefan", "Ivan","Adrien"
|
|
});
|
|
|
|
private static List<string> LastNames = new List<string>(new string[]
|
|
{
|
|
"Meister", "Schär", "Eberhard", "Zingg", "Howald", "Aebi", "Feldmann"
|
|
});
|
|
|
|
private static List<string> Streets = new List<string>(new string[]
|
|
{
|
|
"Rosenauweg", "Schessstrasse", "Hardstrasse", "Gehweg", "Bananastreet", "Moosweg", "Feldstrasse"
|
|
});
|
|
|
|
private static List<string> Cities = new List<string>(new string[]
|
|
{
|
|
"Meister", "Schär", "Eberhard", "Zingg", "Howald", "Aebi", "Feldmann"
|
|
});
|
|
|
|
private static List<string> Regions = new List<string>(new string[]
|
|
{
|
|
"Aargau", "Zurich", "Graubünden","Vallhalla", "Hell", "Heaven"
|
|
});
|
|
|
|
|
|
private static List<string> BirthDates = new List<string>(new string[]
|
|
{
|
|
"2001-07-11 20:18:00.000", "1999-03-12 10:18:00.000","1980-01-21 00:18:00.000",
|
|
});
|
|
|
|
private static List<string> DoctorOrigins = new List<string>(new string[]
|
|
{
|
|
"SanktMonika", "DisneyWorld", "Kantonsspital Baden", "Online Schulung"
|
|
});
|
|
|
|
private static List<string> Foods = new List<string>(new string[]
|
|
{
|
|
"SanktMonika", "DisneyWorld", "Kantonsspital Baden", "Online Schulung", "Heaven"
|
|
});
|
|
|
|
private static List<string> Names = new List<string>(new string[]
|
|
{
|
|
"SanktMonika", "DisneyWorld", "Kantonsspital Baden", "Online Schulung", "Heaven"
|
|
});
|
|
|
|
private static List<int> DoctorId = new List<int>(new int[]
|
|
{
|
|
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
|
|
});
|
|
|
|
private static List<int> PatientId = new List<int>(new int[]
|
|
{
|
|
11, 2, 3, 4, 5, 6, 7, 8, 9, 10
|
|
});
|
|
|
|
private static List<int> ResultId = new List<int>(new int[]
|
|
{
|
|
1, 2, 3, 4, 5
|
|
});
|
|
|
|
private static List<int> ExamId = new List<int>(new int[]
|
|
{
|
|
1, 2, 3, 4, 5
|
|
});
|
|
|
|
private static List<int> OriginId = new List<int>(new int[]
|
|
{
|
|
1, 2, 3, 4, 5
|
|
});
|
|
|
|
|
|
|
|
public static Exam CreateRandomExams(Exam exams)
|
|
{
|
|
using (EHEC_DBEntities ctx = new EHEC_DBEntities())
|
|
{
|
|
//int DoctorAmount = Doctor.Count();
|
|
//int PatientAmount = Patient.Count();
|
|
//int ResultAmount = Result.Count();
|
|
|
|
Random r = new Random();
|
|
for (int i = 0; i < 20; i++)
|
|
{
|
|
foreach (var p in FirstNames)
|
|
{
|
|
Patient patient = new Patient
|
|
{
|
|
PatientUid = Guid.NewGuid().ToString(),
|
|
FirstName = FirstNames[r.Next(0, 5)].ToString(),
|
|
LastName = LastNames[r.Next(0, 7)].ToString(),
|
|
BirthDate = Convert.ToDateTime(BirthDates[r.Next(0, 3)].ToString()),
|
|
Street = Streets[r.Next(0, 7)].ToString(),
|
|
City = Cities[r.Next(0, 7)].ToString(),
|
|
Region = Regions[r.Next(0, 6)].ToString()
|
|
};
|
|
//Global.GlobalInstance.DbAccess.Patients.Add(patient);
|
|
ctx.Patients.Add(patient);
|
|
ctx.SaveChanges();
|
|
}
|
|
|
|
foreach (var d in FirstNames)
|
|
{
|
|
Doctor doctor = new Doctor
|
|
{
|
|
DoctorUid = Guid.NewGuid().ToString(),
|
|
FirstName = FirstNames[r.Next(0, 5)].ToString(),
|
|
LastName = LastNames[r.Next(0, 7)].ToString(),
|
|
DoctorOrigin = DoctorOrigins[r.Next(0, 4)].ToString(),
|
|
Region = Regions[r.Next(0, 6)].ToString()
|
|
};
|
|
//Global.GlobalInstance.DbAccess.Doctors.Add(doctor);
|
|
ctx.Doctors.Add(doctor);
|
|
ctx.SaveChanges();
|
|
}
|
|
|
|
foreach (var o in FirstNames)
|
|
{
|
|
Origin origin = new Origin
|
|
{
|
|
OriginUid = Guid.NewGuid().ToString(),
|
|
Name = Names[r.Next(0, 5)].ToString(),
|
|
Food = Foods[r.Next(0, 5)].ToString(),
|
|
Street = Streets[r.Next(0, 7)].ToString(),
|
|
City = Cities[r.Next(0, 7)].ToString(),
|
|
};
|
|
ctx.Origins.Add(origin);
|
|
ctx.SaveChanges();
|
|
}
|
|
|
|
foreach (var t in FirstNames)
|
|
{
|
|
Result result = new Result
|
|
{
|
|
ResultUid = Guid.NewGuid().ToString(),
|
|
Name = Names[r.Next(0, 5)].ToString()
|
|
|
|
};
|
|
ctx.Results.Add(result);
|
|
ctx.SaveChanges();
|
|
}
|
|
|
|
if (i > 5)
|
|
{
|
|
for (int y = 0; y < 5; y++)
|
|
{
|
|
Exam exam = new Exam
|
|
{
|
|
ExamUid = Guid.NewGuid().ToString(),
|
|
DoctorId = DoctorId[r.Next(0, 5)],
|
|
PatientId = PatientId[r.Next(0, 5)],
|
|
ResultId = ResultId[r.Next(0, 5)]
|
|
};
|
|
ctx.Exams.Add(exam);
|
|
ctx.SaveChanges();
|
|
}
|
|
if (i > 10)
|
|
{
|
|
for (int o = 0; o < 5; o++)
|
|
{
|
|
Origin_Exam origin_exam = new Origin_Exam
|
|
{
|
|
Origin_ExamUid = Guid.NewGuid().ToString(),
|
|
ExamId = DoctorId[r.Next(0, 5)],
|
|
OriginId = PatientId[r.Next(0, 5)],
|
|
};
|
|
ctx.Origin_Exam.Add(origin_exam);
|
|
ctx.SaveChanges();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return exams;
|
|
}
|
|
}
|
|
} |