void gMapMarkerMaker(Donor donor, PointLatLng et) { MyMap.Overlays.Clear(); MyMap.Zoom = 14; TimeSpan st = new TimeSpan(58, 0, 0, 0); GMapOverlay markersOverlay = new GMapOverlay("markers"); GMarkerGoogle marker; if (donor.TimePassed() > st) { marker = new GMarkerGoogle(donor.getlatlog(), GMarkerGoogleType.green_small);//if the donor have passed 58 days after giving bloob then the marker will be green else red } else { marker = new GMarkerGoogle(donor.getlatlog(), GMarkerGoogleType.red_small); } markersOverlay.Markers.Add(marker); marker.ToolTip = new GMapRoundedToolTip(marker); marker.ToolTipText = donor.getName().ToString() + "\n" + donor.getBloodGroup().ToString() + "\n" + donor.getEmail().ToString(); MyMap.Overlays.Add(markersOverlay); listed.b++; }
public void readdata() { Donor d = new Donor(); TextReader str = new StreamReader("DATA.txt"); int[] f = new int[3]; double cp, dp; string w, x, y, z; PointLatLng et = new PointLatLng(); int count = 0; while (str.Peek() >= 0)//reading data form donor and inputting it in donor class { count++; w = str.ReadLine(); x = str.ReadLine(); y = str.ReadLine(); z = str.ReadLine(); d.setName(w); d.setEmail(x); d.setphone_number(y); d.setBG(z); f[0] = Convert.ToInt32(str.ReadLine()); f[1] = Convert.ToInt32(str.ReadLine()); f[2] = Convert.ToInt32(str.ReadLine()); DateTime j = new DateTime(f[2], f[1], f[0]); d.setLast_donated(j); cp = Convert.ToDouble(str.ReadLine()); dp = Convert.ToDouble(str.ReadLine()); et.Lat = cp; et.Lng = dp; d.setlatlog(et); string group = d.getBloodGroup(); if (group == "A+") { L[0].AddFirst(d); MessageBox.Show("Inserting A+ donor"); } else if (group == "A-") { L[1].AddFirst(d); MessageBox.Show("Inserting A- donor"); } else if (group == "B+") { L[2].AddFirst(d); MessageBox.Show("Inserting B+ donor"); } else if (group == "B-") { L[3].AddFirst(d); MessageBox.Show("Inserting B- donor"); } else if (group == "AB+") { L[4].AddFirst(d); MessageBox.Show("Inserting AB+ donor"); } else if (group == "AB-") { L[5].AddFirst(d); MessageBox.Show("Inserting AB- donor"); } else if (group == "O+") { L[6].AddFirst(d); MessageBox.Show("Inserting O+ donor"); } else if (group == "O-") { L[7].AddFirst(d); MessageBox.Show("Inserting O- donor"); } } str.Close(); MessageBox.Show(count + " lines read!"); }
public void insert(Donor d, PointLatLng r) { GeoCoordinate dis = new GeoCoordinate(); GeoCoordinate To = new GeoCoordinate(); GeoCoordinate newN = new GeoCoordinate(d.latlog.Lat, d.latlog.Lng); dis.Latitude = r.Lat; dis.Longitude = r.Lng; node newnode = new node(); newnode.data = d; newnode.left = null; newnode.right = null; node pp = null; node ptr; ptr = root; int xyz = 0; if (ptr == null) { if (dis.GetDistanceTo(newN) < 3000) { root = new node(); root.data = newnode.data; root.left = null; root.right = null; length++; } } else { while (ptr != null) { To.Latitude = ptr.data.latlog.Lat; To.Longitude = ptr.data.latlog.Lng; if (dis.GetDistanceTo(newN) < 3000 && dis.GetDistanceTo(newN) < dis.GetDistanceTo(To)) { pp = ptr; ptr = ptr.left; xyz = 1; } else if (dis.GetDistanceTo(newN) < 3000) { pp = ptr; ptr = ptr.right; xyz = 2; } else { xyz = 0; break; } } if (xyz == 1) { pp.left = new node(); pp.left.data = newnode.data; pp.left.left = null; pp.left.right = null; ///MessageBox.Show("left inserted" + pp.left.data.blood_group); length++; } else if (xyz == 2) { pp.right = new node(); pp.right.data = newnode.data; pp.right.left = null; pp.right.left = null; ///MessageBox.Show("right inserted" + pp.right.data.blood_group); length++; } else { } } }