예제 #1
0
        //-------------------------------------------------------
        private void m_menuWalk_Click(object sender, EventArgs e)
        {
            IDefinition definition = GetCurrent();

            if (definition != null)
            {
                if (m_connexion == null)
                {
                    if (!SetupConnexion())
                    {
                        return;
                    }
                }
                CResultAErreurType <IList <Variable> > result = m_connexion.Walk(definition.GetNumericalForm());
                if (!result)
                {
                    CFormAfficheErreur.Show(result.Erreur);
                }
                else
                {
                    CFormViewSNMPResult.ViewResult("Walk " + definition.Name,
                                                   result.DataType,
                                                   this,
                                                   definition.Tree);
                }
            }
        }
예제 #2
0
        private void m_btnOk_Click(object sender, EventArgs e)
        {
            CResultAErreur result = CResultAErreur.True;

            if (m_txtFormuleRootOnly.Formule == null || m_txtFormuleRootOnly.Formule.TypeDonnee.TypeDotNetNatif != typeof(bool))
            {
                result.EmpileErreur(I.T("Root elements only formula is incorrect|20055"));
            }
            if (m_txtFormuleIncludeParents.Formule == null || m_txtFormuleIncludeParents.Formule.TypeDonnee.TypeDotNetNatif != typeof(bool))
            {
                result.EmpileErreur(I.T("Include parent elements is incorrect|20056"));
            }
            if (m_txtFormuleIncludeChilds.Formule == null || m_txtFormuleIncludeChilds.Formule.TypeDonnee.TypeDotNetNatif != typeof(bool))
            {
                result.EmpileErreur(I.T("Include child elements is incorrect|20057"));
            }
            if (!result)
            {
                CFormAfficheErreur.Show(result.Erreur);
                return;
            }
            m_filtre.FormuleNeConserverQueLesRacines     = m_txtFormuleRootOnly.Formule;
            m_filtre.FormuleIntegrerParentsHierarchiques = m_txtFormuleIncludeParents.Formule;
            m_filtre.FormuleIntegrerFilsHierarchiques    = m_txtFormuleIncludeChilds.Formule;
            DialogResult = DialogResult.OK;
            Close();
        }
예제 #3
0
        void m_menuGrouperActions_Click(object sender, EventArgs e)
        {
            if (Selection.Count > 0)
            {
                CResultAErreur result = CResultAErreur.True;
                using (CWaitCursor waiter = new CWaitCursor())
                {
                    List <CAction> lst = new List <CAction>();
                    foreach (object obj in Selection)
                    {
                        CAction action = obj as CAction;
                        if (action != null && action.GetType() != typeof(CActionDebut) && action.GetType() != typeof(CActionPointEntree))
                        {
                            lst.Add(action);
                        }
                    }

                    result = CActionProcessFils.CreateForSelection(lst.ToArray());
                    if (result)
                    {
                        Selection.Clear();
                        if (result.Data is CAction)
                        {
                            Selection.Add(result.Data as CAction);
                        }

                        Refresh();
                    }
                }
                if (!result)
                {
                    CFormAfficheErreur.Show(result.Erreur);
                }
            }
        }
예제 #4
0
 void m_menuDegrouperActions_Click(object sender, EventArgs e)
 {
     if (Selection.Count == 1 && Selection[0] is CActionProcessFils)
     {
         CActionProcessFils action = Selection[0] as CActionProcessFils;
         CResultAErreur     result = action.Degrouper();
         if (!result)
         {
             CFormAfficheErreur.Show(result.Erreur);
         }
         else
         {
             Selection.Clear();
             if (result.Data is IEnumerable <CAction> )
             {
                 List <I2iObjetGraphique> lstTmp = new List <I2iObjetGraphique>();
                 foreach (CAction actionTmp in (IEnumerable <CAction>)result.Data)
                 {
                     lstTmp.Add(actionTmp);
                 }
                 Selection.AddRange(lstTmp);
                 Refresh();
             }
         }
     }
 }
