Beispiel #1
0
        public ActionResult Subscribe(NewsletterSubscribeViewModel model)
        {
            if (!ModelState.IsValid)
            {
                // If the subscription data is not valid, displays the subscription form with error messages
                return(View(model));
            }

            // Gets the default Kentico contact provider
            IContactProvider contactProvider = Service <IContactProvider> .Entry();

            // Either gets an existing contact by email or creates a new contact object with the given email
            ContactInfo contact = contactProvider.GetContactForSubscribing(model.Email);

            // Gets a newsletter
            // Fill in the code name of your newsletter object in Kentico
            NewsletterInfo newsletter = NewsletterInfoProvider.GetNewsletterInfo("SampleNewsletter", SiteContext.CurrentSiteID);

            // Prepares settings that configure the subscription behavior
            var subscriptionSettings = new NewsletterSubscriptionSettings()
            {
                RemoveAlsoUnsubscriptionFromAllNewsletters = true, // Subscription removes the given email address from the global opt-out list for all marketing emails (if present)
                SendConfirmationEmail = true,                      // Allows sending of confirmation emails for the subscription
                AllowOptIn            = true                       // Allows handling of double opt-in subscription for newsletters that have it enabled
            };

            // Subscribes the contact with the specified email address to the given newsletter
            SubscriptionService.Subscribe(contact, newsletter, subscriptionSettings);

            // Passes information to the view, indicating whether the newsletter requires double opt-in for subscription
            model.RequireDoubleOptIn = newsletter.NewsletterEnableOptIn;

            // Displays a view to inform the user that the subscription was successful
            return(View("SubscribeSuccess", model));
        }
        public void TryDeleteDocumentItem()
        {
            var id = "13F0CBA5-C2E7-4251-86BE-59CC01AD49FD";
            var identificationNumber = "4DDE638F-7632-4A77-8FE8-7B62C06AE154"; // "8dfdd485-68f2-48cd-883b-cc0f43e94fd2";
            var typeId = "A07C5CE3-659C-4FCC-A60B-5CCB6E26B8A4";               // "1b453a59-b318-4e14-8684-83f0b78fa8a1";

            Debug.WriteLine(identificationNumber);
            IContactProvider p = ContactProviderFactory.CreateProvider();
            var savedDocument  = p.SaveDocumentItem(new DocumentItem {
                Id = id, IdentificationNumber = identificationNumber, TypeId = typeId, IssueDate = DateTime.Now
            });

            Debug.WriteLine(savedDocument.ToString());


            using (TransactionScope scope = new TransactionScope())
            {
                p.DeleteDocumentItem(id);
            }
            var result1 = p.GetDocumentItem(id);

            Assert.IsNotNull(result1);


            using (TransactionScope scope = new TransactionScope())
            {
                var result2 = p.DeleteDocumentItem(id);
                scope.Complete();
            }
            var result3 = p.GetDocumentItem(id);

            Assert.IsNull(result3);
        }
Beispiel #3
0
 protected ContactPicker(IContactProvider <TContact> provider, string name, int requestCode, Type pickerActivityType)
     : base(provider)
 {
     Name               = name;
     RequestCode        = requestCode;
     PickerActivityType = pickerActivityType;
 }
Beispiel #4
0
 public ContactListRepository()
 {
     _listManager             = (IContactListProvider)ServiceLocator.ServiceProvider.GetService(typeof(IContactListProvider));
     _contactProvider         = (IContactProvider)ServiceLocator.ServiceProvider.GetService(typeof(IContactProvider));
     _subscriptionService     = (ISubscriptionService)ServiceLocator.ServiceProvider.GetService(typeof(ISubscriptionService));
     _recipientManagerFactory = (IRecipientManagerFactory)ServiceLocator.ServiceProvider.GetService(typeof(IRecipientManagerFactory));
     _contactListRepository   = (IRepository <ContactListModel>)ServiceLocator.ServiceProvider.GetService(typeof(IRepository <ContactListModel>));
 }
 public SubscriptionController(ISubscriptionService subscriptionService, ISubscriptionApprovalService subscriptionApprovalService, IUnsubscriptionProvider unsubscriptionProvider, IEmailHashValidator emailHashValidator, IContactProvider contactProvider)
 {
     mSubscriptionService         = subscriptionService;
     mSubscriptionApprovalService = subscriptionApprovalService;
     mUnsubscriptionProvider      = unsubscriptionProvider;
     mEmailHashValidator          = emailHashValidator;
     mContactProvider             = contactProvider;
 }
