public IList<SearchResult> Find(OneClickSearchDetail detail) { List<SearchResult> ret = innerFinder.Find(detail).ToList(); Evaluate(detail, ret); ret.Sort(); return ret; }
public static OneClickSearchDetail CreateDefault() { DateTime now = DateTime.Now; OneClickSearchDetail model = new OneClickSearchDetail() { StartDateTime = now, AvailableTolerenceThreshold = 30 }; return model; }
public virtual IList<SearchResult> Find(OneClickSearchDetail detail) { IList<SearchResult> ret = new List<SearchResult>(); for (int k = 0; k < recRooms.Count; k++) { var recipient = recRooms[k]; string fbString = recipient.FreeBusy(detail.StartDateTime, 1); int startPoint = detail.StartDateTime.Hour * 60 + detail.StartDateTime.Minute; int i = startPoint + 1; int latestAvailTime = startPoint + detail.AvailableTolerenceThreshold; while (i <= latestAvailTime && fbString[i] == '1') { i++; } if (i <= latestAvailTime) { int availDuration = 0; int j = i; while (fbString[j] == '0' && availDuration < 60) { availDuration++; j++; } ret.Add( new OneClickSearchResult() { TheRoom = roomRepository.GetAt(k), AvailStartTime = detail.StartDateTime.Date.AddMinutes(i), AvailDuration = availDuration } ); } } return ret; }
public IList<SearchResult> Find(OneClickSearchDetail detail) { return new List<SearchResult>(); }
public IList<SearchResult> Find(OneClickSearchDetail detail) { var sr1 = new OneClickSearchResult() { TheRoom = new MeetingRoom { Id = 1, Capacity = 7, Name = "Wu Ying Dian", Email = "*****@*****.**", Description = "1F WS" }, AvailStartTime = DateTime.Now, AvailDuration = 30, Dist = 10, Score = 23.5 }; var sr2 = new OneClickSearchResult() { TheRoom = new MeetingRoom { Id = 2, Capacity = 10, Name = "Wen Yuan Ge", Email = "*****@*****.**", Description = "2F ES" }, AvailStartTime = DateTime.Now, AvailDuration = 25, Dist = 10, Score = 35.5 }; var sr3 = new OneClickSearchResult() { TheRoom = new MeetingRoom { Id = 3, Capacity = 10, Name = "Ti Ren Ge", Email = "*****@*****.**", Description = "体仁阁" }, AvailStartTime = DateTime.Now, AvailDuration = 20, Dist = 10, Score = 35.5 }; var sr4 = new OneClickSearchResult() { TheRoom = new MeetingRoom { Id = 3, Capacity = 10, Name = "Qian Long", Email = "*****@*****.**", Description = "乾隆" }, AvailStartTime = DateTime.Now, AvailDuration = 10, Dist = 10, Score = 15.5 }; var sr5 = new OneClickSearchResult() { TheRoom = new MeetingRoom { Id = 3, Capacity = 10, Name = "Yang Guifei", Email = "*****@*****.**", Description = "杨贵妃" }, AvailStartTime = DateTime.Now, AvailDuration = 15, Dist = 10, Score = 17.5 }; var sr6 = new OneClickSearchResult() { TheRoom = new MeetingRoom { Id = 3, Capacity = 10, Name = "Meng Zi", Email = "*****@*****.**", Description = "孟子" }, AvailStartTime = DateTime.Now, AvailDuration = 20, Dist = 10, Score = 17.5 }; IList<OneClickSearchResult> ret = new List<OneClickSearchResult>(); ret.Add(sr1); ret.Add(sr2); ret.Add(sr3); ret.Add(sr4); ret.Add(sr5); ret.Add(sr6); var arr = ret.ToArray(); Array.Sort(arr); return new List<SearchResult>(arr); }