예제 #1
0
        ///////////////////////////////////////////////////////////////////////////
        public static void Show(CPileErreur erreur, string strCaption)
        {
            CFormAfficheErreur form = new CFormAfficheErreur(erreur);

            form.Text = strCaption;
            form.ShowDialog();
        }
예제 #2
0
        //-------------------------------------------------------------------
        private void m_lnkImportMibs_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter = I.T("Mib files (*.mib)|*.mib|All files (*.*)|*.*|20255");
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    StreamReader reader = new StreamReader(dlg.FileName, System.Text.Encoding.Default);
                    CResultAErreurType <IList <IModule> > resultModules = CSnmpMibModule.CompileFile(reader);
                    reader.Close();
                    if (resultModules)
                    {
                        using (CContexteDonnee ctx = CSc2iWin32DataClient.ContexteCourant.GetContexteEdition())
                        {
                            CListeObjetDonneeGenerique <CSnmpMibModule> lstModules = new CListeObjetDonneeGenerique <CSnmpMibModule>(ctx);
                            lstModules.AssureLectureFaite();
                            lstModules.InterditLectureInDB = true;
                            foreach (IModule module in resultModules.DataType)
                            {
                                //Cherche le module dans la liste des modules
                                lstModules.Filtre = new CFiltreData(CSnmpMibModule.c_champModuleId + "=@1",
                                                                    module.Name);
                                if (lstModules.Count == 0)
                                {
                                    CSnmpMibModule mib = new CSnmpMibModule(ctx);
                                    mib.CreateNewInCurrentContexte();
                                    mib.ModuleId  = module.Name;
                                    mib.ModuleMib = module;
                                    mib.Libelle   = module.Name;
                                }
                            }
                            CResultAErreur result = ctx.CommitEdit();
                            if (!result)
                            {
                                CFormAfficheErreur.Show(result.Erreur);
                            }
                            else
                            {
                                m_panelListe.RemplirGrille();
                            }
                        }
                    }
                    else
                    {
                        CFormAfficheErreur.Show(resultModules.Erreur);
                    }
                }
                catch (Exception ex)
                {
                    CResultAErreur result = CResultAErreur.True;
                    result.EmpileErreur(new CErreurException(ex));
                    CFormAfficheErreur.Show(result.Erreur);
                }
            }
        }
예제 #3
0
파일: Program.cs 프로젝트: ykebaili/Timos
        private static void ImporterChamps()
        {
            StreamReader reader   = new StreamReader("C:\\Partage\\Import Orange\\Champs controles.txt", Encoding.Default);
            string       strLigne = reader.ReadLine();

            strLigne = reader.ReadLine();
            using (CContexteDonnee contexte = new CContexteDonnee(CSessionClient.GetSessionUnique().IdSession, true, false))
            {
                while (strLigne != null)
                {
                    CRoleChampCustom roleSite            = CRoleChampCustom.GetRole(CSite.c_roleChampCustom);
                    CRoleChampCustom roleWorkBook        = CRoleChampCustom.GetRole(CDossierSuivi.c_roleChampCustom);
                    CRoleChampCustom roleCaracteristique = CRoleChampCustom.GetRole(CCaracteristiqueEntite.c_roleChampCustom);
                    string[]         datas = strLigne.Split('\t');
                    if (datas.Length >= 1)
                    {
                        CChampCustom champ = new CChampCustom(contexte);
                        if (!champ.ReadIfExists(new CFiltreData(CChampCustom.c_champNom + "=@1",
                                                                datas[0])))
                        {
                            champ.CreateNewInCurrentContexte();
                        }
                        champ.Nom = datas[0];
                        C2iTypeDonnee tp = new C2iTypeDonnee(TypeDonnee.tString);
                        if (datas.Length > 1)
                        {
                            if (datas[1].ToUpper() == "BOOL")
                            {
                                tp = new C2iTypeDonnee(TypeDonnee.tBool);
                            }
                            else if (datas[1].ToUpper() == "DATE")
                            {
                                tp = new C2iTypeDonnee(TypeDonnee.tDate);
                            }
                        }
                        champ.TypeDonneeChamp = tp;
                        champ.Categorie       = "";
                        if (datas.Length > 2)
                        {
                            champ.Categorie = datas[2];
                        }
                        CRoleChampCustom role = roleCaracteristique;
                        champ.Role = role;
                    }
                    strLigne = reader.ReadLine();
                }
                reader.Close();
                CResultAErreur result = contexte.SaveAll(true);
                if (!result)
                {
                    CFormAfficheErreur.Show(result.Erreur);
                }
            }
        }
