Пример #1
0
        private void Btnmodificar_Clicked(object sender, EventArgs e)
        {
            ma1 = Convert.ToString(txtmaterial1.SelectedItem);
            ma2 = Convert.ToString(txtmaterial2.SelectedItem);
            ga1 = txtGauge1.Text;
            ga2 = txtGauge2.Text;
            si1 = txtsize1.Text;
            si2 = txtsize2.Text;
            re1 = txtreturned1.Text;
            re2 = txtreturned2.Text;
            scr = txtscrap.Text;
            fin = txtfinished.Text;
            LaminationModel mod = new LaminationModel()
            {
                Material1    = ma1,
                Material2    = ma2,
                Gauge1       = ga1,
                Gauge2       = ga2,
                Size1        = si1,
                Size2        = si2,
                Returned1    = re1,
                Returned2    = re2,
                Scrap        = scr,
                Finished     = fin,
                IdLamination = lamination.IdLamination
            };

            using (var contexto = new DataContextLamination())
            {
                contexto.Actualizar(mod);
            }
            DisplayAlert("Update", "your Material Lamination has been update", "ok");
            Navigation.PushAsync(new ListadoLamination());
        }
Пример #2
0
        public LaminationViewModel()
        {
            Nuevo = new Command(() => {
                Material1          = "";
                Material2          = "";
                Gauge1             = string.Empty;
                Gauge2             = string.Empty;
                Size1              = string.Empty;
                Size2              = string.Empty;
                Returned1          = string.Empty;
                Returned2          = string.Empty;
                Scrap              = string.Empty;
                FinishedLamination = string.Empty;
                Finished           = string.Empty;
            }
                                );
            Guardar = new Command(() => {
                LaminationModel modelo = new LaminationModel()
                {
                    Material1          = Material1,
                    Material2          = Material2,
                    Size1              = Size1,
                    Size2              = Size2,
                    Returned1          = Returned1,
                    Returned2          = Returned2,
                    Scrap              = Scrap,
                    FinishedLamination = FinishedLamination,
                    Finished           = Finished
                };

                using (var contexto = new DataContextLamination())
                {
                    contexto.Insertar(modelo);
                }
            }
                                  );
            Modificar = new Command(() => {
                LaminationModel modelo = new LaminationModel()
                {
                    Material1          = Material1,
                    Material2          = Material2,
                    Size1              = Size1,
                    Size2              = Size2,
                    Returned1          = Returned1,
                    Returned2          = Returned2,
                    Scrap              = Scrap,
                    FinishedLamination = FinishedLamination,
                    Finished           = Finished,
                    IdLamination       = IdLamination
                };

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

            Eliminar = new Command(() => {
                LaminationModel modelo = new LaminationModel()
                {
                    Material1          = Material1,
                    Material2          = Material2,
                    Size1              = Size1,
                    Size2              = Size2,
                    Returned1          = Returned1,
                    Returned2          = Returned2,
                    Scrap              = Scrap,
                    FinishedLamination = FinishedLamination,
                    Finished           = Finished,
                    IdLamination       = IdLamination
                };

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