Exemple #1
0
        private clsProduccion getobjProduccion(Object varjson)
        {
            clsProduccion obj  = new clsProduccion();
            JObject       json = (JObject)varjson;

            obj.folio    = json["folio"].ToString();
            obj.material = json["material"].ToString();
            obj.cantidad = json["cantidad"].ToString();
            obj.unidad   = json["unidad"].ToString();
            obj.cliente  = json["cliente"].ToString();
            obj.fecha    = json["fecha"].ToString();
            return(obj);
        }
Exemple #2
0
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            int indicearreglo = indexPath.Row;

            UITableViewCell cell;
            clsProduccion   objprod = lstProd.ElementAt(indicearreglo);


            if (indicearreglo % 2 == 0)
            {
                string idcell = celdaProduccionBlack;
                cell = tableView.DequeueReusableCell(idcell) as CustomListadoProduccionCellBlack;

                if (cell == null)
                {
                    cell = new CustomListadoProduccionCellBlack((NSString)idcell);
                }
            }
            else
            {
                string idcell = celdaProduccionWhite;
                cell = tableView.DequeueReusableCell(idcell) as CustomListadoProduccionCellWhite;

                if (cell == null)
                {
                    cell = new CustomListadoProduccionCellWhite((NSString)idcell);
                }
            }



            String strcantidad = objprod.cantidad + " " + objprod.unidad;

            ((CustomListadoProduccionCell)cell).UpdateCell(objprod.material, strcantidad, objprod.cliente, objprod.folio, objprod.fecha);


            return(cell);
        }
Exemple #3
0
        public async Task <Boolean> getBusquedaProduccion()
        {
            var bounds = UIScreen.MainScreen.Bounds;

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

            client = new HttpClient();
            string url = Consts.ulrserv + "reportes/getReporteProduccion";
            var    uri = new Uri(string.Format(url));
            Dictionary <string, string> pet = new Dictionary <string, string>();

            pet.Add("folio", folio);
            pet.Add("material", material);
            pet.Add("cantidad", cantidad);
            pet.Add("unidad", unidad);
            pet.Add("cliente", cliente);
            pet.Add("fecha", fechaini);
            pet.Add("fechafin", fechafin);
            var json = JsonConvert.SerializeObject(pet);

            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 datos del servidor: " + e.HResult;

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

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

            foreach (var item in jrarray)
            {
                clsProduccion objp = getobjProduccion(item);
                lstProd.Add(objp);
            }


            return(true);
        }