private void DataClick(object obj) { var point = (ChartPoint)obj; var userName = point.SeriesView.Title; var serie = GoalRecords2.FirstOrDefault(view => view.Title == userName); var date = Dates.ElementAt((int)point.X); date = date.Replace('.', '-'); DateTime result = DateTime.ParseExact(date, "dd-MM-yyyy", CultureInfo.InvariantCulture); string note; using (var db = new GoalMasterDatabaseContext()) { var user = db.Users.FirstOrDefault(us => us.Login == userName); var goalRecord = db.GoalRecords.FirstOrDefault(gr => gr.Date == result && gr.User.ID == user.ID); note = goalRecord.Note; } MessageBox_Show(null, $"{note}", "Note"); }
public string GetRandomDate() { return(Dates.ElementAt(_random.Next(Dates.Count() - 1))); }