コード例 #1
0
 private void Refrescar()
 {
     using (Sistema_CalificacionEntities2 db = new Sistema_CalificacionEntities2())
     {
         var lst = from d in db.EMPLEADOS
                   select d;
         dataGridView1.DataSource = lst.ToList();
     }
 }
コード例 #2
0
 private void cargaDatos(int?id)
 {
     using (Sistema_CalificacionEntities2 db = new Sistema_CalificacionEntities2())
     {
         nEmpleados              = db.EMPLEADOS.Find(id);
         textBoxNombreEmp.Text   = nEmpleados.NOMBRE_EMPL;
         textBoxApellidoEmp.Text = nEmpleados.APELLIDO_EMPL;
         textBoxCedEmp.Text      = nEmpleados.CEDULA_ALUMN;
         textBoxPassEmp.Text     = nEmpleados.PASS_ALUMN;
         textBoxDirEmp.Text      = nEmpleados.DIRECCION_EMPL;
         textBoxTelfEmp.Text     = nEmpleados.TELEFONO_EMPL;
         textBoxTituloEmp.Text   = nEmpleados.TITULO_EMPL;
     }
 }
コード例 #3
0
        private void buttonEliminar_Click(object sender, EventArgs e)
        {
            int?id = GetId();

            if (id != null)
            {
                using (Sistema_CalificacionEntities2 db = new Sistema_CalificacionEntities2())
                {
                    EMPLEADOS nEmpleados = db.EMPLEADOS.Find(id);
                    db.EMPLEADOS.Remove(nEmpleados);

                    db.SaveChanges();
                }

                Refrescar();
            }
        }
コード例 #4
0
        private void buttonGuardar_Click(object sender, EventArgs e)
        {
            using (Sistema_CalificacionEntities2 db = new Sistema_CalificacionEntities2())
            {
                if (id == null)
                {
                    nEmpleados = new EMPLEADOS();
                }
                else
                {
                    nEmpleados.NOMBRE_EMPL    = textBoxNombreEmp.Text;
                    nEmpleados.APELLIDO_EMPL  = textBoxApellidoEmp.Text;
                    nEmpleados.CEDULA_ALUMN   = textBoxCedEmp.Text;
                    nEmpleados.PASS_ALUMN     = textBoxPassEmp.Text;
                    nEmpleados.DIRECCION_EMPL = textBoxDirEmp.Text;
                    nEmpleados.TELEFONO_EMPL  = textBoxTelfEmp.Text;
                    nEmpleados.TITULO_EMPL    = textBoxTituloEmp.Text;
                }

                System.Console.WriteLine(id);
                if (id == null)
                {
                    db.EMPLEADOS.Add(nEmpleados);
                }
                else
                {
                    db.Entry(nEmpleados).State = System.Data.Entity.EntityState.Modified;
                }

                db.SaveChanges();


                groupBoxDatosEmp.Hide();
                Refrescar();
                splitContainer1.Panel2.Show();

                textBoxNombreEmp.Clear();
                textBoxApellidoEmp.Clear();
                textBoxCedEmp.Clear();
                textBoxPassEmp.Clear();
                textBoxDirEmp.Clear();
                textBoxTelfEmp.Clear();
                textBoxTituloEmp.Clear();
            }
        }
コード例 #5
0
        private void buttonGuardar_Click(object sender, EventArgs e)
        {
            using (Sistema_CalificacionEntities2 db = new Sistema_CalificacionEntities2())
            {
                EMPLEADOS nEmpleados = new EMPLEADOS();
                nEmpleados.NOMBRE_EMPL    = textBoxNombreEmp.Text;
                nEmpleados.APELLIDO_EMPL  = textBoxApellidoEmp.Text;
                nEmpleados.CEDULA_ALUMN   = textBoxCedEmp.Text;
                nEmpleados.PASS_ALUMN     = textBoxPassEmp.Text;
                nEmpleados.DIRECCION_EMPL = textBoxDirEmp.Text;
                nEmpleados.TELEFONO_EMPL  = textBoxTelfEmp.Text;
                nEmpleados.TITULO_EMPL    = textBoxTituloEmp.Text;

                db.EMPLEADOS.Add(nEmpleados);
                db.SaveChanges();

                this.Close();
            }
        }
コード例 #6
0
        private void buttonActualizar_Click(object sender, EventArgs e)
        {
            using (Sistema_CalificacionEntities2 db = new Sistema_CalificacionEntities2())
            {
                nEmpleados.NOMBRE_EMPL    = textBoxNombreEmp.Text;
                nEmpleados.APELLIDO_EMPL  = textBoxApellidoEmp.Text;
                nEmpleados.CEDULA_ALUMN   = textBoxCedEmp.Text;
                nEmpleados.PASS_ALUMN     = textBoxPassEmp.Text;
                nEmpleados.DIRECCION_EMPL = textBoxDirEmp.Text;
                nEmpleados.TELEFONO_EMPL  = textBoxTelfEmp.Text;
                nEmpleados.TITULO_EMPL    = textBoxTituloEmp.Text;

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

                db.SaveChanges();

                groupBoxDatosEmp.Hide();
                Refrescar();
                splitContainer1.Panel2.Show();
            }
        }