Ignore:
Timestamp:
Dec 8, 2010, 9:44:29 AM (13 years ago)
Author:
Sam Habiel
Message:

UCPatientAppts: Now uses LINQ. Mumps side fixes deal with other bugs.
calendarGrid: Fixes 1 day drawing bug showing yesterday's appointments
CGAVView: Cosmetic changes so far
CGDocument: Documentation change due to change in return values from Mumps.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Scheduling/trunk/cs/bsdx0200GUISourceCode/UCPatientAppts.cs

    r1011 r1038  
    3232            catch (Exception ex) { MessageBox.Show(ex.Message); }
    3333
    34             dvAppt = new DataView(dtAppt);
    35             dvAppt.Sort = "ApptDate ASC";
    3634            SetPastFilter(false);
    37             dgAppts.DataSource = dvAppt;
    38 
     35           
     36            // dgAppts.DataSource = dvAppt;
    3937        }
    4038        /// <summary>
    4139        /// Sets the filter for the DataView on whether to show past appointments or not
     40        /// Uses LINQ. Must use .Net 3.5 or above. Hope the LINQ is self-explanatory.
    4241        /// </summary>
    4342        /// <param name="ShowPastAppts">boolean - self explanatory</param>
    4443        void SetPastFilter(bool ShowPastAppts)
    4544        {
    46             if (ShowPastAppts) dvAppt.RowFilter = "";
    47             else dvAppt.RowFilter = "ApptDate > " + "'" + DateTime.Today.ToShortDateString() + "'";
     45            if (ShowPastAppts)
     46            {
     47                var uncancelledAppts = from appt in dtAppt.AsEnumerable()
     48                                       orderby appt.Field<DateTime>("ApptDate")
     49                                       select appt;
     50
     51                dvAppt = uncancelledAppts.AsDataView();
     52            }
     53            else
     54            {
     55                var uncancelledAppts = from appt in dtAppt.AsEnumerable()
     56                                       where appt.Field<DateTime>("ApptDate") > DateTime.Today
     57                                       orderby appt.Field<DateTime>("ApptDate")
     58                                       select appt;
     59
     60                dvAppt = uncancelledAppts.AsDataView();
     61            }
     62
     63            // It's strange that I have to bind it here; but look like dvAppt points to a new memory
     64            // location when reassigned up above in the LINQ statement, so we have to rebind it.
     65            dgAppts.DataSource = dvAppt;
    4866        }
    4967
Note: See TracChangeset for help on using the changeset viewer.