Beispiel #6
0
 public void SetUp()
 {
     Provider = A.Fake <IContactProvider <Contact> >();
     A.CallTo(() => Provider.GetContactsAsync())
     .ReturnsNextFromSequence(
         Task.FromResult <IEnumerable <Contact> >(FirstProvision),
         Task.FromResult <IEnumerable <Contact> >(SecondProvision));
 }
Beispiel #7
0
 public MainPageViewModel(INavigationService navigationService, IContactProvider contactProvider)
     : base(navigationService)
 {
     Title = "Main Page";
     this.contactProvider = contactProvider;
     Contacts             = contactProvider.GetContactList();
     // Contacts = new ObservableCollection<Person>(Contacts.OrderBy(p => p.Name).ToList());
     NavigateToDetailsPageCommand = new DelegateCommand <Person>(NavigateToDetailsPage);
 }
        public ActionResult Index(ContactView contactData)
        {
            if (ModelState.IsValid)
            {
                this.viewData   = contactData;
                contactProvider = ProviderFactory.GetProvider(contactData.Provider);

                bool       all    = contactData.SelectedAll;
                List <int> indexs = new List <int>();

                if (!string.IsNullOrEmpty(contactData.SelectedIndexes))
                {
                    string[] selected = contactData.SelectedIndexes.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                    foreach (string index in selected)
                    {
                        indexs.Add(Convert.ToInt32(index));
                    }
                }

                if (!all && indexs.Count == 0)
                {
                    ModelState.AddModelError("Comments", "Please select at least one contact to invite.");
                }
                else
                {
                    IList <IContact> selectedContacts = new List <IContact>();
                    if (Session["Contacts_" + contactData.Provider] != null)
                    {
                        selectedContacts = GetContacts((IList <IContact>)Session["Contacts_" + contactData.Provider], new ContactProvider.Selection(all, indexs));
                    }
                    else
                    {
                        selectedContacts = contactProvider.GetContacts(new ContactProvider.Selection(all, indexs));
                    }

                    FriendProvider fp = friendProviderRepository.GetByName(contactProvider.Name);

                    try
                    {
                        inviteContactsService.InviteUsers(this.ProxyLoggedUser, contactData.Comments, fp, TransformContacts(selectedContacts), Convert.ToBoolean(ConfigurationManager.AppSettings["IsInBeta"]));
                        Session.Remove("Contacts_" + contactData.Provider);
                        Session["NewFriendsAdded"] = true;
                        return(RedirectToAction("Index", "Friend"));
                    }
                    catch (LimitOfFriendsExceededException ex)
                    {
                        ModelState.AddModelError("Comments", ex.Message);
                    }
                }
            }

            LoadViewData(contactData.Provider);

            return(View("Index", viewData));
        }
 public NewsletterSubscriptionController()
 {
     // Initializes instances of services required to manage subscriptions and unsubscriptions for all types of email feeds
     // For real-world projects, we recommend using a dependency injection container to initialize service instances
     subscriptionService         = Service.Resolve <ISubscriptionService>();
     unsubscriptionProvider      = Service.Resolve <IUnsubscriptionProvider>();
     subscriptionContactProvider = Service.Resolve <IContactProvider>();
     emailHashValidatorService   = Service.Resolve <IEmailHashValidator>();
     approvalService             = Service.Resolve <ISubscriptionApprovalService>();
 }
 public ContactFormController(IServiceProvider serviceProvider)
 {
     _logger            = serviceProvider.GetService <ILogger <ContactFormController> >();
     _contactProvider   = serviceProvider.GetService <IContactProvider>();
     _scopeService      = serviceProvider.GetService <IScopeService>();
     _moduleManager     = serviceProvider.GetService <IModuleManager>();
     _userProvider      = serviceProvider.GetService <IUserRepository>();
     _emailsender       = serviceProvider.GetService <IEmailSender>();
     _viewRenderService = serviceProvider.GetService <IViewRenderService>();
 }
 /// <summary>
 /// Creates an instance of <see cref="NewsletterSubscriptionWidgetController"/> class.
 /// </summary>
 /// <param name="subscriptionService">Service for newsletter subscription.</param>
 /// <param name="contactProvider">Provider for contact retrieving.</param>
 /// <param name="newsletterInfoProvider">Provider for <see cref="NewsletterInfo"/> management.</param>
 public NewsletterSubscriptionWidgetController(
     ISubscriptionService subscriptionService,
     IContactProvider contactProvider,
     INewsletterInfoProvider newsletterInfoProvider,
     IComponentPropertiesRetriever componentPropertiesRetriever)
 {
     this.subscriptionService          = subscriptionService;
     this.contactProvider              = contactProvider;
     this.newsletterInfoProvider       = newsletterInfoProvider;
     this.componentPropertiesRetriever = componentPropertiesRetriever;
 }
        /// <summary>构造函数</summary>
        public ContactService()
        {
            this.configuration = ContactConfigurationView.Instance.Configuration;

            // 创建对象构建器(Spring.NET)
            string springObjectFile = this.configuration.Keys["SpringObjectFile"].Value;

            SpringObjectBuilder objectBuilder = SpringObjectBuilder.Create(ContactConfiguration.ApplicationName, springObjectFile);

            // 创建数据提供器
            this.provider = objectBuilder.GetObject <IContactProvider>(typeof(IContactProvider));
        }
        /// <summary>
        /// Filters the user's contact list repeatedly based on the user's input to determine the right contact and phone number to call.
        /// </summary>
        /// <param name="state">The current conversation state. This will be modified.</param>
        /// <param name="contactProvider">The provider for the user's contact list. This may be null if the contact list is not to be used.</param>
        /// <returns>The first boolean indicates whether filtering was actually performed. (In some cases, no filtering is necessary.)
        /// The second boolean indicates whether any of the contacts has a phone number whose type matches the requested type.</returns>
        public async Task <(bool, bool)> FilterAsync(PhoneSkillState state, IContactProvider contactProvider)
        {
            var isFiltered = false;

            var searchQuery = string.Empty;

            if (state.LuisResult.Entities.contactName != null)
            {
                searchQuery = string.Join(" ", state.LuisResult.Entities.contactName);
            }

            if (searchQuery.Any() && !(searchQuery == state.ContactResult.SearchQuery && state.ContactResult.Matches.Any()))
            {
                IList <ContactCandidate> contacts;
                if (state.ContactResult.Matches.Any())
                {
                    contacts = state.ContactResult.Matches;
                }
                else if (contactProvider != null)
                {
                    contacts = await contactProvider.GetContactsAsync();
                }
                else
                {
                    contacts = new List <ContactCandidate>();
                }

                if (contacts.Any())
                {
                    // TODO Adjust max number of returned contacts?
                    var matcher = new EnContactMatcher <ContactCandidate>(contacts, ExtractContactFields);
                    var matches = matcher.FindByName(searchQuery);

                    if (!state.ContactResult.Matches.Any() || matches.Any())
                    {
                        isFiltered = isFiltered || matches.Count != state.ContactResult.Matches.Count;
                        state.ContactResult.SearchQuery = searchQuery;
                        state.ContactResult.Matches     = matches;
                    }
                }
            }

            SetRequestedPhoneNumberType(state);
            var hasPhoneNumberOfRequestedType = false;

            (isFiltered, hasPhoneNumberOfRequestedType) = FilterPhoneNumbersByType(state, isFiltered);

            SetPhoneNumber(state);

            return(isFiltered, hasPhoneNumberOfRequestedType);
        }
