public override IStatebleItem CreatePropertyState(IStateble owner, string propertyName, IPropertySettingsInfo information, string uiContext, System.Globalization.CultureInfo culture)
        {
            var args = new StatebleItemCreatorEventArgs();

            args.Identifier     = information.Identifier;
            args.PropertyName   = propertyName;
            args.CopyValue      = information.CopyValue;
            args.ReloadSettings = information.ReloadSettings;
            var labelInfo = GetLabel(owner.Type, uiContext, propertyName);

            if (labelInfo != null)
            {
                args.Label = labelInfo.Label;
            }
            else
            {
                args.Label = new PropertyLabel(propertyName.GetFormatter(), null);
            }
            var result             = new Lazy <IStatebleItem>(() => CreateStatebleItem(owner, args));
            var aggregateValidator = new Validators.AggregateValidator();

            if (information.InputRulesGroupId.HasValue)
            {
                var rules = Settings.GetRules(information.InputRulesGroupId.Value, uiContext);
                if (rules != null)
                {
                    args.Options = rules.Options;
                    if ((args.Options & InputRulesOptions.Necessary) == InputRulesOptions.Necessary)
                    {
                        aggregateValidator.Add(ValidationManager.NecessaryValidator);
                    }
                    if (!string.IsNullOrEmpty(rules.Label))
                    {
                        args.Label = new PropertyLabel(rules.Label.GetFormatter(), rules.Label.GetFormatter());
                    }
                    if (rules.ParseId.HasValue)
                    {
                        args.Parse = CreateParse(rules.ParseId.Value);
                    }
                    if (rules.InputValidateUid.HasValue)
                    {
                        InsertValidate(result.Value, aggregateValidator, rules.InputValidateUid.Value);
                    }
                }
            }
            if ((information.ValidationId.HasValue) && (information.ValidationId > 0))
            {
                var validator = GetValidator(information.ValidationId.Value, culture);
                if (validator != null)
                {
                    aggregateValidator.Add(validator);
                }
            }
            if (aggregateValidator.Count > 0)
            {
                result.Value.Validation = aggregateValidator;
            }
            return(result.Value);
        }
Пример #2
0
 /// <summary>
 /// Construtor padrão.
 /// </summary>
 /// <param name="owner">Dono da propriedade.</param>
 /// <param name="propertyName">Nome da propriedade</param>
 public BusinessEntityPropertyState(IStateble owner, string propertyName)
 {
     owner.Require("owner").NotNull();
     propertyName.Require("propertyName").NotNull().NotEmpty();
     _charCase               = CharacterCase.Undefined;
     _owner                  = owner;
     _propertyName           = propertyName;
     _owner.PropertyChanged += OwnerPropertyChanged;
     _otherAttributes        = new Dictionary <string, object>();
     _isConfigured           = false;
 }
Пример #3
0
 /// <summary>
 /// Carrega o estado da propriedade.
 /// </summary>
 /// <param name="owner">Proprietário do item.</param>
 /// <param name="propertyName">Nome da propriedade</param>
 /// <param name="information">Informações de estado da propriedade</param>
 /// <param name="uiContext">Identificador do contexto de usuário</param>
 /// <param name="culture">Cultura que será usada na criação.</param>
 /// <returns></returns>
 public IStatebleItem CreatePropertyState(IStateble owner, string propertyName, IPropertySettingsInfo information, string uiContext, System.Globalization.CultureInfo culture)
 {
     return(null);
 }
 /// <summary>
 /// Cria uma item com estado.
 /// </summary>
 /// <param name="owner"></param>
 /// <param name="e"></param>
 /// <returns></returns>
 protected abstract IStatebleItem CreateStatebleItem(IStateble owner, StatebleItemCreatorEventArgs e);
Пример #5
0
 /// <summary>
 /// Carrega o estado da propriedade.
 /// </summary>
 /// <param name="owner">Proprietário do item que será criado.</param>
 /// <param name="propertyName">Nome da propriedade</param>
 /// <param name="information">Informações de estado da propriedade</param>
 /// <param name="uiContext">Identificador do contexto de usuário</param>
 /// <param name="culture">Cultura que será usada na criação.</param>
 /// <returns></returns>
 public virtual IStatebleItem CreatePropertyState(IStateble owner, string propertyName, IPropertySettingsInfo information, string uiContext, System.Globalization.CultureInfo culture)
 {
     throw new NotImplementedException();
 }