/// <summary>
 ///     Find all classes at a given time.
 /// </summary>
 public List <Session> FindAllClassesAt(TimeOfWeek time, bool selected)
 {
     // examine every class
     return
         (ClassList.Where(session => !selected || session.Stream.Selected)
          .Where(session => time >= session.Start && time <= session.End)
          .ToList());
 }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            route = Route.getRouteByID(int.Parse(Request.QueryString["routeID"]));
            WebControlGenerator.showInfo(route, infoPanel, false);

            List <TimeOfWeek> schedule = TimeOfWeek.getTimesByRouteIDAsList(route.Id);

            foreach (TimeOfWeek t in schedule)
            {
                t.setNextOperations();
                WebControlGenerator.addTimesToPanel(route, t, timesPanel, true);
            }
        }
 private void FindClickDetails(TimetableEventArgs e)
 {
     _clickTime = e.Time;
     if (Timetable == null)
     {
         _clickSession = null;
         _clickUnavail = null;
     }
     else
     {
         _clickSession = Timetable.FindClassAt(_clickTime, true);
         _clickUnavail = Timetable.FindUnavailableAt(_clickTime);
     }
 }
Esempio n. 4
0
 private void gridViewRoutes_SelectionChanged(object sender, EventArgs e)
 {
     try
     {
         routeID = "" + gridViewRoutes.SelectedRows[0].Cells[0].Value;
         getData(TimeOfWeek.getTimesByRouteIDAsSqlDataAdapter(int.Parse(routeID)), bindingSourceTimes);
     }
     catch (ArgumentOutOfRangeException aoorex)
     {
     }
     catch (Exception ex)
     {
         MessageBox.Show("Probe 2: " + ex);
     }
 }
Esempio n. 5
0
 /// <summary>
 /// Find an unavailable slot at a given time.
 /// </summary>
 /// <returns>The first unavailable slot found, or null if none were found.</returns>
 public Unavailability FindUnavailableAt(TimeOfWeek time)
 {
     foreach (Unavailability u in UnavailableList)
     {
         if (time >= u.Start && time <= u.End)
             return u;
     }
     return null;
 }
Esempio n. 6
0
 /// <summary>
 /// Check if a time is within an unavailable slot.
 /// </summary>
 public bool UnavailableAt(TimeOfWeek time)
 {
     return (FindUnavailableAt(time) != null);
 }
Esempio n. 7
0
 /// <summary>
 /// Check if the timetable is free at a given time.
 /// </summary>
 /// <returns>True if it's free.</returns>
 public bool FreeAt(TimeOfWeek time, bool selected)
 {
     return (!ClassAt(time, selected) && !UnavailableAt(time));
 }
 /// <summary>
 ///     Check if a time is within an unavailable slot.
 /// </summary>
 public bool UnavailableAt(TimeOfWeek time)
 {
     return(FindUnavailableAt(time) != null);
 }
Esempio n. 9
0
 private void FindClickDetails(TimetableEventArgs e)
 {
     ClickTime_ = e.Time;
     if (Timetable_ == null)
     {
         ClickSession_ = null;
         ClickUnavail_ = null;
     }
     else
     {
         ClickSession_ = Timetable_.FindClassAt(ClickTime_, true);
         ClickUnavail_ = Timetable_.FindUnavailableAt(ClickTime_);
     }
 }
Esempio n. 10
0
 /// <summary>
 /// Find a class at a given time.
 /// </summary>
 /// <returns>The first class found, or null if none were found.</returns>
 public Session FindClassAt(TimeOfWeek time, bool selected)
 {
     foreach (Session session in ClassList)
     {
         if (selected && !session.Stream.Selected)
             continue;
         if (time >= session.Start && time <= session.End)
             return session;
     }
     return null;
 }
Esempio n. 11
0
 public TimetableEventArgs(MouseEventArgs e, TimeOfWeek time)
     : base(e.Button, e.Clicks, e.X, e.Y, e.Delta)
 {
     Time = time;
 }
 /// <summary>
 ///     Find a class at a given time.
 /// </summary>
 /// <returns>The first class found, or null if none were found.</returns>
 public Session FindClassAt(TimeOfWeek time, bool selected)
 {
     return
         (ClassList.Where(session => !selected || session.Stream.Selected)
          .FirstOrDefault(session => time >= session.Start && time <= session.End));
 }
 /// <summary>
 ///     Check if there's a class on at a given time.
 /// </summary>
 public bool ClassAt(TimeOfWeek time, bool selected)
 {
     return(FindClassAt(time, selected) != null);
 }
 /// <summary>
 ///     Find all unavailable slots at a given time.
 /// </summary>
 /// <returns>The list of unavailable slots found.</returns>
 public List <Unavailability> FindAllUnavailableAt(TimeOfWeek time)
 {
     return(UnavailableList.Where(u => time >= u.Start && time <= u.End).ToList());
 }
 /// <summary>
 ///     Find an unavailable slot at a given time.
 /// </summary>
 /// <returns>The first unavailable slot found, or null if none were found.</returns>
 public Unavailability FindUnavailableAt(TimeOfWeek time)
 {
     return(UnavailableList.FirstOrDefault(u => time >= u.Start && time <= u.End));
 }
