Add results origins and exams to the randomizer
This commit is contained in:
parent
1970f5a61e
commit
ac076fb52d
|
@ -5,6 +5,8 @@ VisualStudioVersion = 15.0.27428.2027
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EHEC_Server", "EHEC_Server\EHEC_Server.csproj", "{611B075A-0526-4661-BD58-B141BD42E6D7}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EHEC_Server", "EHEC_Server\EHEC_Server.csproj", "{611B075A-0526-4661-BD58-B141BD42E6D7}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Client", "..\Client\Client\Client.csproj", "{7467FD6B-4743-4436-A87B-095EA46C476F}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
@ -21,11 +23,19 @@ Global
|
||||||
{611B075A-0526-4661-BD58-B141BD42E6D7}.Release|Any CPU.Build.0 = Release|Any CPU
|
{611B075A-0526-4661-BD58-B141BD42E6D7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{611B075A-0526-4661-BD58-B141BD42E6D7}.Release|x86.ActiveCfg = Release|x86
|
{611B075A-0526-4661-BD58-B141BD42E6D7}.Release|x86.ActiveCfg = Release|x86
|
||||||
{611B075A-0526-4661-BD58-B141BD42E6D7}.Release|x86.Build.0 = Release|x86
|
{611B075A-0526-4661-BD58-B141BD42E6D7}.Release|x86.Build.0 = Release|x86
|
||||||
|
{7467FD6B-4743-4436-A87B-095EA46C476F}.Debug|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{7467FD6B-4743-4436-A87B-095EA46C476F}.Debug|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{7467FD6B-4743-4436-A87B-095EA46C476F}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{7467FD6B-4743-4436-A87B-095EA46C476F}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{7467FD6B-4743-4436-A87B-095EA46C476F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{7467FD6B-4743-4436-A87B-095EA46C476F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{7467FD6B-4743-4436-A87B-095EA46C476F}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{7467FD6B-4743-4436-A87B-095EA46C476F}.Release|x86.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {5A1E6601-9512-414C-94E3-1E1FE95AAF52}
|
SolutionGuid = {075C6F0D-EA23-4CF6-B8FB-D41D83A60A19}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Web;
|
||||||
|
|
||||||
|
namespace EHEC_Server.DataBuilder
|
||||||
|
{
|
||||||
|
public class CreateMany
|
||||||
|
{
|
||||||
|
|
||||||
|
public Doctor newdoctor = new Doctor()
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,18 +7,13 @@ using EHEC_Server.DataBuilder;
|
||||||
using System.Data.Entity;
|
using System.Data.Entity;
|
||||||
|
|
||||||
|
|
||||||
namespace EHEC_Server.DataBuilder
|
|
||||||
{
|
|
||||||
public class DataSeeder : EHEC_DBEntities
|
|
||||||
{
|
|
||||||
//protected override void Seed(EHEC_DBEntities context)
|
|
||||||
// {
|
|
||||||
//var doctors = GenerateDataBuilder.CreateDoctors();
|
|
||||||
|
|
||||||
// foreach (var d in doctors)
|
|
||||||
// {
|
|
||||||
// // context.Doctor.Add(d);
|
namespace EHEC_Server
|
||||||
// }
|
{
|
||||||
// }
|
public partial class DataSeeder
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -17,15 +17,6 @@ namespace EHEC_Server
|
||||||
private static List<Exam> Exams = new List<Exam>();
|
private static List<Exam> Exams = new List<Exam>();
|
||||||
private static Random Rnd = new Random();
|
private static Random Rnd = new Random();
|
||||||
|
|
||||||
private static List<string> PatientUid = new List<string>(new string[]
|
|
||||||
{
|
|
||||||
"djud73", "23jhgdh738","28hfc9","937hbnf9s","838fbnos","3886b10bd","nc3592bd0","3939uhdj","md8363gbd0","d93gd0sh"
|
|
||||||
});
|
|
||||||
|
|
||||||
private static List<string> DoctorUid = new List<string>(new string[]
|
|
||||||
{
|
|
||||||
"2123dd73", "2325438","2cqw","93123ff9s","cse6654","te5654hz","er343erg556","345tgww","345345tegv","te4tserz"
|
|
||||||
});
|
|
||||||
|
|
||||||
private static List<string> FirstNames = new List<string>(new string[]
|
private static List<string> FirstNames = new List<string>(new string[]
|
||||||
{
|
{
|
||||||
|
@ -63,17 +54,42 @@ namespace EHEC_Server
|
||||||
"SanktMonika", "DisneyWorld", "Kantonsspital Baden", "Online Schulung"
|
"SanktMonika", "DisneyWorld", "Kantonsspital Baden", "Online Schulung"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
private static List<string> Foods = new List<string>(new string[]
|
||||||
|
{
|
||||||
|
"SanktMonika", "DisneyWorld", "Kantonsspital Baden", "Online Schulung"
|
||||||
|
});
|
||||||
|
|
||||||
|
private static List<string> Names = new List<string>(new string[]
|
||||||
|
{
|
||||||
|
"SanktMonika", "DisneyWorld", "Kantonsspital Baden", "Online Schulung"
|
||||||
|
});
|
||||||
|
|
||||||
|
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
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
public static Patient CreateRandomPatients(Patient patients)
|
public static Patient CreateRandomPatients(Patient patients)
|
||||||
{
|
{
|
||||||
using (EHEC_DBEntities ctx = new EHEC_DBEntities())
|
using (EHEC_DBEntities ctx = new EHEC_DBEntities())
|
||||||
{
|
{
|
||||||
Random p = new Random();
|
Random p = new Random();
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < 50; i++)
|
||||||
{
|
{
|
||||||
Patient patient = new Patient
|
Patient patient = new Patient
|
||||||
{
|
{
|
||||||
PatientUid = PatientUid[p.Next(0, 10)].ToString(),
|
PatientUid = Guid.NewGuid().ToString(),
|
||||||
FirstName = FirstNames[p.Next(0, 5)].ToString(),
|
FirstName = FirstNames[p.Next(0, 5)].ToString(),
|
||||||
LastName = LastNames[p.Next(0, 7)].ToString(),
|
LastName = LastNames[p.Next(0, 7)].ToString(),
|
||||||
BirthDate = Convert.ToDateTime(BirthDates[p.Next(0, 3)].ToString()),
|
BirthDate = Convert.ToDateTime(BirthDates[p.Next(0, 3)].ToString()),
|
||||||
|
@ -94,11 +110,11 @@ namespace EHEC_Server
|
||||||
{
|
{
|
||||||
|
|
||||||
Random d = new Random();
|
Random d = new Random();
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < 50; i++)
|
||||||
{
|
{
|
||||||
Doctor doctor = new Doctor
|
Doctor doctor = new Doctor
|
||||||
{
|
{
|
||||||
DoctorUid = DoctorUid[d.Next(0, 10)].ToString(),
|
DoctorUid = Guid.NewGuid().ToString(),
|
||||||
FirstName = FirstNames[d.Next(0, 5)].ToString(),
|
FirstName = FirstNames[d.Next(0, 5)].ToString(),
|
||||||
LastName = LastNames[d.Next(0, 7)].ToString(),
|
LastName = LastNames[d.Next(0, 7)].ToString(),
|
||||||
DoctorOrigin = DoctorOrigins[d.Next(0, 4)].ToString(),
|
DoctorOrigin = DoctorOrigins[d.Next(0, 4)].ToString(),
|
||||||
|
@ -111,33 +127,77 @@ namespace EHEC_Server
|
||||||
}
|
}
|
||||||
return doctors;
|
return doctors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Origin CreateRandomOrigins(Origin origins)
|
||||||
|
{
|
||||||
|
using (EHEC_DBEntities ctx = new EHEC_DBEntities())
|
||||||
|
{
|
||||||
|
Random o = new Random();
|
||||||
|
for (int i = 0; i < 5; i++)
|
||||||
|
{
|
||||||
|
Origin origin = new Origin
|
||||||
|
{
|
||||||
|
OriginUid = Guid.NewGuid().ToString(),
|
||||||
|
Name = Names[o.Next(0, 5)].ToString(),
|
||||||
|
Food = Foods[o.Next(0, 5)].ToString(),
|
||||||
|
Street = Streets[o.Next(0, 5)].ToString(),
|
||||||
|
City = Cities[o.Next(0, 5)].ToString(),
|
||||||
|
|
||||||
|
};
|
||||||
|
ctx.Origins.Add(origin);
|
||||||
|
ctx.SaveChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return origins;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Result CreateRandomResults(Result results)
|
||||||
|
{
|
||||||
|
using (EHEC_DBEntities ctx = new EHEC_DBEntities())
|
||||||
|
{
|
||||||
|
Random r = new Random();
|
||||||
|
for (int i = 0; i < 5; i++)
|
||||||
|
{
|
||||||
|
Result result = new Result
|
||||||
|
{
|
||||||
|
ResultUid = Guid.NewGuid().ToString(),
|
||||||
|
Name = Names[r.Next(0, 5)].ToString()
|
||||||
|
|
||||||
|
};
|
||||||
|
ctx.Results.Add(result);
|
||||||
|
ctx.SaveChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 e = new Random();
|
||||||
|
for (int i = 0; i < 5; i++)
|
||||||
|
{
|
||||||
|
Exam exam = new Exam
|
||||||
|
{
|
||||||
|
ExamUid = Guid.NewGuid().ToString(),
|
||||||
|
DoctorId = DoctorId[e.Next(0, 5)],
|
||||||
|
PatientId = PatientId[e.Next(0, 5)],
|
||||||
|
ResultId = ResultId[e.Next(0, 5)]
|
||||||
|
};
|
||||||
|
ctx.Exams.Add(exam);
|
||||||
|
ctx.SaveChanges();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return exams;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//add patients
|
|
||||||
/* using (EHEC_DBEntities ctx = new EHEC_DBEntities())
|
|
||||||
{
|
|
||||||
Random p = new Random();
|
|
||||||
for (int i = 0; i < 10; i++)
|
|
||||||
{
|
|
||||||
Patient patient = new Patient
|
|
||||||
{
|
|
||||||
PatientUid = PatientUid[p.Next(0, 10)].ToString(),
|
|
||||||
FirstName = FirstNames[p.Next(0, 5)].ToString(),
|
|
||||||
LastName = LastNames[p.Next(0, 7)].ToString(),
|
|
||||||
BirthDate = Convert.ToDateTime(BirthDates[p.Next(0, 3)].ToString()),
|
|
||||||
Street = Streets[p.Next(0, 7)].ToString(),
|
|
||||||
City = Cities[p.Next(0, 7)].ToString(),
|
|
||||||
Region = Regions[p.Next(0, 6)].ToString()
|
|
||||||
};
|
|
||||||
//Global.GlobalInstance.DbAccess.Patients.Add(patient);
|
|
||||||
ctx.Patients.Add(patient);
|
|
||||||
ctx.SaveChanges();
|
|
||||||
}
|
|
||||||
} */
|
|
||||||
//add doctors
|
|
|
@ -175,6 +175,7 @@
|
||||||
<Compile Include="DatabaseAccess\Origin_Exam.cs" />
|
<Compile Include="DatabaseAccess\Origin_Exam.cs" />
|
||||||
<Compile Include="DatabaseAccess\Patient.cs" />
|
<Compile Include="DatabaseAccess\Patient.cs" />
|
||||||
<Compile Include="DatabaseAccess\Result.cs" />
|
<Compile Include="DatabaseAccess\Result.cs" />
|
||||||
|
<Compile Include="DataBuilder\CreateMany.cs" />
|
||||||
<Compile Include="DataBuilder\DataSeeder.cs" />
|
<Compile Include="DataBuilder\DataSeeder.cs" />
|
||||||
<Compile Include="DatabaseAccess\Exam.cs" />
|
<Compile Include="DatabaseAccess\Exam.cs" />
|
||||||
<Compile Include="DataBuilder\GenerateDataBuilder.cs" />
|
<Compile Include="DataBuilder\GenerateDataBuilder.cs" />
|
||||||
|
|
|
@ -39,6 +39,13 @@ namespace EHEC_Server
|
||||||
[OperationContract]
|
[OperationContract]
|
||||||
Doctor CreateRandomDoctor(Doctor doctor);
|
Doctor CreateRandomDoctor(Doctor doctor);
|
||||||
|
|
||||||
|
[OperationContract]
|
||||||
|
Origin CreateRandomOrigin(Origin origin);
|
||||||
|
[OperationContract]
|
||||||
|
Result CreateRandomResult(Result result);
|
||||||
|
[OperationContract]
|
||||||
|
Exam CreateRandomExam(Exam exam);
|
||||||
|
|
||||||
[OperationContract]
|
[OperationContract]
|
||||||
String Ping();
|
String Ping();
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,6 +76,19 @@ namespace EHEC_Server
|
||||||
return GenerateDataBuilder.CreateRandomPatients(patients);
|
return GenerateDataBuilder.CreateRandomPatients(patients);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Origin CreateRandomOrigin(Origin origins)
|
||||||
|
{
|
||||||
|
return GenerateDataBuilder.CreateRandomOrigins(origins);
|
||||||
|
}
|
||||||
|
public Result CreateRandomResult(Result results)
|
||||||
|
{
|
||||||
|
return GenerateDataBuilder.CreateRandomResults(results);
|
||||||
|
}
|
||||||
|
public Exam CreateRandomExam(Exam exams)
|
||||||
|
{
|
||||||
|
return GenerateDataBuilder.CreateRandomExams(exams);
|
||||||
|
}
|
||||||
|
|
||||||
private readonly string ping = "pong";
|
private readonly string ping = "pong";
|
||||||
public string Ping()
|
public string Ping()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue