public List <Activity> GetActivities()
        {
            try
            {
                List <Activity> activities = activity_db.Db_Get_All_Activities();
                return(activities);
            }
            catch (Exception)
            {
                // something went wrong connecting to the database, so we will add a fake student to the list to make sure the rest of the application continues working!
                List <Activity> activities = new List <Activity>();
                Activity        a          = new Activity();
                a.ActivityID           = 1;
                a.Description          = "A game of laser tag. Gather in front of the barn when it is time for this activity.";
                a.NumberOfGuides       = 2;
                a.NumberOfParticipants = 20;
                activities.Add(a);

                Activity b = new Activity();
                b.ActivityID           = 2;
                b.Description          = "A food fight. This activity will be held in the cantine.";
                b.NumberOfGuides       = 5;
                b.NumberOfParticipants = 6840;
                activities.Add(b);

                return(activities);
                //throw new Exception("Someren couldn't connect to the database");
            }
        }
 public List <Activity> GetActivities()
 {
     try
     {
         List <Activity> activity = activity_db.Db_Get_All_Activities();
         return(activity);
     }
     catch (Exception e)
     {
         // Todo: Improve error logic.
         throw new Exception("Someren couldn't connect to the database " + e);
     }
 }
예제 #3
0
 public List <Activity> GetActivities()
 {
     try
     {
         // get the list with activities by calling a function from the DAL layer
         List <Activity> activities = dao.Db_Get_All_Activities();
         return(activities);
     }
     catch (Exception)
     {
         throw new Exception("Something went wrong!"); // or throw new exception
     }
 }
        public List <Activity> GetActivities()
        {
            try
            {
                List <Activity> activities = activity_db.Db_Get_All_Activities();

                return(activities);
            }
            catch (Exception)
            {
                throw new Exception("Someren (activities) couldn't connect to the database");
            }
        }
예제 #5
0
        public List <Activity> GetActivities()
        {
            try
            {
                List <Activity> activities = activity_db.Db_Get_All_Activities();
                return(activities);
            }
            catch (Exception)
            {
                // something went wrong connecting to the database, so we will add a fake student to the list to make sure the rest of the application continues working!
                List <Activity> activities = new List <Activity>();

                return(activities);
                //throw new Exception("Someren couldn't connect to the database");
            }
        }
예제 #6
0
        public List <Activity> GetActivities()
        {
            try
            {
                List <Activity> activitylist = activity_DAO.Db_Get_All_Activities();
                return(activitylist);
            }
            catch (Exception)
            {
                // something went wrong connecting to the database, so we will add a fake student to the list to make sure the rest of the application continues working!
                List <Activity> activities = new List <Activity>();

                Activity a = new Activity();
                a.Id          = 345;
                a.Description = "No connection - Test activity";
                a.StartTime   = new DateTime(2022, 03, 22, 10, 30, 00);
                a.EndTime     = new DateTime(2022, 03, 22, 12, 30, 00);
                activities.Add(a);
                return(activities);
            }
        }
예제 #7
0
        public List <Activity> GetActivities()
        {
            try
            {
                List <Activity> activity = activity_db.Db_Get_All_Activities();
                return(activity);
            }
            catch (Exception)
            {
                // something went wrong connecting to the database, so we will add a fake student to the list to make sure the rest of the application continues working!
                List <Activity> activities = new List <Activity>();
                Activity        a          = new Activity();
                a.Number                = 101;
                a.Description           = "Een hele leuke activiteit!";
                a.Number_of_students    = 10;
                a.Number_of_supervisors = 2;
                activities.Add(a);
                return(activities);

                throw new Exception("Someren couldn't connect to the database");
            }
        }
예제 #8
0
        public List <Activity> GetActivities()
        {
            try
            {
                List <Activity> activity = activity_db.Db_Get_All_Activities();
                return(activity);
            }
            catch (Exception)
            {
                List <Activity> activity   = new List <Activity>();
                Activity        activities = new Activity();
                activities.Id                  = 2;
                activities.ActivityName        = "Cricket";
                activities.NumberofStudents    = 12;
                activities.NumberofSupervisors = 3;
                activity.Add(activities);
                return(activity);

                // Todo: Improve error logic.
                throw new Exception("Someren couldn't connect to the database ");
            }
        }
예제 #9
0
 public List <Activity> GetActivities()
 {
     try
     {
         List <Activity> Activity = Activity_db.Db_Get_All_Activities();
         return(Activity);
     }
     catch (Exception)
     {
         return(new List <Activity>
         {
             new Activity
             {
                 ID = 110001,
                 Name = "test",
                 Description = "broken",
                 NumberOfStudents = 1000,
                 NumberOfSupervisors = 89
             }
         });
     }
 }
예제 #10
0
 public List <Activity> GetActivities()
 {
     return(activity_db.Db_Get_All_Activities());
 }