Exemplo n.º 1
0
 protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     base.OnElementPropertyChanged(sender, e);
     if (e.PropertyName == Controls.CalendarView.HighlightedDaysProperty.PropertyName)
     {
         _pickerView.ClearHighlightedDates();
         _pickerView.HighlightDates(Element.HighlightedDays);
     }
 }
Exemplo n.º 2
0
        public void retrieveAndHighlight(string id, CalendarPickerView calendar)
        {
            MySqlConnection con = new MySqlConnection("Server=mysql873.umbler.com;Port=41890;database=ufscarpds;User Id=ufscarpds;Password=ufscar1993;charset=utf8");

            try
            {
                if (con.State == ConnectionState.Closed)
                {
                    con.Open();
                    Console.WriteLine("Conectado com sucesso2!");

                    MySqlCommand cmd = new MySqlCommand("select data from agendamento where id_usuario = @id_usuario group by data", con);
                    cmd.Parameters.AddWithValue("@id_usuario", id);

                    Console.WriteLine("Passou comando2!");

                    using (MySqlDataReader reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            Console.WriteLine("Passou execute4");
                            DateTime data = reader.GetDateTime("data");

                            if (DateTime.Now <= data && data <= DateTime.Now.AddYears(1))
                            {
                                calendar.HighlightDates(data);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                con.Close();
            }
        }
Exemplo n.º 3
0
        protected override void OnElementChanged(ElementChangedEventArgs <Controls.CalendarView> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement == null)
            {
                var inflatorService = (LayoutInflater)Context.GetSystemService(Context.LayoutInflaterService);
                _view       = (LinearLayout)inflatorService.Inflate(Resource.Layout.CalendarView, null, false);
                _pickerView = _view.FindViewById <CalendarPickerView>(Resource.Id.calendar_view);
                _pickerView.Init(DateTime.Now.AddYears(-4), DateTime.Now.AddYears(4))
                .WithSelectedDate(DateTime.Today)
                .InMode(CalendarPickerView.SelectionMode.Single);
                _pickerView.DateSelected += (sender, args) =>
                {
                    Element.SelectedDate = args.Date;
                    Element.NotifyDateSelected(args.Date);
                };

                _pickerView.HighlightDates(Element.HighlightedDays);
                SetNativeControl(_view);
            }
        }
Exemplo n.º 4
0
        public void retrieveAndHighlight(CalendarPickerView calendar)
        {
            MySqlConnection con = new MySqlConnection("Server=mysql873.umbler.com;Port=41890;database=ufscarpds;User Id=ufscarpds;Password=ufscar1993;charset=utf8");

            try
            {
                if (con.State == ConnectionState.Closed)
                {
                    con.Open();
                    Console.WriteLine("Conectado com sucesso Agendamento Usuario!");
                    MySqlCommand cmd = new MySqlCommand("select data from agendamento where confirmado = 1 group by data", con);
                    // MySqlCommand cmd = new MySqlCommand("select id, data, id_servico, id_usuario, confirmado from agendamento WHERE data >= @dataIni AND data <= @dataFim AND confirmado=1", con);

                    // cmd.Parameters.AddWithValue("@dataIni", today);

                    using (MySqlDataReader reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            DateTime data = reader.GetDateTime("data");

                            if (DateTime.Now <= data && data <= DateTime.Now.AddYears(1))
                            {
                                calendar.HighlightDates(data);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Toast.MakeText(this, "Erro ao carregar agenda!", ToastLength.Short).Show();
            }
            finally
            {
                con.Close();
            }
        }