Example #1
0
        public void insert(string sir)
        {
            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++;
                d = new Donor();
                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);
                if (head == null && d.blood_group == sir)
                {
                    head      = new Tnode();
                    head.data = d;
                    head.next = null;
                    length++; listed.a++;
                }
                else if (d.blood_group == sir)
                {
                    Tnode newnode = new Tnode();
                    newnode.data = new Donor();
                    newnode.data = d;
                    newnode.next = new Tnode();
                    newnode.next = head;
                    head         = new Tnode();
                    head.data    = newnode.data;
                    head.next    = newnode.next;
                    length++; listed.a++;
                }

                //MessageBox.Show("inserted " + head.data.getBloodGroup());
            }
        }
Example #2
0
 void gMapMarkerMaker(Tnode donor, PointLatLng et, int length)//show markers
 {
     MyMap.Position = et;
     try
     {
         MyMap.Overlays.Clear();
         MyMap.Zoom = 14;
         TimeSpan        st             = new TimeSpan(58, 0, 0, 0);
         GMapOverlay     markersOverlay = new GMapOverlay("markers");
         GMarkerGoogle[] marker         = new GMarkerGoogle[length];
         Tnode           ptr;
         ptr = donor;
         int i = 0;
         while (ptr != null)
         {
             if (ptr.data.blood_group.ToString() == seach_box.Text.ToString())
             {
                 if (ptr.data.TimePassed() > st)
                 {
                     marker[i] = new GMarkerGoogle(ptr.data.getlatlog(), GMarkerGoogleType.green_small);//if the donor have passed 58 days after giving bloob then the marker will be green else red
                 }
                 else
                 {
                     marker[i] = new GMarkerGoogle(ptr.data.getlatlog(), GMarkerGoogleType.red_small);
                 }
                 markersOverlay.Markers.Add(marker[i]);
                 marker[i].ToolTip     = new GMapRoundedToolTip(marker[i]);
                 marker[i].ToolTipText = ptr.data.getName().ToString() + "\n" + ptr.data.getBloodGroup().ToString() + "\n" + ptr.data.getEmail().ToString();
                 MyMap.Overlays.Add(markersOverlay);
                 i++;
                 listed.b++;
             }
             ptr = ptr.next;
         }
         if (i == 0)
         {
             MessageBox.Show("No donors found!");
         }
         else
         {
             MessageBox.Show(i.ToString() + " donors found!");
         }
     }
     catch (NullReferenceException ex)
     {
         MessageBox.Show(ex.ToString(), "An exception has occured!");
     }
 }
Example #3
0
 public list()
 {
     head   = null;
     length = 0;
 }