Ejemplo n.º 1
0
 public override void MapearDeDatos()
 {
     txtDescripcion.Text           = plan.Descripcion;
     cmbEspecialidad.SelectedValue = plan.IdEspecialidad;
     try
     {
         plan.ListaMaterias = ml.GetMateriasPorPlan(plan.Id);
         foreach (Materia m in plan.ListaMaterias)
         {
             foreach (DataGridViewRow row in dgvMaterias.Rows)
             {
                 DataGridViewCheckBoxCell chk = (DataGridViewCheckBoxCell)row.Cells["Selected"];
                 if (m.Descripcion == row.Cells["desc_materia"].Value.ToString())
                 {
                     chk.TrueValue = true;
                 }
             }
         }
     }
     catch (NotFoundException ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     catch (CustomException ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Ejemplo n.º 2
0
    protected void aceptarLinkButton_Click(object sender, EventArgs e)
    {
        switch (this.FormMode)
        {
        case TiposDatos.FormModes.Alta:
            this.Entity                = new Plan();
            this.Entity.Descripcion    = txtDescripcion.Text;
            this.Entity.IdEspecialidad = Convert.ToInt32(cbEspecialidades.SelectedValue);
            this.Entity.State          = TiposDatos.States.New;
            this.Entity.ListaMaterias  = getListaMateriasSeleccionadas();
            this.SaveEntity(Entity);
            break;

        case TiposDatos.FormModes.Modificacion:
            this.Entity                = planLogic.GetOne(SelectedID);
            this.Entity.State          = TiposDatos.States.Modified;
            this.Entity.Descripcion    = txtDescripcion.Text;
            this.Entity.IdEspecialidad = Convert.ToInt32(cbEspecialidades.SelectedValue);
            this.Entity.ListaMaterias  = getListaMateriasSeleccionadas();
            this.SaveEntity(Entity);
            break;

        case TiposDatos.FormModes.Baja:
            this.Entity               = new Plan();
            this.Entity.Id            = this.SelectedID;
            this.Entity.State         = TiposDatos.States.Deleted;
            this.Entity.ListaMaterias = materiaLogic.GetMateriasPorPlan(Entity.Id);
            this.SaveEntity(Entity);
            break;

        default:
            break;
        }

        this.ABMPanel.Visible         = false;
        this.gridActionsPanel.Visible = true;
        this.dgvPlanes.DataBind();
        this.ClearForm();
    }