Exemple #1
0
 public void KoppelenWindowSaveClicked(List <Pair> pairsToSave)
 {
     foreach (Pair pair in pairsToSave)
     {
         PairMapper.Save(pair);
     }
 }
Exemple #2
0
 public MainForm()
 {
     InitializeComponent();
     fileRepository    = new FileRepository();
     pairRepository    = new PairRepository();
     developRepository = new DevelopRepository();
     tutorRepository   = new TutorRepository();
     pairMapper        = new PairMapper();
 }
Exemple #3
0
        public void loadAllPairs(PairMapper pairmapper)
        {
            GridPairs.Children.Clear();
            List <Model.Pair> pairs = pairmapper.FindAllUnplanned();
            int i = 0;

            foreach (Model.Pair pair in pairs)
            {
                CustomLabel label = new CustomLabel();
                label.Id = pair.ID;
                string content = "";
                if (pair.Student2 != null)
                {
                    content = pair.Student1.Firstname + " " + pair.Student1.Surname + "\n" +
                              pair.Student2.Firstname + " " + pair.Student2.Surname + "\n\n";
                }
                else
                {
                    content = pair.Student1.Firstname + " " + pair.Student1.Surname + "\n\n";
                }
                string teachers = "";
                string experts  = "";
                foreach (Model.User attachment in pair.Attachments)
                {//TODO: find out why attachment shows up if there isnt any...
                    string name = attachment.Firstname + " " + attachment.Surname + "\n";
                    if (attachment.User_type == "teacher")
                    {
                        teachers += name;
                    }
                    else
                    {
                        experts += name;
                    }
                }
                label.Content         = content + teachers + "\n" + experts;
                label.BorderBrush     = Brushes.LightGray;
                label.BorderThickness = new Thickness(2);
                label.Margin          = new Thickness(1, 1, 1, 1);
                label.MouseMove      += new MouseEventHandler(pair_MouseMove);
                Grid.SetRow(label, i);
                if (GridPairs.RowDefinitions.Count != pairs.Count)
                {
                    RowDefinition row    = new RowDefinition();
                    GridLength    height = new GridLength(145);
                    row.Height = height;
                    GridPairs.RowDefinitions.Add(row);
                }
                GridPairs.Children.Add(label);
                i++;
            }
        }