Exemplo n.º 1
0
        protected override FilterResults PerformFiltering(ICharSequence constraint)
        {
            if (constraint != null && constraint.Length() > 0)
            {
                string query = constraint.ToString().ToUpper();
                JavaList <AppUsers> foundFilter = new JavaList <AppUsers>();
                for (int i = 0; i < currentList.Size(); i++)
                {
                    string name    = currentList[i].Name;
                    string email   = currentList[i].Email;
                    string contact = currentList[i].PhoneNumber;

                    if (name.ToUpper().Contains(query.ToString()) ||
                        email.ToUpper().Contains(query.ToString()) ||
                        contact.ToUpper().Contains(query.ToString()))
                    {
                        foundFilter.Add(new AppUsers {
                            Name          = currentList[i].Name
                            , PhoneNumber = currentList[i].PhoneNumber
                            , Email       = currentList[i].Email
                        });
                    }
                }
                filterResults.Count  = foundFilter.Size();
                filterResults.Values = foundFilter;
            }
            else
            {
                filterResults.Count  = currentList.Size();
                filterResults.Values = currentList;
            }

            return(filterResults);
        }
Exemplo n.º 2
0
        /*
         * - Perform actual filtering.
         */
        protected override FilterResults PerformFiltering(ICharSequence constraint)
        {
            FilterResults filterResults = new FilterResults();

            if (constraint != null && constraint.Length() > 0)
            {
                //CHANGE TO UPPER
                //constraint = constraint.ToString().ToUpper();
                string query = constraint.ToString().ToUpper();

                //HOLD FILTERS WE FIND
                JavaList <String> foundFilters = new JavaList <String>();

                //ITERATE CURRENT LIST
                for (int i = 0; i < currentList.Size(); i++)
                {
                    string galaxy = currentList[i];

                    //SEARCH
                    if (galaxy.ToUpper().Contains(query.ToString()))
                    {
                        //ADD IF FOUND
                        foundFilters.Add(galaxy);
                    }
                }
                //SET RESULTS TO FILTER LIST
                filterResults.Count  = foundFilters.Size();
                filterResults.Values = foundFilters;
            }
            else
            {
                //NO ITEM FOUND.LIST REMAINS INTACT
                filterResults.Count  = currentList.Size();
                filterResults.Values = currentList;
            }

            //RETURN RESULTS
            return(filterResults);
        }
Exemplo n.º 3
0
            protected override FilterResults PerformFiltering(ICharSequence constraint)
            {
                MisNotas      objnota;
                FilterResults filterResults = new FilterResults();

                if (constraint != null && constraint.Length() > 0)
                {
                    string query = constraint.ToString().ToUpper();
                    JavaList <MisNotas> notasEncontradas = new JavaList <MisNotas>();
                    for (int i = 0; i < listaActual.Size(); i++)
                    {
                        objnota           = new MisNotas();
                        objnota.Contenido = listaActual[i].Contenido;


                        if (objnota.Contenido.ToUpper().Contains(query.ToString()))
                        {
                            objnota.Contenido = listaActual[i].Contenido;
                            objnota.Titulo    = listaActual[i].Titulo;
                            objnota.FechaNota = listaActual[i].FechaNota;
                            objnota.IdColor   = listaActual[i].IdColor;
                            objnota.IdFont    = listaActual[i].IdFont;
                            notasEncontradas.Add(objnota);
                        }
                    }
                    filterResults.Count  = notasEncontradas.Size();
                    filterResults.Values = notasEncontradas;
                }
                else
                {
                    //NO ITEM FOUND.LIST REMAINS INTACT
                    filterResults.Count  = listaActual.Size();
                    filterResults.Values = listaActual;
                }
                return(filterResults);
            }
        public static IList ToList(this JavaList @this, Type targetType = null)
        {
            var list = (IList)Activator.CreateInstance(typeof(List <>).MakeGenericType(targetType));

            for (var i = 0; i < @this.Size(); i++)
            {
                var value = @this[i];
                if (value is Java.Lang.Object javaValue)
                {
                    list.Add(javaValue.ToObject(targetType));
                }
                else
                {
                    list.Add(value);
                }
            }
            return(list);
        }
