예제 #1
0
 public CLicenceCheckElementNb()//pour serialisation
 {
     m_LicenceLogiciel    = null;
     m_listRecords        = new List <CNombreUtilisePourTypeLicence>();
     m_DictionarySessions = new Dictionary <int, CLicenceCheckElementNbPourSession>();
     m_CreationsEnCours   = new Dictionary <string, int>();
 }
예제 #2
0
        public void Init(CLicenceLogicielPrtct licenceLogiciel)
        {
            m_LicenceLogiciel    = licenceLogiciel;
            m_listRecords        = new List <CNombreUtilisePourTypeLicence>();
            m_DictionarySessions = new Dictionary <int, CLicenceCheckElementNbPourSession>();
            m_CreationsEnCours   = new Dictionary <string, int>();

            RefreshNombreUtilises();

            /*Dictionary<string,int?> dicUsed = new Dictionary<string,int?>();
             *
             *
             *
             * foreach (Type tp in CContexteDonnee.GetAllTypes())
             * {
             *
             *  object[] attribs = tp.GetCustomAttributes(typeof(LicenceCountAttribute), true);
             *  if (attribs != null && attribs.Length > 0)
             *  {
             *      LicenceCountAttribute counter = attribs[0] as LicenceCountAttribute;
             *      int? nNb = null;
             *      if (!dicUsed.TryGetValue(counter.CountTypeName, out nNb))
             *          nNb = 0;
             *      nNb += GetNbUsedInDbForType(tp);
             *      dicUsed[counter.CountTypeName] = nNb;
             *  }
             * }
             * foreach (KeyValuePair<string, int?> kv in dicUsed)
             * {
             *  CNombreUtilisePourTypeLicence nb = new CNombreUtilisePourTypeLicence(kv.Key, kv.Value.Value);
             *  m_listRecords.Add(nb);
             * }*/

            if (!m_bRegistrerTraitementAvecSauvegardeFait)
            {
                if (m_LicenceLogiciel.Types.Count != 0 || m_LicenceLogiciel is CLicenceDemo)
                {
                    m_bRegistrerTraitementAvecSauvegardeFait = true;
                    CContexteDonneeServeur.AddTraitementAvantSauvegarde(new TraitementSauvegardeExterne(TraitementAvantSauvegarde));
                    m_bHasTypesLimites = true;
                }
            }
        }
예제 #3
0
        private void FillDialog()
        {
            IGestionnaireSessionsTimos gestionnaire = CSessionClient.GestionnaireSessions as IGestionnaireSessionsTimos;
            CLicenceLogicielPrtct      licence      = null;

            if (gestionnaire != null)
            {
                licence = gestionnaire.GetLicenceServeur();
            }
            if (licence == null)
            {
                MessageBox.Show(I.T("Global license error|20200"));
                Close();
                return;
            }
            m_lblNumeroLicence.Text = licence.Numero;
            m_lblNomClient.Text     = licence.Contrat.Client.Nom;
            if (licence.DateLimiteUtilisation != null)
            {
                m_panelDateExpiration.Visible = true;
                m_lblDateExpiration.Text      = licence.DateLimiteUtilisation.Value.ToShortDateString();
            }
            else
            {
                m_panelDateExpiration.Visible = false;
            }


            foreach (CLicenceModuleAppPrtct module in licence.ModulesApp)
            {
                int nIndex = m_lstModules.Items.Add(module.Nom);
            }

            IEnumerable <CNombreUtilisePourTypeLicence> lstRestant = gestionnaire.GetNombreRestantParType();

            if (lstRestant == null)
            {
                lstRestant = new List <CNombreUtilisePourTypeLicence>();
            }
            foreach (CLicenceTypePrtct type in licence.Types)
            {
                ListViewItem item       = new ListViewItem(type.Nom);
                string       strLicence = type.Nombre.ToString();

                item.SubItems.Add(strLicence);
                m_wndListeTypes.Items.Add(item);
                CNombreUtilisePourTypeLicence rest = lstRestant.FirstOrDefault(r => r.IdType.ToUpper() == type.Id.ToUpper());
                if (rest != null)
                {
                    item.SubItems.Add(rest.NombreUtilise.ToString());
                }
            }

            foreach (CUserLicencePrtct user in licence.UserLicences)
            {
                ListViewItem item = new ListViewItem(user.NbSimultane.ToString());
                item.SubItems.Add(user.GetNbUsed().ToString());
                if (user.DateValide != null)
                {
                    item.SubItems.Add(user.DateValide.DateTimeValue.ToShortDateString());
                }
                if (user.IsReadOnly)
                {
                    item.SubItems.Add(I.T("Read only|20215"));
                }
                else
                {
                    item.SubItems.Add(I.T("Full|20214"));
                }
                m_wndListeUsers.Items.Add(item);
            }

            m_listeAlertes = gestionnaire.GetAlertesLicences();
            if (m_listeAlertes.Count > 0)
            {
                m_pageLicence.ImageIndex = 0;
                m_panelAlertes.Visible   = true;
                foreach (CAlerteLicence alerte in m_listeAlertes)
                {
                    ListViewItem item = new ListViewItem(alerte.MessageAlerte);
                    switch (alerte.Gravite)
                    {
                    case EGraviteAlerte.Info:
                        item.ImageIndex = 1;
                        break;

                    case EGraviteAlerte.Critique:
                        item.ImageIndex = 0;
                        break;
                    }
                    m_wndListeAlertes.Items.Add(item);
                }
                m_tabControl.SelectedTab = m_pageLicence;
            }
            else
            {
                m_panelAlertes.Visible   = false;
                m_pageLicence.ImageIndex = -1;
            }
        }
예제 #4
0
 //----------------------------------------------------------------
 public CLicenceCheckElementNb(CLicenceLogicielPrtct licenceLogiciel)
 {
     Init(licenceLogiciel);
 }