Beispiel #1
0
        public static SeachQuery ParseSearchQuery(UriExt url)
        {
            var query = url.QueryParam;

            string tmpValue;
            var    search = new SeachQuery();

            DateTime lastinvoked;

            if ((tmpValue = query["lastinvoked"]) != null && DateTime.TryParse(tmpValue, out lastinvoked))
            {
                search.LastInvokedAfter = lastinvoked;
            }

            uint userId;

            if ((tmpValue = query["userid"]) != null && uint.TryParse(tmpValue, out userId))
            {
                search.UserId = userId;
            }

            int max;

            if ((tmpValue = query["max"]) != null && int.TryParse(tmpValue, out max))
            {
                search.MaxResults = max;
            }

            search.TitlePart = query["title"];

            return(search);
        }
Beispiel #2
0
		public string CommandHistoryTitle(string part)
		{
			var query = new SeachQuery { TitlePart = part };
			return HistoryManager.SearchParsed(query);
		}
Beispiel #3
0
		public string CommandHistoryTill(string time)
		{
			DateTime tillTime;
			switch (time.ToLower())
			{
			case "hour": tillTime = DateTime.Now.AddHours(-1); break;
			case "today": tillTime = DateTime.Today; break;
			case "yesterday": tillTime = DateTime.Today.AddDays(-1); break;
			case "week": tillTime = DateTime.Today.AddDays(-7); break;
			default: return "Not recognized time desciption.";
			}
			var query = new SeachQuery { LastInvokedAfter = tillTime };
			return HistoryManager.SearchParsed(query);
		}
Beispiel #4
0
		public string CommandHistoryTill(DateTime time)
		{
			var query = new SeachQuery { LastInvokedAfter = time };
			return HistoryManager.SearchParsed(query);
		}
Beispiel #5
0
		public string CommandHistoryLast(ExecutionInformation info, int? amount)
		{
			if (amount.HasValue)
			{
				var query = new SeachQuery { MaxResults = amount.Value };
				return HistoryManager.SearchParsed(query);
			}
			else
			{
				var ale = HistoryManager.Search(new SeachQuery { MaxResults = 1 }).FirstOrDefault();
				if (ale != null)
				{
					ClientData client = QueryConnection.GetClientById(info.TextMessage.InvokerId);
					return FactoryManager.RestoreAndPlay(ale, new PlayData(info.Session, client, null, false));
				}
				else return "There is no song in the history";
			}
		}
Beispiel #6
0
		public string CommandHistoryFrom(uint userDbId, int? amount)
		{
			SeachQuery query = new SeachQuery();
			query.UserId = userDbId;

			if (amount.HasValue)
				query.MaxResults = amount.Value;

			return HistoryManager.SearchParsed(query);
		}