예제 #5
0
        //----------------------------------
        public void GetSNMP()
        {
            IDefinition definition = GetCurrent();

            if (definition != null)
            {
                if (m_connexion == null)
                {
                    if (!SetupConnexion())
                    {
                        return;
                    }
                }
                List <uint> lstOID = new List <uint>(definition.GetNumericalForm());
                lstOID.Add(0);
                CResultAErreurType <Variable> result = m_connexion.Get(lstOID.ToArray());
                if (!result)
                {
                    CFormAfficheErreur.Show(result.Erreur);
                }
                else
                {
                    CFormViewSNMPResult.ViewResult("Get " + definition.Name,
                                                   result.DataType,
                                                   this,
                                                   definition.Tree);
                }
            }
        }
예제 #6
0
        private void m_lnkAdd_LinkClicked(object sender, EventArgs e)
        {
            CResultAErreur result = CResultAErreur.True;
            IAllocateurSupprimeurElements allocateur = m_elementEdite as IAllocateurSupprimeurElements;

            if (m_elementEdite != null)
            {
                if (m_zoneMultiple.SourceFormula != null)
                {
                    Type tp = m_zoneMultiple.SourceFormula.TypeDonnee.TypeDotNetNatif;
                    CAffectationsProprietes affectations = SelectAffectation();
                    if (tp != null && affectations != null)
                    {
                        object obj = null;
                        try
                        {
                            if (allocateur != null)
                            {
                                result = allocateur.AlloueElement(tp);
                                if (result)
                                {
                                    obj = result.Data;
                                }
                            }
                            else
                            {
                                obj = Activator.CreateInstance(tp);
                            }
                        }
                        catch (Exception ex)
                        {
                            result.EmpileErreur(new CErreurException(ex));
                        }
                        if (obj == null | !result)
                        {
                            result.EmpileErreur(I.T("Error while allocating element|20003"));
                            CFormAfficheErreur.Show(result.Erreur);
                            return;
                        }
                        result = affectations.AffecteProprietes(obj, m_elementEdite, m_fournisseurProprietes);
                        if (!result)
                        {
                            result.EmpileErreur(I.T("Some values cannot be assigned|20004"));
                            CFormAfficheErreur.Show(result.Erreur);
                        }
                        MajChamps(false);
                        if (!m_listeElementsAdd.Contains(obj))
                        {
                            m_listeElementsAdd.Add(obj);
                            m_lastAddedelement = obj;
                            CUtilControlesWnd.DeclencheEvenement(C2iWndZoneMultiple.c_strIdEvenementAddElement, this);
                        }
                        UpdateFromSource();
                    }
                }
            }
        }