Esempio n. 16
0
 /// <summary>
 /// Find all unavailable slots at a given time.
 /// </summary>
 /// <returns>The list of unavailable slots found.</returns>
 public List<Unavailability> FindAllUnavailableAt(TimeOfWeek time)
 {
     List<Unavailability> us = new List<Unavailability>();
     foreach (Unavailability u in UnavailableList)
     {
         if (time >= u.Start && time <= u.End)
             us.Add(u);
     }
     return us;
 }
Esempio n. 17
0
 /// <summary>
 /// Check if there's a class on at a given time.
 /// </summary>
 public bool ClassAt(TimeOfWeek time, bool selected)
 {
     return FindClassAt(time, selected) != null;
 }
 private static Stream FindStream(Type type, TimeOfWeek time)
 {
     return(Timetable.From(type).FindClassAt(time, false).Stream);
 }
Esempio n. 19
0
 /// <summary>
 /// Find all classes at a given time.
 /// </summary>
 public List<Session> FindAllClassesAt(TimeOfWeek time, bool selected)
 {
     List<Session> sessions = new List<Session>();
     // examine every class
     foreach (Session session in ClassList)
     {
         if (selected && !session.Stream.Selected)
             continue;
         if (time >= session.Start && time <= session.End)
             sessions.Add(session);
     }
     return sessions;
 }
        public static void addTimesToPanel(Route r, TimeOfWeek t, Panel p, bool listing)
        {
            Panel  operationPanel = new Panel();
            Label  header         = new Label();
            string day            = "";

            #region Switch statement
            switch (t.DayOfWeek)
            {
            case 0:
                day = "Sunday";
                break;

            case 1:
                day = "Monday";
                break;

            case 2:
                day = "Tuesday";
                break;

            case 3:
                day = "Wednesday";
                break;

            case 4:
                day = "Thursday";
                break;

            case 5:
                day = "Friday";
                break;

            case 6:
                day = "Sunday";
                break;
            }
            #endregion

            header.Text = day + " - " + t.Time.ToString().Substring(0, 5) + "<br />";
            operationPanel.Controls.Add(header);

            foreach (DateTime dt in t.NextOperations)
            {
                Label label = new Label();
                label.Text = dt.ToString("dd/MM HH:mm");
                if (listing)
                {
                    HyperLink link = new HyperLink();
                    link.NavigateUrl = "..\\customer\\CoachListing.aspx?routeID=" + r.Id + "&timeID=" + t.Id + "&operation=" + dt.ToString("dd/MM/yyyy HH:mm");
                    link.Controls.Add(label);
                    link.Width = new Unit(200);
                    operationPanel.Controls.Add(link);
                }
                else
                {
                    operationPanel.Controls.Add(label);
                }
            }
            Label breakLine = new Label();
            breakLine.Text = "<br /><br />";
            operationPanel.Controls.Add(breakLine);
            p.Controls.Add(operationPanel);
        }
Esempio n. 21
0
 public TimetableEventArgs(MouseButtons button, int clicks, int x, int y, int delta, TimeOfWeek time)
     : base(button, clicks, x, y, delta)
 {
     Time_ = time;
 }
Esempio n. 22
0
 public TimetableEventArgs(MouseEventArgs e, TimeOfWeek time)
     : base(e.Button, e.Clicks, e.X, e.Y, e.Delta)
 {
     Time_ = time;
 }
Esempio n. 23
0
 private Stream FindStream(Type type, TimeOfWeek time)
 {
     return Timetable.From(type).FindClassAt(time, false).Stream;
 }
 /// <summary>
 ///     Check if the timetable is free at a given time.
 /// </summary>
 /// <returns>True if it's free.</returns>
 public bool FreeAt(TimeOfWeek time, bool selected)
 {
     return(!ClassAt(time, selected) && !UnavailableAt(time));
 }