public PagedResult <ReminderItemDTO> GetReminders(Token token, GetRemindersParam remindersParam, PartialRetrievingInfo pageInfo) { var securityInfo = SecurityManager.EnsureAuthentication(token); var service = new ReminderService(Session, securityInfo, Configuration); return(service.GetReminders(remindersParam, pageInfo)); }
protected override void RetrieveObjects(BodyArchitectAccessServiceClient client1, PartialRetrievingInfo pageInfo, EventHandler <GetRemindersCompletedEventArgs> operationCompleted) { var criteria = new GetRemindersParam(); client1.GetRemindersAsync(ApplicationState.Current.SessionData.Token, criteria, pageInfo); client1.GetRemindersCompleted -= operationCompleted; client1.GetRemindersCompleted += operationCompleted; }
public void All() { var profile = (ProfileDTO)profiles[0].Tag; SessionData data = CreateNewSession(profile, ClientInformation); RunServiceMethod(delegate(InternalBodyArchitectService service) { GetRemindersParam param = new GetRemindersParam(); var list = service.GetReminders(data.Token, param, new PartialRetrievingInfo()); Assert.AreEqual(reminders.Count, list.Items.Count); }); }
public void BirthdayOnly() { var profile = (ProfileDTO)profiles[0].Tag; SessionData data = CreateNewSession(profile, ClientInformation); RunServiceMethod(delegate(InternalBodyArchitectService service) { GetRemindersParam param = new GetRemindersParam(); param.Types.Add(Service.V2.Model.ReminderType.Birthday); var list = service.GetReminders(data.Token, param, new PartialRetrievingInfo()); assert(list, 1); }); }
public PagedResult <ReminderItemDTO> GetReminders(GetRemindersParam remindersParam, PartialRetrievingInfo pageInfo) { using (var tx = Session.BeginGetTransaction()) { //DateTime now = Configuration.TimerService.UtcNow; Profile dbProfile = Session.Load <Profile>(SecurityInfo.SessionData.Profile.GlobalId); //var query = Session.CreateQuery("SELECT ri FROM ReminderItem ri WHERE (ri.DateTime-ri.RemindBefore)>=?"); //query.SetDateTime(0, now); //var query = Session.CreateQuery("SELECT ri.DateTime-ri.RemindBefore FROM ReminderItem ri "); //var test=query.List<object>(); //take all reminders from one week since current time var query = Session.QueryOver <ReminderItem>().Where(x => x.Profile == dbProfile); //if(remindersParam.ValidForTime.HasValue) //{ // var langOr = Restrictions.Disjunction(); // langOr.Add(Restrictions.Between("DateTime", now, now + remindersParam.ValidForTime.Value + MaxRemindBefore)); // langOr.Add(Expression.IsNotNull("RepeatPattern")); // query = query.And(langOr); //} if (remindersParam.Types != null && remindersParam.Types.Count > 0) { var langOr = Restrictions.Disjunction(); foreach (var type in remindersParam.Types) { langOr.Add <ReminderItem>(x => x.Type == (ReminderType)type); } query = query.And(langOr); } //var res = query.List(); ////now for pattern reminders //if (remindersParam.ValidForTime.HasValue) //{ // List<ReminderItem> reminders = new List<ReminderItem>(); // reminders.AddRange(evaluatePattern(res, now,remindersParam.ValidForTime.Value)); // reminders.AddRange(res.Where(x => string.IsNullOrWhiteSpace(x.RepeatPattern)).ToList()); // return reminders.Map<IList<ReminderItemDTO>>(); //} //return res.Map<IList<ReminderItemDTO>>(); var listPack = query.ToPagedResults <ReminderItemDTO, ReminderItem>(pageInfo); tx.Commit(); return(listPack); } }
protected override PagedResult <ReminderItemDTO> GetItemsMethod(PartialRetrievingInfo pageInfo) { GetRemindersParam param = new GetRemindersParam(); return(ServiceManager.GetReminders(param, pageInfo)); }
public PagedResult <ReminderItemDTO> GetReminders(Token token, GetRemindersParam remindersParam, PartialRetrievingInfo pageInfo) { return(exceptionHandling(token, () => InternalService.GetReminders(token, remindersParam, pageInfo))); }