Beispiel #14
0
 /// <summary>
 /// Creates an instance of <see cref="NewsletterSubscriptionWidgetController"/> class.
 /// </summary>
 /// <param name="subscriptionService">Service for newsletter subscription.</param>
 /// <param name="contactProvider">Provider for contact retrieving.</param>
 /// <param name="newsletterInfoProvider">Provider for <see cref="NewsletterInfo"/> management.</param>
 public NewsletterSubscriptionWidgetController(
     ApplicationUserManager <ApplicationUser> userManager,
     ISubscriptionService subscriptionService,
     IContactProvider contactProvider,
     INewsletterInfoProvider newsletterInfoProvider,
     IComponentPropertiesRetriever componentPropertiesRetriever,
     IStringLocalizer <NewsletterSubscriptionWidgetController> localizer)
 {
     this.userManager                  = userManager;
     this.subscriptionService          = subscriptionService;
     this.contactProvider              = contactProvider;
     this.newsletterInfoProvider       = newsletterInfoProvider;
     this.componentPropertiesRetriever = componentPropertiesRetriever;
     this.localizer = localizer;
 }
Beispiel #15
0
        public void TryGenerateDefaultData()
        {
            Debug.WriteLine("TryGenerateDefaultData started on " + DateTime.Now);
            _logger.Info("TryGenerateDefaultData started on " + DateTime.Now);
            IContactProvider p      = ContactProviderFactory.CreateProvider();
            Result           result = p.GenerateDefaultData();

            if (result.HasErrors)
            {
                Debug.WriteLine(string.Format("Contact.GenerateDefaultData() reported {0} errors", result.ErrorCount));
                _logger.ErrorFormat("GenerateDefaultData reported {0} errors", result.ErrorCount);
            }
            Assert.IsFalse(result.HasErrors, "GenerateDefaultData() generated errors");
            Debug.WriteLine("TryGenerateDefaultData finished on " + DateTime.Now);
        }
    protected DataSet ContactGrid_OnDataReload(string completeWhere, string currentOrder, int currentTopN, string columns, int currentOffset, int currentPageSize, ref int totalRecords)
    {
        try
        {
            ICredentialProvider credentialProvider = new UserCredentialProvider(MembershipContext.AuthenticatedUser);

            DataComClient        client   = DataComHelper.CreateClient();
            IContactProvider     provider = DataComHelper.CreateContactProvider(client, credentialProvider.GetCredential());
            ContactSearchResults response = provider.SearchContacts(CurrentContactFilter, currentOffset / currentPageSize, currentPageSize);
            DataTable            table    = new DataTable("Contacts");
            table.Columns.Add("ContactId", typeof(long));
            table.Columns.Add("FirstName", typeof(string));
            table.Columns.Add("LastName", typeof(string));
            table.Columns.Add("CompanyName", typeof(string));
            foreach (Contact contact in response.Contacts)
            {
                DataRow row = table.NewRow();
                row["ContactId"]   = contact.ContactId;
                row["FirstName"]   = contact.FirstName;
                row["LastName"]    = contact.LastName;
                row["CompanyName"] = contact.CompanyName;
                table.Rows.Add(row);
                if (contact.ContactId == CurrentContactId)
                {
                    CurrentContact = contact;
                }
            }
            DataSet dataSet = new DataSet();
            dataSet.Tables.Add(table);
            int maxHitCount = currentPageSize * MAX_PAGE_COUNT;
            int hitCount    = (int)response.TotalHits;
            if (hitCount > maxHitCount)
            {
                hitCount = maxHitCount;
                ShowWarning(GetString("datacom.toomanycontacts"), null, null);
            }
            totalRecords = hitCount;
            return(dataSet);
        }
        catch (Exception exception)
        {
            HandleException(exception);
        }
        totalRecords = 0;

        return(null);
    }
 public NewsletterSubscriptionController(ISubscriptionService subscriptionService,
                                         IUnsubscriptionProvider unsubscriptionProvider,
                                         IContactProvider contactProvider,
                                         IEmailHashValidator emailHashValidator,
                                         ISubscriptionApprovalService subscriptionApprovalService,
                                         IIssueInfoProvider issueInfoProvider,
                                         INewsletterInfoProvider newsletterInfoProvider,
                                         ISiteService siteService)
 {
     this.subscriptionService         = subscriptionService;
     this.unsubscriptionProvider      = unsubscriptionProvider;
     this.contactProvider             = contactProvider;
     this.emailHashValidator          = emailHashValidator;
     this.subscriptionApprovalService = subscriptionApprovalService;
     this.issueInfoProvider           = issueInfoProvider;
     this.newsletterInfoProvider      = newsletterInfoProvider;
     this.siteService = siteService;
 }
