public Form2(Offer obj, SalesOfferEntities SOE) { //SOEOI = new SalesOfferEntities(); this.SOEOI = SOE; IList <OfferItem> oi = new System.ComponentModel.BindingList <OfferItem>(); oi = SOE.OfferItem.Where(offi => offi.OfferVersionGroup.OfferVersion.OfferId == obj.Id).ToList(); InitializeComponent(); offerBindingSource.DataSource = obj; offerVersionBindingSource = new BindingSource(); var qovid = ((from ov in SOEOI.OfferVersion where ov.OfferId == obj.Id select ov.IssueDate)).SingleOrDefault(); DateTime ovid; if (DateTime.TryParse(qovid.ToString(), out ovid)) { labIssueDate.Text = ovid.ToString("yyyy/MM/dd"); } else { labIssueDate.Text = null; } offerVersionBindingSource.DataSource = SOEOI.OfferVersion.Local.ToBindingList().Where(ov => ov.OfferId == obj.Id); offerItemBindingSource.DataSource = oi.ToList(); }
private void applyHolidaysButton_Click(object sender, EventArgs e) { System.ComponentModel.BindingList <PlannedHoliday> bl = (System.ComponentModel.BindingList <PlannedHoliday>)holidaysDataGrid.DataSource; simulator.UpdateHolidays(bl.ToList <PlannedHoliday>()); }