Ejemplo n.º 1
0
        private void BtnContinuar_Click(object sender, EventArgs e)
        {
            using (Formulario_102AEntities db = new Formulario_102AEntities())
            {
                if (id == null)
                {
                    usuario = new Usuarios();
                }

                var list = from d in db.Usuarios
                           where d.Ruc_Usuario == TxtRuc.Text
                           select d;
                if (list.Count() > 0)
                {
                    this.Hide();
                    Form1 fr = new Form1(TxtRuc.Text, CmbPeriodo.Text, usuario.id_Usuario);
                    fr.FormClosed += (s, args) => this.Close();
                    fr.Show();
                }
                else
                {
                    MessageBox.Show("Ruc incorrecto");
                }
            }
        }
Ejemplo n.º 2
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");
            }
        }
 private void cargarDatos(int?id)
 {
     using (Formulario_102AEntities db = new Formulario_102AEntities())
     {
         if (id != null)
         {
             nRegistro = new formulario_102A();
         }
         var list = from d in db.formulario_102A
                    where d.id_Usuario == Convert.ToInt32(LblId_user.Text) && d.periodo == LblAño.Text
                    select d;
         if (list.Count() > 0)
         {
             LblAño.Text              = nRegistro.periodo;
             LblNoEmpleados.Text      = Convert.ToString(nRegistro.NoEmpleados);
             Lbl481.Text              = Convert.ToString(nRegistro.i481);
             Lbl491.Text              = Convert.ToString(nRegistro.g491);
             Lbl718.Text              = Convert.ToString(nRegistro.i718);
             Lbl729.Text              = Convert.ToString(nRegistro.i729);
             Lbl739.Text              = Convert.ToString(nRegistro.g739);
             Lbl741.Text              = Convert.ToString(nRegistro.i741);
             Lbl749.Text              = Convert.ToString(nRegistro.r749);
             Lbl751.Text              = Convert.ToString(nRegistro.g751);
             Lbl759.Text              = Convert.ToString(nRegistro.r759);
             Lbl768.Text              = Convert.ToString(nRegistro.p768);
             Lbl769.Text              = Convert.ToString(nRegistro.r769);
             Lbl771.Text              = Convert.ToString(nRegistro.p771);
             Lbl772.Text              = Convert.ToString(nRegistro.p772);
             Lbl773.Text              = Convert.ToString(nRegistro.p773);
             Lbl774.Text              = Convert.ToString(nRegistro.p774);
             Lbl775.Text              = Convert.ToString(nRegistro.p775);
             Lbl779.Text              = Convert.ToString(nRegistro.p779);
             Lbl780.Text              = Convert.ToString(nRegistro.p780);
             CmbTipoBeneficiario.Text = nRegistro.b740;
             Lbl832.Text              = Convert.ToString(nRegistro.c832);
             Lbl839.Text              = Convert.ToString(nRegistro.c839);
             Lbl840.Text              = Convert.ToString(nRegistro.c840);
             Lbl845.Text              = Convert.ToString(nRegistro.c845);
             Lbl846.Text              = Convert.ToString(nRegistro.c846);
             Lbl855.Text              = Convert.ToString(nRegistro.c855);
             Lbl856.Text              = Convert.ToString(nRegistro.c856);
             Lbl859.Text              = Convert.ToString(nRegistro.c859);
             Lbl869.Text              = Convert.ToString(nRegistro.c869);
         }
         else
         {
             MessageBox.Show("Actualizar formulario");
         }
     }
 }
Ejemplo n.º 5
0
 public void cargarDatos(int?id)
 {
     using (Formulario_102AEntities db = new Formulario_102AEntities())
     {
         nRegistro           = db.formulario_102A.Find(id);
         TxtNoEmpleados.Text = Convert.ToString(nRegistro.NoEmpleados);
         Txt481.Text         = Convert.ToString(nRegistro.i481);
         Txt491.Text         = Convert.ToString(nRegistro.g491);
         Txt718.Text         = Convert.ToString(nRegistro.i718);
         Txt729.Text         = Convert.ToString(nRegistro.i729);
         Txt739.Text         = Convert.ToString(nRegistro.g739);
         Txt741.Text         = Convert.ToString(nRegistro.i741);
         Txt749.Text         = Convert.ToString(nRegistro.r749);
         Txt751.Text         = Convert.ToString(nRegistro.g751);
         Txt759.Text         = Convert.ToString(nRegistro.r759);
         Txt769.Text         = Convert.ToString(nRegistro.r769);
     }
 }