Пример #1
0
        public async Task <clsReporteOpConsulta> getReporteOperador()
        {
            client = new HttpClient();
            string url = Consts.ulrserv + "reportes/getReporteOperador";
            var    uri = new Uri(string.Format(url));

            Dictionary <string, string> obj = new Dictionary <string, string>();

            obj.Add("noserie", strNoSerie);
            var json = JsonConvert.SerializeObject(obj);

            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(null);
            }

            var jsonresponse = JObject.Parse(responseString);
            var jtokenerror  = jsonresponse["error_description"];


            if (jtokenerror != null)
            {
                loadPop.Hide();
                string error = jtokenerror.ToString();
                funciones.MessageBox("Error", error);
                return(null);
            }

            jtokenerror = jsonresponse["error"];


            if (jtokenerror != null)
            {
                loadPop.Hide();
                string error = jtokenerror.ToString();
                funciones.MessageBox("Error", error);
                return(null);
            }
            clsReporteOpConsulta objresp = new clsReporteOpConsulta();

            objresp.folio       = jsonresponse["folio"].ToString();
            objresp.noserie     = jsonresponse["noserie"].ToString();
            objresp.fechahora   = jsonresponse["fechahora"].ToString();
            objresp.equipo      = jsonresponse["equipo"].ToString();
            objresp.kmho        = jsonresponse["kmho"].ToString().Replace(",", ".");
            objresp.modelo      = jsonresponse["modelo"].ToString();
            objresp.reporto     = jsonresponse["reporto"].ToString();
            objresp.tipofalla   = jsonresponse["tipofalla"].ToString();
            objresp.idtipofalla = jsonresponse["idtipofalla"].ToString();
            objresp.atiende     = jsonresponse["atiende"].ToString();
            objresp.descripcion = jsonresponse["descripcion"].ToString();


            return(objresp);
        }
Пример #2
0
        async public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            if (UIScreen.MainScreen.Bounds.Width == 414)
            {
                scrViewRepServicios.ContentSize = new CoreGraphics.CGSize(359, 1783);
            }
            else
            {
                scrViewRepServicios.ContentSize = new CoreGraphics.CGSize(316, 1783);
            }

            btnaddref.Layer.CornerRadius = 10;
            btnaddref.ClipsToBounds      = true;

            btnLimpiarRefacciones.Layer.CornerRadius = 10;
            btnLimpiarRefacciones.ClipsToBounds      = true;

            btnGuardar.Layer.CornerRadius = 10;
            btnGuardar.ClipsToBounds      = true;

            txtDescFalla.Layer.BorderColor = UIColor.Black.CGColor;
            txtDescFalla.Layer.BorderWidth = (nfloat)2.0;
            txtDescFalla.Text     = "";
            txtDescFalla.Editable = false;

            txtObs.Layer.BorderColor = UIColor.Black.CGColor;
            txtObs.Layer.BorderWidth = (nfloat)2.0;
            txtObs.Text = "";

            tblRefacciones.Layer.BorderColor = UIColor.Black.CGColor;
            tblRefacciones.Layer.BorderWidth = (nfloat)2.0;
            lstref.Clear();
            tblRefacciones.Source = new FuenteTablaRefacciones(lstref);

            lstusuarios   = new List <clsCmbUsuarios>();
            lsttipofallas = new List <clsTipoFallas>();
            lsttipomnto   = new List <clsTipoMnto>();

            btnaddref.TouchUpInside += delegate
            {
                lstref.Add(txtaddref.Text);
                tblRefacciones.ReloadData();
                txtaddref.Text = "";
            };

            btnLimpiarRefacciones.TouchUpInside += delegate
            {
                lstref.Clear();
                tblRefacciones.ReloadData();
            };

            btnGuardar.TouchUpInside += guardarReporte;


            var bounds = UIScreen.MainScreen.Bounds;

            loadPop = new LoadingOverlay(bounds, "Cargando Datos ...");
            View.Add(loadPop);

            int resptienerep = await tieneRepServicio();

            if (resptienerep == 0)
            {
                funciones.MessageBox("Aviso", "La maquina no tiene Reporte de operador, debe de ingresar primero un reporte de operador para capturar el reporte de servicio");
                this.NavigationController.PopToViewController(viewmaq, true);
                return;
            }


            clsReporteOpConsulta objresp = await getReporteOperador();

            if (objresp == null)
            {
                this.NavigationController.PopToRootViewController(true);
                return;
            }

            txtFolio.Text     = objresp.folio;
            txtEquipo.Text    = objresp.equipo;
            txtnoserie.Text   = objresp.noserie;
            txtkmho.Text      = objresp.kmho;
            txtmodelo.Text    = objresp.modelo;
            txtDescFalla.Text = objresp.descripcion;
            txtTipoFalla.Text = objresp.tipofalla;
            idtipofalla       = Int32.Parse(objresp.idtipofalla);

            Boolean respus = await getUsuarios();

            if (!respus)
            {
                this.NavigationController.PopToViewController(viewmaq, true);
                return;
            }

            Boolean resptip = await getTipoFallas();

            if (!resptip)
            {
                this.NavigationController.PopToViewController(viewmaq, true);
                return;
            }

            Boolean resptipmnto = await getTipoMantenimientos();

            if (!resptipmnto)
            {
                this.NavigationController.PopToViewController(viewmaq, true);
                return;
            }

            inicializaCombos();
            loadPop.Hide();

            bajatecladoinputs();
        }
