Пример #1
0
 private void ChangerElement()
 {
     //Sélection du type
     CInfoClasseDynamique[] lesTypes = DynamicClassAttribute.GetAllDynamicClassHeritant(typeof(IElementAIntervention), typeof(CObjetDonneeAIdNumerique));
     if (lesTypes.Length != 0)
     {
         Type tp = lesTypes[0].Classe;
         if (lesTypes.Length > 1)
         {
             Point pt = m_lnkElementAIntervention.Location;
             pt.Offset(0, m_lnkElementAIntervention.Height);
             pt = PointToScreen(pt);
             List <CInfoClasseDynamique> lstTypes = new List <CInfoClasseDynamique>(lesTypes);
             tp = CFormSelectType.SelectType(pt, lstTypes, "Intervention sur ");
         }
         if (tp != null)
         {
             Type tpForm = CFormFinder.GetTypeFormToList(tp);
             if (tpForm != null && typeof(sc2i.win32.data.navigation.CFormListeStandard).IsAssignableFrom(tpForm))
             {
                 IFormNavigable form = (IFormNavigable)Activator.CreateInstance(tpForm, new object[0]);
                 CObjetDonnee   obj  = CFormNavigateurPopupListe.SelectObject((CFormListeStandard)form, null, "TASK_ELT");
                 if (obj != null)
                 {
                     Intervention.ElementAIntervention = (CObjetDonneeAIdNumerique)obj;
                     UpdateLibelleElement((IElementAIntervention)obj);
                 }
             }
             else
             {
                 CFormAlerte.Afficher("Le système ne sait pas Editer les éléments de type " + DynamicClassAttribute.GetNomConvivial(tp), EFormAlerteType.Erreur);
             }
         }
     }
 }
Пример #2
0
 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();
         }
     }
 }
Пример #3
0
        //-------------------------------------------------------
        public CChampCustom SelectChamp(CChampCustom lastSelectionne)
        {
            CFormListeChampsCustom form = new CFormListeChampsCustom(m_strCodeRole);

            return((CChampCustom)CFormNavigateurPopupListe.SelectObject(
                       form,
                       lastSelectionne,
                       CFormNavigateurPopupListe.CalculeContexteUtilisation(form)));
        }
Пример #4
0
        //------------------------------------------------
        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);
                        }
                    }
                }
            }
        }
Пример #5
0
 private void m_lnkModeleStructure_LinkClicked(object sender, System.EventArgs e)
 {
     CFormNavigateurPopupListe.Show(new CFormListeStructuresDonnees());
     InitComboBoxStructure(true);
 }
Пример #6
0
 //-------------------------------------------------------------------------
 private void m_linkCategorie_LinkClicked(object sender, System.EventArgs e)
 {
     CFormNavigateurPopupListe.Show(new CFormListeCategoriesRapportCrystal());
     InitComboBoxCategorie(true);
 }
 private void m_lnkFormulaire_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
 {
     CFormNavigateurPopupListe.Show((CFormListeStandard)Activator.CreateInstance(m_typeFormGererFormulaires, new object[] { CodeRole }));
     InitPanel(m_definisseur, m_typeFormGererChamps, m_typeFormGererFormulaires);
 }