Beispiel #18
0
        public MainView(
            IInteractionContext interactionContext,
            IMessagingServiceManager messagingService, 
            IContactProvider contactRepo)
        {
            if(interactionContext == null)
                throw new ArgumentNullException("interactionContext");
            if(messagingService == null)
                throw new ArgumentNullException("messagingService");

            _CurrentThread = Thread.CurrentThread;
            _CurrentDispatcher = Dispatcher.CurrentDispatcher;

            _ContactRepo = contactRepo;
            _MessagingService = messagingService;

            PropertyChanged += MainView_PropertyChanged;
            _MessagingService.CredentialsRequested += messagingService_CredentialsRequested;
            _MessagingService.AuthorizationFailed += _MessagingService_AuthorizationFailed;
            _MessagingService.MessagesReceived += _MessagingService_MessagesReceived;

            Messages = new ObservableCollection<UiMessage>();

            Interactions = interactionContext;

            SendMessage = new SendMessageCommand(
                () =>
                {
                    _MessagingService.SendMessage(Recipient, MessageToSend);
                    Recipient = "";
                    MessageToSend = "";
                    if(ReceiveMessage.CanExecute(null))
                        ReceiveMessage.Execute(null);
                });

            ReceiveMessage = new ReceiveMessagesCommand(
                () =>
                    {
                        var result = _MessagingService.GetMessages();

                        _UpdateUIWithMessages(result);
                    });
        }