예제 #4
0
        //-------------------------------------------------------------------------
        private void m_lnkLoadModule_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter = I.T("Mib files (*.mib)|*.mib|All files (*.*)|*.*|20255");
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    StreamReader reader = new StreamReader(dlg.FileName, System.Text.Encoding.Default);
                    CResultAErreurType <IList <IModule> > resultModules = CSnmpMibModule.CompileFile(reader);
                    reader.Close();
                    if (resultModules)
                    {
                        IModule module = null;
                        if (m_txtModuleId.Text == "" && resultModules.DataType.Count > 0)
                        {
                            module = resultModules.DataType[0];
                        }
                        else
                        {
                            module = resultModules.DataType.FirstOrDefault(m => m.Name.ToUpper() == m_txtModuleId.Text.ToUpper());
                        }
                        if (module == null)
                        {
                            MessageBox.Show(I.T("Module '@1' can not be found in file @2|20259",
                                                m_txtModuleId.Text, dlg.FileName));
                            return;
                        }
                        if (SnmpMib.ModuleMib == null ||
                            MessageBox.Show(
                                I.T("Current module will be replaced with the mib module from @1. Are you sure ?|20260", dlg.FileName),
                                "",
                                MessageBoxButtons.YesNo,
                                MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            SnmpMib.ModuleMib = module;
                            UpdateVueMib();
                        }
                    }
                }
                catch (Exception ex)
                {
                    CResultAErreur result = CResultAErreur.True;
                    result.EmpileErreur(new CErreurException(ex));
                    CFormAfficheErreur.Show(result.Erreur);
                }
            }
        }
        private void m_btnValiderModifications_Click(object sender, EventArgs e)
        {
            CResultAErreur result = MAJ_Champs();

            if (result && m_preferenceEditee != null)
            {
                // Enregistre le dictionnaire de préférences dans le registre de la base Timos
                result = m_preferenceEditee.CommitEdit();
                OnChangeTypeSelectionne();
            }
            if (!result)
            {
                CFormAfficheErreur.Show(result.Erreur);
                return;
            }
            m_gestionnaireModeEdition.ModeEdition = false;
        }
예제 #6
0
        private void m_btnTester_Click(object sender, EventArgs e)
        {
            CFiltreDynamique filtre = m_panelFiltre.FiltreDynamique;
            CResultAErreur   result = filtre.GetFormuleEquivalente();

            if (result)
            {
                C2iExpression formule = result.Data as C2iExpression;
                CListeObjetDonneeGenerique <CActeur> lst = new CListeObjetDonneeGenerique <CActeur>(CSc2iWin32DataClient.ContexteCourant);
                StringBuilder bl    = new StringBuilder();
                int           nNbOk = 0;
                foreach (CActeur acteur in lst)
                {
                    CContexteEvaluationExpression ctx = new CContexteEvaluationExpression(acteur);
                    if (formule == null)
                    {
                        result.Data = true;
                    }
                    else
                    {
                        result = formule.Eval(ctx);
                    }
                    if (result)
                    {
                        if (result.Data is bool && (bool)result.Data == true)
                        {
                            bl.Append(acteur.IdentiteComplete);
                            nNbOk++;
                            bl.Append("\r\n");
                        }
                    }
                }
                MessageBox.Show(nNbOk + " elements\r\n" + bl.ToString());
            }
            else
            {
                CFormAfficheErreur.Show(result.Erreur);
            }
        }
