Пример #1
0
 public ExportViewModel(Translator translator, Session session)
     : base(translator,
            translator.Get("Export.List.Title", "Title of the exports list page", "Exports"),
            session)
 {
 }
Пример #2
0
 public ExportListItemViewModel(Translator translator, Export export)
 {
     Id   = export.Id.Value.ToString();
     Name = export.Name.Value.EscapeHtml();
     PhraseDeleteConfirmationQuestion = translator.Get("Export.List.Delete.Confirm.Question", "Delete export confirmation question", "Do you really wish to delete export {0}?", export.GetText(translator)).EscapeHtml();
 }
Пример #3
0
 public NamedIntViewModel(Translator translator, TagUsage usage, bool selected)
     : this((int)usage, usage.Translate(translator), selected)
 {
 }
Пример #4
0
 public NamedIntViewModel(Translator translator, TagMode mode, bool selected)
     : this((int)mode, mode.Translate(translator), selected)
 {
 }
Пример #5
0
 public override string GetText(Translator translator)
 {
     return(_translate(Value, translator));
 }
Пример #6
0
 public NamedIntViewModel(Translator translator, PublicKeyType type, bool selected)
     : this((int)type, type.Translate(translator), selected)
 {
 }
Пример #7
0
 public NamedIntViewModel(Translator translator, PartAccess part, bool selected)
     : this((int)part, part.Translate(translator), selected)
 {
 }
Пример #8
0
 public UniversalDocument(Translator translator, Contact contact, string texTemplate)
 {
     _translator  = translator;
     _contact     = contact;
     _texTemplate = texTemplate;
 }
Пример #9
0
 public NamedIntViewModel(Translator translator, AddressCategory category, bool selected)
     : this((int)category, category.Translate(translator), selected)
 {
 }
Пример #10
0
 public NamedIntViewModel(Translator translator, MailingElementType type, bool selected)
     : this((int)type, type.Translate(translator), selected)
 {
 }
Пример #11
0
 public NamedIntViewModel(Translator translator, Language language, bool selected)
     : this((int)language, language.Translate(translator), selected)
 {
 }
Пример #12
0
 public NamedIntViewModel(Translator translator, ContactColumns columns, bool selected)
     : this((int)columns, columns.TranslateFlag(translator), selected)
 {
 }
Пример #13
0
 public PhraseViewModel(Translator translator, Session session)
     : base(translator, translator.Get("Phrase.List.Title", "Title of the phrase list page", "Countries"),
            session)
 {
 }
Пример #14
0
 public override string GetText(Translator translator)
 {
     throw new NotImplementedException();
 }
Пример #15
0
 public NamedIntViewModel(Translator translator, SubjectAccess subject, bool selected)
     : this((int)subject, subject.Translate(translator), selected)
 {
 }
Пример #16
0
 public override string GetText(Translator translator)
 {
     return(Name.Value);
 }
Пример #17
0
 public NamedIntViewModel(Translator translator, AccessRight right, bool selected)
     : this((int)right, right.Translate(translator), selected)
 {
 }
Пример #18
0
        public ContactListItemViewModel(IDatabase database, Translator translator, Contact contact, Session session, SearchSettings settings)
        {
            ShowOrganization  = settings.Columns.Value.HasFlag(ContactColumns.Organization);
            ShowName          = settings.Columns.Value.HasFlag(ContactColumns.Name);
            ShowStreet        = settings.Columns.Value.HasFlag(ContactColumns.Street);
            ShowPlace         = settings.Columns.Value.HasFlag(ContactColumns.Place);
            ShowState         = settings.Columns.Value.HasFlag(ContactColumns.State);
            ShowMail          = settings.Columns.Value.HasFlag(ContactColumns.Mail);
            ShowPhone         = settings.Columns.Value.HasFlag(ContactColumns.Phone);
            ShowSubscriptions = settings.Columns.Value.HasFlag(ContactColumns.Subscriptions);
            ShowTags          = settings.Columns.Value.HasFlag(ContactColumns.Tags);

            var contactAccess       = session.HasAccess(contact, PartAccess.Contact, AccessRight.Read);
            var subscriptionsAccess = session.HasAccess(contact, PartAccess.Subscription, AccessRight.Read);
            var tagsAccess          = session.HasAccess(contact, PartAccess.TagAssignments, AccessRight.Read);

            Id           = contact.Id.ToString();
            Organization = contact.Organization.Value.EscapeHtml();
            LastName     = contactAccess ?
                           contact.LastName.Value.EscapeHtml() :
                           string.Empty;
            FirstNames = contactAccess ?
                         contact.ShortTitleAndNames.EscapeHtml() :
                         string.Empty;
            MailAddress = contactAccess ?
                          contact.PrimaryMailAddress.EscapeHtml() :
                          string.Empty;
            PhoneNumber = contactAccess ?
                          contact.PrimaryPhoneNumber.EscapeHtml() :
                          string.Empty;
            Place = contactAccess ?
                    contact.PostalAddresses
                    .OrderBy(p => p.Precedence.Value)
                    .Select(p => p.PlaceWithPostalCode.EscapeHtml())
                    .FirstOrDefault() ?? string.Empty :
                    string.Empty;
            Street = contactAccess ?
                     contact.PostalAddresses
                     .OrderBy(p => p.Precedence.Value)
                     .Select(p => p.StreetOrPostOfficeBox.EscapeHtml())
                     .FirstOrDefault() ?? string.Empty :
                     string.Empty;
            State = contactAccess ?
                    contact.PostalAddresses
                    .OrderBy(p => p.Precedence.Value)
                    .Select(p => p.StateOrCountry(translator).EscapeHtml())
                    .FirstOrDefault() ?? string.Empty :
                    string.Empty;
            Subscriptions = subscriptionsAccess ?
                            string.Join(", ",
                                        contact.Subscriptions
                                        .Select(m => m.Feed.Value.GetText(translator))
                                        .OrderBy(m => m)) :
                            string.Empty;
            Tags = tagsAccess ?
                   string.Join(", ",
                               contact.TagAssignments
                               .Select(t => t.Tag.Value.GetText(translator))
                               .OrderBy(t => t)) :
                   string.Empty;
        }
Пример #19
0
 public abstract string GetText(Translator translator);