public ZeroCso(List <WorkData> adat, KiosztasDao kdao) { DataGridViewComboBoxCell combo; InitializeComponent(); this.kdao = kdao; List <string> utcanevek = kdao.GetUtcak(); foreach (WorkData ma in adat) { if (ma.CsoHossz == 0) { combo = new DataGridViewComboBoxCell(); foreach (string ns in utcanevek) { combo.Items.Add(ns); } try { combo.Value = ma.Utca.ToUpper(); } catch (Exception) { combo.Value = utcanevek[0]; } int row = csoGrid.Rows.Add(); csoGrid[Cim.Index, row].Value = ma; csoGrid[ValosCsohossz.Index, row].Value = 0; csoGrid[ValosCim.Index, row] = combo; csoGrid[ValosHsz.Index, row].Value = ma.HazSzam; csoGrid[CsoStr.Index, row].Value = ma.CsoStr; } } }
public MunkalapPanel(Repository repo, KiosztasDao dao) { this.dao = dao; this.repo = repo; InitializeComponent(); List <string> utcak = dao.GetUtcak(); List <WorkData> work = repo.GetOsszAdat().Values.ToList(); csoGrid.AutoGenerateColumns = false; csoGrid.DataSource = work; DataGridViewColumn col = new DataGridViewTextBoxColumn(); col.ReadOnly = true; col.HeaderText = "Munkalap"; col.DataPropertyName = "WorksheetNumber"; col.Width = 60; csoGrid.Columns.Add(col); col = new DataGridViewTextBoxColumn(); col.ReadOnly = true; col.HeaderText = "m3"; col.DataPropertyName = "WorkCapacity"; col.Width = 30; csoGrid.Columns.Add(col); col = new DataGridViewTextBoxColumn(); col.ReadOnly = true; col.HeaderText = "Tm3"; col.DataPropertyName = "TenylegesKobmeter"; col.Width = 30; csoGrid.Columns.Add(col); col = new DataGridViewTextBoxColumn(); col.HeaderText = "Napszak"; col.ReadOnly = true; col.DataPropertyName = "Napszak"; col.Width = 50; csoGrid.Columns.Add(col); DataGridViewComboBoxColumn combo = new DataGridViewComboBoxColumn(); combo.HeaderText = "Utca"; foreach (string itm in utcak) { combo.Items.Add(itm); } combo.Items.Add(""); combo.AutoComplete = true; combo.MaxDropDownItems = 10; combo.DataPropertyName = "Utca"; combo.Width = 140; csoGrid.Columns.Add(combo); col = new DataGridViewTextBoxColumn(); col.HeaderText = "Hsz"; col.DataPropertyName = "HazSzam"; col.Width = 60; csoGrid.Columns.Add(col); col = new DataGridViewTextBoxColumn(); col.HeaderText = "Info"; col.DataPropertyName = "Megjegyzes"; csoGrid.Columns.Add(col); col = new DataGridViewCheckBoxColumn(); col.HeaderText = "Problémás"; col.DataPropertyName = "Problematic"; col.Width = 60; csoGrid.Columns.Add(col); col = new DataGridViewTextBoxColumn(); col.HeaderText = "ID"; col.DataPropertyName = "Number"; col.Width = 10; col.Visible = false; csoGrid.Columns.Add(col); csoGrid.CellValueChanged += new DataGridViewCellEventHandler(csoGrid_CellValueChanged); }