예제 #7
0
파일: Program.cs 프로젝트: ykebaili/Timos
        static void Main()
        {
            //Test
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            CFinalCustomerInformations.Init();

            SystemEvents.SessionEnding += SystemEvents_SessionEnding;

            Thread thSplash = new Thread(new ThreadStart(SplashScreen));

            thSplash.Start();
            //new CFormPoissonAvril().ShowDialog();
#if DEBUG
            Thread.Sleep(10000);

            //CRecepteurNotification recepteur = new CRecepteurNotification(-1, typeof(CDonneeNotificationServeurStarted));
            //recepteur.OnReceiveNotification += new NotificationEventHandler(recepteur_OnReceiveNotification);
            //Application.Run();
#endif

            System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false;
            CTraducteur.ReadFichier("timos.mes");

            //System.Threading.Thread.CurrentThread.ApartmentState = System.Threading.ApartmentState.STA;

            CServicePopupProgressionTimos serviceIndicateur = new CServicePopupProgressionTimos();
            IIndicateurProgression        indicateur        = null;/* = serviceIndicateur.GetNewIndicateurAndPopup();
                                                                    * indicateur.SetInfo("Démarrage");*/
#if DEBUG
#else
            try
            {
#endif

            AppDomain.CurrentDomain.Load("futurocom.win32.sig");
            AppDomain.CurrentDomain.Load("futurocom.win32.chart");
            AppDomain.CurrentDomain.Load("data.hotel.easyquery");
            AppDomain.CurrentDomain.Load("data.hotel.easyquery.win32");

            CTimosAppRegistre timosRegistre = new CTimosAppRegistre();
            CResultAErreur result           = timos.client.CInitialiseurClientTimos.InitClientTimos(timosRegistre, true, indicateur);

            /*GC.Collect();
             * GC.WaitForPendingFinalizers();
             * long nMemo = GC.GetTotalMemory(true);
             * DateTime dtChrono = DateTime.Now;
             * //for (int n = 0; n < 10000; n++)
             * {
             *  using (CContexteDonnee ctx = new CContexteDonnee(0, true, false))
             *  {
             *      for (int n = 0; n < 10000; n++)
             *      {
             *          using (CContexteDonnee ctx2 = ctx.GetContexteEdition())
             *          {
             *              CTypeAlarme tp = new CTypeAlarme(ctx2);
             *              tp.ReadIfExists(129);
             *          }
             *      }
             *  }
             * }
             * GC.Collect();
             * GC.WaitForPendingFinalizers();
             * long nMemo2 = GC.GetTotalMemory(true);
             * System.Threading.Thread.Sleep(10000);
             * TimeSpan sp = DateTime.Now - dtChrono;
             * Console.WriteLine("TEST : " + sp.TotalMilliseconds);*/


            //serviceIndicateur.EndIndicateur(indicateur);
            if (!result)
            {
                thSplash.Abort();
                result.EmpileErreur(I.T("Error while opening application|1219"));
                CFormAlerte.Afficher(result.Erreur, EFormAlerteBoutons.Ok, EFormAlerteType.Exclamation);
            }
            else
            {
                CSc2iWin32DataClient.Init(CFournisseurContexteDonnee.GetInstance());
                CReferenceObjetDonnee.SetFournisseurContexteDonnee(CFournisseurContexteDonnee.GetInstance());

                //Effet Fondu
                CEffetFonduPourFormManager.EffetActif = timosRegistre.OptionsGraphiques_FonduActif;
                if (AuthentifierUtilisateur(thSplash))
                {
                    string strVersionServeur = CTimosApp.SessionClient.SessionSurServeur.GetVersionServeur();
                    string strVersionClient  = Assembly.GetExecutingAssembly().GetName().Version.ToString();
                    if (strVersionClient != strVersionServeur)
                    {
                        result.EmpileErreur(I.T("Server (@2) and client (@1) version doesn't match. Please, update your Timos client version|20144",
                                                strVersionClient, strVersionServeur));
                        CFormAlerte.Afficher(result.Erreur);
                        CTimosApp.SessionClient.CloseSession();
                        return;
                    }
                    //Si le profil affecté n'est pas le même que le profil demandé
                    //pour l'utilisateur, affiche une boite de message indiquant
                    //la différence de profil
                    CDonneesActeurUtilisateur user = CUtilSession.GetUserForSession(CSc2iWin32DataClient.ContexteCourant);
                    if (user != null && user.IdProfilLicence.Length != 0)
                    {
                        CInfoLicenceUserProfil profil = (CInfoLicenceUserProfil)CTimosApp.SessionClient.GetPropriete(CInfoLicenceUserProfil.c_nomIdentification);
                        if (profil != null && profil.Id != user.IdProfilLicence)
                        {
                            CFormAlerte.Afficher(I.T("You are connected as @1|20023", profil.Nom), EFormAlerteType.Info);
                        }
                    }
                    bool bRestart = true;
                    foreach (Assembly ass in CGestionnaireAssemblies.GetAssemblies())
                    {
                        CGestionnaireExtendeurFormEditionStandard.RegisterExtendersInAssembly(ass);
                    }

                    C2iRegistre.InitRegistreApplication(new CTimosAppRegistre());
#if DEBUG
                    //ImporterChamps();

                    CRelationBesoin_Satisfaction.InitCachePourUnClientJamaisCotéServeur();

                    string str = "";
                    foreach (RelationTypeIdAttribute r in CContexteDonnee.RelationsTypeIds)
                    {
                        str += r.TableFille;
                        str += "\t";
                        str += r.ChampType;
                        str += Environment.NewLine;
                    }

                    Application.Run(new CFormMain());
#else
                    while (bRestart)
                    {
                        bRestart = false;

                        try
                        {
                            Application.Run(new CFormMain());
                        }
                        catch (Exception e)
                        {
                            result = CResultAErreur.True;
                            result.EmpileErreur(new CErreurException(e));
                            CFormAfficheErreur.Show(result.Erreur);
                            bRestart = true;
                        }
                    }
#endif
                }
            }
#if DEBUG
#else
        }

        catch (Exception ex)
        {
            StringBuilder bl = new StringBuilder();
            ReflectionTypeLoadException lex = ex as System.Reflection.ReflectionTypeLoadException;
            if (lex != null)
            {
                foreach (Exception ee in lex.LoaderExceptions)
                {
                    bl.Append(ee.Message.ToString());
                    bl.Append("\r\n");
                }
            }
            else
            {
                bl.Append(ex.Message.ToString( ));
            }
            CFormAlerte.Afficher(bl.ToString());
        }
#endif
        }