public void llenacmbAsistentes()
        {
            actShAsistentes = new UIActionSheet("Seleccionar");
            foreach (clsCmbUsuarios us in lstasistentescombo)
            {
                String nombre = us.nombre + " " + us.apepaterno + " " + us.apematerno;
                actShAsistentes.Add(nombre);
            }
            actShAsistentes.Add("Cancelar");

            actShAsistentes.Style             = UIActionSheetStyle.BlackTranslucent;
            actShAsistentes.CancelButtonIndex = lstasistentescombo.Count;


            actShAsistentes.Clicked += delegate(object sender, UIButtonEventArgs e)
            {
                if (e.ButtonIndex != lstasistentescombo.Count)
                {
                    clsCmbUsuarios us = lstasistentescombo.ElementAt((int)e.ButtonIndex);
                    txtAsistentes.Text = us.nombre + " " + us.apepaterno + " " + us.apematerno;
                    idasistentesel     = us.idusuario;
                }
                else
                {
                    txtAsistentes.Text = "";
                    idasistentesel     = -1;
                }
            };
        }
        public clsCmbUsuarios getobjUsuario(Object varjson)
        {
            clsCmbUsuarios objus = new clsCmbUsuarios();
            JObject        json  = (JObject)varjson;

            objus.idusuario  = Int32.Parse(json["idusuario"].ToString());
            objus.nombre     = json["nombre"].ToString();
            objus.apepaterno = json["apepaterno"].ToString();
            objus.apematerno = json["apematerno"].ToString();

            return(objus);
        }
示例#3
0
        public async Task <Boolean> getUsuarios()
        {
            client = new HttpClient();
            string url = Consts.ulrserv + "usuarios/getCmbUsuarios";
            var    uri = new Uri(string.Format(url));

            var json = "";

            string responseString = string.Empty;

            responseString = await funciones.llamadaRest(client, uri, loadPop, json, Consts.token);

            if (responseString.Equals("-1") || responseString.Equals("-2"))
            {
                funciones.SalirSesion(this);
                return(false);
            }

            JArray jrarray;


            try
            {
                var jsonresponse = JArray.Parse(responseString);
                jrarray = jsonresponse;
            }
            catch (Exception e)
            {
                loadPop.Hide();
                var jsonresponse = JObject.Parse(responseString);

                string mensaje = "error al traer los usuarios del servidor: " + e.HResult;

                var jtokenerror = jsonresponse["error"];
                if (jtokenerror != null)
                {
                    mensaje = jtokenerror.ToString();
                }

                funciones.MessageBox("Error", mensaje);
                return(false);
            }

            foreach (var us in jrarray)
            {
                clsCmbUsuarios objus = getobjUsuario(us);
                lstResponsables.Add(objus);
            }

            return(true);
        }
        public async Task <Boolean> searchUsers()
        {
            var bounds = UIScreen.MainScreen.Bounds;

            loadPop = new LoadingOverlay(bounds, "Buscando usuarios...");
            View.Add(loadPop);

            client         = new HttpClient();
            client.Timeout = new System.TimeSpan(0, 0, 0, 10, 0);

            string url = Consts.ulrserv + "usuarios/getUsuariosSearch";
            var    uri = new Uri(string.Format(url));

            Dictionary <String, String> param = new Dictionary <String, String>();

            param.Add("nombre", txtAsistentes.Text);
            var json = JsonConvert.SerializeObject(param);

            string responseString = string.Empty;

            responseString = await funciones.llamadaRest(client, uri, loadPop, json, Consts.token);

            if (responseString.Equals("-1") || responseString.Equals("-2"))
            {
                funciones.SalirSesion(this);
                return(false);
            }

            JArray jrarray;


            try
            {
                var jsonresponse = JArray.Parse(responseString);
                jrarray = jsonresponse;
            }
            catch (Exception e)
            {
                loadPop.Hide();
                var jsonresponse = JObject.Parse(responseString);

                string mensaje = "error al traer los usuarios del servidor: " + e.HResult;

                var jtokenresult = jsonresponse["result"].ToString();
                if (jtokenresult.Equals("0"))
                {
                    funciones.MessageBox("Error", "No se han encontrado coincidencias");
                    return(false);
                }

                var jtokenerror = jsonresponse["error"];
                if (jtokenerror != null)
                {
                    mensaje = jtokenerror.ToString();
                }

                funciones.MessageBox("Error", mensaje);
                return(false);
            }

            foreach (var us in jrarray)
            {
                clsCmbUsuarios objus = getobjUsuario(us);
                lstasistentescombo.Add(objus);
            }

            return(true);
        }