Exemplo n.º 5
0
        protected override FilterResults PerformFiltering(ICharSequence constraint)
        {
            try
            {
                var filterResults = new FilterResults();
                var foundFilters  = new JavaList <Classes.UserContacts.User>();

                if (constraint != null && constraint.Length() > 0)
                {
                    for (var i = 0; i < currentList.Size(); i++)
                    {
                        var Data  = currentList[i];
                        var query = constraint.ToString().ToUpper();

                        if (Data.name.ToUpper().Contains(query))
                        {
                            foundFilters.Add(Data);
                        }
                    }

                    filterResults.Count  = foundFilters.Count;
                    filterResults.Values = foundFilters;

                    return(filterResults);
                }

                filterResults.Count  = currentList.Count;
                filterResults.Values = currentList;
                return(filterResults);
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
                var filterResults = new FilterResults();
                filterResults.Count  = currentList.Count;
                filterResults.Values = currentList;
                return(filterResults);
            }
        }
Exemplo n.º 6
0
        public void GetSpaceCrafts()
        {
            HouseList.Clear();
            DBAdapter db = new DBAdapter(this);

            db.openDB();
            ICursor c = db.Retrieve();                     //SpaceCraft s = null;

            if (c != null)
            {
                while (c.MoveToNext())
                {
                    string phone = c.GetString(c.GetColumnIndex("name"));
                    HouseList.Add(phone);
                    Collections.Sort(HouseList);
                }
            }
            db.CloseDB();
            if (HouseList.Size() > 0)
            {
                list.Adapter = adapter;
            }
        }
Exemplo n.º 7
0
        public int retrieve(string id)
        {
            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!");

                    MySqlCommand cmd = new MySqlCommand("select id, material, id_usuario, quantidade, altura, largura, preco, visivel from orcamento where id_usuario = @id_usuario AND visivel=true", con);
                    cmd.Parameters.AddWithValue("@id_usuario", id);

                    Console.WriteLine("Passou comando2!");
                    total = 0;
                    using (MySqlDataReader reader = cmd.ExecuteReader())
                    {
                        int aux = 0;
                        while (reader.Read())
                        {
                            aux++;
                            //   materiaisDisplay.Add(reader["nome"].ToString());
                            // Console.WriteLine("Adicionando. MateriaisDisplay: " + materiaisDisplay);

                            int   id2        = reader.GetOrdinal("id");
                            int   idusuario  = reader.GetOrdinal("id_usuario");
                            int   quantidade = reader.GetOrdinal("quantidade");
                            float preco      = reader.GetFloat("preco");
                            float altura     = reader.GetFloat("altura");
                            float largura    = reader.GetFloat("largura");

                            OrcamentoM o = new OrcamentoM();

                            o.Id         = reader.GetInt32(id2);
                            o.Material   = reader["material"].ToString();
                            o.IdUsuario  = reader.GetInt32(idusuario);
                            o.Quantidade = reader.GetInt32(quantidade);
                            o.Preco      = preco;
                            o.Visivel    = reader.GetBoolean("visivel");
                            o.Largura    = largura;
                            o.Altura     = altura;

                            orcamentos.Add(o);

                            Console.WriteLine("Orcamento: id=" + o.Id.ToString() + " material=" + o.Material + " idUsuario=" + o.IdUsuario.ToString() +
                                              " quantidade=" + o.Quantidade.ToString() + " preco=" + o.Preco.ToString() + " visivel=" + o.Visivel.ToString() + " largura=" + o.Largura.ToString() +
                                              " altura=" + o.Altura.ToString());

                            Console.WriteLine("QTD=" + quantidade);

                            total = total + (o.Quantidade * o.Preco * o.Altura * o.Largura);

                            Console.WriteLine("TOTAL=" + total);

                            orcamentosDisplay.Add(o.Material);
                        }

                        if (aux == 0)
                        {
                            return(0);
                        }
                    }

                    if (orcamentosDisplay.Size() > 0)
                    {
                        listaOrcamentos.Adapter = adapter;
                    }
                }
            }
            catch (MySqlException ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                con.Close();
            }

            return(1);
        }
 public override int GetSize() => list.Size();
