Beispiel #1
0
        private void BtnAceptar1_Click(object sender, EventArgs e)
        {
            using (Formulario_102AEntities db = new Formulario_102AEntities())
            {
                if (id == null)
                {
                    nRegistro = new formulario_102A();
                }

                nRegistro.i481 = Convert.ToInt32(Txt481.Text);
                nRegistro.g491 = Convert.ToInt32(Txt491.Text);
                nRegistro.i718 = Convert.ToInt32(Txt718.Text);
                nRegistro.i729 = Convert.ToInt32(Txt729.Text);
                nRegistro.g739 = Convert.ToInt32(Txt739.Text);
                nRegistro.i741 = Convert.ToInt32(Txt741.Text);
                nRegistro.r749 = Convert.ToInt32(Txt749.Text);
                nRegistro.g751 = Convert.ToInt32(Txt751.Text);
                nRegistro.r759 = Convert.ToInt32(Txt759.Text);
                nRegistro.r769 = Convert.ToInt32(Txt769.Text);
                if (id == null)
                {
                    db.formulario_102A.Add(nRegistro);
                }

                //db.Entry(nRegistro).State = System.Data.Entity.EntityState.Modified;

                db.SaveChanges();
            }
        }
        private void BtnAceptar_Click(object sender, EventArgs e)
        {
            using (Formulario_102AEntities db = new Formulario_102AEntities())
            {
                if (id == null)
                {
                    nRegistro = new formulario_102A();
                }

                nRegistro.periodo     = LblAño.Text;
                nRegistro.NoEmpleados = Convert.ToInt32(LblNoEmpleados.Text);
                nRegistro.i481        = Convert.ToInt32(Lbl481.Text);
                nRegistro.g491        = Convert.ToInt32(Lbl491.Text);
                nRegistro.i718        = Convert.ToInt32(Lbl718.Text);
                nRegistro.i729        = Convert.ToInt32(Lbl729.Text);
                nRegistro.g739        = Convert.ToInt32(Lbl739.Text);
                nRegistro.i741        = Convert.ToInt32(Lbl741.Text);
                nRegistro.r749        = Convert.ToInt32(Lbl749.Text);
                nRegistro.g751        = Convert.ToInt32(Lbl751.Text);
                nRegistro.r759        = Convert.ToInt32(Lbl759.Text);
                nRegistro.r769        = Convert.ToInt32(Lbl769.Text);

                nRegistro.p768 = Convert.ToInt32(Lbl768.Text);
                nRegistro.p771 = Convert.ToInt32(Lbl771.Text);
                nRegistro.p772 = Convert.ToInt32(Lbl772.Text);
                nRegistro.p773 = Convert.ToInt32(Lbl773.Text);
                nRegistro.p774 = Convert.ToInt32(Lbl774.Text);
                nRegistro.p775 = Convert.ToInt32(Lbl775.Text);
                nRegistro.p779 = Convert.ToInt32(Lbl779.Text);
                nRegistro.p780 = Convert.ToInt32(Lbl780.Text);
                nRegistro.b740 = CmbTipoBeneficiario.Text;

                nRegistro.c832 = Convert.ToInt32(Lbl481.Text);
                nRegistro.c839 = Convert.ToDouble(Lbl839.Text);
                nRegistro.c840 = Convert.ToInt32(Lbl840.Text);
                nRegistro.c845 = Convert.ToInt32(Lbl845.Text);
                nRegistro.c846 = Convert.ToInt32(Lbl846.Text);
                nRegistro.c855 = Convert.ToDouble(Lbl855.Text);
                nRegistro.c856 = Convert.ToDouble(Lbl856.Text);
                nRegistro.c859 = Convert.ToDouble(Lbl859.Text);
                nRegistro.c869 = Convert.ToDouble(Lbl869.Text);

                if (id == null)
                {
                    db.formulario_102A.Add(nRegistro);
                }

                //db.Entry(nRegistro).State = System.Data.Entity.EntityState.Modified;

                db.SaveChanges();
                MessageBox.Show("Su formulario se registro exitosamente");
            }
        }