Beispiel #1
0
    /// <summary>
    /// Raises the <see cref="E:System.Web.UI.Control.PreRender"/> event.
    /// </summary>
    /// <param name="e">An <see cref="T:System.EventArgs"/> object that contains the event data.</param>
    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);

        if (!Visible)
        {
            return;
        }

        DateTime fromDate = GetLastWebUpdate();

        SearchOptions.UserIds.AddRange(UserCalendar.GetCalendarAccessUserList(CurrentUserId));
        SearchOptions.StartDate = fromDate;
        if (!String.IsNullOrEmpty(grdNewActivities.SortExpression))
        {
            SearchOptions.OrderBy = grdNewActivities.SortExpression;
        }
        SearchOptions.IncludeUnconfirmed = true;
        SearchOptions.MaxResults         = grdNewActivities.PageSize;

        grdNewActivities.DataSource = ActivitiesNewObjectDataSource;
        grdNewActivities.DataBind();
        grdModifiedActivities.DataSource = ActivitiesModifiedObjectDataSource;
        grdModifiedActivities.DataBind();
    }
    /// <summary>
    /// Raises the <see cref="E:System.Web.UI.Control.PreRender"/> event.
    /// </summary>
    /// <param name="e">An <see cref="T:System.EventArgs"/> object that contains the event data.</param>
    protected override void OnPreRender(EventArgs e)
    {
        if (!Visible)
        {
            return;
        }

        DateTime            fromDate    = DateTime.UtcNow;
        IUserOptionsService userOptions = ApplicationContext.Current.Services.Get <IUserOptionsService>();

        if (userOptions != null)
        {
            try
            {
                fromDate = DateTime.Parse(userOptions.GetCommonOption("LastWebUpdate", "Web", false, fromDate.ToString(), "LastWebUpdate"));
            }
            catch
            { }
        }

        SearchOptions.NotesOnly  = true;
        SearchOptions.SearchDate = fromDate;
        SearchOptions.UserIds.AddRange(UserCalendar.GetCalendarAccessUserList(CurrentUserId));

        //New History
        SearchOptions.SearchType = WhatsNewSearchOptions.SearchTypeEnum.New;
        if (!String.IsNullOrEmpty(grdNewNotes.SortExpression))
        {
            SearchOptions.OrderBy       = grdNewNotes.SortExpression;
            SearchOptions.SortDirection =
                (grdNewNotes.CurrentSortDirection.Equals("Ascending", StringComparison.CurrentCultureIgnoreCase))
                    ? ListSortDirection.Ascending
                    : ListSortDirection.Descending;
        }
        WNRequest.SearchOptions = SearchOptions;
        grdNewNotes.DataSource  = NotesNewObjectDataSource;
        grdNewNotes.DataBind();

        //Modified History
        SearchOptions.SearchType = WhatsNewSearchOptions.SearchTypeEnum.Updated;
        if (!String.IsNullOrEmpty(grdModifiedNotes.SortExpression))
        {
            SearchOptions.OrderBy       = grdModifiedNotes.SortExpression;
            SearchOptions.SortDirection =
                (grdModifiedNotes.CurrentSortDirection.Equals("Ascending", StringComparison.CurrentCultureIgnoreCase))
                    ? ListSortDirection.Ascending
                    : ListSortDirection.Descending;
        }
        else
        {
            SearchOptions.OrderBy       = "ModifyDate";
            SearchOptions.SortDirection = ListSortDirection.Ascending;
        }
        WNRequest.SearchOptions     = SearchOptions;
        grdModifiedNotes.DataSource = NotesModifiedObjectDataSource;
        grdModifiedNotes.DataBind();

        base.OnPreRender(e);
    }