Example #1
0
 private void FillDDLSporen()
 {
     foreach (Spoor spoor in bc.GetAllSporen())
     {
         ddlSpoorBlokkeren.Items.Add(spoor.Nummer.ToString());
         ddlSpoorReserverenSpoor.Items.Add(spoor.Nummer.ToString());
         ddlSectorBlokkerenSpoor.Items.Add(spoor.Nummer.ToString());
         if (spoor.Beschikbaar == true)
         {
             ddlTramVerplaatsenSpoor.Items.Add(spoor.Nummer.ToString());
         }
     }
 }
        private void VulAlgemeneDGV()
        {
            List <Spoor> listSporen = bc.GetAllSporen();

            int huidigeMaxSectoren = 0;

            foreach (Spoor sporen in listSporen) //test
            {
                if (sporen.Sectoren.Count > huidigeMaxSectoren)
                {
                    huidigeMaxSectoren = sporen.Sectoren.Count;
                }
            }

            foreach (Spoor s in listSporen)
            {
                dgvBeheer.Columns.Add("idk", "Spoor " + s.SpoorNummer);

                //for (int i = 0; i < s.Sectoren.Count - 1; i++)
                //{
                //    dgvBeheer.Rows[i].Cells[0].Value = s.Sectoren[i].Id;
                //}
            }
            for (int i = 0; i < huidigeMaxSectoren; i++)
            {
                dgvBeheer.Rows.Add(1);
            }

            foreach (DataGridViewRow row in dgvBeheer.Rows)
            {
                foreach (DataGridViewCell cell in row.Cells)
                {
                    cell.Style.BackColor = Color.LightGray;
                    cell.Style.ForeColor = Color.DarkGray;
                }
            }

            for (int rowIndex = 0; rowIndex < huidigeMaxSectoren; rowIndex++)
            {
                for (int columnIndex = 0; columnIndex < listSporen.Count; columnIndex++)
                {
                    if (listSporen[columnIndex].Sectoren.Count > rowIndex)
                    {
                        dgvBeheer.Rows[rowIndex].Cells[columnIndex].Style.BackColor =
                            dgvBeheer.Rows[rowIndex].Cells[columnIndex].OwningColumn.DefaultCellStyle.BackColor;
                        dgvBeheer.Rows[rowIndex].Cells[columnIndex].Style.ForeColor =
                            dgvBeheer.Rows[rowIndex].Cells[columnIndex].OwningColumn.DefaultCellStyle.ForeColor;
                    }
                }
            }
        }
Example #3
0
        public void UpdateTestMethode()
        {
            BeheerController bc    = new BeheerController();
            List <Tram>      trams = bc.GetAllTrams();

            trams[1].Defect = !trams[1].Defect;
            //bc.TramStatusAanpassen(trams[1]);

            List <Spoor> sporen = bc.GetAllSporen();

            sporen[0].Sectoren[0].Tram = trams[1];
            DatabaseController dc = new DatabaseController();

            dc.UpdateSector(sporen[0].Sectoren[0], bc.HuidigeRemise);

            //    List<Sector> sectoren = db.GetAllSectoren();
            //    List<Onderhoud> onderhoud = db.GetAllOnderhoud();
            //    List<Verbinding> transfers = db.GetAllVerbindingen();
        }