コード例 #1
0
 public CursoDesktop(int ID, ModoForm modo) : this()
 {
     Modo        = modo;
     CursoActual = new CursoLogic().GetOne(ID);
     MapearDeDatos();
 }
コード例 #2
0
        private void tsbEliminar_Click(object sender, EventArgs e)
        {
            DialogResult confirm = MessageBox.Show("¿Está seguro de que desea eliminar los elementos seleccionados?", "Eliminar", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);

            if (confirm == DialogResult.Yes)
            {
                try {
                    if (tabControl.SelectedTab == tabUsuarios)
                    {
                        List <Usuario> array = new List <Usuario>();
                        foreach (DataGridViewRow row in dgvUsuarios.SelectedRows)
                        {
                            Usuario entity = (Usuario)row.DataBoundItem;
                            entity.State = BusinessEntity.States.Deleted;
                            usuarios.Save(entity);
                        }
                    }
                    else if (tabControl.SelectedTab == tabPersonas)
                    {
                        List <Persona> array = new List <Persona>();
                        foreach (DataGridViewRow row in dgvPersonas.SelectedRows)
                        {
                            Persona entity = (Persona)row.DataBoundItem;
                            entity.State = BusinessEntity.States.Deleted;
                            personas.Save(entity);
                        }
                    }
                    else if (tabControl.SelectedTab == tabEspecialidades)
                    {
                        List <Especialidad> array = new List <Especialidad>();
                        foreach (DataGridViewRow row in dgvEspecialidades.SelectedRows)
                        {
                            Especialidad entity = (Especialidad)row.DataBoundItem;
                            entity.State = BusinessEntity.States.Deleted;
                            especialidades.Save(entity);
                        }
                    }
                    else if (tabControl.SelectedTab == tabEspecialidades)
                    {
                        List <Especialidad> array = new List <Especialidad>();
                        foreach (DataGridViewRow row in dgvEspecialidades.SelectedRows)
                        {
                            Especialidad entity = (Especialidad)row.DataBoundItem;
                            entity.State = BusinessEntity.States.Deleted;
                            especialidades.Save(entity);
                        }
                    }
                    else if (tabControl.SelectedTab == tabPlanes)
                    {
                        List <Plan> array = new List <Plan>();
                        foreach (DataGridViewRow row in dgvPlanes.SelectedRows)
                        {
                            Plan entity = (Plan)row.DataBoundItem;
                            entity.State = BusinessEntity.States.Deleted;
                            planes.Save(entity);
                        }
                    }

                    else if (tabControl.SelectedTab == tabMaterias)
                    {
                        List <Materia> array = new List <Materia>();
                        foreach (DataGridViewRow row in dgvMaterias.SelectedRows)
                        {
                            Materia entity = (Materia)row.DataBoundItem;
                            entity.State = BusinessEntity.States.Deleted;
                            materias.Save(entity);
                        }
                    }
                    else if (tabControl.SelectedTab == tabComisiones)
                    {
                        List <Comision> array = new List <Comision>();
                        foreach (DataGridViewRow row in dgvComisiones.SelectedRows)
                        {
                            Comision entity = (Comision)row.DataBoundItem;
                            entity.State = BusinessEntity.States.Deleted;
                            comisiones.Save(entity);
                        }
                    }
                    else if (tabControl.SelectedTab == tabCursos)
                    {
                        List <Curso> array = new List <Curso>();
                        foreach (DataGridViewRow row in dgvCursos.SelectedRows)
                        {
                            Curso entity = (Curso)row.DataBoundItem;
                            entity.State = BusinessEntity.States.Deleted;
                            cursos.Save(entity);
                        }
                    }
                    // COMPLETAR
                }
                catch (System.Data.Entity.Infrastructure.DbUpdateException ex)
                {
                    switch (ex.InnerException)
                    {
                    case System.Data.Entity.Core.UpdateException ue:
                        MessageBox.Show("No se ha podido eliminar un elemento ya que está referenciado por otro elemento", "Error al eliminar", MessageBoxButtons.OK, MessageBoxIcon.Warning);;
                        break;
                    }
                }
                // COMPLETAR
                finally
                {
                    Listar();
                }
            }
        }
コード例 #3
0
 public ListadoAlumnos(Curso curso, Usuario persona)
 {
     logeado = persona;
     InitializeComponent();
     cursoActual = curso;
 }
コード例 #4
0
 public ListadoAlumnos(Curso curso)
 {
     InitializeComponent();
     cursoActual = curso;
 }
コード例 #5
0
ファイル: Menu.cs プロジェクト: Net2018-UTN/TP2NET
        private void btnCursos_Click(object sender, EventArgs e)
        {
            Curso curso = new Curso();

            curso.ShowDialog();
        }
コード例 #6
0
ファイル: Menu.cs プロジェクト: Net2018-UTN/TP2NET
        private void cursosToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Curso curso = new Curso();

            curso.ShowDialog();
        }