예제 #7
0
 //-------------------------------------------------------------------------
 private void m_arbreCategories_DragDrop(object sender, DragEventArgs e)
 {
     if (DragDataHasDocGed(e.Data))
     {
         using (CContexteDonnee ctx = CSc2iWin32DataClient.ContexteCourant.GetContexteEdition())
         {
             bool bAddCategorie       = (e.KeyState & 8) == 8;
             TreeViewHitTestInfo info = m_arbreCategories.HitTest(m_arbreCategories.PointToClient(new Point(e.X, e.Y)));
             TreeNode            node = info.Node;
             if (info != null && info.Node != null && m_arbreCategories.GetObjetInNode(info.Node) is CCategorieGED)
             {
                 CCategorieGED categorie = m_arbreCategories.GetObjetInNode(info.Node) as CCategorieGED;
                 foreach (CReferenceObjetDonnee refDoc in (CReferenceObjetDonnee[])e.Data.GetData(typeof(CReferenceObjetDonnee[])))
                 {
                     CDocumentGED doc = refDoc.GetObjet(ctx) as CDocumentGED;
                     if (doc != null)
                     {
                         if (!bAddCategorie)//Supprime les anciennes catégories
                         {
                             CListeObjetsDonnees lst = doc.RelationsCategories;
                             CObjetDonneeAIdNumerique.Delete(lst, true);
                         }
                         bool bDedans = false;
                         foreach (CRelationDocumentGED_Categorie rel in doc.RelationsCategories)
                         {
                             if (rel.Categorie.Id == categorie.Id)
                             {
                                 bDedans = true;
                                 break;
                             }
                         }
                         if (!bDedans)
                         {
                             CRelationDocumentGED_Categorie newRel = new CRelationDocumentGED_Categorie(ctx);
                             newRel.CreateNewInCurrentContexte();
                             newRel.Categorie = categorie;
                             newRel.Document  = doc;
                         }
                     }
                 }
             }
             CResultAErreur result = ctx.CommitEdit();
             if (!result)
             {
                 CFormAfficheErreur.Show(result.Erreur);
             }
             else
             {
                 InitPanelList(m_elementSelectionne);
             }
         }
     }
     HightlightCategorie(null);
 }
        private void m_lnkDemarrer_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            CResultAErreur result = CResultAErreur.True;

            try
            {
                C2iStructureImport structure = m_panelStructure.GetStructureFinale();
                if (structure.Mappages.Select(m => m.IsCle).Count() == 0)
                {
                    if (MessageBox.Show(I.T("Warning, You didn't select any identification field. Continue ?|20052"),
                                        "",
                                        MessageBoxButtons.YesNo) == DialogResult.No)
                    {
                        return;
                    }
                }
                string strFichier = m_panelStructure.NomFichier;

                using (CContexteDonnee ctx = new CContexteDonnee(CSc2iWin32DataClient.ContexteCourant.IdSession, true, false))
                {
                    ctx.SetVersionDeTravail(CSc2iWin32DataClient.ContexteCourant.IdVersionDeTravail, false);
                    using (CWaitCursor waiter = new CWaitCursor())
                    {
                        result = structure.Importer(strFichier, ctx);
                    }
                    if (result)
                    {
                        DataTable table     = ctx.GetTableSafe(CContexteDonnee.GetNomTableForType(structure.TypeCible));
                        int       nNbUpdate = structure.NbUpdated;
                        int       nNbCreate = structure.NbCreated;
                        if (CFormAlerte.Afficher(I.T("This opération will create @1 and update @2 elements. Do you confirm this operation ?|20050",
                                                     nNbCreate.ToString(),
                                                     nNbUpdate.ToString()), EFormAlerteType.Question) == DialogResult.Yes)
                        {
                            result = ctx.SaveAll(true);
                            if (result)
                            {
                                CFormAlerte.Afficher(I.T("Import ended with success|20051"), EFormAlerteType.Info);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                result.EmpileErreur(new CErreurException(ex));
            }
            if (!result)
            {
                CFormAfficheErreur.Show(result.Erreur);
            }
        }
        //---------------------------------------------------------------
        private void m_btnSave_Click(object sender, EventArgs e)
        {
            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Filter = I.T("Graphical formula|*.grafexp|All files|*.*|20004");
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                CResultAErreur result = CSerializerObjetInFile.SaveToFile(RepresentationEditee, C2iExpressionGraphique.c_cleFichier, dlg.FileName);
                if (!result)
                {
                    CFormAfficheErreur.Show(result.Erreur);
                }
            }
        }
예제 #10
0
        //-------------------------------------------------------
        private void m_mnuVoirTable_Click(object sender, EventArgs e)
        {
            IDefinition definition = GetCurrent();

            if (definition != null)
            {
                if (m_connexion == null)
                {
                    if (!SetupConnexion())
                    {
                        return;
                    }
                }
                CResultAErreurType <DataTable> result = m_connexion.GetTable(definition.GetNumericalForm());
                if (!result)
                {
                    CFormAfficheErreur.Show(result.Erreur);
                }
                else
                {
                    DataTable   table = result.DataType;
                    IObjectTree tree  = definition.Tree;
                    if (tree != null)
                    {
                        foreach (DataColumn col in table.Columns)
                        {
                            try
                            {
                                uint[]      oid = ObjectIdentifier.Convert(col.ColumnName);
                                IDefinition def = tree.Find(oid);
                                if (def != null)
                                {
                                    col.ColumnName = def.Name;
                                }
                            }
                            catch
                            {
                            }
                        }
                    }

                    CFormVisuTable.ShowTable("Table " + definition.Name, result.DataType);
                }
            }
        }
        private void m_btnLoad_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter = I.T("Graphical formula|*.grafexp|All files|*.*|20004");
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                C2iExpressionGraphique rep    = new C2iExpressionGraphique();
                CResultAErreur         result = CSerializerObjetInFile.ReadFromFile(rep, C2iExpressionGraphique.c_cleFichier, dlg.FileName);
                if (!result)
                {
                    CFormAfficheErreur.Show(result.Erreur);
                }
                else
                {
                    this.Init(rep, m_fournisseurProprietes, m_objetAnalyse);
                }
            }
        }