Beispiel #19
0
        public void LoadViewData(string providerCode)
        {
            contactProvider = ProviderFactory.GetProvider(providerCode);
            int totalCount = 0;

            // Find all friends
            IDictionary <string, object> propertyValues = new Dictionary <string, object>();

            propertyValues.Add("BasicUser", this.ProxyLoggedUser);
            IList <Friend> currentFriends = friendRepository.FindAll(propertyValues);

            IList <IContact> finalContacts = null;

            if (Session["Contacts_" + providerCode] == null)
            {
                IList <IContact> contacts = contactProvider.GetContacts(0, 0, out totalCount);

                // Make sure the user is not a friend already
                finalContacts = (from c in contacts
                                 where !(from f in currentFriends select f.User.EmailAddress).Contains(c.Email.ToLower())
                                 select c).ToList <IContact>();

                Session["Contacts_" + providerCode] = finalContacts;
            }
            else
            {
                finalContacts = (IList <IContact>)Session["Contacts_" + providerCode];
                totalCount    = finalContacts.Count;
            }
            propertyValues = new Dictionary <string, object>();
            propertyValues.Add("BasicUser", this.ProxyLoggedUser);

            viewData.Contacts   = finalContacts;
            viewData.Provider   = providerCode;
            viewData.TotalCount = totalCount;

            FriendProvider friendProvider = friendProviderRepository.GetByName(contactProvider.Name);

            viewData.ProviderImg  = friendProvider.ImageUri;
            viewData.ProviderName = friendProvider.Name;
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        ContactInfo contact = EditedObject as ContactInfo;

        AuthorizeReadRequest(contact);
        IDataComConfiguration configuration = DataComHelper.GetConfiguration(ContactSiteID);

        if (configuration.GetToken() == null)
        {
            ShowWarning(GetString("datacom.notoken"), null, null);
        }
        else
        {
            try
            {
                if (!String.IsNullOrEmpty(ContactHiddenField.Value))
                {
                    JsonSerializer serializer   = new JsonSerializer();
                    Contact        freshContact = serializer.Unserialize <Contact>(ContactHiddenField.Value);
                    if (Contact == null)
                    {
                        ContactForm.MergeHint = true;
                    }
                    else
                    {
                        if (Contact.ContactId != freshContact.ContactId)
                        {
                            ContactForm.MergeHint = true;
                        }
                        else if (String.IsNullOrEmpty(Contact.Phone) && String.IsNullOrEmpty(Contact.Email) && (!String.IsNullOrEmpty(freshContact.Phone) || !String.IsNullOrEmpty(freshContact.Email)))
                        {
                            ContactForm.MergeHint           = true;
                            ContactForm.MergeHintAttributes = new string[] { "Phone", "Email" };
                        }
                    }
                    Contact = freshContact;
                }
                if (Contact == null)
                {
                    ContactInfo      contactInfo = EditedObject as ContactInfo;
                    ContactIdentity  identity    = DataComHelper.CreateContactIdentity(contactInfo);
                    DataComClient    client      = DataComHelper.CreateClient(configuration);
                    IContactProvider provider    = DataComHelper.CreateContactProvider(client, configuration);
                    ContactFinder    finder      = DataComHelper.CreateContactFinder(provider);
                    ContactFilter    filterHint  = null;
                    Contact          match       = finder.Find(identity, out filterHint);
                    if (match != null)
                    {
                        ShowInformation(GetString("datacom.contactmatch"));
                        Contact = match;
                        ContactForm.MergeHint = true;
                    }
                    else
                    {
                        ShowInformation(GetString("datacom.nocontactmatch"));
                    }
                    Filter = filterHint;
                }
                InitializeHeaderActions();
                InitializeDataComForm();
            }
            catch (Exception exception)
            {
                HandleException(exception);
            }
        }
    }
