コード例 #1
0
        public async override void ViewDidLoad()
        {
            base.ViewDidLoad();

            NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.DidShowNotification, TecladoArriba);
            NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.WillHideNotification, TecladoAbajo);

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

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

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


            clsCmbObras ob = await cargaDatosObra();

            if (ob != null)
            {
                loadPop.Hide();
                txtNombreObra.Text      = ob.nombre;
                txtDescripcionobra.Text = ob.descripcion;
            }

            btnModificarObra.TouchUpInside += modificaObra;
            btnEliminarObra.TouchUpInside  += BorrarObra;

            bajatecladoinputs();
        }
コード例 #2
0
        public clsCmbObras getobjAreaObra(Object varjson)
        {
            clsCmbObras objob = new clsCmbObras();
            JObject     json  = (JObject)varjson;

            objob.idobra = Int32.Parse(json["idobra"].ToString());
            objob.nombre = json["nombre"].ToString();

            return(objob);
        }
コード例 #3
0
        public async Task <clsCmbObras> cargaDatosObra()
        {
            var bounds = UIScreen.MainScreen.Bounds;

            loadPop = new LoadingOverlay(bounds, "Cargando datos de la Obra...");
            View.Add(loadPop);

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

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

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

            pet.Add("idobra", idobra.ToString());

            var    json           = JsonConvert.SerializeObject(pet);
            string responseString = string.Empty;

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


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



            var jsonresponse = JObject.Parse(responseString);

            var result = jsonresponse["result"];

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

            clsCmbObras obj = new clsCmbObras();

            obj.idobra      = Int32.Parse(jsonresponse["idobra"].ToString());
            obj.nombre      = jsonresponse["nombre"].ToString();
            obj.descripcion = jsonresponse["descripcion"].ToString();


            return(obj);
        }
コード例 #4
0
        public async Task <Boolean> getAreasObra()
        {
            client = new HttpClient();
            string url = Consts.ulrserv + "obras/getObras";
            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 ob in jrarray)
            {
                clsCmbObras objarea = getobjAreaObra(ob);
                lstAreasObra.Add(objarea);
            }

            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;
                }
            };
        }