public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Id.GetHashCode();
         hashCode = (hashCode * 397) ^ RulerName.GetHashCode();
         hashCode = (hashCode * 397) ^ NationName.GetHashCode();
         hashCode = (hashCode * 397) ^ Role.GetHashCode();
         hashCode = (hashCode * 397) ^ Alliance.GetHashCode();
         hashCode = (hashCode * 397) ^ Balance.GetHashCode();
         hashCode = (hashCode * 397) ^ AvailableSlots.GetHashCode();
         return(hashCode);
     }
 }
Esempio n. 2
0
        public IEnumerable <AvailableSlots> GetAvailableSlots()
        {
            try
            {
                var res = es.Available_Slots.ToList();

                List <AvailableSlots> slots = new List <AvailableSlots>();

                foreach (var r in res)
                {
                    AvailableSlots a = new AvailableSlots();

                    a.Slot_ID = r.Slot_ID;

                    slots.Add(a);
                }
                return(slots);
            }

            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 3
0
        public async Task <string> LoadBookings(DateTime xyz)
        {
            await Initialize();
            await SyncBookings();

            string answer = "false";

            try
            {
                List <Booking> item = new List <Booking>();
                //item.Clear();

                item = await BookingsTable2
                       .Where(todoItem => todoItem.Date == xyz)
                       .ToListAsync();



                TakenSlots.Clear();
                foreach (var x in item)
                {
                    TakenSlots.Add(x.Slot);
                }

                AvailableSlots.Clear();
                for (int i = 1; i <= 9; i++)
                {
                    if (!(TakenSlots.Contains(i)))
                    {
                        AvailableSlots.Add(i);
                    }
                }

                foreach (var xy in AvailableSlots)
                {
                    if (xy == 1)
                    {
                        TimesPage.Holder.Add("9AM");
                    }
                    else if (xy == 2)
                    {
                        TimesPage.Holder.Add("10AM");
                    }
                    else if (xy == 3)
                    {
                        TimesPage.Holder.Add("11AM");
                    }
                    else if (xy == 4)
                    {
                        TimesPage.Holder.Add("12PM");
                    }
                    else if (xy == 5)
                    {
                        TimesPage.Holder.Add("1PM");
                    }

                    else if (xy == 6)
                    {
                        TimesPage.Holder.Add("2PM");
                    }
                    else if (xy == 7)
                    {
                        TimesPage.Holder.Add("3PM");
                    }
                    else if (xy == 8)
                    {
                        TimesPage.Holder.Add("4PM");
                    }
                    else if (xy == 9)
                    {
                        TimesPage.Holder.Add("5PM");
                    }
                    else
                    {
                        TimesPage.Holder.Add("Sorry, No times are available for this date.");
                    }
                }

                return(answer);
            }


            catch (Exception er)
            {
                await DisplayAlert("Alert", "da error: " + er, "Ok");

                return(answer);
            }
        }