예제 #12
0
        //--------------------------------------------------------------------------------
        private void AddDoc(string strNomFichier, IEnumerable <CCategorieGED> lstCats)
        {
            CDocumentGED doc = new CDocumentGED(m_contexteDonnee);

            doc.CreateNewInCurrentContexte();
            doc.Libelle = Path.GetFileName(strNomFichier);
            foreach (CObjetDonneeAIdNumerique objet in m_wndDocuments.GetListeAssociations(m_source))
            {
                doc.AssocieA(objet);
            }
            foreach (CCategorieGED categorie in lstCats)
            {
                doc.AddCategory(categorie);
            }

            C2iWndDocumentsGed.CInfoAffectationDocumentToGed info = new C2iWndDocumentsGed.CInfoAffectationDocumentToGed(strNomFichier, m_source);
            CContexteEvaluationExpression ctx = new CContexteEvaluationExpression(info);

            foreach (CAffectationsProprietes aff in m_wndDocuments.Affectations)
            {
                CResultAErreur result = CResultAErreur.True;
                result.Data = true;
                if (aff.FormuleCondition != null)
                {
                    result = aff.FormuleCondition.Eval(ctx);
                }
                if (result && result.Data is bool && (bool)result.Data)
                {
                    result = aff.AffecteProprietes(doc, info, m_fournisseurProprietes);
                    if (!result)
                    {
                        result.EmpileErreur(I.T("Some values cannot be assigned to EDM Document"));
                        CFormAfficheErreur.Show(result.Erreur);
                    }
                }
            }

            CNouveauDoc nouveauDoc = new CNouveauDoc(doc, strNomFichier);

            m_listeDocuments.Add(doc);
            m_listeNouveauxDocs.Add(nouveauDoc);
            UpdateVisuel();
        }
예제 #13
0
 //-----------------------------------------------------------------
 private void m_menuBrowse_Click(object sender, EventArgs e)
 {
     if (Selection.Count == 1)
     {
         IObjetDeEasyQuery obj    = Selection[0] as IObjetDeEasyQuery;
         CResultAErreur    result = CResultAErreur.True;
         ((CEasyQuery)ObjetEdite).ClearCache();
         if (obj != null)
         {
             result = obj.GetDatas(((CEasyQuery)ObjetEdite).ListeSources);
         }
         if (!result || !(result.Data is DataTable))
         {
             CFormAfficheErreur.Show(result.Erreur);
         }
         else
         {
             CFormVisuTable.ShowTable(result.Data as DataTable);
         }
     }
 }
예제 #14
0
 private void m_lnkDelete_LinkClicked(object sender, EventArgs e)
 {
     m_timerDelete.Enabled = true;
     if (m_delegueSuppression != null)
     {
         CResultAErreur result = m_delegueSuppression(m_elementEdite);
         if (!result)
         {
             result.EmpileErreur(I.T("Error while deleting element|20002"));
             CFormAfficheErreur.Show(result.Erreur);
         }
     }
     try
     {
         m_timerDelete.Enabled         = false;
         m_lnkDelete.Visible           = true;
         m_panelSousFormulaire.Visible = true;
     }
     catch
     {
     }
 }
