public void Init(CAuditVersionObjetOperation cavoo) { m_cavoo = cavoo; }
public bool Initialiser(object valeur) { Controls.Clear(); try { m_valeur = (CControlListeOperationsSurCAVO.CValeurCAVOO)valeur; } catch { return(false); } CAuditVersionObjetOperation cavoo = m_valeur.CAVOO; Type tpEntite = cavoo.TypeEntite; string strType = cavoo.IDifferencesBlobType == null || cavoo.IDifferencesBlobType == "" ? cavoo.TypeValeurString : cavoo.IDifferencesBlobType; Type tpValeur = CActivatorSurChaine.GetType(strType); Control ctrl = null; //ENTITE LIEE ? if (tpValeur == typeof(int)) { if (cavoo.Champ.GetType() == typeof(CChampCustomPourVersion)) { //SAVOIR SI LE CHAMP CUSTOM POINTE VERS UNE ENTITE... //((CChampPourVersionInDb)cavoo.Champ). } else { PropertyInfo[] props = tpEntite.GetProperties(); foreach (PropertyInfo p in props) { object[] atts = p.GetCustomAttributes(typeof(RelationAttribute), false); if (atts.Length == 1) { RelationAttribute att = (RelationAttribute)atts[0]; if (att.ChampsParent.Length == 1 && att.ChampsFils.Length == 1 && att.ChampsParent[0] == cavoo.Champ.FieldKey) { string strDescrip = ""; if (m_valeur.Valeur != null) { CFiltreData filtre = new CFiltreData(att.ChampsFils[0] + " =@1", (int)m_valeur.Valeur); CListeObjetsDonnees lstObj = new CListeObjetsDonnees(cavoo.ContexteDonnee, p.PropertyType, filtre); bool bElementAccessible = lstObj.Count == 1; CObjetDonneeAIdNumerique obj = null; if (bElementAccessible) { obj = (CObjetDonneeAIdNumerique)lstObj[0]; strDescrip = obj.DescriptionElement; } else { strDescrip = I.T("Indefinite element from type @1 |30278", DynamicClassAttribute.GetNomConvivial(p.PropertyType)); } CControlListeOperationsSurCAVO.CValeurCAVOOEntite valeurEntite = new CControlListeOperationsSurCAVO.CValeurCAVOOEntite(strDescrip, (int)m_valeur.Valeur, p.PropertyType, obj); CControlOpertionCAVOOEntite ctrlEntite = new CControlOpertionCAVOOEntite(); ctrlEntite.Initialiser(valeurEntite); ctrl = ctrlEntite; break; } return(true); } } } } } if (ctrl == null) { //if (tpValeur == typeof(DateTime)) //{ //} //else if (tpValeur == typeof(int)) //{ //} //else if (tpValeur == typeof(bool)) //{ //} if (typeof(IDifferencesBlob).IsAssignableFrom(tpValeur)) { if (tpValeur == typeof(timos.data.CDifferencesTables)) { CControlOpertionCAVOOBlobTableParametrable ctrlTable = new CControlOpertionCAVOOBlobTableParametrable(); ctrlTable.Init(m_valeur); ctrl = ctrlTable; } else { } } //else if (tpValeur == typeof(byte[])) //{ //} else { try { Label lbl = new Label(); if (m_valeur.Valeur != null) { lbl.Text = m_valeur.Valeur.ToString(); } ctrl = lbl; } catch { } } } if (ctrl != null) { Controls.Add(ctrl); ctrl.Dock = DockStyle.Fill; } return(true); }
public CValeurCAVOO(CAuditVersionObjetOperation cavoo, EOrigineVersion origine) { m_valeur = origine == EOrigineVersion.Cible ? cavoo.ValeurCible : cavoo.ValeurSource; m_origine = origine; m_cavoo = cavoo; }