Exemple #1
0
        //--------------------------------------------------
        private void FillListeChamps()
        {
            List <CCustomizableListItem> lstItems = new List <CCustomizableListItem>();
            ITypeDonneeCumulee           type     = m_cmbTypesDonnees.SelectedValue as ITypeDonneeCumulee;

            if (type != null)
            {
                m_controleItem.InitControle(m_agent, type);
                IEnumerable <CChampDonneeCumulee> champs = type.GetChampsRenseignes();
                foreach (CChampDonneeCumulee champ in champs)
                {
                    CParametreFillChampDonneeCumulee parametre = m_setup.ParametresFillChamps.FirstOrDefault(
                        c => c.Champ.Equals(champ));
                    if (parametre == null)
                    {
                        parametre = new CParametreFillChampDonneeCumulee();
                        parametre.FormuleSource = null;
                        parametre.Champ         = champ;
                    }
                    CCustomizableListItem item = new CCustomizableListItem();
                    item.Tag = parametre;
                    lstItems.Add(item);
                }
            }

            m_wndListeChamps.Items = lstItems.ToArray();
        }
Exemple #2
0
        //--------------------------------------------------
        public CResultAErreur MajChamps()
        {
            CResultAErreur result = CResultAErreur.True;

            if (m_txtLibelle.Text.Length == 0)
            {
                result.EmpileErreur(I.T("Enter a label for this polling setup|20127"));
                return(result);
            }
            ITypeDonneeCumulee tp = m_cmbTypesDonnees.SelectedValue as ITypeDonneeCumulee;

            if (tp == null)
            {
                result.EmpileErreur(I.T("Select a data type|20128"));
                return(result);
            }

            result = m_wndListeChamps.MajChamps();
            if (!result)
            {
                return(result);
            }
            CListeParametresFillChampDonneeCumulee lstParametres = new CListeParametresFillChampDonneeCumulee();

            foreach (CCustomizableListItem item in m_wndListeChamps.Items)
            {
                CParametreFillChampDonneeCumulee parametre = item.Tag as CParametreFillChampDonneeCumulee;
                if (parametre.FormuleSource != null)
                {
                    lstParametres.Add(parametre);
                }
            }
            m_setup.Libelle              = m_txtLibelle.Text;
            m_setup.IdTypeDonneeCumulee  = tp.Id;
            m_setup.ParametresFillChamps = lstParametres;
            if (m_txtFrequence.UnitValue == null)
            {
                m_setup.FrequenceMinutes = 0;
            }
            else
            {
                m_setup.FrequenceMinutes = m_txtFrequence.UnitValue.ConvertTo(CClasseUniteTemps.c_idMIN).Valeur;
            }
            return(result);
        }
Exemple #3
0
        //-------------------------------------------------------
        protected override CResultAErreur MyInitChamps(CCustomizableListItem item)
        {
            CResultAErreur result = base.MyInitChamps(item);

            if (!result)
            {
                return(result);
            }
            CParametreFillChampDonneeCumulee p = item != null ? item.Tag as CParametreFillChampDonneeCumulee : null;

            if (p != null)
            {
                string strNom = "";
                if (m_typeDonneeCumulee != null)
                {
                    strNom = m_typeDonneeCumulee.GetNomChamp(p.Champ);
                }
                else
                {
                    strNom = p.Champ.TypeChamp.ToString() + p.Champ.NumeroChamp;
                }
                m_lblChamp.Text = strNom;
                if (IsCreatingImage)
                {
                    m_lblFormule.Text = p.FormuleSource != null?
                                        p.FormuleSource.GetString() :
                                            "";

                    m_txtFormule.Visible = false;
                    m_lblFormule.Visible = true;
                    m_lblFormule.Dock    = DockStyle.Fill;
                }
                else
                {
                    m_txtFormule.Formule = p.FormuleSource;
                    m_txtFormule.Visible = true;
                    m_lblFormule.Visible = false;
                    m_txtFormule.Dock    = DockStyle.Fill;
                }
            }
            return(result);
        }
Exemple #4
0
        //--------------------------------------------------
        protected override CResultAErreur MyMajChamps()
        {
            CResultAErreur result = base.MyMajChamps();

            if (result)
            {
                CParametreFillChampDonneeCumulee p = CurrentItem != null ?
                                                     CurrentItem.Tag as CParametreFillChampDonneeCumulee
                    : null;
                if (p != null)
                {
                    p.FormuleSource = m_txtFormule.Formule;
                    if (m_txtFormule.Formule == null &&
                        !m_txtFormule.ResultAnalyse)
                    {
                        result.EmpileErreur(m_txtFormule.ResultAnalyse.Erreur);
                    }
                }
            }
            return(result);
        }