Ejemplo n.º 1
0
        private void Btnmodificar_Clicked(object sender, EventArgs e)
        {
            mat = Convert.ToString(txtmaterial.SelectedItem);
            gau = txtgauge.Text;
            siz = txtsize.Text;
            nor = txtnorolls.Text;
            wgt = txtwgtroll.Text;
            tot = txttotalweight.Text;
            con = txtconversion.Text;
            scr = txtscrap.Text;
            fin = txtfinished.Text;
            pri = txtprint.Text;
            ConversionModel mod = new ConversionModel()
            {
                Material     = mat,
                Gauge        = gau,
                Size         = siz,
                NoRolls      = nor,
                WgtRoll      = wgt,
                TotalWeight  = tot,
                Conversion   = con,
                Scrap        = scr,
                Finished     = fin,
                Print        = pri,
                IdConversion = conversion.IdConversion
            };

            using (var contexto = new DataContextConversion())
            {
                contexto.Actualizar(mod);
            }
            DisplayAlert("Update", "your Material Conversion has been update", "ok");
            Navigation.PushAsync(new ListadoConversion());
        }
Ejemplo n.º 2
0
        public ConversionViewModel()
        {
            Nuevo = new Command(() => {
                Material    = "";
                Gauge       = string.Empty;
                Size        = string.Empty;
                NoRolls     = string.Empty;
                WgtRoll     = string.Empty;
                TotalWeight = string.Empty;
                Conversion  = string.Empty;
                Scrap       = string.Empty;
                Finished    = string.Empty;
                Print       = string.Empty;
            }
                                );
            Guardar = new Command(() => {
                ConversionModel modelo = new ConversionModel()
                {
                    Material    = Material,
                    Gauge       = Gauge,
                    Size        = Size,
                    NoRolls     = NoRolls,
                    WgtRoll     = WgtRoll,
                    TotalWeight = TotalWeight,
                    Conversion  = Conversion,
                    Scrap       = Scrap,
                    Finished    = Finished,
                    Print       = Print
                };

                using (var contexto = new DataContextConversion())
                {
                    contexto.Insertar(modelo);
                }
            }
                                  );
            Modificar = new Command(() => {
                ConversionModel modelo = new ConversionModel()
                {
                    Material     = Material,
                    Gauge        = Gauge,
                    Size         = Size,
                    NoRolls      = NoRolls,
                    WgtRoll      = WgtRoll,
                    TotalWeight  = TotalWeight,
                    Conversion   = Conversion,
                    Scrap        = Scrap,
                    Finished     = Finished,
                    Print        = Print,
                    IdConversion = IdConversion
                };

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

            Eliminar = new Command(() => {
                ConversionModel modelo = new ConversionModel()
                {
                    Material     = Material,
                    Gauge        = Gauge,
                    Size         = Size,
                    NoRolls      = NoRolls,
                    WgtRoll      = WgtRoll,
                    TotalWeight  = TotalWeight,
                    Conversion   = Conversion,
                    Scrap        = Scrap,
                    Finished     = Finished,
                    Print        = Print,
                    IdConversion = IdConversion
                };

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