コード例 #1
0
        public IList<SearchResult> Find(OneClickSearchDetail detail)
        {
            List<SearchResult> ret = innerFinder.Find(detail).ToList();
            Evaluate(detail, ret);

            ret.Sort();

            return ret;
        }
コード例 #2
0
 public static OneClickSearchDetail CreateDefault()
 {
     DateTime now = DateTime.Now;
     OneClickSearchDetail model = new OneClickSearchDetail()
     {
         StartDateTime = now,
         AvailableTolerenceThreshold = 30
     };
     return model;
 }
コード例 #3
0
ファイル: SimpleFinder.cs プロジェクト: wangning81/Bookit
        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;
        }
コード例 #4
0
ファイル: EmptyFinder.cs プロジェクト: wangning81/Bookit
 public IList<SearchResult> Find(OneClickSearchDetail detail)
 {
     return new List<SearchResult>();
 }
コード例 #5
0
ファイル: DummyFinder.cs プロジェクト: wangning81/Bookit
        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);
        }