예제 #15
0
        private void testToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ((C2iExpressionGraphique)ObjetEdite).RefreshFormuleFinale();
            C2iExpression formule = ((C2iExpressionGraphique)ObjetEdite).FormuleFinale;

            if (formule != null)
            {
                if (MessageBox.Show(formule.GetString() + "\nTest ?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    CContexteEvaluationExpression ctx    = new CContexteEvaluationExpression(m_objetAnalyse != null?m_objetAnalyse.ElementAVariableInstance:null);
                    sc2i.common.CResultAErreur    result = formule.Eval(ctx);
                    if (!result)
                    {
                        CFormAfficheErreur.Show(result.Erreur);
                    }
                    else
                    {
                        MessageBox.Show(result.Data == null ? "null" : result.Data.ToString());
                    }
                }
            }
        }
예제 #16
0
        //--------------------------------------------------------------------
        private void m_lnkEditerModificationsPrevisionnelles_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (m_gestionnaireModeEdition.ModeEdition)
            {
                Intervention.VersionDonneesAAppliquer = (CVersionDonnees)m_txtSelectVersionLiee.ElementSelectionne;
            }
            if (Intervention.VersionDonneesAAppliquer == null)
            {
                if (!m_gestionnaireModeEdition.ModeEdition)
                {
                    CFormAlerte.Afficher(I.T("No planified modification for that intervention|1359"), EFormAlerteType.Erreur);
                    return;
                }
                //Si nouvelle inter, il faut la valider
                if (CFormAlerte.Afficher(I.T("You have to save your intervention before associate it to planified modification. Would you like to save now ?|1356"),
                                         EFormAlerteType.Question) == DialogResult.No)
                {
                    return;
                }
                if (SaveRequired != null)
                {
                    CancelEventArgs args = new CancelEventArgs();
                    args.Cancel = false;
                    SaveRequired(this, args);
                    if (args.Cancel)
                    {
                        return;
                    }
                }
                else
                {
                    CFormAlerte.Afficher("Error", EFormAlerteType.Erreur);
                    return;
                }

                CResultAErreur result = CResultAErreur.True;

                //Création de la version
                CVersionDonnees version = CFormCreateVersionPourIntervention.GetVersionForInter(Intervention);
                if (version != null)
                {
                    if (version.IsNew())
                    {
                        result = version.CommitEdit();
                        if (!result)
                        {
                            CFormAlerte.Afficher(I.T("Error while creating data version|1357"), EFormAlerteType.Erreur);
                            return;
                        }
                    }

                    //Affectation de la version à l'intervention
                    CIntervention intervention = Intervention;
                    bool          bStartEdit   = intervention.ContexteDonnee.IsEnEdition;
                    if (!bStartEdit)
                    {
                        intervention.BeginEdit();
                    }
                    intervention.VersionDonneesAAppliquer = version;
                    if (!bStartEdit)
                    {
                        result = intervention.CommitEdit();
                    }
                    if (!result)
                    {
                        intervention.CancelEdit();
                        CFormAlerte.Afficher(I.T("Error while affecting version do intervention|1358"), EFormAlerteType.Erreur);
                    }
                    InitChamps(intervention);
                }
            }

            //La version de données est maintenant normallement associée à l'intervention
            CSite site = Intervention.Site;

            if (site == null)
            {
                return;
            }
            if (Intervention.VersionDonneesAAppliquer == null)
            {
                return;
            }
            //Crée un contexte dans la version
            using (CContexteDonnee contexte = new CContexteDonnee(Intervention.ContexteDonnee.IdSession, true, false))
            {
                CResultAErreur result = contexte.SetVersionDeTravail(Intervention.VersionDonneesAAppliquer.Id, true);
                if (!result)
                {
                    CFormAfficheErreur.Show(result.Erreur);
                    return;
                }

                site = (CSite)site.GetObjetInContexte(contexte);
                CFormNavigateurPopup.Show(new CFormEditionSite(site));
            }
        }
