public void CreateCustomEntityTest()
        {
            using (ActFramework framework = new ActFramework())
            {
                Trace.WriteLine("CreateCustomEntityTest - start");
                framework.LogOn(Settings.Default.userName, Settings.Default.password, Settings.Default.databaseHost, Settings.Default.databaseName);
                Trace.WriteLine("CreateCustomEntityTest - LogOn");

                IbolTestsManager manager       = new IbolTestsManager(framework);
                Contact          contact       = framework.CurrentUser.Contact;
                ContactList      contactAsList = framework.Contacts.GetContactAsContactList(contact);

                IbolTests ibolTest = manager.CreateCustomEntity();
                Assert.IsNotNull(ibolTest, "CreateCustomEntity is null");
                Trace.WriteLine("CreateCustomEntityTest - CreateCustomEntity");

                ibolTest.SetContacts(contactAsList);

                int typeId = 1;
                ibolTest.TypeId = typeId;
                Guid testId = Guid.NewGuid();
                ibolTest.TestId = testId;
                ibolTest.Update();
                Assert.AreEqual(typeId, ibolTest.TypeId, "TypeId");
                Assert.AreEqual(testId, ibolTest.TestId, "TestId");
                Trace.WriteLine("CreateCustomEntityTest - Update and stop");
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a new association between two contacts
        /// </summary>
        /// <remarks>
        /// Creating an association between two entities
        /// This sample creates a new association between two contacts.
        /// The sample shows the following tasks:
        /// - Retrieve the appropriate AssocaitionManager for a Contact to Contact association
        /// - Two methods of setting detailed information for the Association
        /// - Persisting the association to the database
        /// </remarks>
        private Association CreateAssociation(Contact contactOne, Contact contactTwo)
        {
            //Log into the framework and retrieve the correct AssociationManager
            ActFramework ACTFM = new ActFramework();

            ACTFM.LogOn("C:\\Documents and Settings\\Administrator\\My Documents\\ACT\\Act for Win 8\\Databases\\Act8Demo.pad", "Chris Huffman", "");

            Framework.MutableEntities.MutableEntity company = null;
            Framework.MetaData.Entity opportunity           = null;
            AssociationManager        associationManager    = ACTFM.Associations.GetAssociationManager(company, opportunity);

            //Create the assocaition
            Association association = associationManager.CreateAssociation(contactOne, contactTwo);

            //First means of setting association information
            association.Fields[Framework.Associations.StandardField.Details] = "Association Details";

            //Second meand of setting association information
            AssociationFieldDescriptor field = associationManager.GetFieldDescriptor(Framework.Associations.StandardField.Entity1Role);

            field.SetValue(association, "First entities role in this assocaition");

            //Persist the association to the database.
            association.Update();

            return(association);
        }
Esempio n. 3
0
        /// <summary>
        /// Retrieves names of all contact custom fields from the Act! Database
        /// </summary>
        /// <returns>Array list with names of the custom fields</returns>
        /// <remarks>
        /// Getting custom contact fields
        /// This sample retrieves names of the custom contact fields and puts them into an Array list.
        /// The sample shows the following tasks:
        /// - Using the SDK to get Contact field descriptors.
        /// - Getting the table of each contact field descriptor using the TableByName property of SchemaMetadata.
        /// - If column in the table is custom (IsCustom = true), adding the field name to the Array list.
        /// </remarks>
        public /*override*/ ArrayList GetContactCustomFields()
        {
            ActFramework ACTFM = new ActFramework();

            ACTFM.LogOn("C:\\Documents and Settings\\Administrator\\My Documents\\ACT\\Act for Win 8\\Databases\\Act8Demo.pad", "Chris Huffman", "");
            SchemaMetaData    smd              = ACTFM.SchemaMetaData;
            ReadOnlyHashtable tblByName        = smd.TableByName;
            ArrayList         customFieldArray = new ArrayList();

            ContactFieldDescriptor[] cfdList = ACTFM.Contacts.GetContactFieldDescriptors();
            ContactFieldDescriptor   cfd;
            Table  tContact;
            Column col;

            for (int i = 0; i < cfdList.Length; i++)
            {
                cfd      = cfdList[i];
                tContact = (Act.Framework.MetaData.Table)tblByName[cfd.TableName];
                col      = (Column)tContact.ColumnByDisplayName[cfd.DisplayName];
                if (col != null)
                {
                    if (col.IsCustom)
                    {
                        customFieldArray.Add(col.Name);
                    }
                }
            }
            return(customFieldArray);
        }
        public void GetFieldDescriptorTest()
        {
            using (ActFramework framework = new ActFramework())
            {
                Trace.WriteLine("GetFieldDescriptorTest - start");
                framework.LogOn(Settings.Default.userName, Settings.Default.password, Settings.Default.databaseHost, Settings.Default.databaseName);
                Trace.WriteLine("GetFieldDescriptorTest - LogOn");

                IbolTestsManager  manager    = new IbolTestsManager(framework);
                DBFieldDescriptor descriptor = manager.GetFieldDescriptor("TestId");
                Assert.IsNotNull(descriptor, "CustomEntityDescriptor is null");
                Trace.WriteLine("GetFieldDescriptorTest - GetFieldDescriptor");

                try
                {
                    DBFieldDescriptor xyz = manager.GetFieldDescriptor("Xyz");
                    Assert.Fail("MutableEntityMetaDataArgumentException expected. " + xyz);
                }
                catch (MutableEntityMetaDataArgumentException ex)
                {
                    Trace.WriteLine("GetFieldDescriptorTest: " + ex.ToString());
                }
                Trace.WriteLine("GetFieldDescriptorTest - stop");
            }
        }
Esempio n. 5
0
 public IbolTestsManager(ActFramework framework) :
     base(framework)
 {
     this.Descriptor = this.GetCustomEntityDescriptor(IbolTests.IbolTableName, (int)ParentEntity.Contacts);
     this.manager    = this.ActFramework.CustomEntities.GetSubEntityManager <IbolTests>(this.Descriptor);
     this.InitializeColumns(this.dataTypes);
 }
Esempio n. 6
0
        /// <summary>
        /// Retrieves an association manager given the name of two entity types. IE "Contact" or "Group"
        /// </summary>
        private AssociationManager GetAssociationManager(string entityOne, string entityTwo)
        {
            ActFramework ACTFM = new ActFramework();

            ACTFM.LogOn("C:\\Documents and Settings\\Administrator\\My Documents\\ACT\\Act for Win 8\\Databases\\Act8Demo.pad", "Chris Huffman", "");
            AssociationManager manager = ACTFM.Associations.GetAssociationManager(entityOne, entityTwo);

            return(manager);
        }
Esempio n. 7
0
        /// <summary>
        /// Retrieves an association manager given two existing database entities.
        /// </summary>
        /// <remarks>
        /// The entities passed in in this case do not necessarily need to be the entities you wish
        /// to relate. Instead they are used to determine entity types for future associations
        /// supported by the returned AssociationManager.
        /// </remarks>
        /// <remarks>
        /// Retrieving an associations manager
        /// The associations manager is retrieved using the the GetAssociationManager method of the AssociationsManager.This method supports 5 overloads so the SDK consumer may retrieve the needed manager in several ways. Examples of two different methods are provided below.
        /// </remarks>
        private AssociationManager GetAssociationManager(Contact contact, Group group)
        {
            ActFramework ACTFM = new ActFramework();

            ACTFM.LogOn("C:\\Documents and Settings\\Administrator\\My Documents\\ACT\\Act for Win 8\\Databases\\Act8Demo.pad", "Chris Huffman", "");
            AssociationManager manager = ACTFM.Associations.GetAssociationManager(contact, group);

            return(manager);
        }
        public void DeleteCustomEntityTest()
        {
            using (ActFramework framework = new ActFramework())
            {
                framework.LogOn(Settings.Default.userName, Settings.Default.password, Settings.Default.databaseHost, Settings.Default.databaseName);

                IbolManagerBase ibolManagerBase = new IbolManagerBase(framework);
                ibolManagerBase.DeleteCustomEntity(IbolTests.IbolTableName);
            }
        }
Esempio n. 9
0
        private void OnConnected()
        {
            // we're bound to contacts
            GetListManager();

            if (this.ContactListComponent != null && this.ContactListComponent.FrameworkComponent != null &&
                this.ContactListComponent.FrameworkComponent.Framework != null)
            {
                ActFramework framework = ContactListComponent.FrameworkComponent.Framework;
            }
        }
        public void GetCustomEntityDescriptorTest()
        {
            using (ActFramework framework = new ActFramework())
            {
                framework.LogOn(Settings.Default.userName, Settings.Default.password, Settings.Default.databaseHost, Settings.Default.databaseName);

                IbolManagerBase        ibolManagerBase = new IbolManagerBase(framework);
                CustomEntityDescriptor descriptor      = ibolManagerBase.GetCustomEntityDescriptor(IbolTests.IbolTableName, (int)ParentEntity.Contacts);
                Assert.IsNotNull(descriptor, "descriptor is null");
            }
        }
Esempio n. 11
0
        /// <summary>
        /// Retrieves name of the Contact table of given field if there are lot of custom fields and additional Contact tables
        /// </summary>
        /// <param name="dbFieldName">real name of the field</param>
        /// <returns>table name as string if field exist in database; otherwise return empty string</returns>
        /// <remarks>
        /// Getting a table name
        /// This sample retrieves the name of the Contact table for the given real field name.It is useful in cases where the Act! database contains a large number of custom fields and additional Contact tables.
        /// The sample shows the following tasks:
        /// - Using the SDK to get Contact field descriptors.
        /// - Comparing the ColumnName of each contact field descriptor in the list with the parameter.
        /// - When we find the contact field descriptor with the same column name as the one in the parameter, we return its Table name.If not found – we return empty string.
        /// </remarks>
        private string GetTableName(string dbFieldName)
        {
            ActFramework ACTFM = new ActFramework();

            ACTFM.LogOn("C:\\Documents and Settings\\Administrator\\My Documents\\ACT\\Act for Win 8\\Databases\\Act8Demo.pad", "Chris Huffman", "");
            ContactFieldDescriptor[] cfd = ACTFM.Contacts.GetContactFieldDescriptors();
            for (int i = 0; i < cfd.Length; i++)
            {
                if (dbFieldName.Equals(cfd[i].ColumnName))
                {
                    return(cfd[i].TableName);
                }
            }
            return("");
        }
        public void SamplesTest()
        {
            Trace.WriteLine("GettingaContactListTests.SamplesTest-Start");
            using (ActFramework framework = new ActFramework())
            {
                framework.LogOn(Settings.Default.userName, Settings.Default.password, Settings.Default.databaseHost, Settings.Default.databaseName);

                GettingaContactList gettingaContactList = new GettingaContactList(framework);
                int count = gettingaContactList.Samples();
                Assert.AreEqual <int>(4, count, "count <> 4");

                //Assert.Fail();
            }
            Trace.WriteLine("GettingaContactListTests.SamplesTest-Stop");
        }
Esempio n. 13
0
 void IPlugin.OnUnLoad()
 {
     // this is equivalent to being disposed,
     // so make sure to detach from any events
     if (application != null)
     {
         application.AfterLogon   -= new EventHandler(Application_AfterLogon);
         application.BeforeLogoff -= new EventHandler(Application_BeforeLogoff);
         ActFramework framework = application.ActFramework;
         if (framework != null)
         {
             framework.Database.BeforeDatabaseLock -= new Act.Framework.Database.DatabaseLockHandler(Database_BeforeDatabaseLock);
         }
     }
 }
Esempio n. 14
0
        /// <summary>
        /// Retrieves an array of Contact-Contact associations for the given contact
        /// and updates the association information.
        /// </summary>
        /// <remarks>
        /// Retrieving a list of associations
        /// This sample demonstrates how to retrieve and update a list of associated entities given a specific entity.
        /// </remarks>
        private void UpdateAssociatons(Contact contact, string newRole)
        {
            //Log into the framework and retrive the correct AssociationManager
            ActFramework ACTFM = new ActFramework();

            ACTFM.LogOn("C:\\Documents and Settings\\Administrator\\My Documents\\ACT\\Act for Win 8\\Databases\\Act8Demo.pad", "Chris Huffman", "");
            AssociationManager associationManager = ACTFM.Associations.GetAssociationManager("Group", "Opportunity");

            //Retrieve the associations for the passed in contact.
            Association[] associations = associationManager.GetAssociations(contact);
            foreach (Association association in associations)
            {
                //Update the associaton.
                association.Fields[Framework.Associations.StandardField.Entity1Role] = newRole;
                association.Update();
            }
        }
        public void GetFieldTest()
        {
            using (ActFramework framework = new ActFramework())
            {
                framework.LogOn(Settings.Default.userName, Settings.Default.password, Settings.Default.databaseHost, Settings.Default.databaseName);

                IbolManagerBase        ibolManagerBase = new IbolManagerBase(framework);
                CustomEntityDescriptor descriptor      = ibolManagerBase.GetCustomEntityDescriptor(IbolTests.IbolTableName, (int)ParentEntity.Contacts);
                Assert.IsNotNull(descriptor, "CustomEntityDescriptor is null");

                string          alias     = "GetFieldTest";
                FieldDataType   fieldType = FieldDataType.Character;
                FieldDescriptor des       = ibolManagerBase.GetField(descriptor, alias, fieldType);
                Assert.IsNotNull(des, "FieldDescriptor is null");
                Logging.Log("InitializeColumns", des.Name + ", " + des.ColumnName + ", " + des.Alias + ", " + des.TableName);
            }
        }
        public void SamplesTest()
        {
            Trace.WriteLine("UsingFrameworkMetadataTests.SamplesTest.Start");
            Trace.Flush();

            using (ActFramework framework = new ActFramework())
            {
                //framework.LogOn("CHuffman", "password", "localhost", "MyDatabase");
                framework.LogOn(Settings.Default.userName, Settings.Default.password, Settings.Default.databaseHost, Settings.Default.databaseName);

                UsingFrameworkMetadata usingFrameworkMetadata = new UsingFrameworkMetadata(framework);
                int count = usingFrameworkMetadata.Samples();
                Assert.AreEqual <int>(0, count, "count <> 0");
                //Assert.Fail();
            }
            Trace.WriteLine("UsingFrameworkMetadataTests.SamplesTest.Stop");
        }
Esempio n. 17
0
        /// <summary>
        /// Delete secondary contact from MyRecord
        /// </summary>
        /// <param name="secondaryContactID">ID of the secondary contact which has to be deleted </param>
        /// <remarks>
        /// Deleting a secondary contact
        /// This sample deletes a secondary contact from MyRecord in an Act! database.
        /// The sample shows the following tasks:
        /// - Getting MyRecord.
        /// - Using the SDK to retrieve the list of all secondary contacts for MyRecord.
        /// - Comparing the ID of each secondary contact in the list to the ID of the contact we want to delete.
        /// - When we find the secondary contact with the same ID as the one in the parameter, removing this secondary contact from the list using the implementation of IBindingList interface.
        /// </remarks>
        private void DeleteSecondaryContact(string secondaryContactID)
        {
            ActFramework ACTFM = new ActFramework();

            ACTFM.LogOn("C:\\Documents and Settings\\Administrator\\My Documents\\ACT\\Act for Win 8\\Databases\\Act8Demo.pad", "Chris Huffman", "");
            Contact     actContact            = ACTFM.Contacts.GetMyRecord();
            ContactList secondaryContactsList = ACTFM.Contacts.GetSecondaryContacts(null, actContact);
            Contact     secondaryContact;

            for (int i = 0; i < secondaryContactsList.Count; i++)
            {
                secondaryContact = secondaryContactsList[i];
                if (secondaryContact.ID.ToString().Equals(secondaryContactID))
                {
                    ((IBindingList)secondaryContactsList).Remove(secondaryContact);
                }
            }
        }
        public void GetCustomSubEntitiesTest()
        {
            using (ActFramework framework = new ActFramework())
            {
                Trace.WriteLine("GetCustomSubEntitiesTest - start");
                framework.LogOn(Settings.Default.userName, Settings.Default.password, Settings.Default.databaseHost, Settings.Default.databaseName);
                Trace.WriteLine("GetCustomSubEntitiesTest - LogOn");

                IbolTestsManager  manager        = new IbolTestsManager(framework);
                Contact           contact        = framework.CurrentUser.Contact;
                IFilterCriteria[] filterCriteria = null;

                CustomEntityList <IbolTests> list = manager.GetCustomSubEntities(contact, filterCriteria);
                Assert.IsNotNull(list, "CustomEntityList<IbolTests> is null");
                Trace.WriteLine("GetCustomSubEntitiesTest - GetCustomSubEntities: " + list.Count + " and stop");

                CustomEntitiesSamplesTests.SearchTypesFor(typeof(IFilterCriteria));
            }
        }
Esempio n. 19
0
        /// <summary>
        /// Retrieves an entity list of contacts associated with a given contact
        /// and updates the associaton information.
        /// </summary>
        /// <remarks>
        /// Retrieving a list of associated entities(EntityList) and update association details
        /// This sample demonstrates the use of an AssociationFieldDescriptor to interact with other entities in the Act! framework.Currently supported entities are Opportunities, Companies, Groups and Contacts.
        /// </remarks>
        private void UpdateAssociatons2(Contact contact, string newRole)
        {
            //Log into the framework and retrieve the correct AssociationManager
            ActFramework ACTFM = new ActFramework();

            ACTFM.LogOn("C:\\Documents and Settings\\Administrator\\My Documents\\ACT\\Act for Win 8\\Databases\\Act8Demo.pad", "Chris Huffman", "");
            AssociationManager associationManager = ACTFM.Associations.GetAssociationManager("Group", "Opportunity");

            //Retrieve the entity list.
            Act.Framework.Entities.EntityList entityList = associationManager.GetAssociatedEntities(null, contact);
            //Retrieve the field descriptor
            AssociationFieldDescriptor roleField = associationManager.GetFieldDescriptor(Framework.Associations.StandardField.Entity1Role);

            //Enumerate each entity and update the role details.
            foreach (Act.Framework.Entities.Entity entity in entityList)
            {
                roleField.SetValue(entity, newRole);
                ((IUpdateableEntity)entity).Update();
            }
        }
Esempio n. 20
0
        /// <summary>
        /// Inserts Secondary contact to MyRecord
        /// </summary>
        /// <remarks>
        /// Inserting a secondary contact
        /// This sample inserts a secondary contact into MyRecord in an Act! database.
        /// The sample shows the following tasks:
        /// - Getting MyRecord
        /// - Using the SDK to retrieve the list of all secondary contacts for MyRecord.
        /// - Using an implementation of IBindingList interface to add a new secondary contact to MyRecord and set properties.
        /// - After adding all properties, updating the secondary contact in the Act! database
        /// </remarks>
        private void InsertSecondaryContact()
        {
            ActFramework ACTFM = new ActFramework();

            ACTFM.LogOn("C:\\Documents and Settings\\Administrator\\My Documents\\ACT\\Act for Win 8\\Databases\\Act8Demo.pad", "Chris Huffman", "");
            Contact     actContact            = ACTFM.Contacts.GetMyRecord();
            ContactList secondaryContactsList = ACTFM.Contacts.GetSecondaryContacts(null, actContact);
            Contact     secondaryContact      = (Contact)((IBindingList)secondaryContactsList).AddNew();
            string      firstName             = "John";
            string      lastName = "Smith";
            string      title    = "Accountant";

            //.
            //.(add values for other properties)
            //.
            secondaryContact.FullName = firstName + " " + lastName;
            secondaryContact.Fields["Contact.Title", false] = title;
            //.
            //.(assign additional properties to secondary contact)
            //.
            secondaryContact.Update();
        }
Esempio n. 21
0
        //Inherited from RelationalDatabase
        //public string DatabaseType { get; set; } //MySQL, SQLite, MS SQL Server, Act!, etc...
        //public string LoginPath { get; set; }

        //Must-implements for Act_DatabaseInterface
        //NOTE: *******************loginpath and image path MUST be compatible with each other ***************************************
        //public void CreateConnection(string login, string password) //todo: add argument for database 
        public void CreateConnection(string login, string password, string database)
        {
            DatabaseType = ("Act!");
            //LoginPath = "C:\\Users\\Scott\\Documents\\ACT\\ACT Data\\Databases\\ScottyPPv16Web3.pad";
            //LoginPath = "C:\\Users\\Scott\\Documents\\ACT\\ACT Data\\Databases\\OptomiLADellv2.pad"; //Dell laptop remote DB
            //LoginPath = "C:\\Users\\zenkutsu64\\My Documents\\ACT\\ACT Data\\Databases\\PivotPointWebv16.pad"; //jamporium.com (Rackspace)
            //LoginPath = "C:\\Users\\zenkutsu64\\Documents\\ACT\\ACT Data\\Databases\\OptomiLA.pad"; //bizexpedite.com (Azure)
           
            if (database == "PPSearch")
                LoginPath = "C:\\Users\\Scott\\Documents\\ACT\\ACT Data\\Databases\\ScottPivotPoint2point0.pad"; //todo: conditional to select login path
            else if (database == "PPTalent")
                LoginPath = "C:\\Users\\Scott\\Documents\\ACT\\ACT Data\\Databases\\ScottPivotPointTalent.pad";
            else if (database == "GladPixGarden")
                LoginPath = "C:\\Users\\Scott\\Documents\\ACT\\ACT Data\\Databases\\ScottGladPixGarden.pad"; //todo: conditional to select login path
           
            //LoginPath = "C:\\Users\\zenkutsu64\\Documents\\ACT\\ACT Data\\Databases\\PivotPoint2point0.pad"; //bizexpedite.com (Azure)
            theFramework = new ActFramework();
            try { 
                theFramework.LogOn(LoginPath, login, password);
                //Test block here to investigate details of the db
                SchemaMetaData smd = theFramework.SchemaMetaData;
                ReadOnlyHashtable tblByName = smd.TableByName;
                ArrayList customFieldArray = new ArrayList();
                ContactFieldDescriptor[] cfdList = theFramework.Contacts.GetContactFieldDescriptors(); //inspect cfdList in the debugger to get info
            }
            catch (InvalidLogonException e){
                Console.WriteLine(e.Message);
            }
            catch (TargetInvocationException e)
            {
                Console.WriteLine(e.Message);
            }
            catch (PADObjectException e)
            {
                Console.WriteLine(e.Message);
            }


        }
Esempio n. 22
0
 public IbolManagerBase(ActFramework framework)
 {
     this.ActFramework = framework ?? throw new ArgumentNullException("framework");
 }
Esempio n. 23
0
 public GettingaContactList(ActFramework framework)
 {
     this.framework = framework;
 }
Esempio n. 24
0
 public UsingFrameworkMetadata(ActFramework framework)
 {
     this.framework = framework;
 }