Beispiel #21
0
 public static IContactProvider Create(this IContactProvider ignore)
 {
     return(ignore.Create((null as IServiceCollection).Create()));
 }
Beispiel #22
0
        public void TryGenerate()
        {
            IContactProvider p = ContactProviderFactory.CreateProvider();

            p.GenerateDefaultData();
        }
 public ContactService(IContactProvider contactProvider)
 {
     _contactProvider = contactProvider;
 }
Beispiel #24
0
 public PhoneContactPicker(IContactProvider <PhoneContact> provider, string name, int requestCode,
                           Type activityType)
     : base(provider, name, requestCode, activityType)
 {
 }
Beispiel #25
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Do not check login if it's a CallBack - search button was pressed (see CreateSearchActionClientScript method)
        if (!RequestHelper.IsCallback())
        {
            bool validCredential = false;
            try
            {
                validCredential = CheckCredential();
            }
            catch (Exception ex)
            {
                HandleException(ex);
                return;
            }

            if (!validCredential)
            {
                URLHelper.Redirect(UrlResolver.ResolveUrl(LoginPageUrl));
            }
        }

        try
        {
            if (!String.IsNullOrEmpty(ContactHiddenField.Value))
            {
                JsonSerializer serializer   = new JsonSerializer();
                Contact        freshContact = serializer.Unserialize <Contact>(ContactHiddenField.Value);
                if (Contact == null)
                {
                    ContactForm.MergeHint = true;
                }
                else
                {
                    if (Contact.ContactId != freshContact.ContactId)
                    {
                        ContactForm.MergeHint = true;
                    }
                    else if (String.IsNullOrEmpty(Contact.Phone) && String.IsNullOrEmpty(Contact.Email) && (!String.IsNullOrEmpty(freshContact.Phone) || !String.IsNullOrEmpty(freshContact.Email)))
                    {
                        ContactForm.MergeHint           = true;
                        ContactForm.MergeHintAttributes = new string[] { "Phone", "Email" };
                    }
                }
                Contact = freshContact;
            }
            ContactInfo     contactInfo = EditedObject as ContactInfo;
            ContactIdentity identity    = DataComHelper.CreateContactIdentity(contactInfo);
            Filter = identity.CreateFilter();
            // Do not search for contact if it's a CallBack - search button was pressed (see CreateSearchActionClientScript method)
            if (Contact == null && !RequestHelper.IsCallback())
            {
                DataComClient    client   = DataComHelper.CreateClient();
                IContactProvider provider = DataComHelper.CreateContactProvider(client, credentialProvider.GetCredential());
                ContactFinder    finder   = DataComHelper.CreateContactFinder(provider);
                Contact          match    = finder.Find(identity);
                if (match != null)
                {
                    ShowInformation(GetString("datacom.contactmatch"));
                    Contact = match;
                    ContactForm.MergeHint = true;
                }
                else
                {
                    ShowInformation(GetString("datacom.nocontactmatch"));
                }
            }
            InitializeHeaderActions();
            InitializeDataComForm();
        }
        catch (Exception exception)
        {
            HandleException(exception);
        }
    }
