/// <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); }
//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); } }