public SearchSettings(Guid id) : base(id) { User = new ForeignKeyField <User, SearchSettings>(this, "userid", false, null); Name = new StringField(this, "name", 256); FilterSubscription = new ForeignKeyField <Feed, SearchSettings>(this, "filtersubscription", true, null); FilterTag = new ForeignKeyField <Tag, SearchSettings>(this, "filtertag", true, null); FilterText = new StringField(this, "filtertext", 256); ItemsPerPage = new Field <int>(this, "itemsperpage", 20); CurrentPage = new Field <int>(this, "currentpage", 0); Columns = new EnumField <ContactColumns>(this, "columns", ContactColumns.Default, ContactColumnsExtensions.TranslateFlag); }
public Contact(Guid id) : base(id) { Organization = new StringField(this, "username", 32); Title = new StringField(this, "title", 256); FirstName = new StringField(this, "firstname", 256); MiddleNames = new StringField(this, "middlenames", 256); LastName = new StringField(this, "lastname", 256); BirthDate = new Field <DateTime>(this, "birthdate", new DateTime(1850, 1, 1)); Language = new EnumField <Language>(this, "language", Publicus.Language.English, LanguageExtensions.Translate); Deleted = new Field <bool>(this, "deleted", false); PostalAddresses = new List <PostalAddress>(); ServiceAddresses = new List <ServiceAddress>(); Subscriptions = new List <Subscription>(); TagAssignments = new List <TagAssignment>(); PublicKeys = new List <PublicKey>(); }
public Mailing(Guid id) : base(id) { Title = new StringField(this, "title", 256); RecipientFeed = new ForeignKeyField <Feed, Mailing>(this, "recipientfeedid", false, null); RecipientTag = new ForeignKeyField <Tag, Mailing>(this, "recipienttagid", true, null); RecipientLanguage = new EnumNullField <Language>(this, "recipientlanguage", LanguageExtensions.Translate); Sender = new ForeignKeyField <Group, Mailing>(this, "senderid", false, null); Creator = new ForeignKeyField <User, Mailing>(this, "creatorid", false, null); Header = new ForeignKeyField <MailingElement, Mailing>(this, "headerid", true, null); Footer = new ForeignKeyField <MailingElement, Mailing>(this, "footerid", true, null); Subject = new StringField(this, "subject", 256); HtmlText = new StringField(this, "htmltext", 33554432, AllowStringType.SafeHtml); PlainText = new StringField(this, "plaintext", 33554432, AllowStringType.SafeHtml); CreatedDate = new Field <DateTime>(this, "createddate", DateTime.UtcNow); SendingDate = new FieldNull <DateTime>(this, "sendingdate"); SentDate = new FieldNull <DateTime>(this, "sentdate"); Status = new EnumField <MailingStatus>(this, "status", MailingStatus.New, MailingStatusExtensions.Translate); }
public void AssignFlagIntString <T>(string fieldName, EnumField <T> field, T flag, string stringValue) where T : struct, IConvertible { switch (stringValue) { case "0": field.Value = (T)(object)((int)(object)field.Value & ~(int)(object)flag); break; case "1": field.Value = (T)(object)((int)(object)field.Value | (int)(object)flag); break; default: IsSuccess = false; Add(fieldName, "Validation.Flag.Invalid", "Validation message on enum invalid", "Invalid value"); break; } }
public void AssignEnumIntString <T>(string fieldName, EnumField <T> field, string stringValue) where T : struct, IConvertible { if (!string.IsNullOrEmpty(stringValue)) { if (int.TryParse(stringValue, out int intValue)) { T value = (T)(object)intValue; if (IsValue <T>(value)) { field.Value = value; } else { IsSuccess = false; Add(fieldName, "Validation.Enum.Invalid", "Validation message on enum invalid", "Invalid value"); } } else { IsSuccess = false; Add(fieldName, "Validation.Enum.Invalid", "Validation message on enum invalid", "Invalid value"); } } else { Add(fieldName, "Validation.Enum.Required", "Validation message on enum required", "Choice required"); IsSuccess = false; } }
public PhraseTranslation(Guid id) : base(id) { Phrase = new ForeignKeyField <Phrase, PhraseTranslation>(this, "phraseid", false, p => p.Translations); Language = new EnumField <Language>(this, "language", Publicus.Language.English, LanguageExtensions.Translate); Text = new StringField(this, "text", 4096, AllowStringType.ParameterizedText); }
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); }
public User(Guid id) : base(id) { UserName = new StringField(this, "username", 32); Language = new EnumField <Language>(this, "language", Publicus.Language.English, LanguageExtensions.Translate); }