Exemple #1
0
 /// <summary>
 /// Handles the Load event of the Page control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!rdpStartDate.SelectedDate.HasValue && !rdpEndDate.SelectedDate.HasValue)
     {
         var dataManager  = new DataManager();
         var userSettings = dataManager.UserSettings.SelectByClassName(CurrentUser.Instance.ID, TaskWidgetFilterClassName);
         if (userSettings != null)
         {
             var filter = new TaskFilterSettings();
             filter.Deserialize(userSettings.UserSettings);
             rdpStartDate.SelectedDate = filter.StartDate;
             rdpEndDate.SelectedDate   = filter.EndDate;
             rcRangeSelection.RangeSelectionStartDate = filter.StartDate;
             rcRangeSelection.RangeSelectionEndDate   = filter.EndDate;
             FireFilterChangedEvent();
         }
         else
         {
             rdpStartDate.SelectedDate = DateTime.Now;
             rdpEndDate.SelectedDate   = DateTime.Now;
             rcRangeSelection.RangeSelectionStartDate = DateTime.Now;
             rcRangeSelection.RangeSelectionEndDate   = DateTime.Now;
             FireFilterChangedEvent();
         }
     }
 }
Exemple #2
0
        /// <summary>
        /// Saves the settings.
        /// </summary>
        protected void SaveSettings()
        {
            var dataManager  = new DataManager();
            var userSettings = dataManager.UserSettings.SelectByClassName(CurrentUser.Instance.ID, TaskWidgetFilterClassName) ?? new tbl_UserSettings();
            var filter       = new TaskFilterSettings
            {
                StartDate = rdpStartDate.SelectedDate ?? DateTime.Now,
                EndDate   = rdpEndDate.SelectedDate ?? DateTime.Now
            };

            userSettings.UserID       = CurrentUser.Instance.ID;
            userSettings.ClassName    = TaskWidgetFilterClassName;
            userSettings.UserSettings = filter.Serialize();

            dataManager.UserSettings.Save(userSettings);

            rcRangeSelection.RangeSelectionStartDate = rdpStartDate.SelectedDate ?? DateTime.Now;
            rcRangeSelection.RangeSelectionEndDate   = rdpEndDate.SelectedDate ?? DateTime.Now;
        }