Beispiel #26
0
 public ContactsViewModel(IMvxLogProvider logProvider, IMvxNavigationService navigationService, IContactProvider contactProvider)
     : base(logProvider, navigationService)
 {
     ContactProvider = contactProvider;
 }
Beispiel #27
0
        public static IServiceCollection Create(this IServiceCollection ignore, IContentRepository contentRepo, IArchiveProvider archiveProvider, IContactProvider contactProvider, ISearchProvider searchProvider, IPageGenerator pageGen, IHomePageGenerator homePageGen, INavigationProvider navProvider, IRedirectProvider redirectProvider, ISyndicationProvider syndicationProvider, ISettings settings, IEnumerable <Category> categories, IContentEncoder contentEncoder, IContentItemPageGenerator contentItemPageGen)
        {
            IServiceCollection container = new ServiceCollection();

            container.AddSingleton <IPageGenerator>(pageGen);
            container.AddSingleton <IHomePageGenerator>(homePageGen);
            container.AddSingleton <INavigationProvider>(navProvider);
            container.AddSingleton <IArchiveProvider>(archiveProvider);
            container.AddSingleton <IContactProvider>(contactProvider);
            container.AddSingleton <ISearchProvider>(searchProvider);
            container.AddSingleton <ISyndicationProvider>(syndicationProvider);
            container.AddSingleton <IEnumerable <Category> >(categories);
            container.AddSingleton <IRedirectProvider>(redirectProvider);
            container.AddSingleton <IContentEncoder>(contentEncoder);
            container.AddSingleton <IContentItemPageGenerator>(contentItemPageGen);

            container.AddSingleton <IContentRepository>(contentRepo);
            settings.SourceConnection = contentRepo.GetSourceConnection();
            container.AddSingleton <ISettings>(settings);

            return(container);
        }
Beispiel #28
0
 public BaseContactPicker(IContactProvider <TContact> provider)
 {
     this.provider = provider;
     Names         = new List <string>();
     allContacts   = currentlyDisplayedContacts = new List <TContact>();
 }
Beispiel #29
0
 public static IContactProvider Create(this IContactProvider ignore, IServiceProvider serviceProvider)
 {
     return(new TemplateProvider(serviceProvider));
 }
Beispiel #30
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="contactProvider"></param>
 /// <param name="mapper"></param>
 public ContactController(IContactProvider contactProvider, IMapper mapper) : base(mapper)
 {
     _contactProvider = contactProvider;
 }
Beispiel #31
0
 public static IContactProvider Create(this IContactProvider ignore, IServiceCollection container)
 {
     return(ignore.Create(container.BuildServiceProvider()));
 }