public List <Listageneral> guardardos(string path, int usuario)
        {
            var conn = new SQLiteConnection(path);
            var asa  = conn.Table <Guardados>();
            List <Listageneral> general = new List <Listageneral>();
            Listageneral        temp;

            foreach (var s in asa)
            {
                if (s.usuario == usuario)
                {
                    temp = new Listageneral(s.id_formato, s.nombre, "°", 1);
                    general.Add(temp);
                }
            }
            return(general);
        }
        public List <Listageneral> cuestionarioslocal(string path, int instancia)
        {
            var conn = new SQLiteConnection(path);
            var asa  = conn.Table <Cuestionarios>();


            List <Listageneral> general = new List <Listageneral>();
            Listageneral        temp;

            foreach (var s in asa)
            {
                if (s.instancia == instancia)
                {
                    temp = new Listageneral(s.id_cuestionario, s.nombre, "°", 2);
                    general.Add(temp);
                }
            }
            return(general);
        }
        }//obtener todos los guardados por instancia, usuario

        public List <Listageneral> guardados_local(string path, int instancia, int id_usuario)
        {
            var conn = new SQLiteConnection(path);
            var asa  = conn.Table <Guardados>();


            List <Listageneral> general = new List <Listageneral>();
            Listageneral        temp;

            foreach (var s in asa)
            {
                if (s.id_instancia == instancia && s.usuario == id_usuario)
                {
                    temp = new Listageneral(s.id_formato, s.nombre, s.id_modelo + "," + s.nm_modelo, 2);
                    general.Add(temp);
                }
            }
            return(general);
        }
示例#4
0
        void Get_modelos()
        {
            db = new sqlite_database_movements();
            if (System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())
            {
                WebReference1.EJBWebServicev2_0 service = new WebReference1.EJBWebServicev2_0();
                //WebReference1.getPreguntasResponse a = new WebReference1.getPreguntasResponse();
                WebReference1.getModelo indata = new WebReference1.getModelo();
                indata.ID_Instancia = opciones.GetInt("instancia", 0);
                indata.oper         = "TYP";
                indata.ID_MODELO    = 0;
                indata.TY_MODELO    = "F";
                indata.NOMBRE       = "";

                try
                {
                    WebReference1.getModeloResponse respuesta = service.GET_ModeloW(indata);
                    if (respuesta.modelos == null)
                    {
                        //Toast.MakeText(this.ApplicationContext, "Error: Lista de cuestionarios nula", ToastLength.Long).Show();
                        error = "Error: Lista de cuestionarios nula";
                        return;
                    }
                    if (respuesta.modelos.Count() == 0)
                    {
                        //Toast.MakeText(this.ApplicationContext, "Error: No hay Cuestionarios para mostrar", ToastLength.Long).Show();
                        error = "Error: No hay Cuestionarios para mostrar";
                        return;
                    }
                    Listageneral temp;
                    //Toast.MakeText(this.ApplicationContext, respuesta.modelos.Count()+" Cuestionarios encontrados.", ToastLength.Long).Show();
                    error   = respuesta.modelos.Count() + " Cuestionarios encontrados.";
                    locales = db.listam(opciones.GetString("db", ""), opciones.GetInt("instancia", 0));
                    for (int x = 0; x < respuesta.modelos.Count(); x++)
                    {
                        if (locales.Contains(respuesta.modelos[x].id_modelo))
                        {
                            temp = new Listageneral(respuesta.modelos[x].id_modelo, respuesta.modelos[x].nombre_cuestionario, "°", 2);                                                  //diferentes tipos de reporte 1 edit, 2 ok, 3 cancel
                        }
                        else
                        {
                            temp = new Listageneral(respuesta.modelos[x].id_modelo, respuesta.modelos[x].nombre_cuestionario, "°", 3); //diferentes tipos de reporte 1 edit, 2 ok, 3 cancel
                        }
                        general.Add(temp);
                    }
                }
                catch (Exception aa)
                {
                    //Toast.MakeText(this.ApplicationContext, "Error: " + aa.Message, ToastLength.Long).Show();
                    error   = "Error: " + aa.Message;
                    locales = db.listam(opciones.GetString("db", ""), opciones.GetInt("instancia", 0));
                    general = db.cuestionarioslocal(opciones.GetString("db", ""), opciones.GetInt("instancia", 0));
                }
            }
            else
            {
                Toast.MakeText(this.ApplicationContext, "Error: No hay coneccion a internet", ToastLength.Long).Show();
                error   = "Error: No hay coneccion a internet";
                locales = db.listam(opciones.GetString("db", ""), opciones.GetInt("instancia", 0));
                general = db.cuestionarioslocal(opciones.GetString("db", ""), opciones.GetInt("instancia", 0));
            }
        }