Пример #3
0
        public async override void ViewDidLoad()
        {
            base.ViewDidLoad();

            btnGuardar.Layer.CornerRadius = 10;
            btnGuardar.ClipsToBounds      = true;

            if (UIScreen.MainScreen.Bounds.Width == 414)
            {
                ScrView.ContentSize = new CoreGraphics.CGSize(355, 1200);
            }
            else
            {
                ScrView.ContentSize = new CoreGraphics.CGSize(316, 1200);
            }
            txtDescripcion.Layer.BorderColor = UIColor.Black.CGColor;
            txtDescripcion.Layer.BorderWidth = (nfloat)2.0;
            txtDescripcion.Text = "";

            var bounds = UIScreen.MainScreen.Bounds;

            loadPop = new LoadingOverlay(bounds, "Cargando Datos ...");
            View.Add(loadPop);


            int tieneRep = await tieneRepServicio();

            if (tieneRep == -1)
            {
                this.NavigationController.PopToViewController(viewmaq, true);
            }

            if (tieneRep == 1)
            {
                clsReporteOpConsulta objresp = await getReporteOperador();

                if (objresp == null)
                {
                    this.NavigationController.PopToRootViewController(true);
                }
                else
                {
                    loadPop.Hide();

                    txtFolio.Text       = objresp.folio;
                    txtnoserie.Text     = objresp.noserie;
                    txtfechahora.Text   = objresp.fechahora;
                    txtequipo.Text      = objresp.equipo;
                    txtkmho.Text        = objresp.kmho;
                    txtmodelo.Text      = objresp.modelo;
                    txtreporto.Text     = objresp.reporto;
                    txtfipofalla.Text   = objresp.tipofalla;
                    txtatiende.Text     = objresp.atiende;
                    txtDescripcion.Text = objresp.descripcion;

                    btnGuardar.Hidden = true;
                }
            }
            else
            {
                String folio = await getFolio();

                if (folio == "")
                {
                    this.NavigationController.PopToRootViewController(true);
                }


                txtFolio.Text = folio;

                String fecha = await getFechaHoraActual();

                if (fecha == "")
                {
                    this.NavigationController.PopToRootViewController(true);
                }

                txtfechahora.Text = fecha;

                lstusuarios   = new List <clsCmbUsuarios>();
                lsttipofallas = new List <clsTipoFallas>();

                Boolean respus = await getUsuarios();

                if (!respus)
                {
                    this.NavigationController.PopToRootViewController(true);
                }

                Boolean resptip = await getTipoFallas();

                if (!resptip)
                {
                    this.NavigationController.PopToRootViewController(true);
                }
                else
                {
                    loadPop.Hide();
                }


                inicializaCombos();


                inicializadatos();
                btnGuardar.Hidden = false;
            }

            btnGuardar.TouchUpInside += guardarReporte;

            bajatecladoinputs();
        }