예제 #17
0
        //-----------------------------------
        private void m_btnOk_Click(object sender, EventArgs e)
        {
            if (m_txtNomTable.Text.Length == 0)
            {
                MessageBox.Show(I.T("Please enter a table name|20004"));
                return;
            }
            CResultAErreur result = CResultAErreur.True;

            if (m_txtEditeFormule.Formule == null)
            {
                result = m_txtEditeFormule.ResultAnalyse;
                if (result == null)
                {
                    result = CResultAErreur.True;
                }
                result.EmpileErreur(I.T("Error in the formula|20011"));
                CFormAfficheErreur.Show(result.Erreur);
                return;
            }
            m_tableFiltre.NomFinal = m_txtNomTable.Text;
            m_tableFiltre.UseCache = m_chkUseCache.Checked;
            m_tableFiltre.Formule  = m_txtEditeFormule.Formule;
            m_tableFiltre.InclureToutesLesColonnesSource = m_chkInclureTout.Checked;

            if (!m_tableFiltre.InclureToutesLesColonnesSource)
            {
                List <CColumnEQFromSource> lstColonnes = new List <CColumnEQFromSource>();
                foreach (ListViewItem item in m_wndListeColonnesFromSource.Items)
                {
                    if (item.Checked)
                    {
                        IColumnDeEasyQuery col = item.Tag as IColumnDeEasyQuery;
                        if (col != null)
                        {
                            bool bColExiste = false;
                            foreach (IColumnDeEasyQuery colEx in m_tableFiltre.ColonnesFromSource)
                            {
                                CColumnEQFromSource colExSrc = colEx as CColumnEQFromSource;
                                if (colExSrc != null && colExSrc.IdColumnSource == col.Id)
                                {
                                    colEx.ColumnName = item.Text;
                                    lstColonnes.Add(colExSrc);
                                    bColExiste = true;
                                    break;
                                }
                            }
                            if (!bColExiste)
                            {
                                CColumnEQFromSource newCol = new CColumnEQFromSource(col);
                                newCol.ColumnName = item.Text;
                                lstColonnes.Add(newCol);
                            }
                        }
                    }
                }
                m_tableFiltre.ColonnesFromSource = lstColonnes.AsReadOnly();
            }
            else
            {
                m_tableFiltre.ColonnesFromSource = null;
            }

            result = m_panelPostFilter.MajChamps();
            if (!result)
            {
                CFormAlerte.Afficher(result.Erreur);
                return;
            }


            List <CColonneEQCalculee> lst = new List <CColonneEQCalculee>();

            foreach (CColonneEQCalculee col in m_ctrlFormulesNommees.GetFormules())
            {
                lst.Add(col);
            }
            m_tableFiltre.ColonnesCalculeesFromSource = lst;
            DialogResult = DialogResult.OK;
            Close();
        }
        //-----------------------------------
        private void m_btnOk_Click(object sender, EventArgs e)
        {
            if (m_txtNomTable.Text.Length == 0)
            {
                MessageBox.Show(I.T("Please enter a table name|20004"));
                return;
            }
            List <CParametreJointure> lstParametres = new List <CParametreJointure>();
            ArrayList lst = new ArrayList(m_panelJointure.Controls);

            lst.Reverse();
            foreach (Control ctrl in lst)
            {
                CEditeurParametreJointure editeur = ctrl as CEditeurParametreJointure;
                if (editeur != null)
                {
                    CResultAErreur result = editeur.MajChamps();
                    if (!result)
                    {
                        editeur.BackColor = Color.Red;
                        CFormAfficheErreur.Show(result.Erreur);
                        return;
                    }
                    editeur.BackColor = BackColor;
                    lstParametres.Add(editeur.Parametre);
                }
            }

            List <IColumnDeEasyQuery> lstColonnes = new List <IColumnDeEasyQuery>();

            foreach (ListViewItem item in m_wndListeColonnes1.Items)
            {
                if (item.Checked)
                {
                    IColumnDeEasyQuery col = item.Tag as IColumnDeEasyQuery;
                    if (col != null)
                    {
                        bool bColExiste = false;
                        foreach (IColumnDeEasyQuery colEx in m_objetJointure.ColonnesSource)
                        {
                            CColumnEQFromSource colExSrc = colEx as CColumnEQFromSource;
                            if (colExSrc != null && colExSrc.IdColumnSource == col.Id)
                            {
                                colEx.ColumnName = item.Text;
                                lstColonnes.Add(colEx);
                                bColExiste = true;
                                break;
                            }
                        }
                        if (!bColExiste)
                        {
                            IColumnDeEasyQuery newCol = new CColumnEQFromSource(col);
                            newCol.ColumnName = item.Text;
                            lstColonnes.Add(newCol);
                        }
                    }
                }
            }

            foreach (ListViewItem item in m_wndListeColonnes2.Items)
            {
                if (item.Checked)
                {
                    IColumnDeEasyQuery col = item.Tag as IColumnDeEasyQuery;
                    if (col != null)
                    {
                        bool bColExiste = false;
                        foreach (IColumnDeEasyQuery colEx in m_objetJointure.ColonnesSource)
                        {
                            CColumnEQFromSource colExSrc = colEx as CColumnEQFromSource;
                            if (colExSrc != null && colExSrc.IdColumnSource == col.Id)
                            {
                                colEx.ColumnName = item.Text;
                                lstColonnes.Add(colEx);
                                bColExiste = true;
                                break;
                            }
                        }
                        if (!bColExiste)
                        {
                            IColumnDeEasyQuery newCol = new CColumnEQFromSource(col);
                            newCol.ColumnName = item.Text;
                            lstColonnes.Add(newCol);
                        }
                    }
                }
            }
            m_objetJointure.UseCache           = m_chkUseCache.Checked;
            m_objetJointure.ModeJointure       = (CODEQJointure.EModeJointure)m_cmbTypeJointure.SelectedIndex;
            m_objetJointure.ColonnesSource     = lstColonnes;
            m_objetJointure.ParametresJointure = lstParametres;
            m_objetJointure.NomFinal           = m_txtNomTable.Text;

            DialogResult = DialogResult.OK;
            Close();
        }
