コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ContactProvider"/> class.
 /// </summary>
 /// <param name="coreIntelligence">The core intelligence.</param>
 /// <param name="contactData">The contact data.</param>
 /// <param name="networkProvider">The network provider.</param>
 public ContactProvider(EasySocial.FrameWork.Intelligence.CoreIntelligence coreIntelligence, object[] contactData, NetworkProvider networkProvider)
 {
     _coreIntelligence = coreIntelligence;
 }
コード例 #2
0
        /// <summary>
        /// Generates the missing containers in the db.
        /// </summary>
        /// <param name="provider">The provider.</param>
        private void generateMissingContainers(NetworkProvider provider)
        {
            try
            {
                foreach (ContactProvider cprovider in provider.Contacts.ToList())
                {
                    if (ContactContainer2ContactProvider.Where(x => x.ContactIdentifier == cprovider.Identifier && x.NetworkID == provider.NetworkID).Count() == 0)
                    {
                        ContactContainer container = CreateContactContainer();
                        TableModels.System_Social_ContactContainer2ContactProvider cc2cp = new System_Social_ContactContainer2ContactProvider()
                        {
                            ContactIdentifier = cprovider.Identifier,
                            NetworkID = provider.NetworkID,
                            ContainerID = container.ID
                        };

                        //container.Attribute.Add("Name", Encoding.Default.GetBytes(cprovider.Name));
                        ContactContainer2ContactProvider.InsertOnSubmit(cc2cp);
                        CoreIntelligence.RepositoryIntelligence.SubmitChanges();
                        cprovider.Container = container;
                    }
                }
            }
            catch(InvalidOperationException)
            {
                generateMissingContainers(provider);
            }
        }