Exemplo n.º 9
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.AgendamentoAdministrador);

            DateTime data = DateTime.Parse(Intent.GetStringExtra("data"));

            resultAgenda = FindViewById <ListView>(Resource.Id.resultAgenda);
            adapter      = new AgendamentoAdapter(this, agendamentos);

            DateTime today = DateTime.Now.Date;

            Console.WriteLine("DATE = " + today.Year + "-" + today.Month + "-" + today.Day);

            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 id, data, id_servico, id_usuario, confirmado from agendamento WHERE data = @data AND confirmado=1", con);

                    cmd.Parameters.AddWithValue("@data", data);

                    using (MySqlDataReader reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            Console.WriteLine("ta no reader");
                            int id = reader.GetOrdinal("id");

                            Agendamento evento = new Agendamento();
                            evento.Id         = reader.GetInt32(id);
                            id                = reader.GetOrdinal("id_servico");
                            evento.IdServico  = reader.GetInt32(id);
                            id                = reader.GetOrdinal("id_usuario");
                            evento.IdUsuario  = reader.GetInt32(id);
                            id                = reader.GetOrdinal("confirmado");
                            evento.Confirmado = reader.GetInt32(id);
                            evento.Data       = reader.GetDateTime("data");

                            Console.WriteLine("-------------------------------------------------------------");
                            Console.WriteLine("----------------------- NEW OBJECT --------------------------");
                            Console.WriteLine("-------------------------------------------------------------");

                            Console.WriteLine("Id= " + evento.Id + " servico= " + evento.IdServico + " usuario= " + evento.IdUsuario);
                            Console.WriteLine("confirmado= " + evento.Confirmado + "data= " + evento.Data);

                            agendamentos.Add(evento);

                            if (evento.IdServico == 1)
                            {
                                agendamentosDisplay.Add(evento.Data + " - Medicao");
                            }
                            else if (evento.IdServico == 2)
                            {
                                agendamentosDisplay.Add(evento.Data + " - Entrega");
                            }
                            else if (evento.IdServico == 3)
                            {
                                agendamentosDisplay.Add(evento.Data + " - Instalacao");
                            }
                        }
                    }

                    if (agendamentosDisplay.Size() > 0)
                    {
                        resultAgenda.Adapter = adapter;
                    }
                }
            }
            catch (MySqlException ex)
            {
                Console.WriteLine(ex.Message);
                Toast.MakeText(this, "Erro ao carregar agenda!", ToastLength.Short).Show();
            }
            finally
            {
                con.Close();
            }

            resultAgenda.ItemClick += (sender, e) =>
            {
                Console.WriteLine("Position: " + e.Position);
                Console.WriteLine("idusuario: " + agendamentos[e.Position].IdUsuario);

                var intent = new Intent(this, typeof(Activity1));
                intent.PutExtra("id", agendamentos[e.Position].Id);
                intent.PutExtra("idservico", agendamentos[e.Position].IdServico);
                intent.PutExtra("idusuario", agendamentos[e.Position].IdUsuario);
                intent.PutExtra("day", agendamentos[e.Position].Data.Day);
                intent.PutExtra("month", agendamentos[e.Position].Data.Month);
                intent.PutExtra("year", agendamentos[e.Position].Data.Year);
                intent.PutExtra("status", agendamentos[e.Position].Confirmado);

                StartActivity(intent);
            };
        }
