Merge branch 'master' into WebClient_Dev

This commit is contained in:
Strati 2018-07-28 10:47:56 +02:00
commit 0b2fb702ad
35 changed files with 61753 additions and 41 deletions

View File

@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Server.DB;
namespace Server.Models
{
public class ClusterData
{
private List<Person> Doctors { get; set; }
private List<City> Cities { get; set; }
public ClusterData()
{
DoctorDB doctorDB = new DoctorDB();
CityDB cityDB = new CityDB();
this.Doctors = new List<Person>(doctorDB.GetAllDoctors());
this.Cities = new List<City>(cityDB.GetAllCities());
}
public List<Node> GenerateNodes()
{
List<Node> Nodes = new List<Node>();
foreach (var doctor in this.Doctors)
{
Node node = new Node
{
id = doctor.PersonID,
label = doctor.FirstName + " " + doctor.LastName,
cid = doctor.City.ZipCode
};
Nodes.Add(node);
}
int counter = 0;
foreach (var city in this.Cities)
{
Node node = new Node
{
id = city.ZipCode,
label = city.Name,
cid = city.ZipCode
};
Nodes.Add(node);
counter++;
}
return Nodes;
}
public List<Edge> GenerateEdges()
{
List<Edge> Edges = new List<Edge>();
foreach (var doctor in this.Doctors)
{
Edge edge = new Edge
{
from = doctor.City.ZipCode,
to = doctor.PersonID
};
Edges.Add(edge);
}
return Edges;
}
}
}

View File

