/// <summary> /// Performs the computation on the milestones to see what progress has been made for each. We MUST use LogbookEntryDisplays, so we override the base class (which uses ExaminerFlightRow) /// </summary> /// <returns>The resulting milestones.</returns> /// <exception cref="MyFlightbookException"></exception> public override Collection <MilestoneItem> Refresh() { if (String.IsNullOrEmpty(Username)) { throw new MyFlightbookException("Cannot compute milestones on an empty user!"); } StringBuilder sbRoutes = new StringBuilder(); Profile pf = Profile.GetUser(Username); IList <LogbookEntryDisplay> lst = LogbookEntryDisplay.GetFlightsForQuery(LogbookEntryBase.QueryCommand(new FlightQuery(Username)), Username, string.Empty, System.Web.UI.WebControls.SortDirection.Descending, pf.UsesHHMM, pf.UsesUTCDateOfFlight); // Set up the airport list once for DB efficiency foreach (LogbookEntryDisplay led in lst) { sbRoutes.AppendFormat(CultureInfo.InvariantCulture, "{0} ", led.Route); } AirportListOfRoutes = new AirportList(sbRoutes.ToString()); IDictionary <string, CannedQuery> d = UserQueries; foreach (LogbookEntryDisplay led in lst) { foreach (CustomRatingProgressItem cpi in ProgressItems) { cpi.ExamineFlight(led, d); } } ; return(Milestones); }
protected void btnCheckAll_Click(object sender, EventArgs e) { UInt32 selectedOptions = SelectedOptions; if (selectedOptions == 0) { lblErr.Text = Resources.FlightLint.errNoOptionsSelected; return; } FlightQuery fq = new FlightQuery(Page.User.Identity.Name); if (mfbDateLastCheck.Date.HasValue()) { fq.DateRange = FlightQuery.DateRanges.Custom; fq.DateMin = mfbDateLastCheck.Date; } DBHelperCommandArgs dbhq = LogbookEntryBase.QueryCommand(fq, fAsc: true); IEnumerable <LogbookEntryBase> rgle = LogbookEntryDisplay.GetFlightsForQuery(dbhq, Page.User.Identity.Name, "Date", SortDirection.Ascending, false, false); BindFlights(new FlightLint().CheckFlights(rgle, Page.User.Identity.Name, selectedOptions, mfbDateLastCheck.Date), rgle.Count()); Response.Cookies[szCookieLastCheck].Value = DateTime.Now.YMDString(); Response.Cookies[szCookieLastCheck].Expires = DateTime.Now.AddYears(5); }