Esempio n. 1
0
        public clsTipoFallas getTipoFalla(Object varjson)
        {
            clsTipoFallas objtip = new clsTipoFallas();
            JObject       json   = (JObject)varjson;

            objtip.idtipofalla = Int32.Parse(json["idtipofalla"].ToString());
            objtip.nombre      = json["nombre"].ToString();
            objtip.descripcion = json["descripcion"].ToString();


            return(objtip);
        }
Esempio n. 2
0
        public async Task <Boolean> getTipoFallas()
        {
            client = new HttpClient();
            string url = Consts.ulrserv + "reportes/getTipoFallas";
            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 tipos de falla del servidor: " + e.HResult;

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

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

            foreach (var tip in jrarray)
            {
                clsTipoFallas objtip = getTipoFalla(tip);
                lsttipofallas.Add(objtip);
            }

            return(true);
        }
Esempio n. 3
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;
                }
            };
        }