Ejemplo n.º 1
0
        private void Btneliminar_Clicked(object sender, EventArgs e)
        {
            using (var contexto = new DataContextPoly())
            {
                contexto.Eliminar(poly);
            }

            DisplayAlert("Delete", "your material has been delete", "ok");
            Navigation.PushAsync(new ListadoPoly());
        }
Ejemplo n.º 2
0
        public PolyViewModel()
        {
            Nuevo = new Command(() => {
                Material         = "";
                Gauge            = string.Empty;
                Size             = string.Empty;
                NoRolls          = string.Empty;
                WgtRoll          = string.Empty;
                TotalWeight      = string.Empty;
                ConversionPoly   = string.Empty;
                Scrap            = string.Empty;
                FinishedPrinting = string.Empty;
                Print            = string.Empty;
            }
                                );
            Guardar = new Command(() => {
                PolyModel modelo = new PolyModel()
                {
                    Material         = Material,
                    Gauge            = Gauge,
                    Size             = Size,
                    NoRolls          = NoRolls,
                    WgtRoll          = WgtRoll,
                    TotalWeight      = TotalWeight,
                    ConversionPoly   = ConversionPoly,
                    Scrap            = Scrap,
                    FinishedPrinting = FinishedPrinting,
                    Print            = Print
                };

                using (var contexto = new DataContextPoly())
                {
                    contexto.Insertar(modelo);
                }
            }
                                  );
            Modificar = new Command(() => {
                PolyModel modelo = new PolyModel()
                {
                    Material         = Material,
                    Gauge            = Gauge,
                    Size             = Size,
                    NoRolls          = NoRolls,
                    WgtRoll          = WgtRoll,
                    TotalWeight      = TotalWeight,
                    ConversionPoly   = ConversionPoly,
                    Scrap            = Scrap,
                    FinishedPrinting = FinishedPrinting,
                    Print            = Print,
                    IdPoly           = IdPoly
                };

                using (var contexto = new DataContextPoly())
                {
                    contexto.Actualizar(modelo);
                }
            }
                                    );

            Eliminar = new Command(() => {
                PolyModel modelo = new PolyModel()
                {
                    Material         = Material,
                    Gauge            = Gauge,
                    Size             = Size,
                    NoRolls          = NoRolls,
                    WgtRoll          = WgtRoll,
                    TotalWeight      = TotalWeight,
                    ConversionPoly   = ConversionPoly,
                    Scrap            = Scrap,
                    FinishedPrinting = FinishedPrinting,
                    Print            = Print,
                    IdPoly           = IdPoly
                };

                using (var contexto = new DataContextPoly())
                {
                    contexto.Eliminar(modelo);
                }
            });
        }