Esempio n. 1
0
        private void Btnmodificar_Clicked(object sender, EventArgs e)
        {
            mat = Convert.ToString(txtmaterial.SelectedItem);
            siz = txtgauge.Text;
            nor = txtnorolls.Text;
            wgt = txtwgtroll.Text;
            tot = txttotalweight.Text;
            con = txtconversionpoly.Text;
            scr = txtscrap.Text;
            fin = txtfinishedprinting.Text;
            pri = txtprint.Text;
            PolyModel mod = new PolyModel()
            {
                Material         = mat,
                Gauge            = gau,
                Size             = siz,
                NoRolls          = nor,
                WgtRoll          = wgt,
                TotalWeight      = tot,
                ConversionPoly   = con,
                Scrap            = scr,
                FinishedPrinting = fin,
                Print            = pri,
                IdPoly           = poly.IdPoly
            };

            using (var contexto = new DataContextPoly())
            {
                contexto.Actualizar(mod);
            }
            DisplayAlert("Update", "your Material Poly has been update", "ok");
            Navigation.PushAsync(new ListadoPoly());
        }
Esempio 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);
                }
            });
        }