private void loadPrograms()
        {
            ProgrammeHelper client = new ProgrammeHelper();
            try
            {

                List<Program> progList = client.ViewProgram(eventDay_.DayID).ToList<Program>();

                DateTime curr = eventDay_.StartDateTime;
                DateTime end = eventDay_.EndDateTime;

                List<Program> newprogList = new List<Program>();
                while (curr.CompareTo(end) < 0)
                {
                    for (int i = 0; i < progList.Count; i++)
                    {
                        if (progList[i].StartDateTime.CompareTo(curr) == 0)
                        {
                            newprogList.Add(progList[i]);
                            curr = progList[i].EndDateTime;
                            goto next;
                        }
                    }

                    Program p = new Program();
                    p.Name = "";
                    p.StartDateTime = curr;
                    p.EndDateTime = curr.AddMinutes(30);
                    newprogList.Add(p);
                    curr = curr.AddMinutes(30);

                next:
                    continue;

                }

                lstProgram.ItemsSource = newprogList.OrderBy(x => x.StartDateTime)
                                                 .ThenBy(x => x.EndDateTime).ToList<Program>();
                lstProgram.SelectedIndex = -1;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                client.Close();
            }
        }
예제 #2
0
        private void loadPrograms()
        {
            ProgrammeHelper client = new ProgrammeHelper();
            List<Program> progs = client.ViewProgram(this.eventday_.DayID).ToList<Program>();

            if (progs.Count() == 0)
                txtProgramMsg.Text = "No Programmes Added Yet.";
            else
            {
                txtProgramMsg.Text = "There are " + progs.Count + " planned programmes";// from " + min.ToShortTimeString() + " to " + max.ToShortTimeString();
            }
            client.Close();
        }