private BindingList <Company> getCompanies() { data = dc.getData(); return(data.Companies); }
private void EventMV_Load(object sender, EventArgs e) { data = dc.getData(); companies = data.Companies.OrderBy(o => o.Name).ToList(); comboBox1.DataSource = companies; comboBox1.DisplayMember = "Name"; if (addition) { pallets = data.Pallets.OrderBy(o => o.Name).ToList(); foreach (Palette p in pallets) { mpallets.Add(new Event.MyPalette(p, 0, 0)); } comboBox2.DataSource = pallets; comboBox2.DisplayMember = "Name"; if (comboBox1.Items.Count != 0) { comboBox1.SelectedItem = comboBox1.Items[0]; } if (comboBox2.Items.Count != 0) { comboBox2.SelectedItem = comboBox2.Items[0]; textBox3.Text = mpallets[0].Plus.ToString(); textBox4.Text = mpallets[0].Minus.ToString(); } } else { Event ev = data.Events.First(o => o.Id == eid); BindingList <Event.MyPalette> evmpbl; Event.MyPalette evmp; dateTimePicker1.Text = ev.Date; if (comboBox1.Items.Count != 0) { comboBox1.SelectedIndex = comboBox1.FindString(ev.Company.Name); } pallets = data.Pallets.OrderBy(o => o.Name).ToList(); evmpbl = ev.MPalette; foreach (Palette p in pallets) { evmp = evmpbl.FirstOrDefault(o => o.Palette.Id == p.Id); if (evmp.Palette != null) { mpallets.Add(new Event.MyPalette(p, evmp.Plus, evmp.Minus)); } else { mpallets.Add(new Event.MyPalette(p, 0, 0)); } } mpallets.OrderBy(o => o.Palette.Name).ToList(); comboBox2.DataSource = pallets; comboBox2.DisplayMember = "Name"; if (comboBox2.Items.Count != 0) { comboBox2.SelectedItem = comboBox2.Items[0]; textBox3.Text = mpallets[0].Plus.ToString(); textBox4.Text = mpallets[0].Minus.ToString(); } textBox2.Text = ev.Comment; } }
private BindingList <Event> getEvents() { data = dc.getData(); return(data.Events); }
private BindingList <Palette> getPallets() { data = dc.getData(); return(data.Pallets); }