public override object Invoke(object objetAppelle, params object[] parametres)
        {
            if (parametres.Length != 1 || parametres[0] == null ||
                !(objetAppelle is CObjetDonneeAIdNumerique))
            {
                return(null);
            }
            CObjetDonneeAIdNumerique objet = (CObjetDonneeAIdNumerique)objetAppelle;
            CListeObjetsDonnees      lst   = CCaracteristiqueEntite.GetCaracteristiques(objet);

            if (parametres.Length > 0 && parametres[0] is CTypeCaracteristiqueEntite)
            {
                lst.Filtre = new CFiltreData(CTypeCaracteristiqueEntite.c_champId + "=@1",
                                             ((CTypeCaracteristiqueEntite)parametres[0]).Id);
            }
            return(lst.ToArray <CCaracteristiqueEntite>());
        }
Exemple #2
0
        public CDocumentAttendu(DataSet ds, CCaracteristiqueEntite carac)
        {
            DataTable dt = ds.Tables[c_nomTable];

            if (dt == null)
            {
                return;
            }

            DataRow  row            = dt.NewRow();
            int      nIdCarac       = -1;
            string   strLibelle     = "";
            int      nIdCategorie   = -1;
            int      nbMin          = 0;
            DateTime?dateLastUpload = null;

            if (carac != null)
            {
                m_caracteristic = carac;
                row[c_champId]  = carac.Id;
                CCategorieGED categorie = CategorieGED;
                if (categorie != null)
                {
                    row[c_champLibelle]     = carac.Libelle == "" ? categorie.Libelle : carac.Libelle;
                    row[c_champIdCategorie] = categorie.Id;
                }
                else
                {
                    row[c_champLibelle]     = carac.Libelle;
                    row[c_champIdCategorie] = -1;
                }
                row[c_champNombreMin] = nbMin;
                if (dateLastUpload == null)
                {
                    row[c_champDateLastUpload] = DBNull.Value;
                }
                else
                {
                    row[c_champDateLastUpload] = dateLastUpload.Value;
                }
            }

            m_row = row;
            dt.Rows.Add(row);
        }
Exemple #3
0
        static int s_nIdNegatif = -1; // Utile pour les carac template vides

        public CCaracteristique(DataSet ds, IObjetDonneeAIdNumeriqueAuto objetEdite, Type typeObjetEdite, string strParentElementType, int nParentElementId, int nOrdre, int nIdGroupe, bool isTemplate)
        {
            m_objetEdite = objetEdite; // Cela peut être une caractéristique, mais pas frocément
            DataTable dt = ds.Tables[c_nomTable];

            if (dt == null)
            {
                return;
            }

            DataRow row = dt.NewRow();

            string strId          = "";
            string strLibelle     = "Nouvel élément";
            int    nTimosId       = s_nIdNegatif--;
            string strTypeElement = "";

            if (typeObjetEdite != null)
            {
                strTypeElement = typeObjetEdite.ToString();
            }
            int nIdMetaType = -1;

            if (objetEdite != null)
            {
                if (!isTemplate)
                {
                    nTimosId = objetEdite.Id;
                }
                strTypeElement = objetEdite.GetType().ToString();
                int nLastPoint = strTypeElement.LastIndexOf(".");
                strId = strTypeElement.Substring(nLastPoint + 1, strTypeElement.Length - nLastPoint - 1) + nTimosId;

                strLibelle = objetEdite.DescriptionElement;

                if (objetEdite is CCaracteristiqueEntite)
                {
                    CCaracteristiqueEntite carac = objetEdite as CCaracteristiqueEntite;
                    strLibelle = carac.Libelle;
                    if (strLibelle == "")
                    {
                        strLibelle = carac.TypeCaracteristique.Libelle;
                    }
                    if (carac.TypeCaracteristique != null)
                    {
                        nIdMetaType = carac.TypeCaracteristique.Id;
                    }
                }
                else if (objetEdite is CDossierSuivi)
                {
                    CDossierSuivi workbook = objetEdite as CDossierSuivi;
                    strLibelle = workbook.Libelle;
                    if (workbook.TypeDossier != null)
                    {
                        nIdMetaType = workbook.TypeDossier.Id;
                    }
                }
                else if (objetEdite is CSite)
                {
                    CSite site = objetEdite as CSite;
                    strLibelle = site.Libelle;
                    if (site.TypeSite != null)
                    {
                        nIdMetaType = site.TypeSite.Id;
                    }
                }
            }

            row[c_champId]                = strId;
            row[c_champTimosId]           = nTimosId;
            row[c_champElementType]       = strTypeElement;
            row[c_champTitre]             = strLibelle;
            row[c_champOrdreAffichage]    = nOrdre;
            row[c_champIdGroupeChamps]    = nIdGroupe;
            row[c_champIsTemplate]        = isTemplate;
            row[c_champIdMetaType]        = nIdMetaType;
            row[c_champParentElementType] = strParentElementType;
            row[c_champParentElementId]   = nParentElementId;

            m_row = row;
            dt.Rows.Add(row);
        }