Пример #1
0
        static void Main(string[] args)
        {
            // test for finding free appointments
            var oo = new AppointmentSchedualer().SchedualAppointment(new Appointment()
            {
                Company = new Company()
                {
                    Type = CompanyType.PostOffice
                }
            });
            var pp = new FreeAppointmentFinder().FindFreeAppointmentByDay(DateTime.Now, CompanyType.Banks, CompanySubType.BankDiscount, "ראשון לציון");
            //DistancesMatrixCreator.Run();
            //Dictionary<Tuple<string, string>, int> dictionary = DistancesMatrixReader.Read();

            /*WebApiHelper helper = new WebApiHelper("http://localhost:60799/");
             *
             * while(true)
             *  {
             *  helper.Post();
             * //  var pp = helper.Get();
             *  Console.WriteLine("done");
             * }
             *
             */
        }
Пример #2
0
        private Dictionary <CompanySubType, List <Appointment> > FindAppointments(List <string[]> errands, DateTime selectedDate, string citySelected)
        {
            var freeAppointmentFinder = new FreeAppointmentFinder();
            var dbCompanyList         = new List <DbAppointmentCompany>();
            var appointmentDictonary  = new Dictionary <CompanySubType, List <Appointment> >();

            foreach (string[] errand in errands)
            {
                dbCompanyList.AddRange(freeAppointmentFinder.FindFreeAppointmentByDay(selectedDate, (CompanyType)Enum.Parse(typeof(CompanyType), errand[0]), (CompanySubType)Enum.Parse(typeof(CompanySubType), errand[1]), citySelected));
            }

            foreach (var dbCompany in dbCompanyList)
            {
                var appointmentList = dbCompany.ConvertToAppointments();
                if (appointmentDictonary.ContainsKey(dbCompany.Company.SubType))
                {
                    appointmentDictonary[dbCompany.Company.SubType].AddRange(appointmentList);
                }
                else
                {
                    appointmentDictonary.Add(dbCompany.Company.SubType, appointmentList);
                }
            }

            return(appointmentDictonary);
        }