Example #1
0
 public AddEditCourse()
 {
     InitializeComponent();
     Models.Person person = MainWindow.logic.GetFullPerson(MainWindow.logic.GetUni());
     for (int i = 1; i <= 3; i++)
     {
         CourseNumber.Items.Add(new ComboBoxItem()
         {
             Content = i
         });
     }
     if (!(person.Studing == "IT-supporter"))
     {
         for (int i = 4; i <= 5; i++)
         {
             CourseNumber.Items.Add(new ComboBoxItem()
             {
                 Content = i
             });
         }
     }
     StartDate.SelectedDate = DateTime.Now;
     EndDate.SelectedDate   = DateTime.Now;
     if (person.Courses.Count == 0 || person.Courses[person.Courses.Count - 1].CourseNumber > CourseNumber.Items.Count)
     {
         CourseNumber.SelectedIndex = 0;
     }
     else
     {
         CourseNumber.SelectedIndex = person.Courses[person.Courses.Count - 1].CourseNumber;
     }
     Remove.Visibility = Visibility.Hidden;
 }
Example #2
0
 public AddEditCourse(int courseIndex)
 {
     InitializeComponent();
     Models.Person person = MainWindow.logic.GetFullPerson(MainWindow.logic.GetUni());
     for (int i = 1; i <= 3; i++)
     {
         CourseNumber.Items.Add(new ComboBoxItem()
         {
             Content = i
         });
     }
     if (!(person.Studing == "IT-supporter"))
     {
         for (int i = 4; i <= 5; i++)
         {
             CourseNumber.Items.Add(new ComboBoxItem()
             {
                 Content = i
             });
         }
     }
     CourseNumber.SelectedIndex = person.Courses[courseIndex].CourseNumber - 1;
     StartDate.SelectedDate     = person.Courses[courseIndex].StartCourse;
     EndDate.SelectedDate       = person.Courses[courseIndex].EndCourse;
     this.ID = person.Courses[courseIndex].ID;
 }
Example #3
0
        public void StartUpSide(string uni)
        {
            Models.Person person = MainWindow.logic.GetFullPerson(uni);
            this.Name.Text  = person.Name;
            this.Study.Text = person.Studing;
            this.UNI.Text   = person.UNI;
            this.uni        = person.UNI;
            for (int i = 0; i < person.Courses.Count; i++)
            {
                StudyingAt.Items.Add(new ListBoxItem()
                {
                    IsEnabled = false, Content = "\bHovedforløb " + person.Courses[i].CourseNumber + "\t" + person.Courses[i].StartCourse.ToString("dd/MM/yyyy") + " - " + person.Courses[i].EndCourse.ToString("dd/MM/yyyy")
                });
            }
            Style style = (Style)Resources["TransparentBTN"];

            for (int i = 1; i <= person.Groups.Count; i++)
            {
                Button button = new Button()
                {
                    Margin              = new Thickness(0, 50 * i, 0, 0),
                    Content             = person.Groups[i - 1].Name,
                    Width               = 280,
                    Height              = 50,
                    Foreground          = new SolidColorBrush(Color.FromArgb(255, 100, 100, 100)),
                    FontSize            = 20,
                    VerticalAlignment   = VerticalAlignment.Top,
                    HorizontalAlignment = HorizontalAlignment.Left,
                    Style               = style,
                    Tag = person.Groups[i - 1].Id
                };
                button.Click += Button_Click;
                this.Groups.Children.Add(button);
            }
            if (MainWindow.logic.IsAdmin(MainWindow.logic.GetUni()))
            {
                if (MainWindow.logic.IsWebAdmin(uni))
                {
                    WebAdminSw.Content = "Gør til normal bruger";
                }
                else
                {
                    WebAdminSw.Content = "Gør til WebAdminstrator";
                }
            }
            else
            {
                Remove.Visibility     = Visibility.Hidden;
                WebAdminSw.Visibility = Visibility.Hidden;
            }
        }
