Esempio n. 1
0
        //------------------------------------------------------
        private void Init(IEnumerable <ISatisfactionBesoin> lstSatisfactions)
        {
            m_listeNiveaux.Clear();
            m_setSatisfactionsIntegrés.Clear();
            CNiveau niveau = new CNiveau(0);

            foreach (ISatisfactionBesoin sat in lstSatisfactions)
            {
                niveau.AddSatisfaction(this, sat);
            }
            m_listeNiveaux.Add(niveau);


            CNiveau niveau0 = niveau;

            while (niveau.Satisfactions.Count() != 0)
            {
                niveau = CalculeNiveauSuivant();
            }
            niveau = niveau0;
            while (niveau.Satisfactions.Count() != 0)
            {
                niveau = CalculeNiveauPrecedent();
            }
            CalculeRectangles();
            m_satisfactionSel = null;
            m_lienSel         = null;
        }
Esempio n. 2
0
        void toolStripPourcentage_OnValideSaisie(object sender, EventArgs e)
        {
            CToolStripPourcentage        pct = sender as CToolStripPourcentage;
            CRelationBesoin_Satisfaction rel = pct != null ? pct.Tag as CRelationBesoin_Satisfaction : null;

            if (rel != null && pct.Value != null)
            {
                if (CFormAlerte.Afficher(I.T("Change repartition for '@1' uses '@2'% of '@3' cost ?|20687",
                                             rel.Besoin.LibelleComplet,
                                             pct.Value.Value.ToString("0.##"),
                                             rel.Satisfaction.Libelle),
                                         EFormAlerteBoutons.OuiNon,
                                         EFormAlerteType.Question) == DialogResult.Yes)
                {
                    bool bCommit = false;
                    if (rel.ContexteDonnee.ContextePrincipal == null)
                    {
                        bCommit = true;
                        rel.BeginEdit();
                    }
                    CUtilSatisfaction.SetPourcentageFor(rel.Besoin, rel.Satisfaction, pct.Value.Value);
                    if (bCommit)
                    {
                        CResultAErreur result = rel.CommitEdit();
                        if (!result)
                        {
                            CFormAlerte.Afficher(result.Erreur);
                        }
                    }
                    Refresh();
                }
            }
        }
Esempio n. 3
0
 //-----------------------------------------------------
 private void Invalidate(CRelationBesoin_Satisfaction sat)
 {
     if (sat != null)
     {
         CSegmentDroite segment = null;
         m_dicSatisfactionToSegment.TryGetValue(sat, out segment);
         if (segment != null)
         {
             Rectangle rct = new Rectangle(PointToDisplay(new Point(segment.Left - 5, segment.Top - 5)),
                                           new Size(SizeToDisplay(segment.SizeEnglobant.Width + 10), SizeToDisplay(segment.SizeEnglobant.Height + 10)));
             rct.Inflate(2, 2);
             m_panelDessin.Invalidate(rct);
         }
     }
 }
Esempio n. 4
0
        //------------------------------------------------------
        public void Init(ISatisfactionBesoin satisfaction)
        {
            m_satisfactionRacine = satisfaction;
            List <ISatisfactionBesoin> lst = new List <ISatisfactionBesoin>();

            lst.Add(satisfaction);
            m_baseMap.Init(lst);
            m_satisfactionSel = null;
            m_lienSel         = null;

            CDessinSatisfaction dessin = m_baseMap.GetDessin(satisfaction);

            if (dessin != null)
            {
                dessin.Expand();
            }
        }
Esempio n. 5
0
        //--------------------------------------------------------------------
        public void Init(CPhaseSpecifications phaseSpecifications)
        {
            CancelEdit();
            CurrentItemIndex      = null;
            Items                 = new CCustomizableListItem[0];
            m_phaseSpecifications = phaseSpecifications;

            if (m_phaseSpecifications != null)
            {
                List <CCustomizableListItem> items      = new List <CCustomizableListItem>();
                CListeObjetsDonnees          lstBesoins = m_phaseSpecifications.Besoins;
                lstBesoins.ReadDependances("BesoinsFils", "TypeProjet", "TypeEquipement", "TypeConsommable", "TypeOperation");
                CRelationBesoin_Satisfaction.PreloadBesoinsSatisfaits(lstBesoins);
                lstBesoins.Filtre = new CFiltreData(CBesoin.c_champIdBesoinParent + " is null");
                foreach (CBesoin besoin in lstBesoins)
                {
                    AddItemBesoinEtFils(null, besoin, items);
                }
                Items = items.ToArray();
            }
            m_panelResumeElementACout.Init(m_phaseSpecifications);
            Refresh();
        }
Esempio n. 6
0
        //-----------------------------------------------------
        private void DoSelection(Point pt, bool bAcceptNull)
        {
            ISatisfactionBesoin satisfaction = GetSatisfactionFromDisplay(pt);

            if (satisfaction != m_satisfactionSel && (satisfaction != null || bAcceptNull))
            {
                Invalidate(m_lienSel);
                Invalidate(m_satisfactionSel);
                m_satisfactionSel = satisfaction;
                m_lienSel         = null;
                Invalidate(satisfaction);
            }
            if (satisfaction == null)
            {
                CRelationBesoin_Satisfaction sat = GetLien(pt);
                if (sat != m_lienSel && (sat != null || bAcceptNull))
                {
                    Invalidate(m_lienSel);
                    m_lienSel = sat;
                    Invalidate(m_lienSel);
                }
            }
        }
Esempio n. 7
0
        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
        }