Ejemplo n.º 1
0
        /// <summary>
        /// Metoda wiążąca comboBoxa z listą nazw szablonów
        /// </summary>
        public void BindTemplates()
        {
            List <Template> templates = Templates.GetAll();

            comboBoxChooseTemplate.Items.Clear();
            foreach (Template item in templates)
            {
                comboBoxChooseTemplate.Items.Add(new ComboBoxItem(item.Name, item.Id));
            }
        }
 /// <summary>
 /// Metoda wiążąca datagridview z bazą danych szablonów
 /// </summary>
 public void BindDataGridView()
 {
     dataGridViewTemplates.DataSource = Templates.GetAll().Select(
         x => new
     {
         Id      = x.Id,
         Name    = x.Name,
         Content = x.Content
     }
         ).ToList();
 }
 /// <summary>
 /// Metoda wiążąca datagridview z bazą danych szablonów
 /// </summary>
 public void BindDataGridView()
 {
     dataGridViewDocuments.DataSource = Documents.GetAll().Select(
         x => new
     {
         Id         = x.Id,
         Name       = x.Name,
         Content    = x.Content,
         AuthorId   = x.AuthorId,
         TemplateId = x.TemplateId
     }
         ).ToList();
 }
Ejemplo n.º 4
0
 //dataGridViewGames -> w danym dataGridView
 //.DataSource <- jako zrodlo danych do wyswietlania
 // = Games <- udwolujemy sie do repozytorium gier
 // GetAll() <- pobieramy wszystkie gry z bazy
 // .Select( <- definujemy, jak bedzie wyglowac dane w dataGridView
 // x => new {tutaj opis parametrow} <- ten 'x' mozna rozumiec jako "kadzy pojedynczy obiekt"
 // .ToList() <- zrobi to liste gier , co umozliwi wyswietlanie w dataGridView
 private void GetAllAboutGamesToDataGridView()
 {
     dataGridViewGames.DataSource = Games.GetAll().Select(
         x => new
     {
         Id       = x.Id,
         Name     = x.Name,
         Producer = x.Producer
     }
         ).ToList();
 }