Example #4
0
        private void BuildStudentSite()
        {
            Models.Person person = MainWindow.logic.GetFullPerson(uni);
            Courses.Children.Clear();
            UpComing.Children.Clear();
            Style style = (Style)Resources["TransparentBTN"];

            #region Course
            Button button = new Button()
            {
                Content           = "Hovedforløb \t\t\t +Tilføj",
                Height            = 30,
                Margin            = new Thickness(0, 0, 0, 0),
                Style             = style,
                VerticalAlignment = VerticalAlignment.Top,
            };
            button.Click += AddCourse;
            userHeight    = 70;
            Courses.Children.Add(button);
            for (int i = 0; i < person.Courses.Count; i++)
            {
                button = new Button()
                {
                    Content           = "Hovedforløb " + person.Courses[i].CourseNumber + "\t\t" + person.Courses[i].StartCourse.ToString("dd-MM-yyyy") + " - " + person.Courses[i].EndCourse.ToString("dd-MM-yyyy"),
                    Tag               = i,
                    Height            = 30,
                    Margin            = new Thickness(0, (userHeight - 40), 0, 0),
                    Style             = style,
                    VerticalAlignment = VerticalAlignment.Top,
                };
                button.Click += EditCourse;
                userHeight   += 30;
                Courses.Children.Add(button);
            }
            #endregion
            #region UpComing
            int topMargin = 0;
            button = new Button()
            {
                Content           = "UpComing \t\t\t\t Type",
                IsEnabled         = false,
                Height            = 30,
                Margin            = new Thickness(0, 0, 0, 0),
                Style             = style,
                VerticalAlignment = VerticalAlignment.Top,
            };
            topMargin += 30;
            UpComing.Children.Add(button);
            List <Models.Events> events = MainWindow.logic.GetEvents();
            string tabs = "";
            for (int i = 0; i < events.Count; i++)
            {
                tabs = "";
                if (events[i].Title.Length <= 39)
                {
                    tabs += "\t";
                }
                if (events[i].Title.Length <= 30)
                {
                    tabs += "\t";
                }
                if (events[i].Title.Length <= 21)
                {
                    tabs += "\t";
                }
                if (events[i].Title.Length <= 15)
                {
                    tabs += "\t";
                }
                if (events[i].Title.Length <= 9)
                {
                    tabs += "\t";
                }
                switch (events[i].Colour)
                {
                case "#DD1515":
                    button = new Button()
                    {
                        Content           = events[i].Title + tabs + " Vigtig Event \n" + events[i].Start_Date.ToString("dd/MM/yyyy HH:mm") + " - " + events[i].End_Date.ToString("dd/MM/yyyy HH:mm"),
                        Height            = 50,
                        Margin            = new Thickness(0, topMargin, 0, 0),
                        Style             = style,
                        VerticalAlignment = VerticalAlignment.Top,
                        Tag = events[i],
                    };
                    button.Click += UpComing_Click;
                    UpComing.Children.Add(button);
                    break;

                case "#AAAAAA":
                    button = new Button()
                    {
                        Content           = events[i].Title + tabs + " Ferie \n" + events[i].Start_Date.ToString("dd/MM/yyyy") + " - " + events[i].End_Date.ToString("dd/MM/yyyy"),
                        Height            = 50,
                        Margin            = new Thickness(0, topMargin, 0, 0),
                        Style             = style,
                        VerticalAlignment = VerticalAlignment.Top,
                        Tag = events[i],
                    };
                    button.Click += UpComing_Click;
                    UpComing.Children.Add(button);
                    break;

                case "#F1C40F":
                    button = new Button()
                    {
                        Content           = events[i].Title + tabs + " Event \n" + events[i].Start_Date.ToString("dd/MM/yyyy HH:mm") + " - " + events[i].End_Date.ToString("dd/MM/yyyy HH:mm"),
                        Height            = 50,
                        Margin            = new Thickness(0, topMargin, 0, 0),
                        Style             = style,
                        VerticalAlignment = VerticalAlignment.Top,
                        Tag = events[i],
                    };
                    button.Click += UpComing_Click;
                    UpComing.Children.Add(button);
                    break;
                }
                topMargin += 50;
            }
            #endregion
        }