Beispiel #1
0
        public virtual IList<SearchResult> Find(RegularSearchDetail 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);

                if (!string.IsNullOrEmpty(fbString))
                {
                    int startPoint = detail.StartDateTime.Hour * 60 + detail.StartDateTime.Minute;
                    int i = startPoint + 1;
                    while (i <= startPoint + detail.Duration && fbString[i] == '0')
                    {
                        i++;
                    }

                    if (i >= startPoint + detail.Duration)
                        ret.Add(
                                new SearchResult()
                                {
                                    TheRoom = roomRepository.GetAt(k)
                                }
                            );
                }
                else
                {
                    Log.Warn("FreeBusy returns null/empty string");
                }
            }
            return ret;
        }
 public static RegularSearchDetail CreateDefault()
 {
     DateTime now = DateTime.Now;
     RegularSearchDetail model = new RegularSearchDetail()
     {
         StartDateTime = now.Minute < 30 ? now.AddMinutes(30 - now.Minute) : now.AddMinutes(60 - now.Minute),
         AttendeeNumber = 5,
         Duration = 60
     };
     return model;
 }
        public IList<SearchResult> Find(RegularSearchDetail detail)
        {
            List<SearchResult> ret = innerFinder.Find(detail).ToList();

            Evaluate(detail, ret);
            foreach (var r in ret)
                r.Score += Math.Pow(r.TheRoom.Capacity - detail.AttendeeNumber, 2);

            ret.Sort();

            return ret;
        }
Beispiel #4
0
 public ActionResult Index(RegularSearchDetail model)
 {
     Log.Info("posting to regular controller...");
     return this.RedirectToRoute(
                                     new {
                                         controller="regular",
                                         startTime = Server.UrlEncode(model.StartDateTime.ToString(Constants.MeetingStartDateTimeUrlSchema, CultureInfo.InvariantCulture)),
                                         duration = model.Duration ,
                                         attendees = model.AttendeeNumber
                                    }
                                );
 }
Beispiel #5
0
 private RedirectToRouteResult RedirectToGetRouteResult(RegularSearchDetail model)
 {
     return
                 this.RedirectToRoute(
                                     new
                                     {
                                         startTime = Server.UrlEncode(model.StartDateTime.ToString(Bookit.Domain.Constants.MeetingStartDateTimeUrlSchema, CultureInfo.InvariantCulture)),
                                         duration = model.Duration,
                                         attendees = model.AttendeeNumber
                                     }
                                );
 }
Beispiel #6
0
 public ActionResult Index(RegularSearchDetail model)
 {
     Log.Info("posted to regular, redirect to GET...");
     return RedirectToGetRouteResult(model);
 }
Beispiel #7
0
 public IList<SearchResult> Find(RegularSearchDetail detail)
 {
     return new List<SearchResult>();
 }
Beispiel #8
0
        public IList<SearchResult> Find(RegularSearchDetail detail)
        {
            SearchResult sr1 = new SearchResult()
                                {
                                    TheRoom = new MeetingRoom
                                                {
                                                    Id = 1,
                                                    Capacity = 7,
                                                    Name = "Wu Ying Dian",
                                                    Email = "*****@*****.**",
                                                    Description = "1F WS"
                                                },
                                    //AvailStartTime = DateTime.Now,
                                    //AvailEndTime = DateTime.Now.AddHours(2),
                                    Dist = 10,
                                    Score = 23.5
                                };

            SearchResult sr2 = new SearchResult()
            {
                TheRoom = new MeetingRoom
                {
                    Id = 2,
                    Capacity = 10,
                    Name = "Wen Yuan Ge",
                    Email = "*****@*****.**",
                    Description = "2F ES"
                },
                //AvailStartTime = DateTime.Now,
                //AvailEndTime = DateTime.Now.AddHours(2),
                Dist = 10,
                Score = 35.5
            };

            SearchResult sr3 = new SearchResult()
            {
                TheRoom = new MeetingRoom
                {
                    Id = 3,
                    Capacity = 10,
                    Name = "Ti Ren Ge",
                    Email = "*****@*****.**",
                    Description = "体仁阁"
                },
                //AvailStartTime = DateTime.Now,
                //AvailEndTime = DateTime.Now.AddHours(2),
                Dist = 10,
                Score = 35.5
            };

            SearchResult sr4 = new SearchResult()
            {
                TheRoom = new MeetingRoom
                {
                    Id = 3,
                    Capacity = 10,
                    Name = "Qian Long",
                    Email = "*****@*****.**",
                    Description = "乾隆"
                },
                //AvailStartTime = DateTime.Now,
                //AvailEndTime = DateTime.Now.AddHours(2),
                Dist = 10,
                Score = 15.5
            };

            SearchResult sr5 = new SearchResult()
            {
                TheRoom = new MeetingRoom
                {
                    Id = 3,
                    Capacity = 10,
                    Name = "Yang Guifei",
                    Email = "*****@*****.**",
                    Description = "杨贵妃"
                },
                //AvailStartTime = DateTime.Now,
                //AvailEndTime = DateTime.Now.AddHours(2),
                Dist = 10,
                Score = 17.5
            };

            SearchResult sr6 = new SearchResult()
            {
                TheRoom = new MeetingRoom
                {
                    Id = 3,
                    Capacity = 10,
                    Name = "Meng Zi",
                    Email = "*****@*****.**",
                    Description = "孟子"
                },
                //AvailStartTime = DateTime.Now,
                //AvailEndTime = DateTime.Now.AddHours(2),
                Dist = 10,
                Score = 17.5
            };

            IList<SearchResult> ret = new List<SearchResult>();
            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);
        }