//--------------------------------------------------------------------- /// <summary> /// Retourne le libellé d'un champ /// </summary> /// <param name="version"></param> /// <returns></returns> public IChampPourVersion GetChamp(IElementAChampPourVersion element) { if (element == null) { return(null); } Type tp = element.TypeEntite; return(new CChampPourVersionInDb(element.FieldKey, element.NomChampConvivial)); //if (tp != null) //{ // //Cherche la propriété liée au champ // foreach (PropertyInfo prop in tp.GetProperties()) // { // object[] attribs = prop.GetCustomAttributes(typeof(TableFieldPropertyAttribute), true); // if (attribs.Length > 0) // { // string strNomChamp = ((TableFieldPropertyAttribute)attribs[0]).NomChamp; // if (strNomChamp == element.FieldKey) // { // attribs = prop.GetCustomAttributes(typeof(DynamicFieldAttribute), true); // if (attribs.Length != 0) // return new CChampPourVersionInDb(element.FieldKey, ((DynamicFieldAttribute)attribs[0]).NomConvivial); // } // } // } //} //return new CChampPourVersionInDb(element.FieldKey, element.FieldKey); }
//--------------------------------------------------------------- public IChampPourVersion GetChamp(IElementAChampPourVersion element) { if (element.TypeChamp == CChampCustomPourVersion.c_typeChamp) { try { int nIdChamp = Int32.Parse(element.FieldKey); CChampCustom champ = new CChampCustom(element.ContexteDonnee); if (champ.ReadIfExists(nIdChamp)) { return(new CChampCustomPourVersion(champ)); } } catch { } } return(null); }