예제 #1
0
        public async Task FillMaterial()
        {
            await bd.Material.LoadAsync();

            foreach (var material in bd.Material.Local)
            {
                Materiales.Add(material);
            }
        }
 private void TapAgregar()    //agrega una fila vacia a la tabla materiales
 {
     IsRefreshing = true;
     Materiales.Add(new Material()
     {
         Boleta         = "0",
         NombreMaterial = "",
         Cantidad       = "0",
         Fecha          = "",
         Comentario     = ""
     });
     IsRefreshing = false;
 }
        private void LoadMateriales()
        {
            if (Application.Current.Properties.ContainsKey("Contador")) //contador de la cantidad de elementos en la lista
            {
                Elementos = int.Parse((Application.Current.Properties["Contador"]) as string);
            }
            else
            {
                Elementos = 0;
            }

            IsRefreshing = true;

            for (int j = 0; j < Elementos; j++) //Elementos va a representar el total de elementos o filas existentes en mi persistencia
            {
                if (Application.Current.Properties.ContainsKey("Boleta" + j))
                {
                    boleta = (Application.Current.Properties["Boleta" + j]) as string;
                }
                else
                {
                    boleta = "0";
                }

                if (Application.Current.Properties.ContainsKey("Cantidad" + j))
                {
                    cantidad = (Application.Current.Properties["Cantidad" + j] as string);
                }
                else
                {
                    cantidad = "0";
                }

                if (Application.Current.Properties.ContainsKey("Comentario" + j))
                {
                    comentario = (Application.Current.Properties["Comentario" + j] as string);
                }
                else
                {
                    comentario = "";
                }

                if (Application.Current.Properties.ContainsKey("Fecha" + j))
                {
                    fecha = (Application.Current.Properties["Fecha" + j] as string);
                }
                else
                {
                    fecha = "";
                }

                if (Application.Current.Properties.ContainsKey("NombreMaterial" + j))
                {
                    nombre = (Application.Current.Properties["NombreMaterial" + j] as string);
                }
                else
                {
                    nombre = "";
                }

                Materiales.Add(new Material() //agrega a mi lista todos los elementos existentes en persistencia
                {
                    Boleta         = boleta,
                    Cantidad       = cantidad,
                    Comentario     = comentario,
                    Fecha          = fecha,
                    NombreMaterial = nombre,
                });
            }

            IsRefreshing = false;

            HeighListView = 44 * Materiales.Count; //cantidad de filas en mi lista, multiplicado por 44 que es el alto maximo de cada fila
        }
예제 #4
0
 public Material AgregarMaterial(Material material)
 {
     Materiales.Add(material);
     return(material);
 }