public void Describe(BindingDescribeContext context) {
     context.For<EnumerationField>()
         .Binding("SelectedValues", (contentItem, field, s) => {
             var items = (s ?? "").Split(new[] {',', ';'}, StringSplitOptions.RemoveEmptyEntries);
             field.SelectedValues = items;
         });
 }
Exemplo n.º 2
0
 public void Describe(BindingDescribeContext context)
 {
     context.For <EnumerationField>()
     .Binding("SelectedValues", (contentItem, field, s) => {
         var items            = (s ?? "").Split(new[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries);
         field.SelectedValues = items;
     });
 }
Exemplo n.º 3
0
        public IEnumerable<BindingContext> DescribeBindingContexts() {
            foreach (var provider in _providers) {
                var context = new BindingDescribeContext();
                provider.Describe(context);

                foreach (var description in context.Describe()) {
                    yield return description;
                }
            }
        }
 public void Describe(BindingDescribeContext context) {
     context.For<UserPart>()
         .Binding("UserName", (contentItem, part, s) => {
             part.UserName = s;
             part.NormalizedUserName = s.ToLowerInvariant();
         })
         .Binding("Email", (contentItem, part, s) => part.Email = s)
         .Binding("Password", (contentItem, part, s) => {
             part.HashAlgorithm = "SHA1";
             _membershipService.SetPassword(part, s);
         });
 }
        public void Describe(BindingDescribeContext context) {
            context.For<TaxonomyField>()
                .Binding("Terms", (contentItem, field, s) => {
                    var selectedTerms = 
                        s.Split(new []{',', ';'}, StringSplitOptions.RemoveEmptyEntries)
                        .Select(XmlHelper.Parse<int?>)
                        .Select(t => GetTerm(t.GetValueOrDefault()))
                        .Where(t => t != null).ToList();

                    _taxonomyService.UpdateTerms(contentItem, selectedTerms, field.Name);
                });
        }
        public void Describe(BindingDescribeContext context)
        {
            context.For <TaxonomyField>()
            .Binding("Terms", (contentItem, field, s) => {
                var selectedTerms =
                    s.Split(new [] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries)
                    .Select(XmlHelper.Parse <int?>)
                    .Select(t => GetTerm(t.GetValueOrDefault()))
                    .Where(t => t != null).ToList();

                _taxonomyService.UpdateTerms(contentItem, selectedTerms, field.Name);
            });
        }
Exemplo n.º 7
0
 public void Describe(BindingDescribeContext context)
 {
     context.For <UserPart>()
     .Binding("UserName", (contentItem, part, s) => {
         part.UserName           = s;
         part.NormalizedUserName = s.ToLowerInvariant();
     })
     .Binding("Email", (contentItem, part, s) => part.Email = s)
     .Binding("Password", (contentItem, part, s) => {
         part.HashAlgorithm = "SHA1";
         _membershipService.SetPassword(part, s);
     });
 }
Exemplo n.º 8
0
        public IEnumerable <BindingContext> DescribeBindingContexts()
        {
            foreach (var provider in _providers)
            {
                var context = new BindingDescribeContext();
                provider.Describe(context);

                foreach (var description in context.Describe())
                {
                    yield return(description);
                }
            }
        }
Exemplo n.º 9
0
        public void Describe(BindingDescribeContext context) {
            context.For<EnumerationField>()
                .Binding("SelectedValues", (contentItem, field, s) => {
                    if (String.IsNullOrWhiteSpace(s)) {
                        field.Value = "";
                        return;
                    }

                    var separators = new[] {',', ';'};
                    var hasMultipleValues = s.IndexOfAny(separators) >= 0;

                    if (hasMultipleValues)
                        field.SelectedValues = s.Split(separators, StringSplitOptions.RemoveEmptyEntries);
                    else {
                        field.Value = s;
                    }
                });
        }
Exemplo n.º 10
0
        public void Describe(BindingDescribeContext context)
        {
            context.For <EnumerationField>()
            .Binding("SelectedValues", (contentItem, field, s) => {
                if (String.IsNullOrWhiteSpace(s))
                {
                    field.Value = "";
                    return;
                }

                var separators        = new[] { ',', ';' };
                var hasMultipleValues = s.IndexOfAny(separators) >= 0;

                if (hasMultipleValues)
                {
                    field.SelectedValues = s.Split(separators, StringSplitOptions.RemoveEmptyEntries);
                }
                else
                {
                    field.Value = s;
                }
            });
        }
Exemplo n.º 11
0
 public void Describe(BindingDescribeContext context) {
     context.For<TitlePart>()
         .Binding("Title", (contentItem, part, s) => part.Title = s);
 }
 public void Describe(BindingDescribeContext context)
 {
     context.For <TextField>()
     .Binding("Text", (contentItem, field, s) => field.Value = s);
 }
Exemplo n.º 13
0
 public void Describe(BindingDescribeContext context) {
     context.For<InputField>()
         .Binding("Text", (contentItem, field, s) => field.Value = s);
 }
 public void Describe(BindingDescribeContext context)
 {
     context.For <BooleanField>()
     .Binding("Value", (contentItem, field, s) => field.Value = IsTrueish(s));
 }
 public void Describe(BindingDescribeContext context) {
     context.For<BooleanField>()
         .Binding("Value", (contentItem, field, s) => field.Value = IsTrueish(s));
 }
 public void Describe(BindingDescribeContext context)
 {
     context.For <ImageFileField>()
     .Binding("Text", (contentItem, field, s) => field.FilePath = s);
 }
Exemplo n.º 17
0
 public void Describe(BindingDescribeContext context) {
     context.For<BodyPart>()
         .Binding("Text", (contentItem, part, s) => part.Text = s);
 }
 public void Describe(BindingDescribeContext context)
 {
     context.For <NumericField>()
     .Binding("Value", (contentItem, field, s) => field.Value = XmlHelper.Parse <decimal>(s));
 }
Exemplo n.º 19
0
 public void Describe(BindingDescribeContext context)
 {
     context.For <TitlePart>()
     .Binding("Title", (contentItem, part, s) => part.Title = s);
 }
 public void Describe(BindingDescribeContext context) {
     context.For<ImageFileField>()
         .Binding("Text", (contentItem, field, s) => field.FilePath = s);
 }
Exemplo n.º 21
0
 public void Describe(BindingDescribeContext context)
 {
     context.For <BodyPart>()
     .Binding("Text", (contentItem, part, s) => part.Text = s);
 }