private void loadData() { this.Con = new es_K04000766Entities(); DateTime enteredDate = this.getDate(); var events = (from e in this.Con.Events from c in this.Con.Categories where e.category == c.id && EntityFunctions.TruncateTime(e.startdate) <= enteredDate && EntityFunctions.TruncateTime(e.enddate) >= enteredDate orderby e.startdate ascending select new { id = e.id, title = e.title, startdate = e.startdate, enddate = e.enddate, notes = e.notes, categoryid = c.id, categoryname = c.name, color = c.color }).ToList(); eventGrid.ItemsSource = events; this.eventGrid.AlternationCount = 1; }
private void printAllEvents() { es_K04000766Entities Con = new es_K04000766Entities(); List <Event> tableData; //if user selected a category only show records with the matching category if (cbCategory.SelectedIndex > 0) { int categoryId = getCategoryId(); tableData = Con.Events.Where(e => e.category == categoryId).OrderBy(e => e.startdate).ToList(); printEvents("ALL_EVENTS", tableData); } else { tableData = Con.Events.OrderBy(e => e.startdate).ToList(); printEvents("ALL_EVENTS", tableData); } }
private void setDefaultValues() { this.Con = new es_K04000766Entities(); foreach (String hour in Time.hourList) { this.cbStartHour.Items.Add(hour); this.cbEndHour.Items.Add(hour); } foreach (String minute in Time.minuteList) { this.cbStartMinute.Items.Add(minute); this.cbEndMinute.Items.Add(minute); } foreach (String type in Time.ampmList) { this.cbStartAMPM.Items.Add(type); this.cbEndAMPM.Items.Add(type); } //default to index 0 this.cbStartHour.SelectedIndex = 0; this.cbStartMinute.SelectedIndex = 0; this.cbStartAMPM.SelectedIndex = 0; this.cbEndHour.SelectedIndex = 0; this.cbEndMinute.SelectedIndex = 0; this.cbEndAMPM.SelectedIndex = 0; dpStartDate.Text = DateTime.Today.ToShortTimeString(); dpEndDate.Text = DateTime.Today.ToShortTimeString(); //load category box foreach (Category cat in this.Con.Categories) { this.cbCategory.Items.Add(cat.name); } }
private void printRangeEvents(DateTime startDate, DateTime endDate) { es_K04000766Entities Con = new es_K04000766Entities(); List <Event> tableData; if (cbCategory.SelectedIndex > 0) { int categoryId = getCategoryId(); tableData = Con.Events.Where(e => EntityFunctions.TruncateTime(e.startdate) >= startDate && EntityFunctions.TruncateTime(e.enddate) <= endDate && e.category == categoryId) .OrderBy(e => e.startdate) .ToList(); } else { tableData = Con.Events.Where(e => EntityFunctions.TruncateTime(e.startdate) >= startDate && EntityFunctions.TruncateTime(e.enddate) <= endDate) .OrderBy(e => e.startdate) .ToList(); } printEvents("RANGE_EVENTS", tableData); }
public PrintWindow() { this.Con = new es_K04000766Entities(); InitializeComponent(); loadCategories(); }