@ -26,13 +26,6 @@ namespace Server.Helper
{
"Schweiz", "Deutschland", "Österreich"
});
private static List<string> CityList = new List<string>(new string[]
{
"Herzogenbuchsee", "Langenthal", "Olten", "Bern", "Lyssach",
"Zürich", "Genf", "Hamburg", "Berlin", "München", "Main", "Wien",
"Entenhausen", "Altena", "Erlangen", "Güsten", "Heubach", "Langendorf",
"Münster", "Wiesbaden"
});
private static List<string> CityFirstPart = new List<string>(new string[]
{
"Burg", "Gross", "Klein", "Ober", "Unter", "Riedt", "Enten", "Lang", "Kurz", "Wies",
@ -41,7 +34,7 @@ namespace Server.Helper
private static List<string> CitySecondPart = new List<string>(new string[]
{
"dorf", "thal", "ikon", "hausen", "langen", "bach", "baden", "felden", "stein", "stadt",
"matten", "weier", "wald", "see", "heim", "kirchen"
"matten", "weier", "wald", "see", "heim", "kirchen", "weiden"
});
private static List<string> FirstNames = new List<string>(new string[]
{
@ -104,23 +97,25 @@ namespace Server.Helper
}
public static List<Doctor> CreateDoctors()
{
int Counter = FirstNames.Count() * LastNames.Count();
int FirstNamesAmount = FirstNames.Count();
int LastNamesAmount = LastNames.Count();
int CitiesAmount = Cities.Count();
int FirstNameAmount = FirstNames.Count();
int LastNameAmount = LastNames.Count();
for (int i = 0; i < Counter; i++)
for (int i = 0; i < FirstNamesAmount; i++)
{
int RandomCityID = Rnd.Next(1, CitiesAmount);
City PersonCity = Cities[RandomCityID];
String Streetname = "Musterstrasse ";
String StreetNumber = Rnd.Next(1, 20).ToString();
for (int j = 0; j < LastNamesAmount; j++)
{
int RandomCityID = Rnd.Next(1, CitiesAmount);
City PersonCity = Cities[RandomCityID];
String Streetname = "Musterstrasse ";
String StreetNumber = Rnd.Next(1, 20).ToString();
Doctor doctor = new Doctor(
FirstNames[Rnd.Next(1, FirstNameAmount)],
LastNames[Rnd.Next(1, LastNameAmount)],
Genders[0],
Salutations[0], Streetname, StreetNumber, PersonCity);
Doctors.Add(doctor);
Doctor doctor = new Doctor(
FirstNames[i],
LastNames[j],
Genders[0],
Salutations[0], Streetname, StreetNumber, PersonCity);
Doctors.Add(doctor);
}
}
return Doctors;
}

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Server.Models
{
public class Edge
{
public int from { get; set; }
public int to { get; set; }
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Server.Models
{
public class Node
{
public int id { get; set; }
public string label { get; set; }
public int cid { get; set; }
}
}

View File

@ -55,6 +55,9 @@
<HintPath>..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.8\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Web.DynamicData" />
@ -116,11 +119,14 @@
</Compile>
<Compile Include="IService.cs" />
<Compile Include="Models\City.cs" />
<Compile Include="Helper\ClusterData.cs" />
<Compile Include="Models\Country.cs" />
<Compile Include="Models\Doctor.cs" />
<Compile Include="Models\Edge.cs" />
<Compile Include="Models\Exam.cs" />
<Compile Include="Models\FoodPlace.cs" />
<Compile Include="Models\Gender.cs" />
<Compile Include="Models\Node.cs" />
<Compile Include="Models\PatientAtFoodPlace.cs" />
<Compile Include="Models\Person.cs" />
<Compile Include="Models\Salutation.cs" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

47
Server/Server/Static/visjs/vis.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -3,13 +3,109 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<head>
<script type="text/javascript" src="Static/visjs/vis.js"></script>
<link href="Static/visjs/vis.css" rel="stylesheet" type="text/css" />
<style type="text/css">
#mynetwork {
width: 1500px;
height: 800px;
border: 1px solid lightgray;
background-color: black
}
#infomessage {
font-family: Arial;
font-weight:bold
}
#buttons {
width: 119px;
}
#stabilisationBox {
width: 175px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
<div id="infomessage">
<p>If you see an empty rectangle the cluster ist currently loading.<br />
Please be patient and don't refresh the page.</p>
</div>
<div id="buttons">
<input id="buttonCluster" type="button" value="Open/Close Clusters" onclick="clusterByHubsize()"/>
</div>
<div id="stabilisationBox">
Stabilize when clustering:<input type="checkbox" id="stabilizeCheckbox">
</div>
<div id="mynetwork"></div>
<script type="text/javascript">
// create an array with nodes
var nodes = new vis.DataSet(<%=this.nodes%>);
// create an array with edges
var edges = new vis.DataSet(<%=this.edges%>);
// create a network
var container = document.getElementById('mynetwork');
// provide the data in the vis format
var data = {
nodes: nodes,
edges: edges
};
var clusterIndex = 0;
var clusters = [];
var options = {};
// initialize your network!
var network = new vis.Network(container, data, options);
network.on("selectNode", function(params) {
if (params.nodes.length == 1) {
if (network.isCluster(params.nodes[0]) == true) {
network.openCluster(params.nodes[0]);
}
}
});
function clusterByHubsize() {
if (clusterIndex == 0) {
network.setData(data);
var clusterOptionsByData = {
processProperties: function (clusterOptions, childNodes) {
clusterIndex = clusterIndex + 1;
clusterOptions.label = "[" + childNodes.length + "]";
clusterOptions.id = 'cluster:' + clusterIndex;
clusters.push({ id: 'cluster:' + clusterIndex });
return clusterOptions;
},
clusterNodeProperties: { borderWidth: 3, shape: 'box', font: { size: 50 } }
};
network.clusterByHubsize(undefined, clusterOptionsByData);
}
else {
openClusters();
}
};
clusterByHubsize();
function openClusters() {
var newClusters = [];
for (var i = 0; i < clusters.length; i++) {
try {
network.openCluster(clusters[i].id);
}
catch {
continue;
}
}
if (document.getElementById('stabilizeCheckbox').checked === true) {
network.stabilize();
}
clusterIndex = 0;
clusters = newClusters;
};
</script>
</body>
</html>

View File

@ -1,11 +1,21 @@
using System;
using System.Collections.Generic;
using Server.DB;
using Server.Models;
using Server.Helper;
using Newtonsoft.Json;
namespace Server
{
public partial class home : System.Web.UI.Page
{
protected string nodes { get; set; }
protected string edges { get; set; }
protected void Page_Load(object sender, EventArgs e)
{
ClusterData cd = new ClusterData();
this.nodes = JsonConvert.SerializeObject(cd.GenerateNodes());
this.edges = JsonConvert.SerializeObject(cd.GenerateEdges());
}
}

View File

@ -7,20 +7,9 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace Server
{
namespace Server {
public partial class home
{
/// <summary>
/// form1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
public partial class home {
}
}

View File

@ -3,4 +3,5 @@
<package id="EntityFramework" version="6.2.0" targetFramework="net461" />
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.8" targetFramework="net461" />
<package id="Microsoft.Net.Compilers" version="2.8.2" targetFramework="net461" developmentDependency="true" />
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net461" />
</packages>