예제 #19
0
파일: CGanttBar.cs 프로젝트: ykebaili/Timos
        //----------------------------------------------------------------
        private void CGanttBar_MouseUp(object sender, MouseEventArgs e)
        {
            Capture = false;

            Point ptMenu = new Point(e.X, e.Y);

            ptMenu = PointToScreen(ptMenu);

            if (!m_bDragEnCours)
            {
                IElementDeGantt eltSel = GetElementAt(new Point(e.X, e.Y));
                if (eltSel == null)
                {
                    KeyValuePair <IElementDeGantt, int[]>?sel = m_dicElementGanttToZoneY.FirstOrDefault(kv => kv.Value[0] < e.Y && kv.Value[1] > e.Y);
                    if (sel != null)
                    {
                        eltSel = sel.Value.Key;
                    }
                }
                if (eltSel != null)
                {
                    if (!LockEdition)
                    {
                        if ((e.Button & MouseButtons.Left) == MouseButtons.Left && ModifierKeys == Keys.Control && SelectedElement != null)
                        {
                            if (eltSel is CElementDeGanttProjet && SelectedElement is CElementDeGanttProjet)
                            {
                                if (eltSel.Predecesseurs.Contains(SelectedElement))
                                {
                                    if (MessageBox.Show(I.T("Remove dependancy between @1 and @2 ?|20002",
                                                            eltSel.Libelle, SelectedElement.Libelle), "",
                                                        MessageBoxButtons.YesNo,
                                                        MessageBoxIcon.Question) == DialogResult.Yes)
                                    {
                                        eltSel.RemovePredecesseur(SelectedElement);
                                        Refresh();
                                    }
                                }
                                else
                                {
                                    if (MessageBox.Show(I.T("Create dependancy between @1 and @2 ?|20003",
                                                            eltSel.Libelle, SelectedElement.Libelle), "",
                                                        MessageBoxButtons.YesNo,
                                                        MessageBoxIcon.Question) == DialogResult.Yes)
                                    {
                                        CResultAErreur result = eltSel.AddPredecesseur(SelectedElement);
                                        if (!result)
                                        {
                                            CFormAfficheErreur.Show(result.Erreur);
                                        }
                                        else
                                        {
                                            Refresh();
                                        }
                                    }
                                }
                            }
                        }
                    }
                    //Acces direct ?
                    Point pt = new Point(e.X, e.Y);
                    KeyValuePair <IElementDeGantt, Rectangle>?kv = m_dicElementGanttToRectangleAccesDirect.FirstOrDefault
                                                                   (
                        k => k.Value.Contains(pt)
                                                                   );
                    if (kv != null && kv.Value.Key != null)
                    {
                        ParametreAffichage.DateDebut = ParametreAffichage.AddCells(kv.Value.Key.DateDebut, -1);
                    }
                    SelectedElement = eltSel;
                }
                else
                {
                    SelectedElement = null;
                }

                // Gestion du menu contextuel
                if ((e.Button & MouseButtons.Right) == MouseButtons.Right)
                {
                    ContextMenuStrip menuElementDeGantt = new ContextMenuStrip();
                    menuElementDeGantt.Opening += new CancelEventHandler(menuElementDeGantt_Opening);


                    if (SelectedElement != null)
                    {
                        bool bEnableMenu = !LockEdition;
                        // Ajoute les items sur l'élement de Gantt
                        ToolStripMenuItem itemLabelElementDeGantt = new ToolStripMenuItem(SelectedElement.Libelle);
                        itemLabelElementDeGantt.Enabled = false;

                        CToolStripDateTimePicker itemControlDateDebut = new CToolStripDateTimePicker();
                        itemControlDateDebut.StartDate      = SelectedElement.DateDebut;
                        itemControlDateDebut.EndDate        = SelectedElement.DateFin;
                        itemControlDateDebut.OnValideDates += new EventHandler(itemControlDates_OnValueChanged);
                        itemControlDateDebut.Enabled        = bEnableMenu;

                        menuElementDeGantt.Items.Add(itemLabelElementDeGantt);
                        menuElementDeGantt.Items.Add(itemControlDateDebut);

                        menuElementDeGantt.Items.Add(new ToolStripSeparator());
                    }
                    else
                    {
                        ToolStripMenuItem itemTitre = new ToolStripMenuItem("-----------------"); // Juste pour permetre au menu de s'ouvrir même si Selectedelement est null
                        itemTitre.Enabled = false;
                        menuElementDeGantt.Items.Add(itemTitre);
                    }

                    // Affiche le menu contextuel sur elements de Gantt
                    menuElementDeGantt.Show(ptMenu);
                }
            }
            else
            {
                DrawImageDragDrop();
                if (m_imageDragEnCours != null)
                {
                    m_imageDragEnCours.Dispose();
                    m_imageDragEnCours = null;
                }
                m_bDragEnCours = false;
                m_fournisseurX.Highlight(-1, -1);
                DateTime dateDebut = m_fournisseurX.AddCells(SelectedElement.DateDebut, (int)((e.X - m_nXStartDrag) / ParametreAffichage.CellWidth));
                TimeSpan sp        = dateDebut - SelectedElement.DateDebut;
                //SelectedElement.Move(sp, null, EModeDeplacementProjet.MoveAutoOnly, true);
                bool bDoMove = true;
                if (BeforeMoveBar != null)
                {
                    MovingBar = SelectedElement;
                    bDoMove   = BeforeMoveBar("BeforeMoveBar", this);
                }
                if (bDoMove)
                {
                    MoveElement(sp, null);
                }
                Refresh();
            }
        }