Пример #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 = txtconversion.Text;
            scr = txtscrap.Text;
            fin = txtfinished.Text;
            pri = txtprint.Text;
            ShrinkModel mod = new ShrinkModel()
            {
                Material    = mat,
                Gauge       = gau,
                Size        = siz,
                NoRolls     = nor,
                WgtRoll     = wgt,
                TotalWeight = tot,
                Conversion  = con,
                Scrap       = scr,
                Finished    = fin,
                Print       = pri,
                IdShrink    = shrink.IdShrink
            };

            using (var contexto = new DataContextShrink())
            {
                contexto.Actualizar(mod);
            }
            DisplayAlert("Update", "your Material Shrink has been update", "ok");
            Navigation.PushAsync(new ListadoShrink());
        }
Пример #2
0
 public void LlenarShrink()
 {
     using (var contexto = new DataContextShrink())
     {
         ObservableCollection <ShrinkModel> modelo = new ObservableCollection <ShrinkModel>(contexto.Consultar());
         ListadoShrink = modelo;
     }
 }
Пример #3
0
        private void Btneliminar_Clicked(object sender, EventArgs e)
        {
            using (var contexto = new DataContextShrink())
            {
                contexto.Eliminar(shrink);
            }

            DisplayAlert("Delete", "your material Shrink has been delete", "ok");
            Navigation.PushAsync(new ListadoShrink());
        }
Пример #4
0
        public ShrinkViewModel()
        {
            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(() => {
                ShrinkModel modelo = new ShrinkModel()
                {
                    Material    = Material,
                    Gauge       = Gauge,
                    Size        = Size,
                    NoRolls     = NoRolls,
                    WgtRoll     = WgtRoll,
                    TotalWeight = TotalWeight,
                    Conversion  = Conversion,
                    Scrap       = Scrap,
                    Finished    = Finished,
                    Print       = Print
                };

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

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

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

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