moved the randomizer functions away from the global and into the databuilder files
This commit is contained in:
parent
971348764e
commit
3bee2333f1
|
@ -2,10 +2,11 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
|
using System.ServiceModel;
|
||||||
|
|
||||||
namespace EHEC_Server.DataBuilder
|
namespace EHEC_Server
|
||||||
{
|
{
|
||||||
public class GenerateDataBuilder
|
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
|
//dieses file wird im moment nicht benötigt, da alles im global benutzt wird, bitte so belassen für den moment
|
||||||
|
@ -16,9 +17,19 @@ namespace EHEC_Server.DataBuilder
|
||||||
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[]
|
||||||
{
|
{
|
||||||
"Michael", "Andreas", "Stefan", "Ivan","Adrien"
|
"Michael", "Andreas", "Stefan", "Ivan","Adrien"
|
||||||
});
|
});
|
||||||
|
|
||||||
private static List<string> LastNames = new List<string>(new string[]
|
private static List<string> LastNames = new List<string>(new string[]
|
||||||
|
@ -26,25 +37,107 @@ namespace EHEC_Server.DataBuilder
|
||||||
"Meister", "Schär", "Eberhard", "Zingg", "Howald", "Aebi", "Feldmann"
|
"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[]
|
private static List<string> DoctorOrigins = new List<string>(new string[]
|
||||||
{
|
{
|
||||||
"SanktMonika", "DisneyWorld", "Kantonsspital Baden", "Online Schulung"
|
"SanktMonika", "DisneyWorld", "Kantonsspital Baden", "Online Schulung"
|
||||||
});
|
});
|
||||||
|
|
||||||
private static List<string> Street = new List<string>(new string[]
|
|
||||||
{
|
|
||||||
"Rosenauweg", "Schessstrasse", "Hardstrasse", "Gehweg", "Bananastreet", "Moosweg", "Feldstrasse"
|
|
||||||
});
|
|
||||||
|
|
||||||
private static List<string> BirthDate = new List<string>(new string[]
|
public static Patient CreateRandomPatients(Patient patients)
|
||||||
{
|
{
|
||||||
"12991212", "20000112",
|
using (EHEC_DBEntities ctx = new EHEC_DBEntities())
|
||||||
});
|
{
|
||||||
|
Random p = new Random();
|
||||||
private static List<string> City = new List<string>(new string[]
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return patients;
|
||||||
|
}
|
||||||
|
public static Doctor CreateRandomDoctors(Doctor doctors)
|
||||||
{
|
{
|
||||||
"Meister", "Schär", "Eberhard", "Zingg", "Howald", "Aebi", "Feldmann"
|
using (EHEC_DBEntities ctx = new EHEC_DBEntities())
|
||||||
});
|
{
|
||||||
|
|
||||||
|
Random d = new Random();
|
||||||
|
for (int i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
Doctor doctor = new Doctor
|
||||||
|
{
|
||||||
|
DoctorUid = DoctorUid[d.Next(0, 10)].ToString(),
|
||||||
|
FirstName = FirstNames[d.Next(0, 5)].ToString(),
|
||||||
|
LastName = LastNames[d.Next(0, 7)].ToString(),
|
||||||
|
DoctorOrigin = DoctorOrigins[d.Next(0, 4)].ToString(),
|
||||||
|
Region = Regions[d.Next(0, 6)].ToString()
|
||||||
|
};
|
||||||
|
//Global.GlobalInstance.DbAccess.Doctors.Add(doctor);
|
||||||
|
ctx.Doctors.Add(doctor);
|
||||||
|
ctx.SaveChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return doctors;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//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
|
|
@ -41,5 +41,8 @@ namespace EHEC_Server
|
||||||
return patient;
|
return patient;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -9,7 +9,7 @@ using EHEC_Server.DataBuilder;
|
||||||
namespace EHEC_Server
|
namespace EHEC_Server
|
||||||
{
|
{
|
||||||
public partial class Global : System.Web.HttpApplication
|
public partial class Global : System.Web.HttpApplication
|
||||||
{
|
{/*
|
||||||
private static List<string> FirstNames = new List<string>(new string[]
|
private static List<string> FirstNames = new List<string>(new string[]
|
||||||
{
|
{
|
||||||
"Michael", "Andreas", "Stefan", "Ivan","Adrien"
|
"Michael", "Andreas", "Stefan", "Ivan","Adrien"
|
||||||
|
@ -45,7 +45,16 @@ namespace EHEC_Server
|
||||||
{
|
{
|
||||||
"SanktMonika", "DisneyWorld", "Kantonsspital Baden", "Online Schulung"
|
"SanktMonika", "DisneyWorld", "Kantonsspital Baden", "Online Schulung"
|
||||||
});
|
});
|
||||||
|
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"
|
||||||
|
});
|
||||||
|
*/
|
||||||
protected void Application_Start(object sender, EventArgs e)
|
protected void Application_Start(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -58,45 +67,47 @@ namespace EHEC_Server
|
||||||
|
|
||||||
|
|
||||||
//add patients
|
//add 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 < 10; i++)
|
||||||
{
|
{
|
||||||
Patient patient = new Patient
|
Patient patient = new Patient
|
||||||
{
|
{
|
||||||
FirstName = FirstNames[p.Next(0,5)].ToString(),
|
PatientUid = PatientUid[p.Next(0, 10)].ToString(),
|
||||||
LastName = LastNames [p.Next(0, 7)].ToString(),
|
FirstName = FirstNames[p.Next(0, 5)].ToString(),
|
||||||
BirthDate = Convert.ToDateTime(BirthDates [p.Next(0,3)].ToString()),
|
LastName = LastNames[p.Next(0, 7)].ToString(),
|
||||||
Street = Streets[p.Next(0, 7)].ToString(),
|
BirthDate = Convert.ToDateTime(BirthDates[p.Next(0, 3)].ToString()),
|
||||||
City = Cities[p.Next(0, 7)].ToString(),
|
Street = Streets[p.Next(0, 7)].ToString(),
|
||||||
Region = Regions[p.Next(0, 6)].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);
|
//Global.GlobalInstance.DbAccess.Patients.Add(patient);
|
||||||
ctx.SaveChanges();
|
ctx.Patients.Add(patient);
|
||||||
}
|
ctx.SaveChanges();
|
||||||
}
|
}
|
||||||
//add doctors
|
}
|
||||||
using (EHEC_DBEntities ctx = new EHEC_DBEntities())
|
//add doctors
|
||||||
{
|
using (EHEC_DBEntities ctx = new EHEC_DBEntities())
|
||||||
|
{
|
||||||
Random d = new Random();
|
|
||||||
for (int i = 0; i < 10; i++)
|
|
||||||
{
|
|
||||||
Doctor doctor = new Doctor
|
|
||||||
{
|
|
||||||
FirstName = FirstNames[d.Next(0, 5)].ToString(),
|
|
||||||
LastName = LastNames[d.Next(0, 7)].ToString(),
|
|
||||||
DoctorOrigin = DoctorOrigins[d.Next(0, 4)].ToString(),
|
|
||||||
Region = Regions[d.Next(0, 6)].ToString()
|
|
||||||
};
|
|
||||||
//Global.GlobalInstance.DbAccess.Doctors.Add(doctor);
|
|
||||||
ctx.Doctors.Add(doctor);
|
|
||||||
ctx.SaveChanges();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Random d = new Random();
|
||||||
|
for (int i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
Doctor doctor = new Doctor
|
||||||
|
{
|
||||||
|
DoctorUid = DoctorUid[d.Next(0, 10)].ToString(),
|
||||||
|
FirstName = FirstNames[d.Next(0, 5)].ToString(),
|
||||||
|
LastName = LastNames[d.Next(0, 7)].ToString(),
|
||||||
|
DoctorOrigin = DoctorOrigins[d.Next(0, 4)].ToString(),
|
||||||
|
Region = Regions[d.Next(0, 6)].ToString()
|
||||||
|
};
|
||||||
|
//Global.GlobalInstance.DbAccess.Doctors.Add(doctor);
|
||||||
|
ctx.Doctors.Add(doctor);
|
||||||
|
ctx.SaveChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
//all the following code was auto-generated by createing the global file and will be deleted later
|
//all the following code was auto-generated by createing the global file and will be deleted later
|
||||||
|
@ -132,4 +143,4 @@ namespace EHEC_Server
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,12 @@ namespace EHEC_Server
|
||||||
[OperationContract]
|
[OperationContract]
|
||||||
List<Result> GetResults();
|
List<Result> GetResults();
|
||||||
|
|
||||||
|
[OperationContract]
|
||||||
|
Patient CreateRandomPatient(Patient patient);
|
||||||
|
|
||||||
|
[OperationContract]
|
||||||
|
Doctor CreateRandomDoctor(Doctor doctor);
|
||||||
|
|
||||||
[OperationContract]
|
[OperationContract]
|
||||||
String Ping();
|
String Ping();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ using System.ServiceModel;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using EHEC_Server.DataBuilder;
|
using EHEC_Server.DataBuilder;
|
||||||
|
|
||||||
|
|
||||||
namespace EHEC_Server
|
namespace EHEC_Server
|
||||||
{
|
{
|
||||||
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the
|
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the
|
||||||
|
@ -16,6 +17,7 @@ namespace EHEC_Server
|
||||||
{
|
{
|
||||||
|
|
||||||
Doctor dataaccess_doctor = new Doctor();
|
Doctor dataaccess_doctor = new Doctor();
|
||||||
|
private static List<Doctor> Doctors = new List<Doctor>();
|
||||||
Patient dataaccess_patient = new Patient();
|
Patient dataaccess_patient = new Patient();
|
||||||
Result dataaccess_result = new Result();
|
Result dataaccess_result = new Result();
|
||||||
Origin dataaccess_origin = new Origin();
|
Origin dataaccess_origin = new Origin();
|
||||||
|
@ -64,6 +66,15 @@ namespace EHEC_Server
|
||||||
{
|
{
|
||||||
return dataaccess_result.CreateResult(result);
|
return dataaccess_result.CreateResult(result);
|
||||||
}
|
}
|
||||||
|
public Doctor CreateRandomDoctor(Doctor doctors)
|
||||||
|
{
|
||||||
|
return GenerateDataBuilder.CreateRandomDoctors(doctors);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Patient CreateRandomPatient(Patient patients)
|
||||||
|
{
|
||||||
|
return GenerateDataBuilder.CreateRandomPatients(patients);
|
||||||
|
}
|
||||||
|
|
||||||
private readonly string ping = "pong";
|
private readonly string ping = "pong";
|
||||||
public string Ping()
|
public string Ping()
|
||||||
|
|
|
@ -30,8 +30,8 @@
|
||||||
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
|
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
|
||||||
</system.serviceModel>
|
</system.serviceModel>
|
||||||
<connectionStrings>
|
<connectionStrings>
|
||||||
<!--<add name="EHEC_DBEntities" connectionString="metadata=res://*/Model.csdl|res://*/Model.ssdl|res://*/Model.msl;provider=System.Data.SqlClient;provider connection string="data source=LAPTOP-S6N189QG;initial catalog=EHEC_DB;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />-->
|
<add name="EHEC_DBEntities" connectionString="metadata=res://*/Model.csdl|res://*/Model.ssdl|res://*/Model.msl;provider=System.Data.SqlClient;provider connection string="data source=LAPTOP-S6N189QG;initial catalog=EHEC_DB;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
|
||||||
<add name="EHEC_DBEntities" connectionString="metadata=res://*/Model.csdl|res://*/Model.ssdl|res://*/Model.msl;provider=System.Data.SqlClient;provider connection string="data source=.\SQLEXPRESS;initial catalog=EHEC_DB;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
|
<!--<add name="EHEC_DBEntities" connectionString="metadata=res://*/Model.csdl|res://*/Model.ssdl|res://*/Model.msl;provider=System.Data.SqlClient;provider connection string="data source=.\SQLEXPRESS;initial catalog=EHEC_DB;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />-->
|
||||||
</connectionStrings>
|
</connectionStrings>
|
||||||
<entityFramework>
|
<entityFramework>
|
||||||
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
|
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace EHEC_Server
|
||||||
ContractResolver = new CamelCasePropertyNamesContractResolver()
|
ContractResolver = new CamelCasePropertyNamesContractResolver()
|
||||||
};
|
};
|
||||||
var Json = JObject.FromObject(GetCluster(), serializer);
|
var Json = JObject.FromObject(GetCluster(), serializer);
|
||||||
System.IO.File.WriteAllText(@"C: \Users\novski\Desktop\cluster.json", JsonConvert.SerializeObject(Json));
|
System.IO.File.WriteAllText(@"C: \Users\ism_c\Desktop\cluster.json", JsonConvert.SerializeObject(Json));
|
||||||
return Json;
|
return Json;
|
||||||
}
|
}
|
||||||
private ClusterModel GetCluster()
|
private ClusterModel GetCluster()
|
||||||
|
|
Loading…
Reference in New Issue