Exemplo n.º 10
0
        public void retrieve(string id, DateTime data, bool filtrarPorData)
        {
            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 id, data, id_servico, id_usuario, confirmado from agendamento where id_usuario = @id_usuario" + (filtrarPorData ? " and data = @data" : ""), con);
                    cmd.Parameters.AddWithValue("@id_usuario", id);
                    cmd.Parameters.AddWithValue("@data", data);

                    Console.WriteLine("Passou comando2!");

                    using (MySqlDataReader reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            //   materiaisDisplay.Add(reader["nome"].ToString());
                            // Console.WriteLine("Adicionando. MateriaisDisplay: " + materiaisDisplay);


                            Console.WriteLine("Passou execute reader2!");
                            int id2       = reader.GetOrdinal("id");
                            int idservico = reader.GetOrdinal("id_servico");
                            int idusuario = reader.GetOrdinal("id_usuario");
                            int conf      = reader.GetOrdinal("confirmado");

                            Console.WriteLine("Passou execute2");

                            Agendamento a = new Agendamento();

                            Console.WriteLine("Passou execute3");
                            a.Id = reader.GetInt32(id2);
                            Console.WriteLine("Passou execute4");
                            a.Data = reader.GetDateTime("data");
                            Console.WriteLine("Passou execute5");
                            a.IdServico  = reader.GetInt32(idservico);
                            a.IdUsuario  = reader.GetInt32(idusuario);
                            a.Confirmado = reader.GetInt32(conf);

                            Console.WriteLine("Id= " + a.Id + " Data= " + a.Data + " idservico= " + a.IdServico);
                            Console.WriteLine("idusuario= " + a.IdUsuario + "confirmado= " + a.Confirmado);

                            agendamentos.Add(a);
                            if (a.IdServico == 1)
                            {
                                agendamentosDisplay.Add("Medi??o");
                            }
                            else if (a.IdServico == 2)
                            {
                                agendamentosDisplay.Add("Entrega");
                            }
                            else if (a.IdServico == 3)
                            {
                                agendamentosDisplay.Add("Instala??o");
                            }
                        }
                    }

                    if (agendamentosDisplay.Size() > 0)
                    {
                        listaAgendamentos.Adapter = adapter;
                    }
                }
            }
            catch (MySqlException ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                con.Close();
            }
        }
Exemplo n.º 11
0
        public void retrieve()
        {
            if (materiaisDisplay.Size() > 0)
            {
                materiaisDisplay.Clear();
                materiais.Clear();
            }

            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!");

                    MySqlCommand cmd = new MySqlCommand("select id, nome, categoria, descricao, preco, foto from material", con);

                    using (MySqlDataReader reader = cmd.ExecuteReader())
                    {
                        int id = reader.GetOrdinal("id");

                        while (reader.Read())
                        {
                            materiaisDisplay.Add(reader["nome"].ToString());

                            /* Lendo a foto */
                            int    bufferSize = 65535;
                            byte[] ImageData  = new byte[bufferSize];

                            if (reader["foto"] == null)
                            {
                                Console.WriteLine("Não tem foto!!!");
                            }
                            else
                            {
                                Console.WriteLine("Tem foto.");
                            }

                            reader.GetBytes(reader.GetOrdinal("foto"), 0, ImageData, 0, bufferSize);

                            //Console.WriteLine("ImageData: " + Encoding.Default.GetString(ImageData));

                            materiais.Add(new Material()
                            {
                                Id = reader.GetInt32(id), Nome = reader["nome"].ToString(), Categoria = reader["categoria"].ToString(), Descricao = reader["descricao"].ToString(), Preco = reader.GetDouble(4), Foto = ImageData
                            });
                        }
                    }

                    if (materiaisDisplay.Size() > 0)
                    {
                        lista.Adapter = adapter;
                    }
                }
            }
            catch (MySqlException ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                con.Close();
            }
        }