private void GraphSetup() { List <KeyValuePair <string, int> > graphData = new List <KeyValuePair <string, int> >(); string[] months = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "Decemeber" }; int[] checkins = new int[12]; for (int i = 0; i < 12; i++) { this.checkins[i] = 0; } if (this.business != null) { BusinessCheckinsQueries.GetBusinessCheckin(this.AddMonthToGraph, this.business.BusinessID); for (int i = 0; i < 12; i++) { graphData.Add(new KeyValuePair <string, int>(months[i], this.checkins[i])); } } else { this.CheckInButton.IsEnabled = false; } this.checkinChart.DataContext = graphData; }
private void Button_Click(object sender, RoutedEventArgs e) { Checkin checkin = new Checkin(DateTime.Now.Year.ToString(), DateTime.Now.Month.ToString(), DateTime.Now.Day.ToString(), DateTime.Now.ToString("hh:mm:ss"), this.business.BusinessID); BusinessCheckinsQueries.InsertCheckin(checkin); this.PropertyChanged?.DynamicInvoke(null, new PropertyChangedEventArgs(string.Empty)); // notify the businessSearch this.checkinChart.DataContext = null; this.GraphSetup(); // refresh the graaph }