Пример #8
0
        /// ////////////////////////////////////////////////////////////////
        private void CControlEdition_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            Point             ptSouris     = GetLogicalPointFromDisplay(new Point(e.X, e.Y));
            I2iObjetGraphique wndNouvelEle = null;

            switch (ModeEdition)
            {
            case EModeEditeurProjet.Selection:
                break;


            case EModeEditeurProjet.Projet:

                if (BeforeAddElement != null && !BeforeAddElement())
                {
                    break;
                }

                CProjet nouveauProjet;
                if (m_bModeCreation)
                {
                    nouveauProjet = new CProjet(WndProjetEdite.Projet.ContexteDonnee);
                    nouveauProjet.CreateNew();
                }
                else
                {
                    CFiltreData filtre = new CFiltreDataAvance(CProjet.c_nomTable, "HasNo(" + CProjet.c_champIdParent + ") AND " + CProjet.c_champCodeSystemeComplet + " not like @1", ProjetEnCreation.CodeSystemePartiel + "%");

                    //string strIdsPrjsToIgnore = ProjetEnCreation.Id.ToString();
                    //foreach (CProjet prjFils in ProjetEnCreation.ProjetsFils)
                    //    strIdsPrjsToIgnore += "," + prjFils.Id.ToString();
                    //filtre = CFiltreData.GetAndFiltre(filtre, new CFiltreDataAvance(CProjet.c_nomTable, CProjet.c_champId + " not in (" + strIdsPrjsToIgnore +")"));
                    CListeObjetsDonnees lstPrjs    = new CListeObjetsDonnees(ProjetEnCreation.ContexteDonnee, typeof(CProjet), filtre);
                    CFormListeProjet    frmProjets = new CFormListeProjet(lstPrjs);
                    nouveauProjet = (CProjet)CFormNavigateurPopupListe.SelectObject(frmProjets, null, "");

                    if (nouveauProjet == null)
                    {
                        return;
                    }
                }

                nouveauProjet.Projet = ProjetEnCreation;

                nouveauProjet.DesignerProjetX = e.X;
                nouveauProjet.DesignerProjetY = e.Y;

                wndNouvelEle = new CWndProjetBrique(nouveauProjet);
                break;


            case EModeEditeurProjet.Intervention:
                if (BeforeAddElement != null && !BeforeAddElement())
                {
                    break;
                }

                CIntervention nouvelleInter;

                if (m_bModeCreation)
                {
                    nouvelleInter = new CIntervention(WndProjetEdite.Projet.ContexteDonnee);
                    nouvelleInter.CreateNew();
                }
                else
                {
                    CFiltreData             filtre    = new CFiltreDataAvance(CIntervention.c_nomTable, "HasNo(" + CProjet.c_champId + ")");
                    CListeObjetsDonnees     lstInter  = new CListeObjetsDonnees(ProjetEnCreation.ContexteDonnee, typeof(CIntervention), filtre);
                    CFormListeInterventions frmInters = new CFormListeInterventions(lstInter);
                    nouvelleInter = (CIntervention)CFormNavigateurPopupListe.SelectObject(frmInters, null, "");
                    if (nouvelleInter == null)
                    {
                        return;
                    }
                }

                nouvelleInter.DesignerProjetX = e.X;
                nouvelleInter.DesignerProjetY = e.Y;
                nouvelleInter.Projet          = WndProjetEdite.Projet;
                wndNouvelEle = new CWndIntervention(nouvelleInter);
                break;

            case EModeEditeurProjet.LienStart:
                I2iObjetGraphique o = WndProjetEdite.GetObjetFilsFromPoint(ptSouris);
                if (o != null && o is IWndElementDeProjetPlanifiable)
                {
                    m_eleDebutLien = (IWndElementDeProjetPlanifiable)o;
                    ModeEdition    = EModeEditeurProjet.LienEnd;
                }

                break;

            case EModeEditeurProjet.LienEnd:
                ModeEdition = EModeEditeurProjet.LienStart;
                I2iObjetGraphique ele = WndProjetEdite.GetObjetFilsFromPoint(ptSouris);
                bool bCreer           = true;
                if (ele != null && ele != m_eleDebutLien && ele is IWndElementDeProjetPlanifiable)
                {
                    foreach (I2iObjetGraphique objet in ObjetEdite.Childs)
                    {
                        if (objet is CWndLienDeProjet)
                        {
                            CWndLienDeProjet wndLien = (CWndLienDeProjet)objet;
                            if (wndLien.ElementArrivee == m_eleDebutLien &&
                                wndLien.ElementDepart == ele ||
                                wndLien.ElementArrivee == ele &&
                                wndLien.ElementDepart == m_eleDebutLien)
                            {
                                bCreer = false;
                                break;
                            }
                        }
                    }

                    if (bCreer && BeforeAddElement != null && !BeforeAddElement())
                    {
                        break;
                    }

                    if (bCreer)
                    {
                        CLienDeProjet lien = new CLienDeProjet(WndProjetEdite.Projet.ContexteDonnee);
                        lien.CreateNewInCurrentContexte();
                        lien.ElementA = m_eleDebutLien.ElementDuProjet;
                        lien.ElementB = ((IWndElementDeProjetPlanifiable)ele).ElementDuProjet;
                        lien.Projet   = WndProjetEdite.Projet;

                        CWndLienDeProjet wndLien = new CWndLienDeProjet(lien);
                        wndLien.ElementDepart  = (IWndElementDeProjetPlanifiable)m_eleDebutLien;
                        wndLien.ElementArrivee = (IWndElementDeProjetPlanifiable)ele;
                        wndNouvelEle           = wndLien;
                        ModeEdition            = EModeEditeurProjet.LienStart;
                    }
                }
                break;
            }
            if (wndNouvelEle != null)
            {
                Point pt = new Point(ptSouris.X - wndNouvelEle.Size.Width / 2, ptSouris.Y - wndNouvelEle.Size.Height / 2);
                wndNouvelEle.Position = pt;
                WndProjetEdite.AddChild(wndNouvelEle);

                Selection.Clear();
                Selection.Add(wndNouvelEle);
                //Refresh();

                if (AfterAddElement != null)
                {
                    AfterAddElement(wndNouvelEle);
                }
            }
        }