private void Producto_BT_Click(object sender, EventArgs e) { PlanAnualSelectForm form = new PlanAnualSelectForm(this); if (form.ShowDialog() == DialogResult.OK) { _plan = form.Selected as PlanAnualInfo; Plan_TB.Text = _plan.Nombre; } }
private void PlanAnual_CB_SelectedIndexChanged(object sender, EventArgs e) { if (this is AuditoriaEditForm) { return; } if (PlanAnual_CB.SelectedItem != null && ((ComboBoxSource)PlanAnual_CB.SelectedItem).Oid != 0) { PlanAnualInfo plan = _planes.GetItem(((ComboBoxSource)PlanAnual_CB.SelectedItem).Oid); if (plan != null) { //Hay que buscar todas las auditorías asociadas al plan anual seleccionado long oid_tipo_siguiente = AuditoriaList.GetSiguienteTipoAuditoria(((ComboBoxSource)PlanAnual_CB.SelectedItem).Oid); foreach (Plan_TipoInfo info in plan.PlanesTipos) { if (info.Orden == oid_tipo_siguiente + 1) { TipoAuditoriaInfo tipo = _tipos_auditorias.GetItem(info.OidTipo); _entity.OidPlan = info.OidPlan; _entity.OidTipoAuditoria = info.OidTipo; _entity.OidPlanTipo = info.Oid; _entity.TipoAuditoria = tipo.Numero + " " + tipo.Nombre; TipoAuditoria_TB.Text = _entity.TipoAuditoria; break; } } } _tipo_auditoria = _tipos_auditorias.GetItem(_entity.OidTipoAuditoria); if (_tipo_auditoria != null) { CuestionesAuditoria cuestiones = CuestionesAuditoria.NewChildList(); foreach (CuestionInfo info in _tipo_auditoria.Cuestiones) { CuestionAuditoria cuestion = CuestionAuditoria.NewChild(_entity); cuestion.Numero = info.Numero; cuestion.OidCuestion = info.Oid; cuestion.OidAuditoria = Entity.Oid; cuestiones.AddItem(cuestion); } _entity.Cuestiones = cuestiones; Datos_Cuestiones.DataSource = _entity.Cuestiones; } } }
///// <summary> ///// Abre el formulario para borrar item ///// <returns>void</returns> ///// </summary> public override void DeleteObject(long oid) { if (MessageBox.Show(moleQule.Face.Resources.Messages.DELETE_CONFIRM, moleQule.Face.Resources.Labels.ADVISE_TITLE, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes) { try { PlanAnualInfo instructor = PlanAnualInfo.Get(oid, true); //if (instructor != null // && instructor.Sesiones.Count == 0 // && instructor.Examenes.Count == 0) PlanAnual.Delete(oid); //else // MessageBox.Show("No es posible eliminar al instructor seleccionado.\n" // + "Es posible que tenga sesiones asociados en algún horario o exámenes creados por este instructor.\n" // + "Debe modificarlas antes de continuar."); //Se eliminan todos los formularios de ese objeto foreach (EntityDriverForm form in _list_active_form) { if (form is ItemMngBaseForm) { if (((ItemMngBaseForm)form).Oid == oid) { form.Dispose(); break; } } } } catch (DataPortalException ex) { MessageBox.Show(iQExceptionHandler.GetiQException(ex).Message); } finally { RefreshList(); } } }
/// <summary> /// Abre el formulario para borrar item /// <returns>void</returns> /// </summary> public override void DeleteObject(long oid) { if (MessageBox.Show(moleQule.Face.Resources.Messages.DELETE_CONFIRM, moleQule.Face.Resources.Labels.ADVISE_TITLE, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes) { try { PlanAnualInfo plan = PlanAnualInfo.Get(oid, true); if (plan != null && plan.PlanesTipos.Count > 0) { MessageBox.Show(Resources.Messages.PLAN_ANUAL_CON_TIPOS_ASOCIADOS); _action_result = DialogResult.Ignore; return; } PlanAnual.Delete(oid); _action_result = DialogResult.OK; //Se eliminan todos los formularios de ese objeto foreach (ItemMngBaseForm form in _list_active_form) { if (form.Oid == oid) { form.Dispose(); break; } } } catch (Csla.DataPortalException ex) { MessageBox.Show(iQExceptionHandler.GetiQException(ex).Message); } finally { RefreshList(); } } }
protected override void GetFormSourceData(long oid) { _entity = PlanAnualInfo.Get(oid, true); _mf_type = ManagerFormType.MFView; }