Ejemplo n.º 1
0
 public Feed(Guid id) : base(id)
 {
     Name     = new MultiLanguageStringField(this, "name");
     Parent   = new ForeignKeyField <Feed, Feed>(this, "parentid", true, p => p.Children);
     Children = new List <Feed>();
     Groups   = new List <Group>();
 }
Ejemplo n.º 2
0
        public void AssignMultiLanguageFree(string fieldName, MultiLanguageStringField field, List <MultiItemViewModel> multiItems)
        {
            if (multiItems != null)
            {
                var newValue = new MultiLanguageString();

                foreach (var item in multiItems)
                {
                    if (int.TryParse(item.Key, out int intLanguage) &&
                        !string.IsNullOrEmpty(item.Value))
                    {
                        var language = (Language)intLanguage;

                        if (IsValue(language))
                        {
                            newValue[language] = item.Value;
                        }
                    }
                }

                field.Value = newValue;
            }
            else
            {
                field.Value = new MultiLanguageString();
            }
        }
Ejemplo n.º 3
0
 public Group(Guid id) : base(id)
 {
     Feed             = new ForeignKeyField <Feed, Group>(this, "feedid", false, o => o.Groups);
     Name             = new MultiLanguageStringField(this, "name");
     MailName         = new MultiLanguageStringField(this, "mailname");
     MailAddress      = new MultiLanguageStringField(this, "mailaddress");
     GpgKeyId         = new StringField(this, "gpgkeyid", 256);
     GpgKeyPassphrase = new StringField(this, "gpgkeypassphrase", 256);
     Roles            = new List <Role>();
 }
Ejemplo n.º 4
0
        public void AssignMultiLanguageRequired(string fieldName, MultiLanguageStringField field, List <MultiItemViewModel> multiItems)
        {
            if (multiItems != null)
            {
                var newValue = new MultiLanguageString();

                foreach (var item in multiItems)
                {
                    if (int.TryParse(item.Key, out int intLanguage) &&
                        !string.IsNullOrEmpty(item.Value))
                    {
                        var language = (Language)intLanguage;

                        if (IsValue(language))
                        {
                            newValue[language] = item.Value;
                        }
                    }
                }

                if (string.IsNullOrEmpty(newValue.AnyValue))
                {
                    Add(fieldName,
                        "Validation.String.Required",
                        "Validation message on string required",
                        "Value required");
                    IsSuccess = false;
                }
                else
                {
                    field.Value = newValue;
                }
            }
            else
            {
                Add(fieldName,
                    "Validation.String.Required",
                    "Validation message on string required",
                    "Value required");
                IsSuccess = false;
            }
        }
Ejemplo n.º 5
0
 public Country(Guid id) : base(id)
 {
     Name = new MultiLanguageStringField(this, "name");
 }
Ejemplo n.º 6
0
 public Tag(Guid id) : base(id)
 {
     Name  = new MultiLanguageStringField(this, "name");
     Mode  = new EnumField <TagMode>(this, "mode", TagMode.None, TagModeExtensions.Translate);
     Usage = new EnumField <TagUsage>(this, "usage", TagUsage.None, TagUsageExtensions.Translate);
 }
Ejemplo n.º 7
0
 public Role(Guid id) : base(id)
 {
     Group       = new ForeignKeyField <Group, Role>(this, "groupid", false, g => g.Roles);
     Name        = new MultiLanguageStringField(this, "name");
     Permissions = new List <Permission>();
 }
Ejemplo n.º 8
0
 public MasterRole(Guid id) : base(id)
 {
     Name            = new MultiLanguageStringField(this, "name");
     RoleAssignments = new List <RoleAssignment>();
 }