/// <summary> /// Converto Value of Object to His Type /// </summary> /// <param name="param"></param> /// <returns></returns> public override object ConvertValue(BaseFieldTraitementParam param) { object value = null; value = param.BaseField.Value; return(value); }
public override object ConvertValue(BaseFieldTraitementParam param) { List <BaseEntity> ls = null; ls = param.BaseField.Value as List <BaseEntity>; IGwinBaseBLO ServicesEntity = param.EntityBLO .CreateServiceBLOInstanceByTypeEntityAndContext( param.ConfigProperty.PropertyInfo.PropertyType.GetGenericArguments()[0], param.EntityBLO.Context ); Type TypeListeObjetValeur = typeof(List <>).MakeGenericType( param.ConfigProperty.PropertyInfo.PropertyType.GetGenericArguments()[0]); IList ls_valeur = (IList)Activator.CreateInstance(TypeListeObjetValeur); foreach (BaseEntity b in ls) { var entity_valeur = ServicesEntity.GetBaseEntityByID(b.Id); ls_valeur.Add(entity_valeur); } return(ls_valeur); }
public override object ConvertValue(BaseFieldTraitementParam param) { IGwinBaseBLO ServicesEntity = param .EntityBLO .CreateServiceBLOInstanceByTypeEntity(param.ConfigProperty.PropertyInfo.PropertyType); BaseEntity ManyToOneEntity = ServicesEntity.GetBaseEntityByID(Convert.ToInt64(param.BaseField.Value)); return(ManyToOneEntity); }
public virtual object ConvertValue(BaseFieldTraitementParam param) { object value = null; if (param.ConfigProperty.PropertyInfo.PropertyType.IsPrimitive) { value = Convert.ChangeType(param.BaseField.Value, param.ConfigProperty.PropertyInfo.PropertyType); } else { value = param.BaseField.Value; } return(value); }
public override object ConvertValue(BaseFieldTraitementParam param) { LocalizedString localizedString = (LocalizedString)param .Entity.GetType() .GetProperty(param.ConfigProperty.PropertyInfo.Name) .GetValue(param.Entity); if (localizedString == null) { localizedString = new LocalizedString(); } localizedString.Current = param.BaseField.Value.ToString(); return(localizedString); }
/// <summary> /// Set Values to Entity /// </summary> public virtual void ReadEntity() { foreach (PropertyInfo item in ListeChampsFormulaire()) { ConfigProperty ConfigProperty = new ConfigProperty(item, this.ConfigEntity); // Find Field BaseField baseField = null; if (ConfigProperty.EntryForm?.TabPage == true) { //Control[] recherche = this.tabControlForm.Controls.Find(item.Name, true); //if (recherche.Count() > 0) // baseField = (BaseField)recherche.First(); //else // throw new FieldNotExistInFormException(); } else { Control[] recherche = this.ConteneurFormulaire.Controls.Find(item.Name, true); if (recherche.Count() > 0) { baseField = (BaseField)recherche.First(); } else { throw new FieldNotExistInFormException(); } } // Params BaseFieldTraitementParam param = new BaseFieldTraitementParam(); param.ConfigProperty = ConfigProperty; param.Entity = this.Entity; param.BaseField = baseField; param.EntityBLO = this.EntityBLO; // Get FieldTraitement Type IFieldTraitements fieldTraitement = BaseFieldTraitement.CreateInstance(param.ConfigProperty); object value = fieldTraitement.ConvertValue(param); param.Entity.GetType().GetProperty(param.ConfigProperty.PropertyInfo.Name).SetValue(param.Entity, value); } }