private void Popup() { try { if (InvokeRequired) { BeginInvoke(new MethodInvoker(Popup)); } else { if (Context.User != null && Context.User.HasPopups) { DL.Internal.Popup.PopupObjectCollection popups = new BL.Internal.Popup().GetallActivePopupsByUser(Context.User); TimeSpan time; foreach (DL.Internal.Popup.PopupObject popup in popups) { //Show popup directly? if (popup.ShowDirect == true) { Alert(popup); popup.ShowDirect = false; new BL.Internal.Popup().Save(popup); } time = new TimeSpan(int.Parse(popup.Time.Substring(0, 2)), int.Parse(popup.Time.Substring(2, 2)), int.Parse(popup.Time.Substring(4, 2))); switch (popup.Repeation) { case Enumeration.Frequency.TimeFrequency.Daily: DateTime compTime = DateTime.Now; if (time.CompareTo(DateTime.Now.TimeOfDay.Add(new TimeSpan(0, 0, 15))) != time.CompareTo(DateTime.Now.TimeOfDay.Add(new TimeSpan(0, 0, -15)))) Alert(popup); break; case Enumeration.Frequency.TimeFrequency.Monthly: if (PROF_IT.Common.Convert.DateFunctions.DBDateToDate(popup.CreationDate, false).Day == DateTime.Now.Day && time.CompareTo(DateTime.Now.TimeOfDay.Add(new TimeSpan(0, 0, 15))) != time.CompareTo(DateTime.Now.TimeOfDay.Add(new TimeSpan(0, 0, -15)))) Alert(popup); break; case Enumeration.Frequency.TimeFrequency.Weekly: if (PROF_IT.Common.Convert.DateFunctions.DBDateToDate(popup.CreationDate, false).DayOfWeek == DateTime.Now.DayOfWeek && time.CompareTo(DateTime.Now.TimeOfDay.Add(new TimeSpan(0, 0, 15))) != time.CompareTo(DateTime.Now.TimeOfDay.Add(new TimeSpan(0, 0, -15)))) Alert(popup); break; } } } } } catch (System.Exception exception1) { //System.Exception innerException = exception1; //throw new System.Exception(MethodBase.GetCurrentMethod().Name, innerException); } }
private void Popup() { try { if (InvokeRequired) { BeginInvoke(new MethodInvoker(Popup)); } else { if (Context.User != null && Context.User.HasPopups) { DL.Internal.Popup.PopupObjectCollection popups = new BL.Internal.Popup().GetallActivePopupsByUser(Context.User); TimeSpan time; foreach (DL.Internal.Popup.PopupObject popup in popups) { //Show popup directly? if (popup.ShowDirect == true) { Alert(popup); popup.ShowDirect = false; new BL.Internal.Popup().Save(popup); } time = new TimeSpan(int.Parse(popup.Time.Substring(0, 2)), int.Parse(popup.Time.Substring(2, 2)), int.Parse(popup.Time.Substring(4, 2))); switch (popup.Repeation) { case Enumeration.Frequency.TimeFrequency.Daily: DateTime compTime = DateTime.Now; if (time.CompareTo(DateTime.Now.TimeOfDay.Add(new TimeSpan(0, 0, 15))) != time.CompareTo(DateTime.Now.TimeOfDay.Add(new TimeSpan(0, 0, -15)))) { Alert(popup); } break; case Enumeration.Frequency.TimeFrequency.Monthly: if (PROF_IT.Common.Convert.DateFunctions.DBDateToDate(popup.CreationDate, false).Day == DateTime.Now.Day && time.CompareTo(DateTime.Now.TimeOfDay.Add(new TimeSpan(0, 0, 15))) != time.CompareTo(DateTime.Now.TimeOfDay.Add(new TimeSpan(0, 0, -15)))) { Alert(popup); } break; case Enumeration.Frequency.TimeFrequency.Weekly: if (PROF_IT.Common.Convert.DateFunctions.DBDateToDate(popup.CreationDate, false).DayOfWeek == DateTime.Now.DayOfWeek && time.CompareTo(DateTime.Now.TimeOfDay.Add(new TimeSpan(0, 0, 15))) != time.CompareTo(DateTime.Now.TimeOfDay.Add(new TimeSpan(0, 0, -15)))) { Alert(popup); } break; } } } } } catch (System.Exception exception1) { //System.Exception innerException = exception1; //throw new System.Exception(MethodBase.GetCurrentMethod().Name, innerException); } }