Ejemplo n.º 1
0
        public Visit GetVisitByID(int ID)
        {
            string query = "SELECT * FROM Bezoek WHERE";

            using (SqlConnection conn = dbconn.Connect)
            {
                using (SqlCommand cmd = new SqlCommand(query, conn))
                {
                    using (SqlDataReader reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            v = CreateVisitFromReader(reader);
                        }
                    }
                }
                dbconn.Connect.Close();
            }
            return(v);
        }
Ejemplo n.º 2
0
 public void AddSighting(Visit v, Sighting sighting)
 {
     context.AddSighting(v, sighting);
 }
Ejemplo n.º 3
0
 public void AddSighting(Visit v, Sighting sighting)
 {
     v.WaarnemingenTijdensDitBezoek.Add(sighting);
 }
Ejemplo n.º 4
0
        public void NewVisit(string fullName, int projectID, DateTime datestarted)
        {
            Visit v = new Visit(fullName, projectID, datestarted);

            visits.Add(v);
        }
Ejemplo n.º 5
0
 partial void DeleteVisit(Visit instance);
Ejemplo n.º 6
0
 partial void UpdateVisit(Visit instance);
Ejemplo n.º 7
0
 partial void InsertVisit(Visit instance);
Ejemplo n.º 8
0
 private void detach_Visits(Visit entity)
 {
     this.SendPropertyChanging();
     entity.Patient = null;
 }
Ejemplo n.º 9
0
 private void attach_Visits(Visit entity)
 {
     this.SendPropertyChanging();
     entity.Patient = this;
 }
Ejemplo n.º 10
0
        // Load method using Tuple
        public Tuple <List <Staff>, List <Client>, List <Visit> > loadAll()
        {
            // Declare all the lists
            List <Client> clients   = new List <Client>();
            List <Staff>  employees = new List <Staff>();
            List <Visit>  visits    = new List <Visit>();

            // Gets all the lines from the text file.
            string str;

            string[] words;
            string[] lines = File.ReadAllLines(@"C:\Users\valka\OneDrive\Работен плот\cw2\cw2\PresentationLayer\PresentationLayer\Data.txt");

            foreach (string line in lines)
            {
                // For each Client line split, replace and then create a new Client and add it to the clients list.
                if (line.Contains("Client - ID"))
                {
                    str   = line.Replace("Client - ID: ", "");
                    str   = str.Replace("FirstName", "");
                    str   = str.Replace("Surname", "");
                    str   = str.Replace("Address", "");
                    str   = str.Replace("LocationLat", "");
                    str   = str.Replace("LocationLon", "");
                    words = str.Split(':');

                    Client client = new Client
                    {
                        Id        = Int32.Parse(words[0]),
                        FirstName = words[1],
                        Surname   = words[2],
                        Address1  = words[3].Replace(" Edinburgh", ""),
                        Address2  = "Edinburgh",
                        LocLat    = Double.Parse(words[4]),
                        LocLon    = Double.Parse(words[5])
                    };
                    clients.Add(client);
                }

                // For each Visit line split, replace and then create a new Visit and add it to the visits list.
                if (line.Contains("ClientID"))
                {
                    str   = line.Replace("ClientID- ", "");
                    str   = str.Replace("Staff", "");
                    str   = str.Replace("Type", "");
                    str   = str.Replace("Date", "");
                    words = str.Split('-');

                    Visit visit = new Visit
                    {
                        ClientId = Int32.Parse(words[0]),
                        Type     = Int32.Parse(words[2]),
                        Date     = DateTime.Parse(words[3])
                    };

                    string[] staff = words[1].Split(' ');

                    foreach (string i in staff)
                    {
                        if (i != "")
                        {
                            visit.addToList(Int32.Parse(i));
                        }
                    }
                    visits.Add(visit);
                }

                // For each Staff Member line split, replace and then create a new Staff and add it to the employees list.
                if (line.Contains("Staff Member"))
                {
                    str   = line.Replace("Staff Member - ID: ", "");
                    str   = str.Replace("FirstName", "");
                    str   = str.Replace("Surname", "");
                    str   = str.Replace("Address", "");
                    str   = str.Replace("Category", "");
                    str   = str.Replace("BaseLocationLat", "");
                    str   = str.Replace("BaseLocationLon", "");
                    words = str.Split(':');

                    Staff staff = new Staff
                    {
                        Id         = Int32.Parse(words[0]),
                        FirstName  = words[1],
                        Surname    = words[2],
                        Address1   = words[3].Replace(" Edinburgh", ""),
                        Address2   = "Edinburgh",
                        Category   = words[4],
                        BaseLocLat = Double.Parse(words[5]),
                        BaseLocLon = Double.Parse(words[6])
                    };
                    employees.Add(staff);
                }
            }

            // Return a tuple with the 3 lists
            return(Tuple.Create(employees, clients, visits));
        }
Ejemplo n.º 11
0
 public void AddSighting(Visit v, Sighting sighting)
 {
     throw new NotImplementedException();
 }