private void m_btnSelect_Click(object sender, System.EventArgs e) { if (m_typeRelation.Multiple) { SelectionMultiples(); RefreshText(); } else { Type typeForm = CFormFinder.GetTypeFormToList(m_typeRelation.TypeElements); if (typeForm == null || !typeForm.IsSubclassOf(typeof(CFormListeStandard))) { CFormAlerte.Afficher(I.T("The system cannot list elements from type @1|30119", m_typeRelation.TypeElementsConvivial), EFormAlerteType.Exclamation); return; } CObjetDonneeAIdNumerique objetSel; CFormListeStandard form = (CFormListeStandard)Activator.CreateInstance(typeForm, new object[] {}); form.FiltreDeBase = m_typeRelation.FiltreDataAssocie; objetSel = (CObjetDonneeAIdNumerique)CFormNavigateurPopupListe.SelectObject(form, null, CFormNavigateurPopupListe.CalculeContexteUtilisation(this)); if (objetSel != null) { if (ListeRelations.Count > 1) { DeleteAll(); } m_elementALien.AddElementLie(objetSel, m_typeRelation.Code); RefreshText(); } } }
private void AfficheListe( ) { Type typeForm = CFormFinder.GetTypeFormToList(m_parametreVisu.TypeElements); if (typeForm == null || !typeForm.IsSubclassOf(typeof(CFormListeStandard))) { m_resultEdit.EmpileErreur(I.T("The system can not list elements of type @1|1082", m_parametreVisu.TypeElements.ToString())); return; } try { CFormListeStandard form = (CFormListeStandard)Activator.CreateInstance(typeForm, new object[] {}); form.FiltreDeBase = m_parametreVisu.Filtre; if (m_parametreVisu.TitreFenetre != "") { form.TitreForce = m_parametreVisu.TitreFenetre; } form.ContexteUtilisation = m_parametreVisu.ContexteFenetre; CFormNavigateurPopup.Show(form, CTimosApp.Navigateur); } catch (Exception e) { m_resultEdit.EmpileErreur(new CErreurException(e)); } }
//------------------------------------------------ private void itemAdd_Click(object sender, EventArgs e) { ToolStripMenuItem item = sender as ToolStripMenuItem; Type tp = item != null ? item.Tag as Type : null; if (tp != null) { CReferenceTypeForm refFrm = CFormFinder.GetTypeFormToList(tp); if (refFrm != null) { CFormListeStandard frm = refFrm.GetForm() as CFormListeStandard; if (frm != null) { IAffectableAEtape affectable = CFormNavigateurPopupListe.SelectObject(frm, null, "") as IAffectableAEtape; if (affectable != null) { AddAffectable(affectable); } } } } }
/// ////////////////////////////////////////////////////////////////// protected static CResultAErreur ExecuteActionListe(CActionSur2iLinkAfficherListe action, object objetCible) { CResultAErreur result = CResultAErreur.True; CFiltreDynamique filtre = action.Filtre; if (filtre == null || filtre.TypeElements == null) { result.EmpileErreur(I.T("Link parameter error : filter is null|30077")); return(result); } if (objetCible != null) { CObjetPourSousProprietes objetPourSousProp = null; objetPourSousProp = new CObjetPourSousProprietes(objetCible); IVariableDynamique variable = CActionSur2iLinkAfficherListe.AssureVariableElementCible(filtre, objetPourSousProp); /*if ( variable.TypeDonnee.TypeDotNetNatif != objetCible.GetType() ) * { * result.EmpileErreur(I.T("Expected type in the filter does not correspond to object type|30078")); * return result; * }*/ if (variable != null) { filtre.SetValeurChamp(variable.IdVariable, objetCible); } } result = filtre.GetFiltreData(); if (!result) { result.EmpileErreur(I.T("Filter error|30079")); return(result); } CFiltreData filtreData = (CFiltreData)result.Data; Type tp = CFormFinder.GetTypeFormToList(filtre.TypeElements); try { if (tp != null || tp.IsSubclassOf(typeof(CFormListeStandard))) { CFormListeStandard form = ( CFormListeStandard )Activator.CreateInstance(tp, new object[0]); CContexteEvaluationExpression ctxEval = new CContexteEvaluationExpression(objetCible); ctxEval.AttacheObjet(typeof(CContexteDonnee), CSc2iWin32DataClient.ContexteCourant); if (action.FormuleContexte != null) { result = action.FormuleContexte.Eval(ctxEval); if (!result) { result.EmpileErreur(I.T("Form context evaluation error|30080")); return(result); } if (result.Data != null) { form.ContexteUtilisation = result.Data.ToString(); } } if (action.FormuleTitre != null) { result = action.FormuleTitre.Eval(ctxEval); if (!result) { result.EmpileErreur(I.T("Form title evaluation error|30081")); return(result); } if (result.Data != null) { form.TitreForce = result.Data.ToString(); } } form.FiltreDeBase = filtreData; form.AffectationsPourNouveauxElements = action.Affectations; form.ObjetReferencePourAffectationsInitiales = objetCible; form.BoutonAjouterVisible = action.ShowBoutonAjouter; form.BoutonModifierVisible = action.ShowBoutonDetail; form.BoutonSupprimerVisible = action.ShowBoutonSupprimer; if (action.IdFiltreDynamiqueAUtiliser >= 0) { CFiltreDynamiqueInDb filtretoUse = new CFiltreDynamiqueInDb(CContexteDonneeSysteme.GetInstance()); if (filtretoUse.ReadIfExists(action.IdFiltreDynamiqueAUtiliser)) { CFiltreDynamique filtreDyn = filtretoUse.Filtre; if (filtreDyn != null) { CContexteEvaluationExpression ctx = new CContexteEvaluationExpression(objetCible); foreach (CFormuleNommee formule in action.ValeursVariablesFiltre) { if (formule.Formule != null) { CResultAErreur res = formule.Formule.Eval(ctx); if (res) { try { string strId = formule.Id; filtreDyn.SetValeurChamp(strId, res.Data); } catch { } } } } form.FiltrePrefere = filtreDyn; } } } if (action.ActionSurDetail != null) { CExecuteurActionSurPanelListeSpeedStandard executeur = new CExecuteurActionSurPanelListeSpeedStandard(action.ActionSurDetail, form); form.SetModifierElementDelegate(new CPanelListeSpeedStandard.ModifierElementDelegate(executeur.ExecuteAction)); } CTimosApp.Navigateur.AffichePage(form); } else { result.EmpileErreur(I.T("Not avaliable|30082")); } } catch (Exception e) { result.EmpileErreur(new CErreurException(e)); } return(result); }