示例#5
0
        public void inicializaCombos()
        {
            //--------Combo Responsables---------------------
            actResponsables = new UIActionSheet("Seleccionar");
            foreach (clsCmbUsuarios us in lstResponsables)
            {
                actResponsables.Add(us.nombre);
            }
            actResponsables.Add("Cancelar");

            actResponsables.Style             = UIActionSheetStyle.BlackTranslucent;
            actResponsables.CancelButtonIndex = lstResponsables.Count;

            btnResponsable.TouchUpInside += delegate
            {
                actResponsables.ShowInView(this.contentViewSolicitudMaquina);
            };

            actResponsables.Clicked += delegate(object sender, UIButtonEventArgs e)
            {
                if (e.ButtonIndex != lstResponsables.Count)
                {
                    clsCmbUsuarios us = lstResponsables.ElementAt((int)e.ButtonIndex);
                    txtResponsable.Text = us.nombre;
                    idresponsable       = us.idusuario;
                }
                else
                {
                    txtResponsable.Text = "";
                    idresponsable       = -1;
                }
            };

            //--------Combo Areas Obra---------------------
            actAreasObra = new UIActionSheet("Seleccionar");
            foreach (clsCmbObras ob in lstAreasObra)
            {
                actAreasObra.Add(ob.nombre);
            }
            actAreasObra.Add("Cancelar");

            actAreasObra.Style             = UIActionSheetStyle.BlackTranslucent;
            actAreasObra.CancelButtonIndex = lstAreasObra.Count;

            btnAreaObra.TouchUpInside += delegate
            {
                actAreasObra.ShowInView(this.contentViewSolicitudMaquina);
            };

            actAreasObra.Clicked += delegate(object sender, UIButtonEventArgs e)
            {
                if (e.ButtonIndex != lstAreasObra.Count)
                {
                    clsCmbObras ob = lstAreasObra.ElementAt((int)e.ButtonIndex);
                    txtAreaObra.Text = ob.nombre;
                    idarea           = ob.idobra;
                }
                else
                {
                    txtAreaObra.Text = "";
                    idarea           = -1;
                }
            };
        }
示例#6
0
        public void inicializaCombos()
        {
            //--------Combo Reporto---------------------
            actShRealizo = new UIActionSheet("Seleccionar");
            foreach (clsCmbUsuarios us in lstusuarios)
            {
                String nombre = us.nombre + " " + us.apepaterno + " " + us.apematerno;
                actShRealizo.Add(nombre);
            }
            actShRealizo.Add("Cancelar");

            actShRealizo.Style             = UIActionSheetStyle.BlackTranslucent;
            actShRealizo.CancelButtonIndex = lstusuarios.Count;

            btnrealizo.TouchUpInside += delegate
            {
                actShRealizo.ShowInView(this.ContentViewRepServicios);
            };

            actShRealizo.Clicked += delegate(object sender, UIButtonEventArgs e)
            {
                if (e.ButtonIndex != lstusuarios.Count)
                {
                    clsCmbUsuarios us = lstusuarios.ElementAt((int)e.ButtonIndex);
                    txtrealizo.Text = us.nombre + " " + us.apepaterno + " " + us.apematerno;
                    idrealizo       = us.idusuario;
                }
                else
                {
                    txtrealizo.Text = "";
                    idrealizo       = -1;
                }
            };

            //--------Combo tipofalla---------------------

            actShTipoFalla = new UIActionSheet("Seleccionar");

            foreach (clsTipoFallas tip in lsttipofallas)
            {
                String falla = tip.nombre;
                actShTipoFalla.Add(falla);
            }
            actShTipoFalla.Add("Cancelar");


            actShTipoFalla.Style             = UIActionSheetStyle.BlackTranslucent;
            actShTipoFalla.CancelButtonIndex = lsttipofallas.Count;

            btntipofalla.TouchUpInside += delegate
            {
                actShTipoFalla.ShowInView(this.ContentViewRepServicios);
            };

            actShTipoFalla.Clicked += delegate(object sender, UIButtonEventArgs e)
            {
                if (e.ButtonIndex != lsttipofallas.Count)
                {
                    clsTipoFallas tip = lsttipofallas.ElementAt((int)e.ButtonIndex);
                    txtTipoFalla.Text = tip.nombre;
                    idtipofalla       = tip.idtipofalla;
                }
                else
                {
                    txtTipoFalla.Text = "";
                    idtipofalla       = -1;
                }
            };

            //--------Combo tipo mantenimiento---------------------

            actShTipoMnto = new UIActionSheet("Seleccionar");

            foreach (clsTipoMnto tip in lsttipomnto)
            {
                String mantenimiento = tip.nombre;
                actShTipoMnto.Add(mantenimiento);
            }
            actShTipoMnto.Add("Cancelar");


            actShTipoMnto.Style             = UIActionSheetStyle.BlackTranslucent;
            actShTipoMnto.CancelButtonIndex = lsttipomnto.Count;

            btntipomnto.TouchUpInside += delegate
            {
                actShTipoMnto.ShowInView(this.ContentViewRepServicios);
            };

            actShTipoMnto.Clicked += delegate(object sender, UIButtonEventArgs e)
            {
                if (e.ButtonIndex != lsttipomnto.Count)
                {
                    clsTipoMnto tip = lsttipomnto.ElementAt((int)e.ButtonIndex);
                    txtTipoMnto.Text = tip.nombre;
                    idtipomnto       = tip.idtipomnto;
                }
                else
                {
                    txtTipoMnto.Text = "";
                    idtipomnto       = -1;
                }
            };
        }