internal static ProductsPriceInStoreService FromJObject(JObject jObject)
		{
			ProductsPriceInStoreService response = new ProductsPriceInStoreService();
			response.nombre = jObject["name"].ToString();
			response.precio = jObject ["tot"].ToString ();
			response.imagen = jObject ["image_url"].ToString ();

			return response;
		}
        internal static ProductsPriceInStoreService FromJObject(JObject jObject)
        {
            ProductsPriceInStoreService response = new ProductsPriceInStoreService();

            response.nombre = jObject["name"].ToString();
            response.precio = jObject ["tot"].ToString();
            response.imagen = jObject ["image_url"].ToString();

            return(response);
        }
Ejemplo n.º 3
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            try{
                lblTienda.Text = storeName;
                ProductsPriceInStoreService productsPriceInStoreService = new ProductsPriceInStoreService();
                productsPriceInStoreService.setListAndStore(this.listId, this.storeId);
                List <ProductsPriceInStoreService> tableItems = productsPriceInStoreService.All();
                tblProductos.TableHeaderView = this.headerView;

                productImages.Clear();
                foreach (var v in tableItems)
                {
                    Images image = new Images {
                        imageUrl = v.imagen
                    };
                    this.productImages.Add(image);
                }

                if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone)
                {
                    this.tblProductos.Source = new ProductsTableSourceIphone(tableItems, this);
                }
                else
                {
                    this.tblProductos.Source = new ProductsTableSource(tableItems, this);
                }
            }catch (System.Net.WebException ex) {
                Console.WriteLine("EXCEPCION WEB: " + ex.ToString());
                UIAlertView alerta = new UIAlertView()
                {
                    Title = "Ups :S", Message = "Algo salio mal, verifica tu conexión a internet e intentalo de nuevo."
                };
                alerta.AddButton("Aceptar");
                alerta.Show();
            }catch (Exception ex) {
                Console.WriteLine("EXCEPCION: " + ex.ToString());
                UIAlertView alerta = new UIAlertView()
                {
                    Title = "Ups :S", Message = "Algo salio mal, por favor intentalo de nuevo."
                };
                alerta.AddButton("Aceptar");
                alerta.Show();
            }
        }
        public List <ProductsPriceInStoreService> GetResponse()
        {
            WebClient    client       = new WebClient();
            Stream       stream       = client.OpenRead(this.resultURL);
            StreamReader reader       = new StreamReader(stream);
            JArray       responseJSON = JArray.Parse(reader.ReadLine());
            List <ProductsPriceInStoreService> responseList = new List <ProductsPriceInStoreService>();

            foreach (JObject jobject in responseJSON)
            {
                ProductsPriceInStoreService response = ProductsPriceInStoreService.FromJObject(jobject);

                responseList.Add(response);
            }

            return(responseList);
        }
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			try{
				lblTienda.Text = storeName;
				ProductsPriceInStoreService productsPriceInStoreService = new ProductsPriceInStoreService ();
				productsPriceInStoreService.setListAndStore (this.listId, this.storeId);
				List<ProductsPriceInStoreService> tableItems = productsPriceInStoreService.All ();
				tblProductos.TableHeaderView = this.headerView;

				productImages.Clear();
				foreach (var v in tableItems){
					Images image = new Images{ imageUrl = v.imagen};
					this.productImages.Add(image);
				}
					
				if(UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone){
					this.tblProductos.Source = new ProductsTableSourceIphone (tableItems, this);
				}else{
					this.tblProductos.Source = new ProductsTableSource (tableItems, this);
				}

			}catch(System.Net.WebException ex){
				Console.WriteLine ("EXCEPCION WEB: " + ex.ToString());
				UIAlertView alerta = new UIAlertView () { 
					Title = "Ups :S", Message = "Algo salio mal, verifica tu conexión a internet e intentalo de nuevo."
				};
				alerta.AddButton ("Aceptar");
				alerta.Show ();
			}catch(Exception ex){
				Console.WriteLine ("EXCEPCION: " + ex.ToString());
				UIAlertView alerta = new UIAlertView () { 
					Title = "Ups :S", Message = "Algo salio mal, por favor intentalo de nuevo."
				};
				alerta.AddButton ("Aceptar");
				alerta.Show ();
			}
		}