diff --git a/WebsitePanel.Installer/Sources/VersionInfo.cs b/WebsitePanel.Installer/Sources/VersionInfo.cs index 04693c31..8ca7c4b0 100644 --- a/WebsitePanel.Installer/Sources/VersionInfo.cs +++ b/WebsitePanel.Installer/Sources/VersionInfo.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.17929 +// Runtime Version:4.0.30319.18010 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -15,8 +15,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Outercurve Foundation")] [assembly: AssemblyCopyright("Copyright В© 2012 Outercurve Foundation.")] -[assembly: AssemblyVersion("2.0.0.1")] -[assembly: AssemblyFileVersion("2.0.0.1")] -[assembly: AssemblyInformationalVersion("2.0.0")] +[assembly: AssemblyVersion("2.1.0.1")] +[assembly: AssemblyFileVersion("2.1.0.1")] +[assembly: AssemblyInformationalVersion("2.1.0")] diff --git a/WebsitePanel.Installer/Sources/WebsitePanel.Installer/Updater.exe b/WebsitePanel.Installer/Sources/WebsitePanel.Installer/Updater.exe index 2a081bbd..6d39ffa3 100644 Binary files a/WebsitePanel.Installer/Sources/WebsitePanel.Installer/Updater.exe and b/WebsitePanel.Installer/Sources/WebsitePanel.Installer/Updater.exe differ diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index 88287608..d21358a6 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -12,6 +12,20 @@ BEGIN END GO + +--- Fix on version 2.0 +DELETE FROM HostingPlanQuotas WHERE QuotaID = 340 +GO +DELETE FROM HostingPlanQuotas WHERE QuotaID = 341 +GO +DELETE FROM HostingPlanQuotas WHERE QuotaID = 342 +GO +DELETE FROM HostingPlanQuotas WHERE QuotaID = 343 +GO +DELETE FROM HostingPlanResources WHERE GroupID = 33 +GO + + -- Version 2.1 section IF NOT EXISTS (SELECT * FROM [dbo].[Providers] WHERE [DisplayName] = 'Hosted Microsoft Exchange Server 2013') BEGIN @@ -25,16 +39,6 @@ GO IF NOT EXISTS (SELECT * FROM [dbo].[Quotas] WHERE [QuotaName] = 'Exchange2007.AllowLitigationHold') -DELETE FROM HostingPlanQuotas WHERE QuotaID = 340 -GO -DELETE FROM HostingPlanQuotas WHERE QuotaID = 341 -GO -DELETE FROM HostingPlanQuotas WHERE QuotaID = 342 -GO -DELETE FROM HostingPlanQuotas WHERE QuotaID = 343 -GO -DELETE FROM HostingPlanResources WHERE GroupID = 33 -GO BEGIN INSERT [dbo].[Quotas] ([QuotaID], [GroupID],[QuotaOrder], [QuotaName], [QuotaDescription], [QuotaTypeID], [ServiceQuota], [ItemTypeID]) VALUES (420, 12, 24,N'Exchange2007.AllowLitigationHold',N'Allow Litigation Hold',1, 0 , NULL) END @@ -58,6 +62,13 @@ ALTER TABLE [dbo].[ExchangeMailboxPlans] ADD END GO +IF NOT EXISTS(select 1 from sys.columns COLS INNER JOIN sys.objects OBJS ON OBJS.object_id=COLS.object_id and OBJS.type='U' AND OBJS.name='ExchangeMailboxPlans' AND COLS.name='LitigationHoldUrl') +BEGIN +ALTER TABLE [dbo].[ExchangeMailboxPlans] ADD + [LitigationHoldUrl] [nvarchar] (256) COLLATE Latin1_General_CI_AS NULL, + [LitigationHoldMsg] [nvarchar] (512) COLLATE Latin1_General_CI_AS NULL +END +GO @@ -85,7 +96,9 @@ ALTER PROCEDURE [dbo].[AddExchangeMailboxPlan] @MailboxPlanType int, @AllowLitigationHold bit, @RecoverableItemsWarningPct int, - @RecoverableItemsSpace int + @RecoverableItemsSpace int, + @LitigationHoldUrl nvarchar(256), + @LitigationHoldMsg nvarchar(512) ) AS @@ -123,7 +136,10 @@ INSERT INTO ExchangeMailboxPlans MailboxPlanType, AllowLitigationHold, RecoverableItemsWarningPct, - RecoverableItemsSpace + RecoverableItemsSpace, + LitigationHoldUrl, + LitigationHoldMsg + ) VALUES ( @@ -147,7 +163,9 @@ VALUES @MailboxPlanType, @AllowLitigationHold, @RecoverableItemsWarningPct, - @RecoverableItemsSpace + @RecoverableItemsSpace, + @LitigationHoldUrl, + @LitigationHoldMsg ) SET @MailboxPlanId = SCOPE_IDENTITY() @@ -185,7 +203,9 @@ ALTER PROCEDURE [dbo].[UpdateExchangeMailboxPlan] @MailboxPlanType int, @AllowLitigationHold bit, @RecoverableItemsWarningPct int, - @RecoverableItemsSpace int + @RecoverableItemsSpace int, + @LitigationHoldUrl nvarchar(256), + @LitigationHoldMsg nvarchar(512) ) AS @@ -209,7 +229,10 @@ UPDATE ExchangeMailboxPlans SET MailboxPlanType = @MailboxPlanType, AllowLitigationHold = @AllowLitigationHold, RecoverableItemsWarningPct = @RecoverableItemsWarningPct, - RecoverableItemsSpace = @RecoverableItemsSpace + RecoverableItemsSpace = @RecoverableItemsSpace, + LitigationHoldUrl = @LitigationHoldUrl, + LitigationHoldMsg = @LitigationHoldMsg + WHERE MailboxPlanId = @MailboxPlanId RETURN @@ -217,6 +240,81 @@ RETURN GO + +ALTER PROCEDURE [dbo].[GetExchangeMailboxPlan] +( + @MailboxPlanId int +) +AS +SELECT + MailboxPlanId, + ItemID, + MailboxPlan, + EnableActiveSync, + EnableIMAP, + EnableMAPI, + EnableOWA, + EnablePOP, + IsDefault, + IssueWarningPct, + KeepDeletedItemsDays, + MailboxSizeMB, + MaxReceiveMessageSizeKB, + MaxRecipients, + MaxSendMessageSizeKB, + ProhibitSendPct, + ProhibitSendReceivePct, + HideFromAddressBook, + MailboxPlanType, + AllowLitigationHold, + RecoverableItemsWarningPct, + RecoverableItemsSpace, + LitigationHoldUrl, + LitigationHoldMsg +FROM + ExchangeMailboxPlans +WHERE + MailboxPlanId = @MailboxPlanId +RETURN + +GO + + + +ALTER PROCEDURE [dbo].[GetExchangeOrganizationStatistics] +( + @ItemID int +) +AS + +IF -1 IN (SELECT B.MailboxSizeMB FROM ExchangeAccounts AS A INNER JOIN ExchangeMailboxPlans AS B ON A.MailboxPlanId = B.MailboxPlanId WHERE A.ItemID=@ItemID) +BEGIN +SELECT + (SELECT COUNT(*) FROM ExchangeAccounts WHERE (AccountType = 1 OR AccountType = 5 OR AccountType = 6) AND ItemID = @ItemID) AS CreatedMailboxes, + (SELECT COUNT(*) FROM ExchangeAccounts WHERE AccountType = 2 AND ItemID = @ItemID) AS CreatedContacts, + (SELECT COUNT(*) FROM ExchangeAccounts WHERE AccountType = 3 AND ItemID = @ItemID) AS CreatedDistributionLists, + (SELECT COUNT(*) FROM ExchangeAccounts WHERE AccountType = 4 AND ItemID = @ItemID) AS CreatedPublicFolders, + (SELECT COUNT(*) FROM ExchangeOrganizationDomains WHERE ItemID = @ItemID) AS CreatedDomains, + (SELECT MIN(B.MailboxSizeMB) FROM ExchangeAccounts AS A INNER JOIN ExchangeMailboxPlans AS B ON A.MailboxPlanId = B.MailboxPlanId WHERE A.ItemID=@ItemID) AS UsedDiskSpace, + (SELECT MIN(B.RecoverableItemsSpace) FROM ExchangeAccounts AS A INNER JOIN ExchangeMailboxPlans AS B ON A.MailboxPlanId = B.MailboxPlanId WHERE A.ItemID=@ItemID) AS UsedLitigationHoldSpace +END +ELSE +BEGIN +SELECT + (SELECT COUNT(*) FROM ExchangeAccounts WHERE (AccountType = 1 OR AccountType = 5 OR AccountType = 6) AND ItemID = @ItemID) AS CreatedMailboxes, + (SELECT COUNT(*) FROM ExchangeAccounts WHERE AccountType = 2 AND ItemID = @ItemID) AS CreatedContacts, + (SELECT COUNT(*) FROM ExchangeAccounts WHERE AccountType = 3 AND ItemID = @ItemID) AS CreatedDistributionLists, + (SELECT COUNT(*) FROM ExchangeAccounts WHERE AccountType = 4 AND ItemID = @ItemID) AS CreatedPublicFolders, + (SELECT COUNT(*) FROM ExchangeOrganizationDomains WHERE ItemID = @ItemID) AS CreatedDomains, + (SELECT SUM(B.MailboxSizeMB) FROM ExchangeAccounts AS A INNER JOIN ExchangeMailboxPlans AS B ON A.MailboxPlanId = B.MailboxPlanId WHERE A.ItemID=@ItemID) AS UsedDiskSpace, + (SELECT SUM(B.RecoverableItemsSpace) FROM ExchangeAccounts AS A INNER JOIN ExchangeMailboxPlans AS B ON A.MailboxPlanId = B.MailboxPlanId WHERE A.ItemID=@ItemID) AS UsedLitigationHoldSpace +END + + +RETURN +GO + + -- UPDATE Domains SET IsDomainPointer=0, DomainItemID=NULL WHERE MailDomainID IS NOT NULL AND isDomainPointer=1 @@ -315,4 +413,10 @@ exec sp_xml_removedocument @idoc COMMIT TRAN RETURN -GO \ No newline at end of file +GO + +IF NOT EXISTS (SELECT * FROM [dbo].[Providers] WHERE [DisplayName] = 'Hosted MS CRM 2011') +BEGIN +INSERT [dbo].[Providers] ([ProviderID], [GroupID], [ProviderName], [DisplayName], [ProviderType], [EditorControl], [DisableAutoDiscovery]) VALUES (1201, 21, N'CRM', N'Hosted MS CRM 2011', N'WebsitePanel.Providers.HostedSolution.CRMProvider2011, WebsitePanel.Providers.HostedSolution', N'CRM', NULL) +END +GO diff --git a/WebsitePanel/Lib/References/Microsoft/microsoft.crm.sdk.proxy.dll b/WebsitePanel/Lib/References/Microsoft/microsoft.crm.sdk.proxy.dll new file mode 100644 index 00000000..47460ba5 Binary files /dev/null and b/WebsitePanel/Lib/References/Microsoft/microsoft.crm.sdk.proxy.dll differ diff --git a/WebsitePanel/Lib/References/Microsoft/microsoft.xrm.client.codegeneration.dll b/WebsitePanel/Lib/References/Microsoft/microsoft.xrm.client.codegeneration.dll new file mode 100644 index 00000000..71a2c2b8 Binary files /dev/null and b/WebsitePanel/Lib/References/Microsoft/microsoft.xrm.client.codegeneration.dll differ diff --git a/WebsitePanel/Lib/References/Microsoft/microsoft.xrm.client.dll b/WebsitePanel/Lib/References/Microsoft/microsoft.xrm.client.dll new file mode 100644 index 00000000..d733ccf6 Binary files /dev/null and b/WebsitePanel/Lib/References/Microsoft/microsoft.xrm.client.dll differ diff --git a/WebsitePanel/Lib/References/Microsoft/microsoft.xrm.portal.dll b/WebsitePanel/Lib/References/Microsoft/microsoft.xrm.portal.dll new file mode 100644 index 00000000..17080f22 Binary files /dev/null and b/WebsitePanel/Lib/References/Microsoft/microsoft.xrm.portal.dll differ diff --git a/WebsitePanel/Lib/References/Microsoft/microsoft.xrm.portal.files.dll b/WebsitePanel/Lib/References/Microsoft/microsoft.xrm.portal.files.dll new file mode 100644 index 00000000..10b89eb3 Binary files /dev/null and b/WebsitePanel/Lib/References/Microsoft/microsoft.xrm.portal.files.dll differ diff --git a/WebsitePanel/Lib/References/Microsoft/microsoft.xrm.sdk.deployment.dll b/WebsitePanel/Lib/References/Microsoft/microsoft.xrm.sdk.deployment.dll new file mode 100644 index 00000000..dda06b51 Binary files /dev/null and b/WebsitePanel/Lib/References/Microsoft/microsoft.xrm.sdk.deployment.dll differ diff --git a/WebsitePanel/Lib/References/Microsoft/microsoft.xrm.sdk.dll b/WebsitePanel/Lib/References/Microsoft/microsoft.xrm.sdk.dll new file mode 100644 index 00000000..957b214a Binary files /dev/null and b/WebsitePanel/Lib/References/Microsoft/microsoft.xrm.sdk.dll differ diff --git a/WebsitePanel/Lib/References/Microsoft/microsoft.xrm.sdk.workflow.dll b/WebsitePanel/Lib/References/Microsoft/microsoft.xrm.sdk.workflow.dll new file mode 100644 index 00000000..b16cb100 Binary files /dev/null and b/WebsitePanel/Lib/References/Microsoft/microsoft.xrm.sdk.workflow.dll differ diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Data/DataProvider.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Data/DataProvider.cs index d9eca5a3..762d78bf 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Data/DataProvider.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Data/DataProvider.cs @@ -2534,7 +2534,7 @@ namespace WebsitePanel.EnterpriseServer public static int AddExchangeMailboxPlan(int itemID, string mailboxPlan, bool enableActiveSync, bool enableIMAP, bool enableMAPI, bool enableOWA, bool enablePOP, bool isDefault, int issueWarningPct, int keepDeletedItemsDays, int mailboxSizeMB, int maxReceiveMessageSizeKB, int maxRecipients, int maxSendMessageSizeKB, int prohibitSendPct, int prohibitSendReceivePct, bool hideFromAddressBook, int mailboxPlanType, - bool enabledLitigationHold, long recoverabelItemsSpace, long recoverabelItemsWarning) + bool enabledLitigationHold, long recoverabelItemsSpace, long recoverabelItemsWarning, string litigationHoldUrl, string litigationHoldMsg) { SqlParameter outParam = new SqlParameter("@MailboxPlanId", SqlDbType.Int); outParam.Direction = ParameterDirection.Output; @@ -2563,8 +2563,10 @@ namespace WebsitePanel.EnterpriseServer new SqlParameter("@HideFromAddressBook", hideFromAddressBook), new SqlParameter("@MailboxPlanType", mailboxPlanType), new SqlParameter("@AllowLitigationHold",enabledLitigationHold), - new SqlParameter("@RecoverableItemsWarningPct", recoverabelItemsSpace), - new SqlParameter("@RecoverableItemsSpace",recoverabelItemsWarning) + new SqlParameter("@RecoverableItemsWarningPct", recoverabelItemsWarning), + new SqlParameter("@RecoverableItemsSpace",recoverabelItemsSpace), + new SqlParameter("@LitigationHoldUrl",litigationHoldUrl), + new SqlParameter("@LitigationHoldMsg",litigationHoldMsg) ); return Convert.ToInt32(outParam.Value); @@ -2575,7 +2577,7 @@ namespace WebsitePanel.EnterpriseServer public static void UpdateExchangeMailboxPlan(int mailboxPlanID, string mailboxPlan, bool enableActiveSync, bool enableIMAP, bool enableMAPI, bool enableOWA, bool enablePOP, bool isDefault, int issueWarningPct, int keepDeletedItemsDays, int mailboxSizeMB, int maxReceiveMessageSizeKB, int maxRecipients, int maxSendMessageSizeKB, int prohibitSendPct, int prohibitSendReceivePct, bool hideFromAddressBook, int mailboxPlanType, - bool enabledLitigationHold, long recoverabelItemsSpace, long recoverabelItemsWarning) + bool enabledLitigationHold, long recoverabelItemsSpace, long recoverabelItemsWarning, string litigationHoldUrl, string litigationHoldMsg) { SqlHelper.ExecuteNonQuery( ConnectionString, @@ -2600,8 +2602,11 @@ namespace WebsitePanel.EnterpriseServer new SqlParameter("@HideFromAddressBook", hideFromAddressBook), new SqlParameter("@MailboxPlanType", mailboxPlanType), new SqlParameter("@AllowLitigationHold", enabledLitigationHold), - new SqlParameter("@RecoverableItemsWarningPct", recoverabelItemsSpace), - new SqlParameter("@RecoverableItemsSpace", recoverabelItemsWarning) + new SqlParameter("@RecoverableItemsWarningPct", recoverabelItemsWarning), + new SqlParameter("@RecoverableItemsSpace", recoverabelItemsSpace), + new SqlParameter("@LitigationHoldUrl",litigationHoldUrl), + new SqlParameter("@LitigationHoldMsg",litigationHoldMsg) + ); } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/ExchangeServer/ExchangeServerController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/ExchangeServer/ExchangeServerController.cs index 58c99fff..9bbfd587 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/ExchangeServer/ExchangeServerController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/ExchangeServer/ExchangeServerController.cs @@ -192,6 +192,7 @@ namespace WebsitePanel.EnterpriseServer stats.CreatedDomains = tempStats.CreatedDomains; stats.CreatedPublicFolders = tempStats.CreatedPublicFolders; stats.UsedDiskSpace = tempStats.UsedDiskSpace; + stats.UsedLitigationHoldSpace = tempStats.UsedLitigationHoldSpace; } else { @@ -218,6 +219,7 @@ namespace WebsitePanel.EnterpriseServer stats.CreatedDomains += tempStats.CreatedDomains; stats.CreatedPublicFolders += tempStats.CreatedPublicFolders; stats.UsedDiskSpace += tempStats.UsedDiskSpace; + stats.UsedLitigationHoldSpace += tempStats.UsedLitigationHoldSpace; } } } @@ -235,6 +237,7 @@ namespace WebsitePanel.EnterpriseServer stats.AllocatedDistributionLists = cntx.Quotas[Quotas.EXCHANGE2007_DISTRIBUTIONLISTS].QuotaAllocatedValue; stats.AllocatedPublicFolders = cntx.Quotas[Quotas.EXCHANGE2007_PUBLICFOLDERS].QuotaAllocatedValue; stats.AllocatedDiskSpace = cntx.Quotas[Quotas.EXCHANGE2007_DISKSPACE].QuotaAllocatedValue; + stats.AllocatedLitigationHoldSpace = cntx.Quotas[Quotas.EXCHANGE2007_RECOVERABLEITEMSSPACE].QuotaAllocatedValue; return stats; } @@ -2714,7 +2717,9 @@ namespace WebsitePanel.EnterpriseServer plan.MaxReceiveMessageSizeKB, plan.AllowLitigationHold, plan.RecoverableItemsSpace != -1 ? (plan.RecoverableItemsSpace * 1024) : -1, - plan.RecoverableItemsSpace != -1 ? (((long)plan.RecoverableItemsWarningPct * (long)plan.RecoverableItemsSpace * 1024) / 100) : -1); + plan.RecoverableItemsSpace != -1 ? (((long)plan.RecoverableItemsWarningPct * (long)plan.RecoverableItemsSpace * 1024) / 100) : -1, + plan.LitigationHoldUrl, + plan.LitigationHoldMsg); DataProvider.SetExchangeAccountMailboxPlan(accountId, mailboxPlanId); @@ -2889,7 +2894,8 @@ namespace WebsitePanel.EnterpriseServer return DataProvider.AddExchangeMailboxPlan(itemID, mailboxPlan.MailboxPlan, mailboxPlan.EnableActiveSync, mailboxPlan.EnableIMAP, mailboxPlan.EnableMAPI, mailboxPlan.EnableOWA, mailboxPlan.EnablePOP, mailboxPlan.IsDefault, mailboxPlan.IssueWarningPct, mailboxPlan.KeepDeletedItemsDays, mailboxPlan.MailboxSizeMB, mailboxPlan.MaxReceiveMessageSizeKB, mailboxPlan.MaxRecipients, mailboxPlan.MaxSendMessageSizeKB, mailboxPlan.ProhibitSendPct, mailboxPlan.ProhibitSendReceivePct, mailboxPlan.HideFromAddressBook, mailboxPlan.MailboxPlanType, - mailboxPlan.AllowLitigationHold, mailboxPlan.RecoverableItemsSpace, mailboxPlan.RecoverableItemsWarningPct); + mailboxPlan.AllowLitigationHold, mailboxPlan.RecoverableItemsSpace, mailboxPlan.RecoverableItemsWarningPct, + mailboxPlan.LitigationHoldUrl, mailboxPlan.LitigationHoldMsg); } catch (Exception ex) { @@ -2959,7 +2965,8 @@ namespace WebsitePanel.EnterpriseServer DataProvider.UpdateExchangeMailboxPlan(mailboxPlan.MailboxPlanId, mailboxPlan.MailboxPlan, mailboxPlan.EnableActiveSync, mailboxPlan.EnableIMAP, mailboxPlan.EnableMAPI, mailboxPlan.EnableOWA, mailboxPlan.EnablePOP, mailboxPlan.IsDefault, mailboxPlan.IssueWarningPct, mailboxPlan.KeepDeletedItemsDays, mailboxPlan.MailboxSizeMB, mailboxPlan.MaxReceiveMessageSizeKB, mailboxPlan.MaxRecipients, mailboxPlan.MaxSendMessageSizeKB, mailboxPlan.ProhibitSendPct, mailboxPlan.ProhibitSendReceivePct, mailboxPlan.HideFromAddressBook, mailboxPlan.MailboxPlanType, - mailboxPlan.AllowLitigationHold, mailboxPlan.RecoverableItemsSpace, mailboxPlan.RecoverableItemsWarningPct); + mailboxPlan.AllowLitigationHold, mailboxPlan.RecoverableItemsSpace, mailboxPlan.RecoverableItemsWarningPct, + mailboxPlan.LitigationHoldUrl, mailboxPlan.LitigationHoldMsg); } catch (Exception ex) { diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/HostedSolution/OrganizationController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/HostedSolution/OrganizationController.cs index ef2994d8..4ab73171 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/HostedSolution/OrganizationController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/HostedSolution/OrganizationController.cs @@ -1329,7 +1329,7 @@ namespace WebsitePanel.EnterpriseServer Organizations orgProxy = GetOrganizationProxy(org.ServiceId); string upn = string.Format("{0}@{1}", name, domain); - string sAMAccountName = BuildAccountName(org.OrganizationId, name); + string sAMAccountName = BuildAccountName(org.OrganizationId, name, org.ServiceId); TaskManager.Write("accountName :" + sAMAccountName); TaskManager.Write("upn :" + upn); @@ -1454,21 +1454,21 @@ namespace WebsitePanel.EnterpriseServer { DataProvider.AddExchangeAccountEmailAddress(accountId, emailAddress); } - - private static string BuildAccountName(string orgId, string name) + + private static string BuildAccountName(string orgId, string name, int ServiceId) { string accountName = name = name.Replace(" ", ""); string CounterStr = "00000"; int counter = 0; bool bFound = false; - if (!AccountExists(accountName)) return accountName; + if (!AccountExists(accountName, ServiceId)) return accountName; do { accountName = genSamLogin(name, CounterStr); - if (!AccountExists(accountName)) bFound = true; + if (!AccountExists(accountName, ServiceId)) bFound = true; CounterStr = counter.ToString("d5"); counter++; @@ -1494,9 +1494,19 @@ namespace WebsitePanel.EnterpriseServer } - private static bool AccountExists(string accountName) + private static bool AccountExists(string accountName, int ServiceId) { - return DataProvider.ExchangeAccountExists(accountName); + + if (!DataProvider.ExchangeAccountExists(accountName)) + { + Organizations orgProxy = GetOrganizationProxy(ServiceId); + + + return orgProxy.DoesSamAccountNameExist(accountName); + } + else + return true; + } public static int DeleteUser(int itemId, int accountId) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Wizards/UserCreationWizard.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Wizards/UserCreationWizard.cs index c30c70aa..44556807 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Wizards/UserCreationWizard.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Wizards/UserCreationWizard.cs @@ -310,25 +310,25 @@ namespace WebsitePanel.EnterpriseServer // error while creating mail account throw new Exception("Could not create mail account", ex); } + } - // Instant Alias / Temporary URL - if (tempDomain && (domainId > 0)) + // Instant Alias / Temporary URL + if (tempDomain && (domainId > 0)) + { + int instantAliasId = ServerController.CreateDomainInstantAlias("", domainId); + if (instantAliasId < 0) { - int instantAliasId = ServerController.CreateDomainInstantAlias("", domainId); - if (instantAliasId < 0) - { - // rollback wizard - Rollback(); + // rollback wizard + Rollback(); - return instantAliasId; - } + return instantAliasId; } + } - // Domain DNS Zone - if (createZoneRecord && (domainId > 0)) - { - ServerController.EnableDomainDns(domainId); - } + // Domain DNS Zone + if (createZoneRecord && (domainId > 0)) + { + ServerController.EnableDomainDns(domainId); } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ExchangeMailboxPlan.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ExchangeMailboxPlan.cs index 34125367..c2207f0d 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ExchangeMailboxPlan.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ExchangeMailboxPlan.cs @@ -59,6 +59,8 @@ namespace WebsitePanel.Providers.HostedSolution bool allowLitigationHold; int recoverableItemsWarningPct; int recoverableItemsSpace; + string litigationHoldUrl; + string litigationHoldMsg; public int ItemId @@ -196,5 +198,16 @@ namespace WebsitePanel.Providers.HostedSolution set { this.recoverableItemsSpace = value; } } + public string LitigationHoldUrl + { + get { return this.litigationHoldUrl; } + set { this.litigationHoldUrl = value; } + } + + public string LitigationHoldMsg + { + get { return this.litigationHoldMsg; } + set { this.litigationHoldMsg = value; } + } } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/IExchangeServer.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/IExchangeServer.cs index 66173f60..56ba3f08 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/IExchangeServer.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/IExchangeServer.cs @@ -64,7 +64,7 @@ namespace WebsitePanel.Providers.HostedSolution ExchangeMailbox GetMailboxMailFlowSettings(string accountName); void SetMailboxMailFlowSettings(string accountName, bool enableForwarding, string forwardingAccountName, bool forwardToBoth, string[] sendOnBehalfAccounts, string[] acceptAccounts, string[] rejectAccounts, bool requireSenderAuthentication); ExchangeMailbox GetMailboxAdvancedSettings(string accountName); - void SetMailboxAdvancedSettings(string organizationId, string accountName, bool enablePOP, bool enableIMAP, bool enableOWA, bool enableMAPI, bool enableActiveSync, long issueWarningKB, long prohibitSendKB, long prohibitSendReceiveKB, int keepDeletedItemsDays, int maxRecipients, int maxSendMessageSizeKB, int maxReceiveMessageSizeKB, bool enabledLitigationHold, long recoverabelItemsSpace, long recoverabelItemsWarning); + void SetMailboxAdvancedSettings(string organizationId, string accountName, bool enablePOP, bool enableIMAP, bool enableOWA, bool enableMAPI, bool enableActiveSync, long issueWarningKB, long prohibitSendKB, long prohibitSendReceiveKB, int keepDeletedItemsDays, int maxRecipients, int maxSendMessageSizeKB, int maxReceiveMessageSizeKB, bool enabledLitigationHold, long recoverabelItemsSpace, long recoverabelItemsWarning, string litigationHoldUrl, string litigationHoldMsg); ExchangeEmailAddress[] GetMailboxEmailAddresses(string accountName); void SetMailboxEmailAddresses(string accountName, string[] emailAddresses); void SetMailboxPrimaryEmailAddress(string accountName, string emailAddress); diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/IOrganization.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/IOrganization.cs index 09e1a3de..6da1e71a 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/IOrganization.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/IOrganization.cs @@ -64,5 +64,7 @@ namespace WebsitePanel.Providers.HostedSolution PasswordPolicyResult GetPasswordPolicy(); string GetSamAccountNameByUserPrincipalName(string organizationId, string userPrincipalName); + + bool DoesSamAccountNameExist(string accountName); } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/OrganizationStatistics.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/OrganizationStatistics.cs index 50981d9e..29bd20df 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/OrganizationStatistics.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/OrganizationStatistics.cs @@ -51,6 +51,10 @@ namespace WebsitePanel.Providers.HostedSolution private int allocatedDiskSpace; private int usedDiskSpace; + private int allocatedLitigationHoldSpace; + private int usedLitigationHoldSpace; + + private int allocatedSharePointSiteCollections; private int createdSharePointSiteCollections; @@ -154,6 +158,18 @@ namespace WebsitePanel.Providers.HostedSolution set { usedDiskSpace = value; } } + public int AllocatedLitigationHoldSpace + { + get { return allocatedLitigationHoldSpace; } + set { allocatedLitigationHoldSpace = value; } + } + + public int UsedLitigationHoldSpace + { + get { return usedLitigationHoldSpace; } + set { usedLitigationHoldSpace = value; } + } + public int AllocatedSharePointSiteCollections { get { return allocatedSharePointSiteCollections; } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/Exchange2013.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/Exchange2013.cs index 9ffb293b..142414c9 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/Exchange2013.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/Exchange2013.cs @@ -287,12 +287,12 @@ namespace WebsitePanel.Providers.HostedSolution public void SetMailboxAdvancedSettings(string organizationId, string accountName, bool enablePOP, bool enableIMAP, bool enableOWA, bool enableMAPI, bool enableActiveSync, long issueWarningKB, long prohibitSendKB, long prohibitSendReceiveKB, int keepDeletedItemsDays, int maxRecipients, int maxSendMessageSizeKB, - int maxReceiveMessageSizeKB, bool enabledLitigationHold, long recoverabelItemsSpace, long recoverabelItemsWarning) + int maxReceiveMessageSizeKB, bool enabledLitigationHold, long recoverabelItemsSpace, long recoverabelItemsWarning, string litigationHoldUrl, string litigationHoldMsg) { SetMailboxAdvancedSettingsInternal(organizationId, accountName, enablePOP, enableIMAP, enableOWA, enableMAPI, enableActiveSync, issueWarningKB, prohibitSendKB, prohibitSendReceiveKB, keepDeletedItemsDays, maxRecipients, maxSendMessageSizeKB, maxReceiveMessageSizeKB, - enabledLitigationHold, recoverabelItemsSpace, recoverabelItemsWarning); + enabledLitigationHold, recoverabelItemsSpace, recoverabelItemsWarning, litigationHoldUrl, litigationHoldMsg); } public ExchangeEmailAddress[] GetMailboxEmailAddresses(string accountName) @@ -2489,7 +2489,7 @@ namespace WebsitePanel.Providers.HostedSolution private void SetMailboxAdvancedSettingsInternal(string organizationId, string accountName, bool enablePOP, bool enableIMAP, bool enableOWA, bool enableMAPI, bool enableActiveSync, long issueWarningKB, long prohibitSendKB, long prohibitSendReceiveKB, int keepDeletedItemsDays, int maxRecipients, int maxSendMessageSizeKB, - int maxReceiveMessageSizeKB, bool enabledLitigationHold, long recoverabelItemsSpace, long recoverabelItemsWarning) + int maxReceiveMessageSizeKB, bool enabledLitigationHold, long recoverabelItemsSpace, long recoverabelItemsWarning, string litigationHoldUrl, string litigationHoldMsg) { ExchangeLog.LogStart("SetMailboxAdvancedSettingsInternal"); ExchangeLog.DebugInfo("Account: {0}", accountName); @@ -2510,12 +2510,13 @@ namespace WebsitePanel.Providers.HostedSolution cmd.Parameters.Add("MaxSendSize", ConvertKBToUnlimited(maxSendMessageSizeKB)); cmd.Parameters.Add("MaxReceiveSize", ConvertKBToUnlimited(maxReceiveMessageSizeKB)); - if (enabledLitigationHold) - { - cmd.Parameters.Add("LitigationHoldEnabled", true); - cmd.Parameters.Add("RecoverableItemsQuota", ConvertKBToUnlimited(recoverabelItemsSpace)); - cmd.Parameters.Add("RecoverableItemsWarningQuota", ConvertKBToUnlimited(recoverabelItemsWarning)); - } + cmd.Parameters.Add("LitigationHoldEnabled", enabledLitigationHold); + cmd.Parameters.Add("RecoverableItemsQuota", ConvertKBToUnlimited(recoverabelItemsSpace)); + + cmd.Parameters.Add("RetentionUrl", litigationHoldUrl); + cmd.Parameters.Add("RetentionComment", litigationHoldMsg); + + if (recoverabelItemsSpace != -1) cmd.Parameters.Add("RecoverableItemsWarningQuota", ConvertKBToUnlimited(recoverabelItemsWarning)); ExecuteShellCommand(runSpace, cmd); diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/CRMProvider2011.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/CRMProvider2011.cs new file mode 100644 index 00000000..cef5e001 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/CRMProvider2011.cs @@ -0,0 +1,1652 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Globalization; +using System.IO; +using System.Net; +using System.Reflection; +using System.Net.Security; +using System.Security.Principal; +using System.Security.Cryptography.X509Certificates; +using System.Threading; +using System.ServiceModel.Description; +using Microsoft.Win32; +using WebsitePanel.Providers.Common; +using WebsitePanel.Providers.ResultObjects; +using WebsitePanel.Server.Utils; +using Microsoft.Xrm.Sdk; +using Microsoft.Xrm.Sdk.Query; +using Microsoft.Xrm.Sdk.Discovery; +using Microsoft.Xrm.Sdk.Client; +using Microsoft.Xrm.Sdk.Deployment; +using Microsoft.Xrm.Sdk.Messages; + + +namespace WebsitePanel.Providers.HostedSolution +{ + public class CRMProvider2011 : HostingServiceProviderBase, ICRM + { + private static string crmPath = null; + + #region Properties + + private string UserName + { + get { return ProviderSettings[Constants.UserName]; } + } + + private string Password + { + get { return ProviderSettings[Constants.Password]; } + } + + private string SqlServer + { + get { return ProviderSettings[Constants.SqlServer]; } + } + + private string ReportingServer + { + get { return ProviderSettings[Constants.ReportingServer]; } + } + + private string CRMServiceUrl + { + get + { + string cRMServiceUrl = "https://" + ProviderSettings[Constants.AppRootDomain] + ":" + ProviderSettings[Constants.Port] + "/XRMDeployment/2011/Deployment.svc"; + return cRMServiceUrl; + } + } + + private string CRMDiscoveryUri + { + get + { + string cRMDiscoveryUri = "https://" + ProviderSettings[Constants.AppRootDomain] + ":" + ProviderSettings[Constants.Port] + "/XRMServices/2011/Discovery.svc"; + return cRMDiscoveryUri; + } + } + + private static string CrmPath + { + get + { + if (string.IsNullOrEmpty(crmPath)) + { + RegistryKey root = Registry.LocalMachine; + RegistryKey rk = root.OpenSubKey("SOFTWARE\\Microsoft\\MSCRM"); + if (rk != null) + { + crmPath = (string)rk.GetValue("CRM_Server_InstallDir", string.Empty); + } + } + return crmPath; + } + } + + #endregion + + + #region Static constructor + + static CRMProvider2011() + { + AppDomain.CurrentDomain.AssemblyResolve += ResolveCRMAssembly; + } + + #endregion + + static Assembly ResolveCRMAssembly(object sender, ResolveEventArgs args) + { + var loadedAssembly = default(Assembly); + // Ensure we load DLLs only. + if (args.Name.ToLower().Contains("microsoft.crm") || args.Name.ToLower().Contains("antixsslibrary")) + { + // + string crmToolsPath = Path.Combine(CrmPath, "tools"); + // + string path = Path.Combine(crmToolsPath, args.Name.Split(',')[0] + ".dll"); + // Call to load an assembly only if its existence is confirmed. + if (File.Exists(path)) + { + loadedAssembly = Assembly.LoadFrom(path); + } + } + // + return loadedAssembly; + } + + private bool CheckCRMWebServicesAccess() + { + Log.WriteStart("CheckCRMWebServicesAccess"); + bool ret = false; + HttpWebResponse response = null; + HttpWebRequest request; + + try + { + WindowsIdentity.GetCurrent(); + + request = WebRequest.Create(CRMServiceUrl) as HttpWebRequest; + + if (request != null) + { + request.UseDefaultCredentials = true; + request.Credentials = CredentialCache.DefaultCredentials; + response = request.GetResponse() as HttpWebResponse; + + } + if (response != null) + ret = (response.StatusCode == HttpStatusCode.OK); + } + catch (Exception ex) + { + Log.WriteError(ex); + ret = false; + } + + Log.WriteEnd("CheckCRMWebServicesAccess"); + return ret; + } + + private static bool CheckPermissions() + { + Log.WriteStart("CheckPermissions"); + bool res = false; + try + { + string group = "PrivUserGroup"; + string user = WindowsIdentity.GetCurrent().Name.Split(new char[] { '\\' })[1]; + res = ActiveDirectoryUtils.IsUserInGroup(user, group); + } + catch (Exception ex) + { + Log.WriteError(ex); + res = false; + } + + Log.WriteEnd("CheckPermissions"); + return res; + } + + private bool CheckOrganizationUnique(string databaseName, string orgName) + { + Log.WriteStart("CheckOrganizationUnique"); + bool res = false; + + SqlConnection connection = null; + try + { + connection = new SqlConnection(); + connection.ConnectionString = + string.Format("Server={1};Initial Catalog={0};Integrated Security=SSPI", + databaseName, SqlServer); + + connection.Open(); + + string commandText = string.Format("SELECT COUNT(*) FROM dbo.Organization WHERE UniqueName = '{0}'", orgName); + SqlCommand command = new SqlCommand(commandText, connection); + int count = (int)command.ExecuteScalar(); + res = count == 0; + + + } + catch (Exception ex) + { + res = false; + Log.WriteError(ex); + } + finally + { + if (connection != null) + connection.Dispose(); + + } + + Log.WriteEnd("CheckOrganizationUnique"); + return res; + } + + private bool CheckSqlServerConnection() + { + Log.WriteStart("CheckSqlServerConnection"); + bool res = false; + SqlConnection connection = null; + try + { + connection = new SqlConnection(); + connection.ConnectionString = + string.Format("server={0}; Integrated Security=SSPI", + SqlServer); + + connection.Open(); + res = true; + } + catch (Exception ex) + { + Log.WriteError(ex); + res = false; + } + finally + { + if (connection != null) + connection.Dispose(); + } + + Log.WriteEnd("CheckSqlServerConnection"); + + return res; + } + + private bool CheckReportServerConnection() + { + Log.WriteStart("CheckReportServerConnection"); + bool ret = false; + HttpWebResponse response = null; + HttpWebRequest request; + + try + { + WindowsIdentity.GetCurrent(); + + request = WebRequest.Create(ReportingServer) as HttpWebRequest; + + if (request != null) + { + request.UseDefaultCredentials = true; + request.Credentials = CredentialCache.DefaultCredentials; + response = request.GetResponse() as HttpWebResponse; + + } + if (response != null) + ret = (response.StatusCode == HttpStatusCode.OK); + } + catch (Exception ex) + { + Log.WriteError(ex); + ret = false; + } + + Log.WriteEnd("CheckReportServerConnection"); + return ret; + } + + private OrganizationResult CheckCrmEnvironment(string strDataBaseName, string organizationUniqueName) + { + OrganizationResult retOrganization = StartLog("CheckCrmEnvironment"); + bool res = CheckSqlServerConnection(); + + if (!res) + { + EndLog("CheckCrmEnvironment", retOrganization, CrmErrorCodes.CRM_SQL_SERVER_ERROR); + return retOrganization; + } + + res = CheckOrganizationUnique(strDataBaseName, organizationUniqueName); + if (!res) + { + EndLog("CheckCrmEnvironment", retOrganization, CrmErrorCodes.CRM_ORGANIZATION_ALREADY_EXISTS); + return retOrganization; + } + + res = CheckReportServerConnection(); + if (!res) + { + EndLog("CheckCrmEnvironment", retOrganization, CrmErrorCodes.CRM_REPORT_SERVER_ERROR); + return retOrganization; + } + + res = CheckPermissions(); + if (!res) + { + EndLog("CheckCrmEnvironment", retOrganization, CrmErrorCodes.CRM_PERMISSIONS_ERROR); + return retOrganization; + } + + res = CheckCRMWebServicesAccess(); + if (!res) + { + EndLog("CheckCrmEnvironment", retOrganization, CrmErrorCodes.CRM_WEB_SERVICE_ERROR); + return retOrganization; + } + + EndLog("CheckCrmEnvironment"); + return retOrganization; + } + + public OrganizationResult CreateOrganization(Guid organizationId, string organizationUniqueName, string organizationFriendlyName, string baseCurrencyCode, string baseCurrencyName, string baseCurrencySymbol, string initialUserDomainName, string initialUserFirstName, string initialUserLastName, string initialUserPrimaryEmail, string organizationCollation) + { + return CreateOrganizationInternal(organizationId, organizationUniqueName, organizationFriendlyName, baseCurrencyCode, baseCurrencyName, baseCurrencySymbol, initialUserDomainName, initialUserFirstName, initialUserLastName, initialUserPrimaryEmail, organizationCollation); + } + + const string CRMSysAdminRoleStr = "Системный администратор;System Administrator"; + + internal OrganizationResult CreateOrganizationInternal(Guid organizationId, string organizationUniqueName, string organizationFriendlyName, string baseCurrencyCode, string baseCurrencyName, string baseCurrencySymbol, string initialUserDomainName, string initialUserFirstName, string initialUserLastName, string initialUserPrimaryEmail, string organizationCollation) + { + OrganizationResult ret = StartLog("CreateOrganizationInternal"); + + if (organizationId == Guid.Empty) + throw new ArgumentException("OrganizationId is Guid.Empty"); + + if (string.IsNullOrEmpty(organizationFriendlyName)) + throw new ArgumentNullException("organizationFriendlyName"); + + if (string.IsNullOrEmpty(baseCurrencyCode)) + throw new ArgumentNullException("baseCurrencyCode"); + + if (string.IsNullOrEmpty(baseCurrencySymbol)) + throw new ArgumentNullException("baseCurrencySymbol"); + + if (string.IsNullOrEmpty(initialUserDomainName)) + throw new ArgumentNullException("initialUserDomainName"); + + string strDataBaseName = "MSCRM_CONFIG"; + + OrganizationResult retCheckEn = CheckCrmEnvironment(strDataBaseName, organizationUniqueName); + + if (!retCheckEn.IsSuccess) + { + ret.ErrorCodes.AddRange(retCheckEn.ErrorCodes); + EndLog("CreateOrganizationInternal", ret, null, null); + return ret; + } + + try + { + + Uri serviceUrl = new Uri(CRMServiceUrl); + + DeploymentServiceClient deploymentService = Microsoft.Xrm.Sdk.Deployment.Proxy.ProxyClientHelper.CreateClient(serviceUrl); + + Microsoft.Xrm.Sdk.Deployment.Organization org = new Microsoft.Xrm.Sdk.Deployment.Organization + { + Id = organizationId, + UniqueName = organizationUniqueName, + FriendlyName = organizationFriendlyName, + SqlServerName = SqlServer, + SrsUrl = ReportingServer, + BaseCurrencyCode = baseCurrencyCode, + BaseCurrencyName = baseCurrencyName, + BaseCurrencySymbol = baseCurrencySymbol, + SqlCollation = organizationCollation, + State = Microsoft.Xrm.Sdk.Deployment.OrganizationState.Enabled + }; + + BeginCreateOrganizationRequest req = new BeginCreateOrganizationRequest + { + Organization = org + }; + + if (!String.IsNullOrEmpty(UserName)) + { + req.SysAdminName = UserName; + } + + BeginCreateOrganizationResponse resp = deploymentService.Execute(req) as BeginCreateOrganizationResponse; + + if (resp == null) + throw new ArgumentException("BeginCreateOrganizationResponse is Null"); + + EntityInstanceId id = new EntityInstanceId(); + id.Name = org.UniqueName; + + Microsoft.Xrm.Sdk.Deployment.OrganizationState OperationState = Microsoft.Xrm.Sdk.Deployment.OrganizationState.Pending; + + do + { + Thread.Sleep(30000); + try + { + Microsoft.Xrm.Sdk.Deployment.Organization getorg + = (Microsoft.Xrm.Sdk.Deployment.Organization)deploymentService.Retrieve(DeploymentEntityType.Organization, id); + OperationState = getorg.State; + } + catch { } + } while ((OperationState != Microsoft.Xrm.Sdk.Deployment.OrganizationState.Enabled) && + (OperationState != Microsoft.Xrm.Sdk.Deployment.OrganizationState.Failed)); + + if (OperationState == Microsoft.Xrm.Sdk.Deployment.OrganizationState.Failed) + throw new ArgumentException("Create organization failed."); + + + try + { + OrganizationServiceProxy _serviceProxy = GetOrganizationProxy(organizationUniqueName); + + string ldap = ""; + + Guid SysAdminGuid = RetrieveSystemUser(GetDomainName(initialUserDomainName), initialUserFirstName, initialUserLastName, CRMSysAdminRoleStr, _serviceProxy, ref ldap); + } + catch { } + + } + catch (Exception ex) + { + HostedSolutionLog.LogError(ex); + EndLog("CheckCrmEnvironment", ret, CrmErrorCodes.CREATE_CRM_ORGANIZATION_GENERAL_ERROR, ex); + return ret; + + } + + EndLog("CheckCrmEnvironment"); + + return ret; + } + + private string GetDomainName(string username) + { + string domain = ActiveDirectoryUtils.GetNETBIOSDomainName(ServerSettings.ADRootDomain); + string ret = string.Format(@"{0}\{1}", domain, username); + return ret; + } + + public string[] GetSupportedCollationNames() + { + return GetSupportedCollationNamesInternal(SqlServer); + } + + internal static string[] GetSupportedCollationNamesInternal(string SqlServer) + { + HostedSolutionLog.LogStart("GetSupportedCollationNamesInternal"); + + List ret = new List(); + + string databaseName = "MSCRM_CONFIG"; + + SqlConnection connection = null; + try + { + connection = new SqlConnection(); + connection.ConnectionString = + string.Format("Server={1};Initial Catalog={0};Integrated Security=SSPI", + databaseName, SqlServer); + + connection.Open(); + + string commandText = "select * from fn_helpcollations() where " + + "(name not like '%_WS') AND (name not like '%_KS') AND (name not like '%_100_%') " + + " AND (name not like 'SQL_%') " + + " order by name"; + SqlCommand command = new SqlCommand(commandText, connection); + SqlDataReader reader = command.ExecuteReader(); + + while (reader.Read()) + { + string name = reader["name"] as string; + ret.Add(name); + } + + } + catch (Exception ex) + { + } + finally + { + if (connection != null) + connection.Dispose(); + + } + + HostedSolutionLog.LogEnd("GetSupportedCollationNamesInternal"); + return ret.ToArray(); + } + + public Currency[] GetCurrencyList() + { + return GetCurrencyListInternal(); + } + + private Currency[] GetCurrencyListInternal() + { + HostedSolutionLog.LogStart("GetCurrencyListInternal"); + List retList = new List(); + + CultureInfo[] cultures = CultureInfo.GetCultures(CultureTypes.AllCultures & ~CultureTypes.NeutralCultures); + + foreach (CultureInfo cultire in cultures) + { + try + { + RegionInfo Region = new RegionInfo(cultire.LCID); + + Console.WriteLine(cultire.NativeName + " " + Region.CurrencyNativeName); + + Currency currency = new Currency(); + currency.RegionName = Region.NativeName; + currency.CurrencyName = Region.CurrencyNativeName; + currency.CurrencyCode = Region.ISOCurrencySymbol; + currency.CurrencySymbol = Region.CurrencySymbol; + retList.Add(currency); + + } + catch + { + continue; + } + } + + retList.Sort(delegate(Currency a, Currency b) { return a.RegionName.CompareTo(b.RegionName); }); + + HostedSolutionLog.LogEnd("GetCurrencyListInternal"); + return retList.ToArray(); + } + + + public ResultObject DeleteOrganization(Guid orgId) + { + return DeleteOrganizationInternal(orgId); + } + + internal ResultObject DeleteOrganizationInternal(Guid orgId) + { + ResultObject res = StartLog("DeleteOrganizationInternal"); + + + res.IsSuccess = true; + try + { + Uri serviceUrl = new Uri(CRMServiceUrl); + + DeploymentServiceClient deploymentService = Microsoft.Xrm.Sdk.Deployment.Proxy.ProxyClientHelper.CreateClient(serviceUrl); + + EntityInstanceId i = new EntityInstanceId(); + i.Id = orgId; //Organisation Id + + Microsoft.Xrm.Sdk.Deployment.Organization org = (Microsoft.Xrm.Sdk.Deployment.Organization)deploymentService.Retrieve(DeploymentEntityType.Organization, i); + + org.State = Microsoft.Xrm.Sdk.Deployment.OrganizationState.Disabled; + + Microsoft.Xrm.Sdk.Deployment.UpdateRequest updateRequest = new Microsoft.Xrm.Sdk.Deployment.UpdateRequest(); + updateRequest.Entity = org; + + deploymentService.Execute(updateRequest); + + } + catch (Exception ex) + { + EndLog("DeleteOrganizationInternal", res, CrmErrorCodes.DELETE_CRM_ORGANIZATION_GENERAL_ERROR, ex); + return res; + + } + + + EndLog("DeleteOrganizationInternal"); + return res; + } + + public override void DeleteServiceItems(ServiceProviderItem[] items) + { + foreach (ServiceProviderItem item in items) + { + try + { + if (item is Organization) + { + Organization org = item as Organization; + DeleteOrganization(org.CrmOrganizationId); + } + + } + catch (Exception ex) + { + Log.WriteError(String.Format("Error deleting '{0}' {1}", item.Name, item.GetType().Name), ex); + } + } + base.DeleteServiceItems(items); + + } + + private static void EndLog(string message, ResultObject res, string errorCode, Exception ex) + { + if (res != null) + { + res.IsSuccess = false; + + if (!string.IsNullOrEmpty(errorCode)) + res.ErrorCodes.Add(errorCode); + } + + if (ex != null) + HostedSolutionLog.LogError(ex); + + HostedSolutionLog.LogEnd(message); + } + + private static void EndLog(string message, ResultObject res, string errorCode) + { + EndLog(message, res, errorCode, null); + } + + private static void EndLog(string message, ResultObject res) + { + EndLog(message, res, null); + } + + private static void EndLog(string message) + { + EndLog(message, null); + } + + private static T StartLog(string message) where T : ResultObject, new() + { + HostedSolutionLog.LogStart(message); + T res = new T(); + res.IsSuccess = true; + return res; + } + + public UserResult CreateCRMUser(OrganizationUser user, string orgName, Guid organizationId, Guid baseUnitId) + { + return CreateCRMUserInternal(user, orgName, organizationId, baseUnitId); + } + + internal UserResult CreateCRMUserInternal(OrganizationUser user, string orgName, Guid organizationId, Guid businessUnitId) + { + UserResult res = StartLog("CreateCRMUserInternal"); + + try + { + if (user == null) + throw new ArgumentNullException("user"); + + if (string.IsNullOrEmpty(orgName)) + throw new ArgumentNullException("orgName"); + + if (organizationId == Guid.Empty) + throw new ArgumentException("organizationId"); + + if (businessUnitId == Guid.Empty) + throw new ArgumentException("businessUnitId"); + + try + { + OrganizationServiceProxy _serviceProxy = GetOrganizationProxy(orgName); + + + string ldap = ""; + Guid guid = RetrieveSystemUser(user.DomainUserName, user.FirstName, user.LastName, CRMSysAdminRoleStr, _serviceProxy, ref ldap); + + user.CrmUserId = guid; + res.Value = user; + + } + catch (Exception ex) + { + EndLog("CreateCRMUserInternal", res, CrmErrorCodes.CANNOT_CREATE_CRM_USER, ex); + return res; + } + } + catch (Exception ex) + { + EndLog("CreateCRMUserInternal", res, CrmErrorCodes.CANNOT_CREATE_CRM_USER_GENERAL_ERROR, ex); + return res; + + } + + EndLog("CreateCRMUserInternal"); + return res; + } + + private static Guid CreateSystemUser(String userName, String firstName, + String lastName, String domain, String roleStr, + OrganizationServiceProxy serviceProxy, ref String ldapPath) + { + + if (serviceProxy.ServiceConfiguration.AuthenticationType == AuthenticationProviderType.LiveId || + serviceProxy.ServiceConfiguration.AuthenticationType == AuthenticationProviderType.OnlineFederation) + throw new Exception(String.Format("To run this sample, {0} {1} must be an active system user in your Microsoft Dynamics CRM Online organization.", firstName, lastName)); + + Guid userId = Guid.Empty; + + Microsoft.Xrm.Sdk.Query.QueryExpression businessUnitQuery = new Microsoft.Xrm.Sdk.Query.QueryExpression + { + EntityName = BusinessUnit.EntityLogicalName, + ColumnSet = new Microsoft.Xrm.Sdk.Query.ColumnSet("businessunitid"), + Criteria = + { + Conditions = + { + new Microsoft.Xrm.Sdk.Query.ConditionExpression("parentbusinessunitid", + Microsoft.Xrm.Sdk.Query.ConditionOperator.Null) + } + } + }; + + BusinessUnit defaultBusinessUnit = serviceProxy.RetrieveMultiple( + businessUnitQuery).Entities[0].ToEntity(); + + // Retrieve the specified security role. + Role role = RetrieveRoleByName(serviceProxy, roleStr); + + //Create a new system user. + SystemUser user = new SystemUser + { + DomainName = userName, + FirstName = firstName, + LastName = lastName, + BusinessUnitId = new EntityReference + { + LogicalName = BusinessUnit.EntityLogicalName, + Name = BusinessUnit.EntityLogicalName, + Id = defaultBusinessUnit.Id + } + }; + userId = serviceProxy.Create(user); + + // Assign the security role to the newly created Microsoft Dynamics CRM user. + AssociateRequest associate = new AssociateRequest() + { + Target = new EntityReference(SystemUser.EntityLogicalName, userId), + RelatedEntities = new EntityReferenceCollection() + { + new EntityReference(Role.EntityLogicalName, role.Id), + }, + Relationship = new Relationship("systemuserroles_association") + }; + serviceProxy.Execute(associate); + + return userId; + } + + + public static Guid RetrieveSystemUser(String userName, String firstName, + String lastName, String roleStr, OrganizationServiceProxy serviceProxy, + ref String ldapPath) + { + String domain; + Guid userId = Guid.Empty; + + if (serviceProxy == null) + throw new ArgumentNullException("serviceProxy"); + + if (String.IsNullOrWhiteSpace(userName)) + throw new ArgumentNullException("UserName"); + + if (String.IsNullOrWhiteSpace(firstName)) + throw new ArgumentNullException("FirstName"); + + if (String.IsNullOrWhiteSpace(lastName)) + throw new ArgumentNullException("LastName"); + + if (String.IsNullOrWhiteSpace(roleStr)) + throw new ArgumentNullException("Role"); + + // Obtain the current user's information. + Microsoft.Crm.Sdk.Messages.WhoAmIRequest who = new Microsoft.Crm.Sdk.Messages.WhoAmIRequest(); + Microsoft.Crm.Sdk.Messages.WhoAmIResponse whoResp = (Microsoft.Crm.Sdk.Messages.WhoAmIResponse)serviceProxy.Execute(who); + Guid currentUserId = whoResp.UserId; + + SystemUser currentUser = + serviceProxy.Retrieve(SystemUser.EntityLogicalName, currentUserId, new Microsoft.Xrm.Sdk.Query.ColumnSet("domainname")).ToEntity(); + + // Extract the domain and create the LDAP object. + String[] userPath = currentUser.DomainName.Split(new char[] { '\\' }); + if (userPath.Length > 1) + domain = userPath[0] + "\\"; + else + domain = String.Empty; + + // Create the system user in Microsoft Dynamics CRM if the user doesn't + // already exist. + Microsoft.Xrm.Sdk.Query.QueryExpression userQuery = new Microsoft.Xrm.Sdk.Query.QueryExpression + { + EntityName = SystemUser.EntityLogicalName, + ColumnSet = new Microsoft.Xrm.Sdk.Query.ColumnSet("systemuserid"), + Criteria = + { + FilterOperator = Microsoft.Xrm.Sdk.Query.LogicalOperator.Or, + Filters = + { + new Microsoft.Xrm.Sdk.Query.FilterExpression + { + FilterOperator = Microsoft.Xrm.Sdk.Query.LogicalOperator.And, + Conditions = + { + new Microsoft.Xrm.Sdk.Query.ConditionExpression("domainname", Microsoft.Xrm.Sdk.Query.ConditionOperator.Equal, domain + userName) + } + }, + new Microsoft.Xrm.Sdk.Query.FilterExpression + { + FilterOperator = Microsoft.Xrm.Sdk.Query.LogicalOperator.And, + Conditions = + { + new Microsoft.Xrm.Sdk.Query.ConditionExpression("firstname", Microsoft.Xrm.Sdk.Query.ConditionOperator.Equal, firstName), + new Microsoft.Xrm.Sdk.Query.ConditionExpression("lastname", Microsoft.Xrm.Sdk.Query.ConditionOperator.Equal, lastName) + } + } + } + + } + }; + + DataCollection existingUsers = (DataCollection)serviceProxy.RetrieveMultiple(userQuery).Entities; + + SystemUser existingUser = null; + if (existingUsers.Count > 0) + existingUser = existingUsers[0].ToEntity(); + + if (existingUser != null) + { + userId = existingUser.SystemUserId.Value; + + // Check to make sure the user is assigned the correct role. + Role role = RetrieveRoleByName(serviceProxy, roleStr); + + // Associate the user with the role when needed. + if (!UserInRole(serviceProxy, userId, role.Id)) + { + AssociateRequest associate = new AssociateRequest() + { + Target = new EntityReference(SystemUser.EntityLogicalName, userId), + RelatedEntities = new EntityReferenceCollection() + { + new EntityReference(Role.EntityLogicalName, role.Id) + }, + Relationship = new Relationship("systemuserroles_association") + }; + serviceProxy.Execute(associate); + } + } + else + { + userId = CreateSystemUser(userName, firstName, lastName, domain, + roleStr, serviceProxy, ref ldapPath); + } + + return userId; + } + + private static Role RetrieveRoleByName(OrganizationServiceProxy serviceProxy, + String roleSplitStr) + { + string[] RolesStr = roleSplitStr.Split(';'); + + foreach (string roleStr in RolesStr) + { + + Microsoft.Xrm.Sdk.Query.QueryExpression roleQuery = new Microsoft.Xrm.Sdk.Query.QueryExpression + { + EntityName = Role.EntityLogicalName, + ColumnSet = new Microsoft.Xrm.Sdk.Query.ColumnSet("roleid"), + Criteria = + { + Conditions = + { + new Microsoft.Xrm.Sdk.Query.ConditionExpression("name", Microsoft.Xrm.Sdk.Query.ConditionOperator.Equal, roleStr) + } + } + }; + + DataCollection roles = serviceProxy.RetrieveMultiple(roleQuery).Entities; + + if (roles.Count > 0) return roles[0].ToEntity(); + } + + return null; + } + + private static bool UserInRole(OrganizationServiceProxy serviceProxy, + Guid userId, Guid roleId) + { + // Establish a SystemUser link for a query. + Microsoft.Xrm.Sdk.Query.LinkEntity systemUserLink = new Microsoft.Xrm.Sdk.Query.LinkEntity() + { + LinkFromEntityName = SystemUserRoles.EntityLogicalName, + LinkFromAttributeName = "systemuserid", + LinkToEntityName = SystemUser.EntityLogicalName, + LinkToAttributeName = "systemuserid", + LinkCriteria = + { + Conditions = + { + new Microsoft.Xrm.Sdk.Query.ConditionExpression( + "systemuserid", Microsoft.Xrm.Sdk.Query.ConditionOperator.Equal, userId) + } + } + }; + + // Build the query. + Microsoft.Xrm.Sdk.Query.QueryExpression query = new Microsoft.Xrm.Sdk.Query.QueryExpression() + { + EntityName = Role.EntityLogicalName, + ColumnSet = new Microsoft.Xrm.Sdk.Query.ColumnSet("roleid"), + LinkEntities = + { + new Microsoft.Xrm.Sdk.Query.LinkEntity() + { + LinkFromEntityName = Role.EntityLogicalName, + LinkFromAttributeName = "roleid", + LinkToEntityName = SystemUserRoles.EntityLogicalName, + LinkToAttributeName = "roleid", + LinkEntities = {systemUserLink} + } + }, + Criteria = + { + Conditions = + { + new Microsoft.Xrm.Sdk.Query.ConditionExpression("roleid", Microsoft.Xrm.Sdk.Query.ConditionOperator.Equal, roleId) + } + } + }; + + // Retrieve matching roles. + EntityCollection ec = serviceProxy.RetrieveMultiple(query); + + if (ec.Entities.Count > 0) + return true; + + return false; + } + + int GetOrganizationProxyTryCount = 5; + int GetOrganizationProxyTryTimeout = 30000; + + private OrganizationServiceProxy GetOrganizationProxy(string orgName) + { + + Uri OrganizationUri = GetOrganizationAddress(orgName); + + OrganizationServiceProxy r = null; + + bool success = false; + int tryItem = 0; + Exception exception = null; + + while (!success) + { + + try + { + // Set IServiceManagement for the current organization. + IServiceManagement orgServiceManagement = + ServiceConfigurationFactory.CreateManagement( + OrganizationUri); + + r = new OrganizationServiceProxy( + orgServiceManagement, + GetUserLogonCredentials()); + + success = true; + + } + catch (Exception exc) + { + Thread.Sleep(GetOrganizationProxyTryTimeout); + tryItem++; + if (tryItem >= GetOrganizationProxyTryCount) + { + exception = exc; + success = true; + } + } + + } + + if (exception != null) + throw new ArgumentException(exception.ToString()); + + r.EnableProxyTypes(); + + return r; + } + + protected virtual ClientCredentials GetUserLogonCredentials() + { + ClientCredentials credentials = new ClientCredentials(); + + if (String.IsNullOrEmpty(UserName)) + { + credentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials; + } + else + { + credentials.UserName.UserName = UserName; + credentials.UserName.Password = Password; + } + + return credentials; + } + + + private DiscoveryServiceProxy GetDiscoveryProxy() + { + + IServiceManagement serviceManagement = + ServiceConfigurationFactory.CreateManagement( + new Uri(CRMDiscoveryUri)); + + ClientCredentials Credentials = GetUserLogonCredentials(); + + DiscoveryServiceProxy r = new DiscoveryServiceProxy(serviceManagement, Credentials); + + return r; + } + + + public OrganizationDetailCollection DiscoverOrganizations(IDiscoveryService service) + { + if (service == null) throw new ArgumentNullException("service"); + RetrieveOrganizationsRequest orgRequest = new RetrieveOrganizationsRequest(); + RetrieveOrganizationsResponse orgResponse = + (RetrieveOrganizationsResponse)service.Execute(orgRequest); + + return orgResponse.Details; + } + + protected virtual Uri GetOrganizationAddress(string orgName) + { + string url = "https://" + ProviderSettings[Constants.AppRootDomain] + ":" + ProviderSettings[Constants.Port] + "/" + orgName + "/XRMServices/2011/Organization.svc"; + + try + { + + using (DiscoveryServiceProxy serviceProxy = GetDiscoveryProxy()) + { + // Obtain organization information from the Discovery service. + if (serviceProxy != null) + { + // Obtain information about the organizations that the system user belongs to. + OrganizationDetailCollection orgs = DiscoverOrganizations(serviceProxy); + + for (int n = 0; n < orgs.Count; n++) + { + if (orgs[n].UniqueName == orgName) + { + // Return the organization Uri. + return new System.Uri(orgs[n].Endpoints[EndpointType.OrganizationService]); + } + } + + } + } + } + catch { } + + return new Uri(url); + + } + + + internal CRMBusinessUnitsResult GetOrganizationBusinessUnitsInternal(Guid organizationId, string orgName) + { + CRMBusinessUnitsResult res = StartLog("GetOrganizationBusinessUnitsInternal"); + + try + { + if (organizationId == Guid.Empty) + throw new ArgumentException("organizationId"); + + if (string.IsNullOrEmpty(orgName)) + throw new ArgumentNullException("orgName"); + + OrganizationServiceProxy serviceProxy; + + try + { + serviceProxy = GetOrganizationProxy(orgName); + } + catch (Exception ex) + { + EndLog("GetOrganizationBusinessUnitsInternal", res, CrmErrorCodes.CANNOT_GET_CRM_SERVICE, ex); + return res; + } + + DataCollection BusinessUnits; + + try + { + + Microsoft.Xrm.Sdk.Query.QueryExpression businessUnitQuery = new Microsoft.Xrm.Sdk.Query.QueryExpression + { + EntityName = BusinessUnit.EntityLogicalName, + ColumnSet = new Microsoft.Xrm.Sdk.Query.ColumnSet(new string[] { "businessunitid", "name" }), + Criteria = + { + Conditions = + { + new Microsoft.Xrm.Sdk.Query.ConditionExpression("parentbusinessunitid", + Microsoft.Xrm.Sdk.Query.ConditionOperator.Null) + } + } + }; + + BusinessUnits = serviceProxy.RetrieveMultiple( + businessUnitQuery).Entities; + + } + catch (Exception ex) + { + EndLog("GetOrganizationBusinessUnitsInternal", res, CrmErrorCodes.CANNOT_GET_CRM_BUSINESS_UNITS, ex); + return res; + } + + List businessUnits = new List(); + + try + { + for (int i = 0; i < BusinessUnits.Count; i++) + { + BusinessUnit bu = BusinessUnits[i].ToEntity(); + + CRMBusinessUnit unit = new CRMBusinessUnit(); + unit.BusinessUnitId = (Guid)bu.BusinessUnitId; + unit.BusinessUnitName = bu.Name; + + if (unit.BusinessUnitName == null) + unit.BusinessUnitName = "default"; + + businessUnits.Add(unit); + + } + + res.Value = businessUnits; + } + catch (Exception ex) + { + EndLog("GetOrganizationBusinessUnitsInternal", res, CrmErrorCodes.CANNOT_FILL_BASE_UNITS_COLLECTION, + ex); + return res; + } + } + catch (Exception ex) + { + EndLog("GetOrganizationBusinessUnitsInternal", res, CrmErrorCodes.GET_ORGANIZATION_BUSINESS_UNITS_GENERAL_ERROR, + ex); + return res; + + } + + EndLog("GetOrganizationBusinessUnitsInternal"); + return res; + + } + + public CRMBusinessUnitsResult GetOrganizationBusinessUnits(Guid organizationId, string orgName) + { + return GetOrganizationBusinessUnitsInternal(organizationId, orgName); + } + + public CrmRolesResult GetAllCrmRoles(string orgName, Guid businessUnitId) + { + return GetAllCrmRolesInternal(orgName, businessUnitId); + } + + public CrmRolesResult GetCrmUserRoles(string orgName, Guid userId) + { + return GetCrmUserRolesInternal(userId, orgName); + } + + public EntityCollection GetUserRoles(Guid userId, string orgName) + { + OrganizationServiceProxy serviceProxy = GetOrganizationProxy(orgName); + + // Establish a SystemUser link for a query. + Microsoft.Xrm.Sdk.Query.LinkEntity systemUserLink = new Microsoft.Xrm.Sdk.Query.LinkEntity() + { + LinkFromEntityName = SystemUserRoles.EntityLogicalName, + LinkFromAttributeName = "systemuserid", + LinkToEntityName = SystemUser.EntityLogicalName, + LinkToAttributeName = "systemuserid", + LinkCriteria = + { + Conditions = + { + new Microsoft.Xrm.Sdk.Query.ConditionExpression( + "systemuserid", Microsoft.Xrm.Sdk.Query.ConditionOperator.Equal, userId) + } + } + }; + + // Build the query. + Microsoft.Xrm.Sdk.Query.QueryExpression query = new Microsoft.Xrm.Sdk.Query.QueryExpression() + { + EntityName = Role.EntityLogicalName, + ColumnSet = new Microsoft.Xrm.Sdk.Query.ColumnSet("roleid"), + LinkEntities = + { + new Microsoft.Xrm.Sdk.Query.LinkEntity() + { + LinkFromEntityName = Role.EntityLogicalName, + LinkFromAttributeName = "roleid", + LinkToEntityName = SystemUserRoles.EntityLogicalName, + LinkToAttributeName = "roleid", + LinkEntities = {systemUserLink} + } + } + }; + + // Retrieve matching roles. + EntityCollection relations = serviceProxy.RetrieveMultiple(query); + + return relations; + } + + internal CrmRolesResult GetCrmUserRolesInternal(Guid userId, string orgName) + { + CrmRolesResult res = StartLog("GetCrmUserRolesInternal"); + + + try + { + EntityCollection relations; + + if (userId == Guid.Empty) + throw new ArgumentException("userId"); + + if (string.IsNullOrEmpty(orgName)) + throw new ArgumentNullException("orgName"); + + try + { + relations = GetUserRoles(userId, orgName); + } + catch (Exception ex) + { + EndLog("GetCrmUserRolesInternal", res, CrmErrorCodes.CANNOT_GET_CRM_USER_ROLES, ex); + return res; + } + + try + { + res.Value = FillCrmRoles(relations, true, Guid.Empty); + } + catch (Exception ex) + { + EndLog("GetCrmUserRolesInternal", res, CrmErrorCodes.CANNOT_FILL_ROLES_COLLECTION, ex); + return res; + } + } + catch (Exception ex) + { + EndLog("GetCrmUserRolesInternal", res, CrmErrorCodes.GET_CRM_USER_ROLE_GENERAL_ERROR, ex); + return res; + } + + EndLog("GetCrmUserRolesInternal"); + return res; + } + + private static List FillCrmRoles(EntityCollection entities, bool isUserRole, Guid businessUnitId) + { + List res = new List(); + + foreach (Entity current in entities.Entities) + { + Role role = current.ToEntity(); + + if (role == null) continue; + + if (businessUnitId != Guid.Empty) + { + if (businessUnitId != role.BusinessUnitId.Id) + continue; + } + + CrmRole crmRole = new CrmRole(); + crmRole.IsCurrentUserRole = isUserRole; + crmRole.RoleId = (Guid)role.RoleId; + crmRole.RoleName = role.Name; + + res.Add(crmRole); + } + + return res; + } + + + private static List FillCrmRoles(EntityCollection entities, Guid businessUnitId) + { + return FillCrmRoles(entities, false, businessUnitId); + } + + internal CrmRolesResult GetAllCrmRolesInternal(string orgName, Guid businessUnitId) + { + CrmRolesResult res = StartLog("GetAllCrmRoles"); + + try + { + if (string.IsNullOrEmpty(orgName)) + throw new ArgumentNullException("orgName"); + + EntityCollection roles; + try + { + OrganizationServiceProxy serviceProxy = GetOrganizationProxy(orgName); + + Microsoft.Xrm.Sdk.Query.QueryExpression roleQuery = new Microsoft.Xrm.Sdk.Query.QueryExpression + { + EntityName = Role.EntityLogicalName, + ColumnSet = new Microsoft.Xrm.Sdk.Query.ColumnSet(new string[] { "roleid", "name", "businessunitid" }), + }; + + roles = serviceProxy.RetrieveMultiple(roleQuery); + + + } + catch (Exception ex) + { + EndLog("GetAllCrmRoles", res, CrmErrorCodes.CANNOT_GET_ALL_CRM_ROLES, ex); + return res; + } + + try + { + List crmRoles = FillCrmRoles(roles, businessUnitId); + res.Value = crmRoles; + } + catch (Exception ex) + { + EndLog("GetAllCrmRoles", res, CrmErrorCodes.CANNOT_FILL_ROLES_COLLECTION, ex); + return res; + } + } + catch (Exception ex) + { + EndLog("GetAllCrmRoles", res, CrmErrorCodes.GET_ALL_CRM_ROLES_GENERAL_ERROR, ex); + return res; + } + + EndLog("GetAllCrmRoles"); + return res; + } + + public ResultObject SetUserRoles(string orgName, Guid userId, Guid[] roles) + { + return SetUserRolesInternal(orgName, userId, roles); + } + + internal ResultObject SetUserRolesInternal(string orgName, Guid userId, Guid[] roles) + { + CrmRolesResult res = StartLog("SetUserRolesInternal"); + + try + { + if (string.IsNullOrEmpty(orgName)) + throw new ArgumentNullException("orgName"); + + if (userId == Guid.Empty) + throw new ArgumentException("userId"); + + if (roles == null) + throw new ArgumentNullException("roles"); + + OrganizationServiceProxy serviceProxy = GetOrganizationProxy(orgName); + + + CrmRolesResult tmpRoles = GetCrmUserRoles(orgName, userId); + res.ErrorCodes.AddRange(tmpRoles.ErrorCodes); + + if (!tmpRoles.IsSuccess) + return res; + + List remRoles = new List(); + + for (int i = 0; i < tmpRoles.Value.Count; i++) + { + if (Array.Find(roles, delegate(Guid current) { return current == tmpRoles.Value[i].RoleId; }) == Guid.Empty) + { + remRoles.Add(tmpRoles.Value[i].RoleId); + } + } + + try + { + DisassociateRequest removeRole = new DisassociateRequest() + { + Target = new EntityReference(SystemUser.EntityLogicalName, userId), + RelatedEntities = new EntityReferenceCollection(), + Relationship = new Relationship("systemuserroles_association") + }; + + for (int i = 0; i < remRoles.Count; i++) + removeRole.RelatedEntities.Add(new EntityReference(Role.EntityLogicalName, remRoles[i])); + + serviceProxy.Execute(removeRole); + + } + catch (Exception ex) + { + EndLog("SetUserRolesInternal", res, CrmErrorCodes.CANNOT_REMOVE_CRM_USER_ROLES, ex); + return res; + } + + + try + { + // Assign the security role to the newly created Microsoft Dynamics CRM user. + AssociateRequest associate = new AssociateRequest() + { + Target = new EntityReference(SystemUser.EntityLogicalName, userId), + RelatedEntities = new EntityReferenceCollection(), + Relationship = new Relationship("systemuserroles_association") + }; + + for (int i = 0; i < roles.Length; i++) + { + bool find = false; + foreach (CrmRole current in tmpRoles.Value) + { + if (current.RoleId == roles[i]) + find = true; + } + if (find) continue; + + associate.RelatedEntities.Add(new EntityReference(Role.EntityLogicalName, roles[i])); + } + + serviceProxy.Execute(associate); + } + catch (Exception ex) + { + EndLog("SetUserRolesInternal", res, CrmErrorCodes.CANNOT_ASSIGN_CRM_USER_ROLES, ex); + return res; + } + + } + catch (Exception ex) + { + EndLog("SetUserRolesInternal", res, CrmErrorCodes.CANNOT_SET_CRM_USER_ROLES_GENERAL_ERROR, ex); + return res; + } + + + EndLog("SetUserRolesInternal"); + return res; + + } + + + public CrmUserResult GetCrmUserById(Guid crmUserId, string orgName) + { + return GetCrmUserByIdInternal(crmUserId, orgName); + } + + internal CrmUserResult GetCrmUserByIdInternal(Guid crmUserId, string orgName) + { + CrmUserResult ret = StartLog("GetCrmUserByIdInternal"); + + try + { + if (crmUserId == Guid.Empty) + throw new ArgumentNullException("crmUserId"); + + if (string.IsNullOrEmpty(orgName)) + throw new ArgumentNullException("orgName"); + + OrganizationServiceProxy serviceProxy = GetOrganizationProxy(orgName); + + SystemUser retruveUser = + serviceProxy.Retrieve(SystemUser.EntityLogicalName, crmUserId, new Microsoft.Xrm.Sdk.Query.ColumnSet("domainname", "businessunitid", "accessmode", "isdisabled")).ToEntity(); + + CrmUser user = null; + + if (retruveUser != null) + { + user = new CrmUser(); + user.BusinessUnitId = retruveUser.BusinessUnitId.Id; + user.CRMUserId = retruveUser.SystemUserId.Value; + user.ClientAccessMode = (CRMUserAccessMode)retruveUser.AccessMode.Value; + user.IsDisabled = (bool)retruveUser.IsDisabled; + + ret.Value = user; + } + } + catch (Exception ex) + { + EndLog("GetCrmUserByIdInternal", ret, CrmErrorCodes.CANONT_GET_CRM_USER_BY_ID, ex); + return ret; + } + + EndLog("GetCrmUserByIdInternal"); + return ret; + } + + + internal CrmUserResult GetCrmUserByDomainNameInternal(string domainName, string orgName) + { + CrmUserResult ret = StartLog("GetCrmUserByDomainNameInternal"); + + try + { + if (string.IsNullOrEmpty(domainName)) + throw new ArgumentNullException("domainName"); + + if (string.IsNullOrEmpty(orgName)) + throw new ArgumentNullException("orgName"); + + + OrganizationServiceProxy serviceProxy = GetOrganizationProxy(orgName); + + Microsoft.Xrm.Sdk.Query.QueryExpression usereQuery = new Microsoft.Xrm.Sdk.Query.QueryExpression + { + EntityName = SystemUser.EntityLogicalName, + ColumnSet = new Microsoft.Xrm.Sdk.Query.ColumnSet("domainname", "businessunitid", "accessmode", "isdisabled", "systemuserid"), + }; + + EntityCollection users = serviceProxy.RetrieveMultiple(usereQuery); + + foreach (Entity entityuser in users.Entities) + { + SystemUser sysuser = entityuser.ToEntity(); + + if (sysuser == null) continue; + if (sysuser.DomainName != domainName) continue; + + CrmUser user = new CrmUser(); + user.BusinessUnitId = sysuser.BusinessUnitId.Id; + user.CRMUserId = sysuser.SystemUserId.Value; + user.ClientAccessMode = (CRMUserAccessMode)sysuser.AccessMode.Value; + user.IsDisabled = sysuser.IsDisabled.Value; + ret.Value = user; + } + } + catch (Exception ex) + { + EndLog("GetCrmUserByDomainNameInternal", ret, CrmErrorCodes.CANONT_GET_CRM_USER_BY_DOMAIN_NAME, ex); + return ret; + } + + EndLog("GetCrmUserByDomainNameInternal"); + return ret; + } + + public CrmUserResult GetCrmUserByDomainName(string domainName, string orgName) + { + return GetCrmUserByDomainNameInternal(domainName, orgName); + } + + + private static Guid GetFetureId(string name) + { + if (string.IsNullOrEmpty(name)) + throw new ArgumentNullException("name"); + + return Guid.Empty; + } + + + public ResultObject ChangeUserState(bool disable, string orgName, Guid crmUserId) + { + return ChangeUserStateInternal(disable, orgName, crmUserId); + } + + + internal ResultObject ChangeUserStateInternal(bool disable, string orgName, Guid crmUserId) + { + ResultObject res = StartLog("ChangeUserStateInternal"); + + res.IsSuccess = true; + try + { + if (crmUserId == Guid.Empty) + throw new ArgumentNullException("crmUserId"); + + if (string.IsNullOrEmpty(orgName)) + throw new ArgumentNullException("orgName"); + + OrganizationServiceProxy serviceProxy = GetOrganizationProxy(orgName); + + // Retrieve a user. + SystemUser user = serviceProxy.Retrieve(SystemUser.EntityLogicalName, + crmUserId, new Microsoft.Xrm.Sdk.Query.ColumnSet(new String[] { "systemuserid", "firstname", "lastname" })).ToEntity(); + + if (user != null) + { + Microsoft.Crm.Sdk.Messages.SetStateRequest request = new Microsoft.Crm.Sdk.Messages.SetStateRequest() + { + EntityMoniker = user.ToEntityReference(), + + // Required by request but always valued at -1 in this context. + Status = new OptionSetValue(-1), + + // Sets the user to disabled. + State = disable ? new OptionSetValue(-1) : new OptionSetValue(0) + }; + + serviceProxy.Execute(request); + + } + } + catch (Exception ex) + { + EndLog("ChangeUserStateInternal", res, CrmErrorCodes.CANNOT_CHANGE_USER_STATE, ex); + return res; + } + + + EndLog("ChangeUserStateInternal"); + return res; + } + + + public override bool IsInstalled() + { + string value = string.Empty; + try + { + RegistryKey root = Registry.LocalMachine; + RegistryKey rk = root.OpenSubKey("SOFTWARE\\Microsoft\\MSCRM"); + + if (rk == null) + rk = root.OpenSubKey("SOFTWARE\\Wow6432Node\\Microsoft\\MSCRM"); + + if (rk != null) + { + value = (string)rk.GetValue("CRM_Server_Version", null); + rk.Close(); + } + } + catch (Exception ex) + { + Log.WriteError(ex); + } + + return value.StartsWith("5."); + } + + } + +} diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2007.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2007.cs index c919a3cf..d04f90ce 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2007.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2007.cs @@ -285,12 +285,12 @@ namespace WebsitePanel.Providers.HostedSolution public void SetMailboxAdvancedSettings(string organizationId, string accountName, bool enablePOP, bool enableIMAP, bool enableOWA, bool enableMAPI, bool enableActiveSync, long issueWarningKB, long prohibitSendKB, long prohibitSendReceiveKB, int keepDeletedItemsDays, int maxRecipients, int maxSendMessageSizeKB, - int maxReceiveMessageSizeKB, bool enabledLitigationHold, long recoverabelItemsSpace, long recoverabelItemsWarning) + int maxReceiveMessageSizeKB, bool enabledLitigationHold, long recoverabelItemsSpace, long recoverabelItemsWarning, string litigationHoldUrl, string litigationHoldMsg) { SetMailboxAdvancedSettingsInternal(organizationId, accountName, enablePOP, enableIMAP, enableOWA, enableMAPI, enableActiveSync, issueWarningKB, prohibitSendKB, prohibitSendReceiveKB, keepDeletedItemsDays, maxRecipients, maxSendMessageSizeKB, maxReceiveMessageSizeKB, - enabledLitigationHold, recoverabelItemsSpace, recoverabelItemsWarning); + enabledLitigationHold, recoverabelItemsSpace, recoverabelItemsWarning, litigationHoldUrl, litigationHoldMsg ); } public ExchangeEmailAddress[] GetMailboxEmailAddresses(string accountName) @@ -2110,7 +2110,7 @@ namespace WebsitePanel.Providers.HostedSolution return cn; } - private ExchangeAccount GetManager(DirectoryEntry entry) + internal virtual ExchangeAccount GetManager(DirectoryEntry entry) { ExchangeAccount retUser = null; string path = ActiveDirectoryUtils.GetADObjectStringProperty(entry, ADAttributes.Manager); @@ -2129,7 +2129,7 @@ namespace WebsitePanel.Providers.HostedSolution return retUser; } - private ExchangeMailbox GetMailboxGeneralSettingsInternal(string accountName) + internal virtual ExchangeMailbox GetMailboxGeneralSettingsInternal(string accountName) { ExchangeLog.LogStart("GetMailboxGeneralSettingsInternal"); ExchangeLog.DebugInfo("Account: {0}", accountName); @@ -2415,7 +2415,8 @@ namespace WebsitePanel.Providers.HostedSolution internal virtual void SetMailboxAdvancedSettingsInternal(string organizationId, string accountName, bool enablePOP, bool enableIMAP, bool enableOWA, bool enableMAPI, bool enableActiveSync, long issueWarningKB, long prohibitSendKB, long prohibitSendReceiveKB, int keepDeletedItemsDays, int maxRecipients, int maxSendMessageSizeKB, - int maxReceiveMessageSizeKB, bool enabledLitigationHold, long recoverabelItemsSpace, long recoverabelItemsWarning) + int maxReceiveMessageSizeKB, bool enabledLitigationHold, long recoverabelItemsSpace, long recoverabelItemsWarning, + string litigationHoldUrl, string litigationHoldMsg) { ExchangeLog.LogStart("SetMailboxAdvancedSettingsInternal"); ExchangeLog.DebugInfo("Account: {0}", accountName); diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2010.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2010.cs index fd55a78e..51013b2e 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2010.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2010.cs @@ -78,6 +78,74 @@ namespace WebsitePanel.Providers.HostedSolution } + internal override ExchangeMailbox GetMailboxGeneralSettingsInternal(string accountName) + { + ExchangeLog.LogStart("GetMailboxGeneralSettingsInternal"); + ExchangeLog.DebugInfo("Account: {0}", accountName); + + ExchangeMailbox info = new ExchangeMailbox(); + info.AccountName = accountName; + Runspace runSpace = null; + try + { + runSpace = OpenRunspace(); + + Collection result = GetMailboxObject(runSpace, accountName); + PSObject mailbox = result[0]; + + string id = GetResultObjectDN(result); + string path = AddADPrefix(id); + DirectoryEntry entry = GetADObject(path); + + + //ADAccountOptions userFlags = (ADAccountOptions)entry.Properties["userAccountControl"].Value; + //info.Disabled = ((userFlags & ADAccountOptions.UF_ACCOUNTDISABLE) != 0); + info.Disabled = (bool)entry.InvokeGet("AccountDisabled"); + + info.DisplayName = (string)GetPSObjectProperty(mailbox, "DisplayName"); + info.HideFromAddressBook = (bool)GetPSObjectProperty(mailbox, "HiddenFromAddressListsEnabled"); + info.EnableLitigationHold = (bool)GetPSObjectProperty(mailbox, "LitigationHoldEnabled"); + + Command cmd = new Command("Get-User"); + cmd.Parameters.Add("Identity", accountName); + result = ExecuteShellCommand(runSpace, cmd); + PSObject user = result[0]; + + info.FirstName = (string)GetPSObjectProperty(user, "FirstName"); + info.Initials = (string)GetPSObjectProperty(user, "Initials"); + info.LastName = (string)GetPSObjectProperty(user, "LastName"); + + info.Address = (string)GetPSObjectProperty(user, "StreetAddress"); + info.City = (string)GetPSObjectProperty(user, "City"); + info.State = (string)GetPSObjectProperty(user, "StateOrProvince"); + info.Zip = (string)GetPSObjectProperty(user, "PostalCode"); + info.Country = CountryInfoToString((CountryInfo)GetPSObjectProperty(user, "CountryOrRegion")); + info.JobTitle = (string)GetPSObjectProperty(user, "Title"); + info.Company = (string)GetPSObjectProperty(user, "Company"); + info.Department = (string)GetPSObjectProperty(user, "Department"); + info.Office = (string)GetPSObjectProperty(user, "Office"); + + + info.ManagerAccount = GetManager(entry); //GetExchangeAccount(runSpace, ObjToString(GetPSObjectProperty(user, "Manager"))); + info.BusinessPhone = (string)GetPSObjectProperty(user, "Phone"); + info.Fax = (string)GetPSObjectProperty(user, "Fax"); + info.HomePhone = (string)GetPSObjectProperty(user, "HomePhone"); + info.MobilePhone = (string)GetPSObjectProperty(user, "MobilePhone"); + info.Pager = (string)GetPSObjectProperty(user, "Pager"); + info.WebPage = (string)GetPSObjectProperty(user, "WebPage"); + info.Notes = (string)GetPSObjectProperty(user, "Notes"); + + } + finally + { + + CloseRunspace(runSpace); + } + ExchangeLog.LogEnd("GetMailboxGeneralSettingsInternal"); + return info; + } + + internal override ExchangeMailbox GetMailboxAdvancedSettingsInternal(string accountName) { ExchangeLog.LogStart("GetMailboxAdvancedSettingsInternal"); @@ -237,11 +305,11 @@ namespace WebsitePanel.Providers.HostedSolution if (result.Count > 0) { PSObject statistics = result[0]; - Unlimited totalItemSize = (Unlimited)GetPSObjectProperty(statistics, "FolderAndSubfolderSize"); - info.LitigationHoldTotalSize = ConvertUnlimitedToBytes(totalItemSize); + ByteQuantifiedSize totalItemSize = (ByteQuantifiedSize)GetPSObjectProperty(statistics, "FolderAndSubfolderSize"); + info.LitigationHoldTotalSize = (totalItemSize == null) ? 0 : ConvertUnlimitedToBytes(totalItemSize); - uint? itemCount = (uint?)GetPSObjectProperty(statistics, "ItemsInFolder"); - info.LitigationHoldTotalItems = ConvertNullableToInt32(itemCount); + Int32 itemCount = (Int32)GetPSObjectProperty(statistics, "ItemsInFolder"); + info.LitigationHoldTotalItems = (itemCount == null) ? 0 : itemCount; } } else @@ -264,7 +332,8 @@ namespace WebsitePanel.Providers.HostedSolution internal override void SetMailboxAdvancedSettingsInternal(string organizationId, string accountName, bool enablePOP, bool enableIMAP, bool enableOWA, bool enableMAPI, bool enableActiveSync, long issueWarningKB, long prohibitSendKB, long prohibitSendReceiveKB, int keepDeletedItemsDays, int maxRecipients, int maxSendMessageSizeKB, - int maxReceiveMessageSizeKB, bool enabledLitigationHold, long recoverabelItemsSpace, long recoverabelItemsWarning) + int maxReceiveMessageSizeKB, bool enabledLitigationHold, long recoverabelItemsSpace, long recoverabelItemsWarning, + string litigationHoldUrl, string litigationHoldMsg) { ExchangeLog.LogStart("SetMailboxAdvancedSettingsInternal"); ExchangeLog.DebugInfo("Account: {0}", accountName); @@ -287,7 +356,11 @@ namespace WebsitePanel.Providers.HostedSolution cmd.Parameters.Add("LitigationHoldEnabled", enabledLitigationHold); cmd.Parameters.Add("RecoverableItemsQuota", ConvertKBToUnlimited(recoverabelItemsSpace)); - cmd.Parameters.Add("RecoverableItemsWarningQuota", ConvertKBToUnlimited(recoverabelItemsWarning)); + + cmd.Parameters.Add("RetentionUrl", litigationHoldUrl); + cmd.Parameters.Add("RetentionComment", litigationHoldMsg); + + if (recoverabelItemsSpace != -1) cmd.Parameters.Add("RecoverableItemsWarningQuota", ConvertKBToUnlimited(recoverabelItemsWarning)); ExecuteShellCommand(runSpace, cmd); diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/OrganizationProvider.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/OrganizationProvider.cs index 9dee569f..e6b505d0 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/OrganizationProvider.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/OrganizationProvider.cs @@ -710,6 +710,48 @@ namespace WebsitePanel.Providers.HostedSolution } + public bool DoesSamAccountNameExist(string accountName) + { + return DoesSamAccountNameExistInternal(accountName); + } + + + private bool DoesSamAccountNameExistInternal(string accountName) + { + HostedSolutionLog.LogStart("DoesSamAccountNameExistInternal"); + HostedSolutionLog.DebugInfo("userPrincipalName : {0}", accountName); + bool bFound = false; + + try + { + + string path = GetRootOU(); + DirectoryEntry entry = ActiveDirectoryUtils.GetADObject(path); + + DirectorySearcher searcher = new DirectorySearcher(entry); + searcher.PropertiesToLoad.Add("sAMAccountName"); + searcher.Filter = "(sAMAccountName=" + accountName + ")"; + searcher.SearchScope = SearchScope.Subtree; + + SearchResult resCollection = searcher.FindOne(); + if (resCollection != null) + { + if(resCollection.Properties["samaccountname"] != null) + bFound = true; ; + } + + HostedSolutionLog.LogEnd("GetSamAccountNameByUserPrincipalNameInternal"); + } + catch (Exception e) + { + HostedSolutionLog.DebugInfo("Failed : {0}", e.Message); + } + + return bFound; + } + + + #endregion #region Domains diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/WebsitePanel.Providers.HostedSolution.csproj b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/WebsitePanel.Providers.HostedSolution.csproj index 20a414bf..c2f266b4 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/WebsitePanel.Providers.HostedSolution.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/WebsitePanel.Providers.HostedSolution.csproj @@ -15,7 +15,7 @@ 3.5 - v3.5 + v4.0 publish\ true Disk @@ -63,6 +63,10 @@ ..\..\Lib\References\Microsoft\Microsoft.Crm.Admin.AdminService.dll False + + False + ..\..\Lib\References\Microsoft\microsoft.crm.sdk.proxy.dll + ..\..\Lib\References\Microsoft\Microsoft.Crm.Setup.Common.dll @@ -119,6 +123,34 @@ ..\..\Lib\References\Microsoft\Microsoft.SharePoint.dll False + + False + ..\..\Lib\References\Microsoft\microsoft.xrm.client.dll + + + False + ..\..\Lib\References\Microsoft\microsoft.xrm.client.codegeneration.dll + + + False + ..\..\Lib\References\Microsoft\microsoft.xrm.portal.dll + + + False + ..\..\Lib\References\Microsoft\microsoft.xrm.portal.files.dll + + + False + ..\..\Lib\References\Microsoft\microsoft.xrm.sdk.dll + + + False + ..\..\Lib\References\Microsoft\microsoft.xrm.sdk.deployment.dll + + + False + ..\..\Lib\References\Microsoft\microsoft.xrm.sdk.workflow.dll + @@ -129,6 +161,8 @@ False ..\..\Lib\System.Management.Automation.dll + + @@ -139,11 +173,13 @@ + + diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/myorganizationcrmsdktypes.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/myorganizationcrmsdktypes.cs new file mode 100644 index 00000000..fe429976 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/myorganizationcrmsdktypes.cs @@ -0,0 +1,168687 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.261 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +[assembly: Microsoft.Xrm.Sdk.Client.ProxyTypesAssemblyAttribute()] +/* +[System.Runtime.Serialization.DataContractAttribute()] +[System.CodeDom.Compiler.GeneratedCodeAttribute("CrmSvcUtil", "5.0.9690.2153")] +public enum AccountState +{ + + [System.Runtime.Serialization.EnumMemberAttribute()] + Active = 0, + + [System.Runtime.Serialization.EnumMemberAttribute()] + Inactive = 1, +}*/ + +/// +/// Business that represents a customer or potential customer. The company that is billed in business transactions. +/// +[System.Runtime.Serialization.DataContractAttribute()] +[Microsoft.Xrm.Sdk.Client.EntityLogicalNameAttribute("account")] +[System.CodeDom.Compiler.GeneratedCodeAttribute("CrmSvcUtil", "5.0.9690.2153")] +public partial class Account : Microsoft.Xrm.Sdk.Entity, System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged +{ + + /// + /// Default Constructor. + /// + public Account() : + base(EntityLogicalName) + { + } + + public const string EntityLogicalName = "account"; + + public const int EntityTypeCode = 1; + + public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; + + public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging; + + private void OnPropertyChanged(string propertyName) + { + if ((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); + } + } + + private void OnPropertyChanging(string propertyName) + { + if ((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new System.ComponentModel.PropertyChangingEventArgs(propertyName)); + } + } + + /// + /// Drop-down list for selecting the category of the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("accountcategorycode")] + public Microsoft.Xrm.Sdk.OptionSetValue AccountCategoryCode + { + get + { + return this.GetAttributeValue("accountcategorycode"); + } + set + { + this.OnPropertyChanging("AccountCategoryCode"); + this.SetAttributeValue("accountcategorycode", value); + this.OnPropertyChanged("AccountCategoryCode"); + } + } + + /// + /// Drop-down list for classifying an account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("accountclassificationcode")] + public Microsoft.Xrm.Sdk.OptionSetValue AccountClassificationCode + { + get + { + return this.GetAttributeValue("accountclassificationcode"); + } + set + { + this.OnPropertyChanging("AccountClassificationCode"); + this.SetAttributeValue("accountclassificationcode", value); + this.OnPropertyChanged("AccountClassificationCode"); + } + } + + /// + /// Unique identifier of the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("accountid")] + public System.Nullable AccountId + { + get + { + return this.GetAttributeValue>("accountid"); + } + set + { + this.OnPropertyChanging("AccountId"); + this.SetAttributeValue("accountid", value); + if (value.HasValue) + { + base.Id = value.Value; + } + else + { + base.Id = System.Guid.Empty; + } + this.OnPropertyChanged("AccountId"); + } + } + + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("accountid")] + public override System.Guid Id + { + get + { + return base.Id; + } + set + { + this.AccountId = value; + } + } + + /// + /// User-provided account number used in correspondence about the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("accountnumber")] + public string AccountNumber + { + get + { + return this.GetAttributeValue("accountnumber"); + } + set + { + this.OnPropertyChanging("AccountNumber"); + this.SetAttributeValue("accountnumber", value); + this.OnPropertyChanged("AccountNumber"); + } + } + + /// + /// Drop-down list for selecting account ratings. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("accountratingcode")] + public Microsoft.Xrm.Sdk.OptionSetValue AccountRatingCode + { + get + { + return this.GetAttributeValue("accountratingcode"); + } + set + { + this.OnPropertyChanging("AccountRatingCode"); + this.SetAttributeValue("accountratingcode", value); + this.OnPropertyChanged("AccountRatingCode"); + } + } + + /// + /// Unique identifier for address 1. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address1_addressid")] + public System.Nullable Address1_AddressId + { + get + { + return this.GetAttributeValue>("address1_addressid"); + } + set + { + this.OnPropertyChanging("Address1_AddressId"); + this.SetAttributeValue("address1_addressid", value); + this.OnPropertyChanged("Address1_AddressId"); + } + } + + /// + /// Type of address for address 1, such as billing, shipping, or primary address. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address1_addresstypecode")] + public Microsoft.Xrm.Sdk.OptionSetValue Address1_AddressTypeCode + { + get + { + return this.GetAttributeValue("address1_addresstypecode"); + } + set + { + this.OnPropertyChanging("Address1_AddressTypeCode"); + this.SetAttributeValue("address1_addresstypecode", value); + this.OnPropertyChanged("Address1_AddressTypeCode"); + } + } + + /// + /// City name for address 1. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address1_city")] + public string Address1_City + { + get + { + return this.GetAttributeValue("address1_city"); + } + set + { + this.OnPropertyChanging("Address1_City"); + this.SetAttributeValue("address1_city", value); + this.OnPropertyChanged("Address1_City"); + } + } + + /// + /// Country/region name for address 1. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address1_country")] + public string Address1_Country + { + get + { + return this.GetAttributeValue("address1_country"); + } + set + { + this.OnPropertyChanging("Address1_Country"); + this.SetAttributeValue("address1_country", value); + this.OnPropertyChanged("Address1_Country"); + } + } + + /// + /// County name for address 1. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address1_county")] + public string Address1_County + { + get + { + return this.GetAttributeValue("address1_county"); + } + set + { + this.OnPropertyChanging("Address1_County"); + this.SetAttributeValue("address1_county", value); + this.OnPropertyChanged("Address1_County"); + } + } + + /// + /// Fax number for address 1. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address1_fax")] + public string Address1_Fax + { + get + { + return this.GetAttributeValue("address1_fax"); + } + set + { + this.OnPropertyChanging("Address1_Fax"); + this.SetAttributeValue("address1_fax", value); + this.OnPropertyChanged("Address1_Fax"); + } + } + + /// + /// Freight terms for address 1. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address1_freighttermscode")] + public Microsoft.Xrm.Sdk.OptionSetValue Address1_FreightTermsCode + { + get + { + return this.GetAttributeValue("address1_freighttermscode"); + } + set + { + this.OnPropertyChanging("Address1_FreightTermsCode"); + this.SetAttributeValue("address1_freighttermscode", value); + this.OnPropertyChanged("Address1_FreightTermsCode"); + } + } + + /// + /// Latitude for address 1. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address1_latitude")] + public System.Nullable Address1_Latitude + { + get + { + return this.GetAttributeValue>("address1_latitude"); + } + set + { + this.OnPropertyChanging("Address1_Latitude"); + this.SetAttributeValue("address1_latitude", value); + this.OnPropertyChanged("Address1_Latitude"); + } + } + + /// + /// First line for entering address 1 information. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address1_line1")] + public string Address1_Line1 + { + get + { + return this.GetAttributeValue("address1_line1"); + } + set + { + this.OnPropertyChanging("Address1_Line1"); + this.SetAttributeValue("address1_line1", value); + this.OnPropertyChanged("Address1_Line1"); + } + } + + /// + /// Second line for entering address 1 information. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address1_line2")] + public string Address1_Line2 + { + get + { + return this.GetAttributeValue("address1_line2"); + } + set + { + this.OnPropertyChanging("Address1_Line2"); + this.SetAttributeValue("address1_line2", value); + this.OnPropertyChanged("Address1_Line2"); + } + } + + /// + /// Third line for entering address 1 information. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address1_line3")] + public string Address1_Line3 + { + get + { + return this.GetAttributeValue("address1_line3"); + } + set + { + this.OnPropertyChanging("Address1_Line3"); + this.SetAttributeValue("address1_line3", value); + this.OnPropertyChanged("Address1_Line3"); + } + } + + /// + /// Longitude for address 1. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address1_longitude")] + public System.Nullable Address1_Longitude + { + get + { + return this.GetAttributeValue>("address1_longitude"); + } + set + { + this.OnPropertyChanging("Address1_Longitude"); + this.SetAttributeValue("address1_longitude", value); + this.OnPropertyChanged("Address1_Longitude"); + } + } + + /// + /// Name to enter for address 1. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address1_name")] + public string Address1_Name + { + get + { + return this.GetAttributeValue("address1_name"); + } + set + { + this.OnPropertyChanging("Address1_Name"); + this.SetAttributeValue("address1_name", value); + this.OnPropertyChanged("Address1_Name"); + } + } + + /// + /// ZIP Code or postal code for address 1. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address1_postalcode")] + public string Address1_PostalCode + { + get + { + return this.GetAttributeValue("address1_postalcode"); + } + set + { + this.OnPropertyChanging("Address1_PostalCode"); + this.SetAttributeValue("address1_postalcode", value); + this.OnPropertyChanged("Address1_PostalCode"); + } + } + + /// + /// Post office box number for address 1. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address1_postofficebox")] + public string Address1_PostOfficeBox + { + get + { + return this.GetAttributeValue("address1_postofficebox"); + } + set + { + this.OnPropertyChanging("Address1_PostOfficeBox"); + this.SetAttributeValue("address1_postofficebox", value); + this.OnPropertyChanged("Address1_PostOfficeBox"); + } + } + + /// + /// Name of primary contact for address 1. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address1_primarycontactname")] + public string Address1_PrimaryContactName + { + get + { + return this.GetAttributeValue("address1_primarycontactname"); + } + set + { + this.OnPropertyChanging("Address1_PrimaryContactName"); + this.SetAttributeValue("address1_primarycontactname", value); + this.OnPropertyChanged("Address1_PrimaryContactName"); + } + } + + /// + /// Method of shipment for address 1. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address1_shippingmethodcode")] + public Microsoft.Xrm.Sdk.OptionSetValue Address1_ShippingMethodCode + { + get + { + return this.GetAttributeValue("address1_shippingmethodcode"); + } + set + { + this.OnPropertyChanging("Address1_ShippingMethodCode"); + this.SetAttributeValue("address1_shippingmethodcode", value); + this.OnPropertyChanged("Address1_ShippingMethodCode"); + } + } + + /// + /// State or province for address 1. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address1_stateorprovince")] + public string Address1_StateOrProvince + { + get + { + return this.GetAttributeValue("address1_stateorprovince"); + } + set + { + this.OnPropertyChanging("Address1_StateOrProvince"); + this.SetAttributeValue("address1_stateorprovince", value); + this.OnPropertyChanged("Address1_StateOrProvince"); + } + } + + /// + /// First telephone number associated with address 1. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address1_telephone1")] + public string Address1_Telephone1 + { + get + { + return this.GetAttributeValue("address1_telephone1"); + } + set + { + this.OnPropertyChanging("Address1_Telephone1"); + this.SetAttributeValue("address1_telephone1", value); + this.OnPropertyChanged("Address1_Telephone1"); + } + } + + /// + /// Second telephone number associated with address 1. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address1_telephone2")] + public string Address1_Telephone2 + { + get + { + return this.GetAttributeValue("address1_telephone2"); + } + set + { + this.OnPropertyChanging("Address1_Telephone2"); + this.SetAttributeValue("address1_telephone2", value); + this.OnPropertyChanged("Address1_Telephone2"); + } + } + + /// + /// Third telephone number associated with address 1. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address1_telephone3")] + public string Address1_Telephone3 + { + get + { + return this.GetAttributeValue("address1_telephone3"); + } + set + { + this.OnPropertyChanging("Address1_Telephone3"); + this.SetAttributeValue("address1_telephone3", value); + this.OnPropertyChanged("Address1_Telephone3"); + } + } + + /// + /// United Parcel Service (UPS) zone for address 1. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address1_upszone")] + public string Address1_UPSZone + { + get + { + return this.GetAttributeValue("address1_upszone"); + } + set + { + this.OnPropertyChanging("Address1_UPSZone"); + this.SetAttributeValue("address1_upszone", value); + this.OnPropertyChanged("Address1_UPSZone"); + } + } + + /// + /// UTC offset for address 1. This is the difference between local time and standard Coordinated Universal Time. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address1_utcoffset")] + public System.Nullable Address1_UTCOffset + { + get + { + return this.GetAttributeValue>("address1_utcoffset"); + } + set + { + this.OnPropertyChanging("Address1_UTCOffset"); + this.SetAttributeValue("address1_utcoffset", value); + this.OnPropertyChanged("Address1_UTCOffset"); + } + } + + /// + /// Unique identifier for address 2. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address2_addressid")] + public System.Nullable Address2_AddressId + { + get + { + return this.GetAttributeValue>("address2_addressid"); + } + set + { + this.OnPropertyChanging("Address2_AddressId"); + this.SetAttributeValue("address2_addressid", value); + this.OnPropertyChanged("Address2_AddressId"); + } + } + + /// + /// Type of address for address 2, such as billing, shipping, or primary address. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address2_addresstypecode")] + public Microsoft.Xrm.Sdk.OptionSetValue Address2_AddressTypeCode + { + get + { + return this.GetAttributeValue("address2_addresstypecode"); + } + set + { + this.OnPropertyChanging("Address2_AddressTypeCode"); + this.SetAttributeValue("address2_addresstypecode", value); + this.OnPropertyChanged("Address2_AddressTypeCode"); + } + } + + /// + /// City name for address 2. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address2_city")] + public string Address2_City + { + get + { + return this.GetAttributeValue("address2_city"); + } + set + { + this.OnPropertyChanging("Address2_City"); + this.SetAttributeValue("address2_city", value); + this.OnPropertyChanged("Address2_City"); + } + } + + /// + /// Country/region name for address 2. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address2_country")] + public string Address2_Country + { + get + { + return this.GetAttributeValue("address2_country"); + } + set + { + this.OnPropertyChanging("Address2_Country"); + this.SetAttributeValue("address2_country", value); + this.OnPropertyChanged("Address2_Country"); + } + } + + /// + /// County name for address 2. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address2_county")] + public string Address2_County + { + get + { + return this.GetAttributeValue("address2_county"); + } + set + { + this.OnPropertyChanging("Address2_County"); + this.SetAttributeValue("address2_county", value); + this.OnPropertyChanged("Address2_County"); + } + } + + /// + /// Fax number for address 2. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address2_fax")] + public string Address2_Fax + { + get + { + return this.GetAttributeValue("address2_fax"); + } + set + { + this.OnPropertyChanging("Address2_Fax"); + this.SetAttributeValue("address2_fax", value); + this.OnPropertyChanged("Address2_Fax"); + } + } + + /// + /// Freight terms for address 2. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address2_freighttermscode")] + public Microsoft.Xrm.Sdk.OptionSetValue Address2_FreightTermsCode + { + get + { + return this.GetAttributeValue("address2_freighttermscode"); + } + set + { + this.OnPropertyChanging("Address2_FreightTermsCode"); + this.SetAttributeValue("address2_freighttermscode", value); + this.OnPropertyChanged("Address2_FreightTermsCode"); + } + } + + /// + /// Latitude for address 2. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address2_latitude")] + public System.Nullable Address2_Latitude + { + get + { + return this.GetAttributeValue>("address2_latitude"); + } + set + { + this.OnPropertyChanging("Address2_Latitude"); + this.SetAttributeValue("address2_latitude", value); + this.OnPropertyChanged("Address2_Latitude"); + } + } + + /// + /// First line for entering address 2 information. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address2_line1")] + public string Address2_Line1 + { + get + { + return this.GetAttributeValue("address2_line1"); + } + set + { + this.OnPropertyChanging("Address2_Line1"); + this.SetAttributeValue("address2_line1", value); + this.OnPropertyChanged("Address2_Line1"); + } + } + + /// + /// Second line for entering address 2 information. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address2_line2")] + public string Address2_Line2 + { + get + { + return this.GetAttributeValue("address2_line2"); + } + set + { + this.OnPropertyChanging("Address2_Line2"); + this.SetAttributeValue("address2_line2", value); + this.OnPropertyChanged("Address2_Line2"); + } + } + + /// + /// Third line for entering address 2 information. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address2_line3")] + public string Address2_Line3 + { + get + { + return this.GetAttributeValue("address2_line3"); + } + set + { + this.OnPropertyChanging("Address2_Line3"); + this.SetAttributeValue("address2_line3", value); + this.OnPropertyChanged("Address2_Line3"); + } + } + + /// + /// Longitude for address 2. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address2_longitude")] + public System.Nullable Address2_Longitude + { + get + { + return this.GetAttributeValue>("address2_longitude"); + } + set + { + this.OnPropertyChanging("Address2_Longitude"); + this.SetAttributeValue("address2_longitude", value); + this.OnPropertyChanged("Address2_Longitude"); + } + } + + /// + /// Name to enter for address 2. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address2_name")] + public string Address2_Name + { + get + { + return this.GetAttributeValue("address2_name"); + } + set + { + this.OnPropertyChanging("Address2_Name"); + this.SetAttributeValue("address2_name", value); + this.OnPropertyChanged("Address2_Name"); + } + } + + /// + /// ZIP Code or postal code for address 2. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address2_postalcode")] + public string Address2_PostalCode + { + get + { + return this.GetAttributeValue("address2_postalcode"); + } + set + { + this.OnPropertyChanging("Address2_PostalCode"); + this.SetAttributeValue("address2_postalcode", value); + this.OnPropertyChanged("Address2_PostalCode"); + } + } + + /// + /// Post office box number for address 2. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address2_postofficebox")] + public string Address2_PostOfficeBox + { + get + { + return this.GetAttributeValue("address2_postofficebox"); + } + set + { + this.OnPropertyChanging("Address2_PostOfficeBox"); + this.SetAttributeValue("address2_postofficebox", value); + this.OnPropertyChanged("Address2_PostOfficeBox"); + } + } + + /// + /// Name of primary contact located at address 2. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address2_primarycontactname")] + public string Address2_PrimaryContactName + { + get + { + return this.GetAttributeValue("address2_primarycontactname"); + } + set + { + this.OnPropertyChanging("Address2_PrimaryContactName"); + this.SetAttributeValue("address2_primarycontactname", value); + this.OnPropertyChanged("Address2_PrimaryContactName"); + } + } + + /// + /// Method of shipment for address 2. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address2_shippingmethodcode")] + public Microsoft.Xrm.Sdk.OptionSetValue Address2_ShippingMethodCode + { + get + { + return this.GetAttributeValue("address2_shippingmethodcode"); + } + set + { + this.OnPropertyChanging("Address2_ShippingMethodCode"); + this.SetAttributeValue("address2_shippingmethodcode", value); + this.OnPropertyChanged("Address2_ShippingMethodCode"); + } + } + + /// + /// State or province for address 2. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address2_stateorprovince")] + public string Address2_StateOrProvince + { + get + { + return this.GetAttributeValue("address2_stateorprovince"); + } + set + { + this.OnPropertyChanging("Address2_StateOrProvince"); + this.SetAttributeValue("address2_stateorprovince", value); + this.OnPropertyChanged("Address2_StateOrProvince"); + } + } + + /// + /// First telephone number associated with address 2. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address2_telephone1")] + public string Address2_Telephone1 + { + get + { + return this.GetAttributeValue("address2_telephone1"); + } + set + { + this.OnPropertyChanging("Address2_Telephone1"); + this.SetAttributeValue("address2_telephone1", value); + this.OnPropertyChanged("Address2_Telephone1"); + } + } + + /// + /// Second telephone number associated with address 2. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address2_telephone2")] + public string Address2_Telephone2 + { + get + { + return this.GetAttributeValue("address2_telephone2"); + } + set + { + this.OnPropertyChanging("Address2_Telephone2"); + this.SetAttributeValue("address2_telephone2", value); + this.OnPropertyChanged("Address2_Telephone2"); + } + } + + /// + /// Third telephone number associated with address 2. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address2_telephone3")] + public string Address2_Telephone3 + { + get + { + return this.GetAttributeValue("address2_telephone3"); + } + set + { + this.OnPropertyChanging("Address2_Telephone3"); + this.SetAttributeValue("address2_telephone3", value); + this.OnPropertyChanged("Address2_Telephone3"); + } + } + + /// + /// United Parcel Service (UPS) zone for address 2. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address2_upszone")] + public string Address2_UPSZone + { + get + { + return this.GetAttributeValue("address2_upszone"); + } + set + { + this.OnPropertyChanging("Address2_UPSZone"); + this.SetAttributeValue("address2_upszone", value); + this.OnPropertyChanged("Address2_UPSZone"); + } + } + + /// + /// UTC offset for address 2. This is the difference between local time and standard Coordinated Universal Time. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("address2_utcoffset")] + public System.Nullable Address2_UTCOffset + { + get + { + return this.GetAttributeValue>("address2_utcoffset"); + } + set + { + this.OnPropertyChanging("Address2_UTCOffset"); + this.SetAttributeValue("address2_utcoffset", value); + this.OnPropertyChanged("Address2_UTCOffset"); + } + } + + /// + /// For internal use only. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("aging30")] + public Microsoft.Xrm.Sdk.Money Aging30 + { + get + { + return this.GetAttributeValue("aging30"); + } + } + + /// + /// Base currency equivalent of the aging 30 for the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("aging30_base")] + public Microsoft.Xrm.Sdk.Money Aging30_Base + { + get + { + return this.GetAttributeValue("aging30_base"); + } + } + + /// + /// For internal use only. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("aging60")] + public Microsoft.Xrm.Sdk.Money Aging60 + { + get + { + return this.GetAttributeValue("aging60"); + } + } + + /// + /// Base currency equivalent of the aging 60 for the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("aging60_base")] + public Microsoft.Xrm.Sdk.Money Aging60_Base + { + get + { + return this.GetAttributeValue("aging60_base"); + } + } + + /// + /// For internal use only. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("aging90")] + public Microsoft.Xrm.Sdk.Money Aging90 + { + get + { + return this.GetAttributeValue("aging90"); + } + } + + /// + /// Base currency equivalent of the aging 90 for the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("aging90_base")] + public Microsoft.Xrm.Sdk.Money Aging90_Base + { + get + { + return this.GetAttributeValue("aging90_base"); + } + } + + /// + /// Type of business associated with the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("businesstypecode")] + public Microsoft.Xrm.Sdk.OptionSetValue BusinessTypeCode + { + get + { + return this.GetAttributeValue("businesstypecode"); + } + set + { + this.OnPropertyChanging("BusinessTypeCode"); + this.SetAttributeValue("businesstypecode", value); + this.OnPropertyChanged("BusinessTypeCode"); + } + } + + /// + /// Unique identifier of the user who created the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("createdby")] + public Microsoft.Xrm.Sdk.EntityReference CreatedBy + { + get + { + return this.GetAttributeValue("createdby"); + } + } + + /// + /// Date and time when the account was created. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("createdon")] + public System.Nullable CreatedOn + { + get + { + return this.GetAttributeValue>("createdon"); + } + } + + /// + /// Unique identifier of the delegate user who created the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("createdonbehalfby")] + public Microsoft.Xrm.Sdk.EntityReference CreatedOnBehalfBy + { + get + { + return this.GetAttributeValue("createdonbehalfby"); + } + } + + /// + /// Credit limit for the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("creditlimit")] + public Microsoft.Xrm.Sdk.Money CreditLimit + { + get + { + return this.GetAttributeValue("creditlimit"); + } + set + { + this.OnPropertyChanging("CreditLimit"); + this.SetAttributeValue("creditlimit", value); + this.OnPropertyChanged("CreditLimit"); + } + } + + /// + /// Base currency equivalent of the credit limit for the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("creditlimit_base")] + public Microsoft.Xrm.Sdk.Money CreditLimit_Base + { + get + { + return this.GetAttributeValue("creditlimit_base"); + } + } + + /// + /// Information about whether credit for the account is on hold. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("creditonhold")] + public System.Nullable CreditOnHold + { + get + { + return this.GetAttributeValue>("creditonhold"); + } + set + { + this.OnPropertyChanging("CreditOnHold"); + this.SetAttributeValue("creditonhold", value); + this.OnPropertyChanged("CreditOnHold"); + } + } + + /// + /// Size of the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("customersizecode")] + public Microsoft.Xrm.Sdk.OptionSetValue CustomerSizeCode + { + get + { + return this.GetAttributeValue("customersizecode"); + } + set + { + this.OnPropertyChanging("CustomerSizeCode"); + this.SetAttributeValue("customersizecode", value); + this.OnPropertyChanged("CustomerSizeCode"); + } + } + + /// + /// Type of the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("customertypecode")] + public Microsoft.Xrm.Sdk.OptionSetValue CustomerTypeCode + { + get + { + return this.GetAttributeValue("customertypecode"); + } + set + { + this.OnPropertyChanging("CustomerTypeCode"); + this.SetAttributeValue("customertypecode", value); + this.OnPropertyChanged("CustomerTypeCode"); + } + } + + /// + /// Unique identifier of the default price list associated with the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("defaultpricelevelid")] + public Microsoft.Xrm.Sdk.EntityReference DefaultPriceLevelId + { + get + { + return this.GetAttributeValue("defaultpricelevelid"); + } + set + { + this.OnPropertyChanging("DefaultPriceLevelId"); + this.SetAttributeValue("defaultpricelevelid", value); + this.OnPropertyChanged("DefaultPriceLevelId"); + } + } + + /// + /// Description of the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("description")] + public string Description + { + get + { + return this.GetAttributeValue("description"); + } + set + { + this.OnPropertyChanging("Description"); + this.SetAttributeValue("description", value); + this.OnPropertyChanged("Description"); + } + } + + /// + /// Information about whether to allow sending direct e-mail to the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("donotbulkemail")] + public System.Nullable DoNotBulkEMail + { + get + { + return this.GetAttributeValue>("donotbulkemail"); + } + set + { + this.OnPropertyChanging("DoNotBulkEMail"); + this.SetAttributeValue("donotbulkemail", value); + this.OnPropertyChanged("DoNotBulkEMail"); + } + } + + /// + /// Information about whether to allow sending bulk-rate postal mail to the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("donotbulkpostalmail")] + public System.Nullable DoNotBulkPostalMail + { + get + { + return this.GetAttributeValue>("donotbulkpostalmail"); + } + set + { + this.OnPropertyChanging("DoNotBulkPostalMail"); + this.SetAttributeValue("donotbulkpostalmail", value); + this.OnPropertyChanged("DoNotBulkPostalMail"); + } + } + + /// + /// Information about whether to allow sending e-mail to the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("donotemail")] + public System.Nullable DoNotEMail + { + get + { + return this.GetAttributeValue>("donotemail"); + } + set + { + this.OnPropertyChanging("DoNotEMail"); + this.SetAttributeValue("donotemail", value); + this.OnPropertyChanged("DoNotEMail"); + } + } + + /// + /// Information about whether to allow sending faxes to the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("donotfax")] + public System.Nullable DoNotFax + { + get + { + return this.GetAttributeValue>("donotfax"); + } + set + { + this.OnPropertyChanging("DoNotFax"); + this.SetAttributeValue("donotfax", value); + this.OnPropertyChanged("DoNotFax"); + } + } + + /// + /// Information about whether to allow phone calls to the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("donotphone")] + public System.Nullable DoNotPhone + { + get + { + return this.GetAttributeValue>("donotphone"); + } + set + { + this.OnPropertyChanging("DoNotPhone"); + this.SetAttributeValue("donotphone", value); + this.OnPropertyChanged("DoNotPhone"); + } + } + + /// + /// Information about whether to allow sending postal mail to the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("donotpostalmail")] + public System.Nullable DoNotPostalMail + { + get + { + return this.GetAttributeValue>("donotpostalmail"); + } + set + { + this.OnPropertyChanging("DoNotPostalMail"); + this.SetAttributeValue("donotpostalmail", value); + this.OnPropertyChanged("DoNotPostalMail"); + } + } + + /// + /// Information on whether to allow sending marketing mail to the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("donotsendmm")] + public System.Nullable DoNotSendMM + { + get + { + return this.GetAttributeValue>("donotsendmm"); + } + set + { + this.OnPropertyChanging("DoNotSendMM"); + this.SetAttributeValue("donotsendmm", value); + this.OnPropertyChanged("DoNotSendMM"); + } + } + + /// + /// First e-mail address for the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("emailaddress1")] + public string EMailAddress1 + { + get + { + return this.GetAttributeValue("emailaddress1"); + } + set + { + this.OnPropertyChanging("EMailAddress1"); + this.SetAttributeValue("emailaddress1", value); + this.OnPropertyChanged("EMailAddress1"); + } + } + + /// + /// Second e-mail address for the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("emailaddress2")] + public string EMailAddress2 + { + get + { + return this.GetAttributeValue("emailaddress2"); + } + set + { + this.OnPropertyChanging("EMailAddress2"); + this.SetAttributeValue("emailaddress2", value); + this.OnPropertyChanged("EMailAddress2"); + } + } + + /// + /// Third e-mail address for the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("emailaddress3")] + public string EMailAddress3 + { + get + { + return this.GetAttributeValue("emailaddress3"); + } + set + { + this.OnPropertyChanging("EMailAddress3"); + this.SetAttributeValue("emailaddress3", value); + this.OnPropertyChanged("EMailAddress3"); + } + } + + /// + /// Exchange rate for the currency associated with the account with respect to the base currency. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("exchangerate")] + public System.Nullable ExchangeRate + { + get + { + return this.GetAttributeValue>("exchangerate"); + } + } + + /// + /// Fax telephone number for the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("fax")] + public string Fax + { + get + { + return this.GetAttributeValue("fax"); + } + set + { + this.OnPropertyChanging("Fax"); + this.SetAttributeValue("fax", value); + this.OnPropertyChanged("Fax"); + } + } + + /// + /// FTP site URL for the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("ftpsiteurl")] + public string FtpSiteURL + { + get + { + return this.GetAttributeValue("ftpsiteurl"); + } + set + { + this.OnPropertyChanging("FtpSiteURL"); + this.SetAttributeValue("ftpsiteurl", value); + this.OnPropertyChanged("FtpSiteURL"); + } + } + + /// + /// Unique identifier of the data import or data migration that created this record. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("importsequencenumber")] + public System.Nullable ImportSequenceNumber + { + get + { + return this.GetAttributeValue>("importsequencenumber"); + } + set + { + this.OnPropertyChanging("ImportSequenceNumber"); + this.SetAttributeValue("importsequencenumber", value); + this.OnPropertyChanged("ImportSequenceNumber"); + } + } + + /// + /// Type of industry with which the account is associated. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("industrycode")] + public Microsoft.Xrm.Sdk.OptionSetValue IndustryCode + { + get + { + return this.GetAttributeValue("industrycode"); + } + set + { + this.OnPropertyChanging("IndustryCode"); + this.SetAttributeValue("industrycode", value); + this.OnPropertyChanged("IndustryCode"); + } + } + + /// + /// Date and time when the account was last contacted as a part of a marketing campaign. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("lastusedincampaign")] + public System.Nullable LastUsedInCampaign + { + get + { + return this.GetAttributeValue>("lastusedincampaign"); + } + set + { + this.OnPropertyChanging("LastUsedInCampaign"); + this.SetAttributeValue("lastusedincampaign", value); + this.OnPropertyChanged("LastUsedInCampaign"); + } + } + + /// + /// Market capitalization of the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("marketcap")] + public Microsoft.Xrm.Sdk.Money MarketCap + { + get + { + return this.GetAttributeValue("marketcap"); + } + set + { + this.OnPropertyChanging("MarketCap"); + this.SetAttributeValue("marketcap", value); + this.OnPropertyChanged("MarketCap"); + } + } + + /// + /// Base currency equivalent of the market capitalization of the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("marketcap_base")] + public Microsoft.Xrm.Sdk.Money MarketCap_Base + { + get + { + return this.GetAttributeValue("marketcap_base"); + } + } + + /// + /// Unique identifier of the master account for merge. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("masterid")] + public Microsoft.Xrm.Sdk.EntityReference MasterId + { + get + { + return this.GetAttributeValue("masterid"); + } + } + + /// + /// Information regarding whether the account has been merged with a master account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("merged")] + public System.Nullable Merged + { + get + { + return this.GetAttributeValue>("merged"); + } + } + + /// + /// Unique identifier of the user who last modified the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("modifiedby")] + public Microsoft.Xrm.Sdk.EntityReference ModifiedBy + { + get + { + return this.GetAttributeValue("modifiedby"); + } + } + + /// + /// Date and time when the account was last modified. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("modifiedon")] + public System.Nullable ModifiedOn + { + get + { + return this.GetAttributeValue>("modifiedon"); + } + } + + /// + /// Unique identifier of the delegate user who last modified the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("modifiedonbehalfby")] + public Microsoft.Xrm.Sdk.EntityReference ModifiedOnBehalfBy + { + get + { + return this.GetAttributeValue("modifiedonbehalfby"); + } + } + + /// + /// Name of the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("name")] + public string Name + { + get + { + return this.GetAttributeValue("name"); + } + set + { + this.OnPropertyChanging("Name"); + this.SetAttributeValue("name", value); + this.OnPropertyChanged("Name"); + } + } + + /// + /// Number of employees at the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("numberofemployees")] + public System.Nullable NumberOfEmployees + { + get + { + return this.GetAttributeValue>("numberofemployees"); + } + set + { + this.OnPropertyChanging("NumberOfEmployees"); + this.SetAttributeValue("numberofemployees", value); + this.OnPropertyChanged("NumberOfEmployees"); + } + } + + /// + /// Unique identifier of the lead from which the account was created. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("originatingleadid")] + public Microsoft.Xrm.Sdk.EntityReference OriginatingLeadId + { + get + { + return this.GetAttributeValue("originatingleadid"); + } + set + { + this.OnPropertyChanging("OriginatingLeadId"); + this.SetAttributeValue("originatingleadid", value); + this.OnPropertyChanged("OriginatingLeadId"); + } + } + + /// + /// Date and time that the record was migrated. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("overriddencreatedon")] + public System.Nullable OverriddenCreatedOn + { + get + { + return this.GetAttributeValue>("overriddencreatedon"); + } + set + { + this.OnPropertyChanging("OverriddenCreatedOn"); + this.SetAttributeValue("overriddencreatedon", value); + this.OnPropertyChanged("OverriddenCreatedOn"); + } + } + + /// + /// Unique identifier of the user or team who owns the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("ownerid")] + public Microsoft.Xrm.Sdk.EntityReference OwnerId + { + get + { + return this.GetAttributeValue("ownerid"); + } + set + { + this.OnPropertyChanging("OwnerId"); + this.SetAttributeValue("ownerid", value); + this.OnPropertyChanged("OwnerId"); + } + } + + /// + /// Type of company ownership, such as public or private. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("ownershipcode")] + public Microsoft.Xrm.Sdk.OptionSetValue OwnershipCode + { + get + { + return this.GetAttributeValue("ownershipcode"); + } + set + { + this.OnPropertyChanging("OwnershipCode"); + this.SetAttributeValue("ownershipcode", value); + this.OnPropertyChanged("OwnershipCode"); + } + } + + /// + /// Unique identifier of the business unit that owns the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("owningbusinessunit")] + public Microsoft.Xrm.Sdk.EntityReference OwningBusinessUnit + { + get + { + return this.GetAttributeValue("owningbusinessunit"); + } + } + + /// + /// Unique identifier of the team who owns the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("owningteam")] + public Microsoft.Xrm.Sdk.EntityReference OwningTeam + { + get + { + return this.GetAttributeValue("owningteam"); + } + } + + /// + /// Unique identifier of the user who owns the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("owninguser")] + public Microsoft.Xrm.Sdk.EntityReference OwningUser + { + get + { + return this.GetAttributeValue("owninguser"); + } + } + + /// + /// Unique identifier of the parent account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("parentaccountid")] + public Microsoft.Xrm.Sdk.EntityReference ParentAccountId + { + get + { + return this.GetAttributeValue("parentaccountid"); + } + set + { + this.OnPropertyChanging("ParentAccountId"); + this.SetAttributeValue("parentaccountid", value); + this.OnPropertyChanged("ParentAccountId"); + } + } + + /// + /// Information that specifies whether the account participates in workflow rules. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("participatesinworkflow")] + public System.Nullable ParticipatesInWorkflow + { + get + { + return this.GetAttributeValue>("participatesinworkflow"); + } + set + { + this.OnPropertyChanging("ParticipatesInWorkflow"); + this.SetAttributeValue("participatesinworkflow", value); + this.OnPropertyChanged("ParticipatesInWorkflow"); + } + } + + /// + /// Payment terms for the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("paymenttermscode")] + public Microsoft.Xrm.Sdk.OptionSetValue PaymentTermsCode + { + get + { + return this.GetAttributeValue("paymenttermscode"); + } + set + { + this.OnPropertyChanging("PaymentTermsCode"); + this.SetAttributeValue("paymenttermscode", value); + this.OnPropertyChanged("PaymentTermsCode"); + } + } + + /// + /// Day of the week that the account prefers for scheduling service activities. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("preferredappointmentdaycode")] + public Microsoft.Xrm.Sdk.OptionSetValue PreferredAppointmentDayCode + { + get + { + return this.GetAttributeValue("preferredappointmentdaycode"); + } + set + { + this.OnPropertyChanging("PreferredAppointmentDayCode"); + this.SetAttributeValue("preferredappointmentdaycode", value); + this.OnPropertyChanged("PreferredAppointmentDayCode"); + } + } + + /// + /// Time of day that the account prefers for scheduling service activities. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("preferredappointmenttimecode")] + public Microsoft.Xrm.Sdk.OptionSetValue PreferredAppointmentTimeCode + { + get + { + return this.GetAttributeValue("preferredappointmenttimecode"); + } + set + { + this.OnPropertyChanging("PreferredAppointmentTimeCode"); + this.SetAttributeValue("preferredappointmenttimecode", value); + this.OnPropertyChanged("PreferredAppointmentTimeCode"); + } + } + + /// + /// Preferred contact method for the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("preferredcontactmethodcode")] + public Microsoft.Xrm.Sdk.OptionSetValue PreferredContactMethodCode + { + get + { + return this.GetAttributeValue("preferredcontactmethodcode"); + } + set + { + this.OnPropertyChanging("PreferredContactMethodCode"); + this.SetAttributeValue("preferredcontactmethodcode", value); + this.OnPropertyChanged("PreferredContactMethodCode"); + } + } + + /// + /// Unique identifier of the facility/equipment preferred by the account for scheduling service activities. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("preferredequipmentid")] + public Microsoft.Xrm.Sdk.EntityReference PreferredEquipmentId + { + get + { + return this.GetAttributeValue("preferredequipmentid"); + } + set + { + this.OnPropertyChanging("PreferredEquipmentId"); + this.SetAttributeValue("preferredequipmentid", value); + this.OnPropertyChanged("PreferredEquipmentId"); + } + } + + /// + /// Unique identifier of the service preferred by the account for scheduling service activities. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("preferredserviceid")] + public Microsoft.Xrm.Sdk.EntityReference PreferredServiceId + { + get + { + return this.GetAttributeValue("preferredserviceid"); + } + set + { + this.OnPropertyChanging("PreferredServiceId"); + this.SetAttributeValue("preferredserviceid", value); + this.OnPropertyChanged("PreferredServiceId"); + } + } + + /// + /// Unique identifier of the system user preferred by the account for scheduling service activities. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("preferredsystemuserid")] + public Microsoft.Xrm.Sdk.EntityReference PreferredSystemUserId + { + get + { + return this.GetAttributeValue("preferredsystemuserid"); + } + set + { + this.OnPropertyChanging("PreferredSystemUserId"); + this.SetAttributeValue("preferredsystemuserid", value); + this.OnPropertyChanged("PreferredSystemUserId"); + } + } + + /// + /// Unique identifier of the primary contact for the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("primarycontactid")] + public Microsoft.Xrm.Sdk.EntityReference PrimaryContactId + { + get + { + return this.GetAttributeValue("primarycontactid"); + } + set + { + this.OnPropertyChanging("PrimaryContactId"); + this.SetAttributeValue("primarycontactid", value); + this.OnPropertyChanged("PrimaryContactId"); + } + } + + /// + /// Revenue amount for the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("revenue")] + public Microsoft.Xrm.Sdk.Money Revenue + { + get + { + return this.GetAttributeValue("revenue"); + } + set + { + this.OnPropertyChanging("Revenue"); + this.SetAttributeValue("revenue", value); + this.OnPropertyChanged("Revenue"); + } + } + + /// + /// Base currency equivalent of the revenue amount for the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("revenue_base")] + public Microsoft.Xrm.Sdk.Money Revenue_Base + { + get + { + return this.GetAttributeValue("revenue_base"); + } + } + + /// + /// Outstanding shares for the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("sharesoutstanding")] + public System.Nullable SharesOutstanding + { + get + { + return this.GetAttributeValue>("sharesoutstanding"); + } + set + { + this.OnPropertyChanging("SharesOutstanding"); + this.SetAttributeValue("sharesoutstanding", value); + this.OnPropertyChanged("SharesOutstanding"); + } + } + + /// + /// Method of shipment for the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("shippingmethodcode")] + public Microsoft.Xrm.Sdk.OptionSetValue ShippingMethodCode + { + get + { + return this.GetAttributeValue("shippingmethodcode"); + } + set + { + this.OnPropertyChanging("ShippingMethodCode"); + this.SetAttributeValue("shippingmethodcode", value); + this.OnPropertyChanged("ShippingMethodCode"); + } + } + + /// + /// Standard Industrial Classification (SIC) code for the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("sic")] + public string SIC + { + get + { + return this.GetAttributeValue("sic"); + } + set + { + this.OnPropertyChanging("SIC"); + this.SetAttributeValue("sic", value); + this.OnPropertyChanged("SIC"); + } + } + + /// + /// Status of the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("statecode")] + public System.Nullable StateCode + { + get + { + Microsoft.Xrm.Sdk.OptionSetValue optionSet = this.GetAttributeValue("statecode"); + if ((optionSet != null)) + { + return ((AccountState)(System.Enum.ToObject(typeof(AccountState), optionSet.Value))); + } + else + { + return null; + } + } + } + + /// + /// Reason for the status of the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("statuscode")] + public Microsoft.Xrm.Sdk.OptionSetValue StatusCode + { + get + { + return this.GetAttributeValue("statuscode"); + } + set + { + this.OnPropertyChanging("StatusCode"); + this.SetAttributeValue("statuscode", value); + this.OnPropertyChanged("StatusCode"); + } + } + + /// + /// Stock exchange on which the business associated with the account is listed. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("stockexchange")] + public string StockExchange + { + get + { + return this.GetAttributeValue("stockexchange"); + } + set + { + this.OnPropertyChanging("StockExchange"); + this.SetAttributeValue("stockexchange", value); + this.OnPropertyChanged("StockExchange"); + } + } + + /// + /// First telephone number for the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("telephone1")] + public string Telephone1 + { + get + { + return this.GetAttributeValue("telephone1"); + } + set + { + this.OnPropertyChanging("Telephone1"); + this.SetAttributeValue("telephone1", value); + this.OnPropertyChanged("Telephone1"); + } + } + + /// + /// Second telephone number for the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("telephone2")] + public string Telephone2 + { + get + { + return this.GetAttributeValue("telephone2"); + } + set + { + this.OnPropertyChanging("Telephone2"); + this.SetAttributeValue("telephone2", value); + this.OnPropertyChanged("Telephone2"); + } + } + + /// + /// Third telephone number for the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("telephone3")] + public string Telephone3 + { + get + { + return this.GetAttributeValue("telephone3"); + } + set + { + this.OnPropertyChanging("Telephone3"); + this.SetAttributeValue("telephone3", value); + this.OnPropertyChanged("Telephone3"); + } + } + + /// + /// Territory to which the account belongs. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("territorycode")] + public Microsoft.Xrm.Sdk.OptionSetValue TerritoryCode + { + get + { + return this.GetAttributeValue("territorycode"); + } + set + { + this.OnPropertyChanging("TerritoryCode"); + this.SetAttributeValue("territorycode", value); + this.OnPropertyChanged("TerritoryCode"); + } + } + + /// + /// Unique identifier of the territory to which the account belongs. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("territoryid")] + public Microsoft.Xrm.Sdk.EntityReference TerritoryId + { + get + { + return this.GetAttributeValue("territoryid"); + } + set + { + this.OnPropertyChanging("TerritoryId"); + this.SetAttributeValue("territoryid", value); + this.OnPropertyChanged("TerritoryId"); + } + } + + /// + /// Stock Exchange symbol for the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("tickersymbol")] + public string TickerSymbol + { + get + { + return this.GetAttributeValue("tickersymbol"); + } + set + { + this.OnPropertyChanging("TickerSymbol"); + this.SetAttributeValue("tickersymbol", value); + this.OnPropertyChanged("TickerSymbol"); + } + } + + /// + /// For internal use only. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("timezoneruleversionnumber")] + public System.Nullable TimeZoneRuleVersionNumber + { + get + { + return this.GetAttributeValue>("timezoneruleversionnumber"); + } + set + { + this.OnPropertyChanging("TimeZoneRuleVersionNumber"); + this.SetAttributeValue("timezoneruleversionnumber", value); + this.OnPropertyChanged("TimeZoneRuleVersionNumber"); + } + } + + /// + /// Unique identifier of the currency associated with the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("transactioncurrencyid")] + public Microsoft.Xrm.Sdk.EntityReference TransactionCurrencyId + { + get + { + return this.GetAttributeValue("transactioncurrencyid"); + } + set + { + this.OnPropertyChanging("TransactionCurrencyId"); + this.SetAttributeValue("transactioncurrencyid", value); + this.OnPropertyChanged("TransactionCurrencyId"); + } + } + + /// + /// Time zone code that was in use when the record was created. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("utcconversiontimezonecode")] + public System.Nullable UTCConversionTimeZoneCode + { + get + { + return this.GetAttributeValue>("utcconversiontimezonecode"); + } + set + { + this.OnPropertyChanging("UTCConversionTimeZoneCode"); + this.SetAttributeValue("utcconversiontimezonecode", value); + this.OnPropertyChanged("UTCConversionTimeZoneCode"); + } + } + + /// + /// Version number of the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("versionnumber")] + public System.Nullable VersionNumber + { + get + { + return this.GetAttributeValue>("versionnumber"); + } + } + + /// + /// Web site URL for the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("websiteurl")] + public string WebSiteURL + { + get + { + return this.GetAttributeValue("websiteurl"); + } + set + { + this.OnPropertyChanging("WebSiteURL"); + this.SetAttributeValue("websiteurl", value); + this.OnPropertyChanged("WebSiteURL"); + } + } + + /// + /// Pronunciation of the account name, written in phonetic hiragana or katakana characters. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("yominame")] + public string YomiName + { + get + { + return this.GetAttributeValue("yominame"); + } + set + { + this.OnPropertyChanging("YomiName"); + this.SetAttributeValue("yominame", value); + this.OnPropertyChanged("YomiName"); + } + } + + /// + /// 1:N account_activity_parties + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("account_activity_parties")] + public System.Collections.Generic.IEnumerable account_activity_parties + { + get + { + return this.GetRelatedEntities("account_activity_parties", null); + } + set + { + this.OnPropertyChanging("account_activity_parties"); + this.SetRelatedEntities("account_activity_parties", null, value); + this.OnPropertyChanged("account_activity_parties"); + } + } + + /// + /// 1:N Account_ActivityPointers + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("Account_ActivityPointers")] + public System.Collections.Generic.IEnumerable Account_ActivityPointers + { + get + { + return this.GetRelatedEntities("Account_ActivityPointers", null); + } + set + { + this.OnPropertyChanging("Account_ActivityPointers"); + this.SetRelatedEntities("Account_ActivityPointers", null, value); + this.OnPropertyChanged("Account_ActivityPointers"); + } + } + + /// + /// 1:N Account_Annotation + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("Account_Annotation")] + public System.Collections.Generic.IEnumerable Account_Annotation + { + get + { + return this.GetRelatedEntities("Account_Annotation", null); + } + set + { + this.OnPropertyChanging("Account_Annotation"); + this.SetRelatedEntities("Account_Annotation", null, value); + this.OnPropertyChanged("Account_Annotation"); + } + } + + /// + /// 1:N Account_Appointments + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("Account_Appointments")] + public System.Collections.Generic.IEnumerable Account_Appointments + { + get + { + return this.GetRelatedEntities("Account_Appointments", null); + } + set + { + this.OnPropertyChanging("Account_Appointments"); + this.SetRelatedEntities("Account_Appointments", null, value); + this.OnPropertyChanged("Account_Appointments"); + } + } + + /// + /// 1:N Account_AsyncOperations + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("Account_AsyncOperations")] + public System.Collections.Generic.IEnumerable Account_AsyncOperations + { + get + { + return this.GetRelatedEntities("Account_AsyncOperations", null); + } + set + { + this.OnPropertyChanging("Account_AsyncOperations"); + this.SetRelatedEntities("Account_AsyncOperations", null, value); + this.OnPropertyChanged("Account_AsyncOperations"); + } + } + + /// + /// 1:N Account_BulkDeleteFailures + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("Account_BulkDeleteFailures")] + public System.Collections.Generic.IEnumerable Account_BulkDeleteFailures + { + get + { + return this.GetRelatedEntities("Account_BulkDeleteFailures", null); + } + set + { + this.OnPropertyChanging("Account_BulkDeleteFailures"); + this.SetRelatedEntities("Account_BulkDeleteFailures", null, value); + this.OnPropertyChanged("Account_BulkDeleteFailures"); + } + } + + /// + /// 1:N account_connections1 + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("account_connections1")] + public System.Collections.Generic.IEnumerable account_connections1 + { + get + { + return this.GetRelatedEntities("account_connections1", null); + } + set + { + this.OnPropertyChanging("account_connections1"); + this.SetRelatedEntities("account_connections1", null, value); + this.OnPropertyChanged("account_connections1"); + } + } + + /// + /// 1:N account_connections2 + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("account_connections2")] + public System.Collections.Generic.IEnumerable account_connections2 + { + get + { + return this.GetRelatedEntities("account_connections2", null); + } + set + { + this.OnPropertyChanging("account_connections2"); + this.SetRelatedEntities("account_connections2", null, value); + this.OnPropertyChanged("account_connections2"); + } + } + + /// + /// 1:N account_customer_opportunity_roles + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("account_customer_opportunity_roles")] + public System.Collections.Generic.IEnumerable account_customer_opportunity_roles + { + get + { + return this.GetRelatedEntities("account_customer_opportunity_roles", null); + } + set + { + this.OnPropertyChanging("account_customer_opportunity_roles"); + this.SetRelatedEntities("account_customer_opportunity_roles", null, value); + this.OnPropertyChanged("account_customer_opportunity_roles"); + } + } + + /// + /// 1:N account_customer_relationship_customer + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("account_customer_relationship_customer")] + public System.Collections.Generic.IEnumerable account_customer_relationship_customer + { + get + { + return this.GetRelatedEntities("account_customer_relationship_customer", null); + } + set + { + this.OnPropertyChanging("account_customer_relationship_customer"); + this.SetRelatedEntities("account_customer_relationship_customer", null, value); + this.OnPropertyChanged("account_customer_relationship_customer"); + } + } + + /// + /// 1:N account_customer_relationship_partner + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("account_customer_relationship_partner")] + public System.Collections.Generic.IEnumerable account_customer_relationship_partner + { + get + { + return this.GetRelatedEntities("account_customer_relationship_partner", null); + } + set + { + this.OnPropertyChanging("account_customer_relationship_partner"); + this.SetRelatedEntities("account_customer_relationship_partner", null, value); + this.OnPropertyChanged("account_customer_relationship_partner"); + } + } + + /// + /// 1:N Account_CustomerAddress + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("Account_CustomerAddress")] + public System.Collections.Generic.IEnumerable Account_CustomerAddress + { + get + { + return this.GetRelatedEntities("Account_CustomerAddress", null); + } + set + { + this.OnPropertyChanging("Account_CustomerAddress"); + this.SetRelatedEntities("Account_CustomerAddress", null, value); + this.OnPropertyChanged("Account_CustomerAddress"); + } + } + + /// + /// 1:N Account_DuplicateBaseRecord + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("Account_DuplicateBaseRecord")] + public System.Collections.Generic.IEnumerable Account_DuplicateBaseRecord + { + get + { + return this.GetRelatedEntities("Account_DuplicateBaseRecord", null); + } + set + { + this.OnPropertyChanging("Account_DuplicateBaseRecord"); + this.SetRelatedEntities("Account_DuplicateBaseRecord", null, value); + this.OnPropertyChanged("Account_DuplicateBaseRecord"); + } + } + + /// + /// 1:N Account_DuplicateMatchingRecord + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("Account_DuplicateMatchingRecord")] + public System.Collections.Generic.IEnumerable Account_DuplicateMatchingRecord + { + get + { + return this.GetRelatedEntities("Account_DuplicateMatchingRecord", null); + } + set + { + this.OnPropertyChanging("Account_DuplicateMatchingRecord"); + this.SetRelatedEntities("Account_DuplicateMatchingRecord", null, value); + this.OnPropertyChanged("Account_DuplicateMatchingRecord"); + } + } + + /// + /// 1:N Account_Emails + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("Account_Emails")] + public System.Collections.Generic.IEnumerable Account_Emails + { + get + { + return this.GetRelatedEntities("Account_Emails", null); + } + set + { + this.OnPropertyChanging("Account_Emails"); + this.SetRelatedEntities("Account_Emails", null, value); + this.OnPropertyChanged("Account_Emails"); + } + } + + /// + /// 1:N Account_Faxes + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("Account_Faxes")] + public System.Collections.Generic.IEnumerable Account_Faxes + { + get + { + return this.GetRelatedEntities("Account_Faxes", null); + } + set + { + this.OnPropertyChanging("Account_Faxes"); + this.SetRelatedEntities("Account_Faxes", null, value); + this.OnPropertyChanged("Account_Faxes"); + } + } + + /// + /// 1:N Account_Letters + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("Account_Letters")] + public System.Collections.Generic.IEnumerable Account_Letters + { + get + { + return this.GetRelatedEntities("Account_Letters", null); + } + set + { + this.OnPropertyChanging("Account_Letters"); + this.SetRelatedEntities("Account_Letters", null, value); + this.OnPropertyChanged("Account_Letters"); + } + } + + /// + /// 1:N account_master_account + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("account_master_account", Microsoft.Xrm.Sdk.EntityRole.Referenced)] + public System.Collections.Generic.IEnumerable Referencedaccount_master_account + { + get + { + return this.GetRelatedEntities("account_master_account", Microsoft.Xrm.Sdk.EntityRole.Referenced); + } + set + { + this.OnPropertyChanging("Referencedaccount_master_account"); + this.SetRelatedEntities("account_master_account", Microsoft.Xrm.Sdk.EntityRole.Referenced, value); + this.OnPropertyChanged("Referencedaccount_master_account"); + } + } + + /// + /// 1:N account_parent_account + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("account_parent_account", Microsoft.Xrm.Sdk.EntityRole.Referenced)] + public System.Collections.Generic.IEnumerable Referencedaccount_parent_account + { + get + { + return this.GetRelatedEntities("account_parent_account", Microsoft.Xrm.Sdk.EntityRole.Referenced); + } + set + { + this.OnPropertyChanging("Referencedaccount_parent_account"); + this.SetRelatedEntities("account_parent_account", Microsoft.Xrm.Sdk.EntityRole.Referenced, value); + this.OnPropertyChanged("Referencedaccount_parent_account"); + } + } + + /// + /// 1:N Account_Phonecalls + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("Account_Phonecalls")] + public System.Collections.Generic.IEnumerable Account_Phonecalls + { + get + { + return this.GetRelatedEntities("Account_Phonecalls", null); + } + set + { + this.OnPropertyChanging("Account_Phonecalls"); + this.SetRelatedEntities("Account_Phonecalls", null, value); + this.OnPropertyChanged("Account_Phonecalls"); + } + } + + /// + /// 1:N account_PostFollows + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("account_PostFollows")] + public System.Collections.Generic.IEnumerable account_PostFollows + { + get + { + return this.GetRelatedEntities("account_PostFollows", null); + } + set + { + this.OnPropertyChanging("account_PostFollows"); + this.SetRelatedEntities("account_PostFollows", null, value); + this.OnPropertyChanged("account_PostFollows"); + } + } + + /// + /// 1:N account_principalobjectattributeaccess + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("account_principalobjectattributeaccess")] + public System.Collections.Generic.IEnumerable account_principalobjectattributeaccess + { + get + { + return this.GetRelatedEntities("account_principalobjectattributeaccess", null); + } + set + { + this.OnPropertyChanging("account_principalobjectattributeaccess"); + this.SetRelatedEntities("account_principalobjectattributeaccess", null, value); + this.OnPropertyChanged("account_principalobjectattributeaccess"); + } + } + + /// + /// 1:N Account_ProcessSessions + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("Account_ProcessSessions")] + public System.Collections.Generic.IEnumerable Account_ProcessSessions + { + get + { + return this.GetRelatedEntities("Account_ProcessSessions", null); + } + set + { + this.OnPropertyChanging("Account_ProcessSessions"); + this.SetRelatedEntities("Account_ProcessSessions", null, value); + this.OnPropertyChanged("Account_ProcessSessions"); + } + } + + /// + /// 1:N Account_RecurringAppointmentMasters + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("Account_RecurringAppointmentMasters")] + public System.Collections.Generic.IEnumerable Account_RecurringAppointmentMasters + { + get + { + return this.GetRelatedEntities("Account_RecurringAppointmentMasters", null); + } + set + { + this.OnPropertyChanging("Account_RecurringAppointmentMasters"); + this.SetRelatedEntities("Account_RecurringAppointmentMasters", null, value); + this.OnPropertyChanged("Account_RecurringAppointmentMasters"); + } + } + + /// + /// 1:N Account_ServiceAppointments + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("Account_ServiceAppointments")] + public System.Collections.Generic.IEnumerable Account_ServiceAppointments + { + get + { + return this.GetRelatedEntities("Account_ServiceAppointments", null); + } + set + { + this.OnPropertyChanging("Account_ServiceAppointments"); + this.SetRelatedEntities("Account_ServiceAppointments", null, value); + this.OnPropertyChanged("Account_ServiceAppointments"); + } + } + + /// + /// 1:N Account_SharepointDocumentLocation + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("Account_SharepointDocumentLocation")] + public System.Collections.Generic.IEnumerable Account_SharepointDocumentLocation + { + get + { + return this.GetRelatedEntities("Account_SharepointDocumentLocation", null); + } + set + { + this.OnPropertyChanging("Account_SharepointDocumentLocation"); + this.SetRelatedEntities("Account_SharepointDocumentLocation", null, value); + this.OnPropertyChanged("Account_SharepointDocumentLocation"); + } + } + + /// + /// 1:N Account_Tasks + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("Account_Tasks")] + public System.Collections.Generic.IEnumerable Account_Tasks + { + get + { + return this.GetRelatedEntities("Account_Tasks", null); + } + set + { + this.OnPropertyChanging("Account_Tasks"); + this.SetRelatedEntities("Account_Tasks", null, value); + this.OnPropertyChanged("Account_Tasks"); + } + } + + /// + /// 1:N contact_customer_accounts + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("contact_customer_accounts")] + public System.Collections.Generic.IEnumerable contact_customer_accounts + { + get + { + return this.GetRelatedEntities("contact_customer_accounts", null); + } + set + { + this.OnPropertyChanging("contact_customer_accounts"); + this.SetRelatedEntities("contact_customer_accounts", null, value); + this.OnPropertyChanged("contact_customer_accounts"); + } + } + + /// + /// 1:N contract_billingcustomer_accounts + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("contract_billingcustomer_accounts")] + public System.Collections.Generic.IEnumerable contract_billingcustomer_accounts + { + get + { + return this.GetRelatedEntities("contract_billingcustomer_accounts", null); + } + set + { + this.OnPropertyChanging("contract_billingcustomer_accounts"); + this.SetRelatedEntities("contract_billingcustomer_accounts", null, value); + this.OnPropertyChanged("contract_billingcustomer_accounts"); + } + } + + /// + /// 1:N contract_customer_accounts + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("contract_customer_accounts")] + public System.Collections.Generic.IEnumerable contract_customer_accounts + { + get + { + return this.GetRelatedEntities("contract_customer_accounts", null); + } + set + { + this.OnPropertyChanging("contract_customer_accounts"); + this.SetRelatedEntities("contract_customer_accounts", null, value); + this.OnPropertyChanged("contract_customer_accounts"); + } + } + + /// + /// 1:N contractlineitem_customer_accounts + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("contractlineitem_customer_accounts")] + public System.Collections.Generic.IEnumerable contractlineitem_customer_accounts + { + get + { + return this.GetRelatedEntities("contractlineitem_customer_accounts", null); + } + set + { + this.OnPropertyChanging("contractlineitem_customer_accounts"); + this.SetRelatedEntities("contractlineitem_customer_accounts", null, value); + this.OnPropertyChanged("contractlineitem_customer_accounts"); + } + } + + /// + /// 1:N CreatedAccount_BulkOperationLogs2 + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("CreatedAccount_BulkOperationLogs2")] + public System.Collections.Generic.IEnumerable CreatedAccount_BulkOperationLogs2 + { + get + { + return this.GetRelatedEntities("CreatedAccount_BulkOperationLogs2", null); + } + set + { + this.OnPropertyChanging("CreatedAccount_BulkOperationLogs2"); + this.SetRelatedEntities("CreatedAccount_BulkOperationLogs2", null, value); + this.OnPropertyChanged("CreatedAccount_BulkOperationLogs2"); + } + } + + /// + /// 1:N incident_customer_accounts + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("incident_customer_accounts")] + public System.Collections.Generic.IEnumerable incident_customer_accounts + { + get + { + return this.GetRelatedEntities("incident_customer_accounts", null); + } + set + { + this.OnPropertyChanging("incident_customer_accounts"); + this.SetRelatedEntities("incident_customer_accounts", null, value); + this.OnPropertyChanged("incident_customer_accounts"); + } + } + + /// + /// 1:N invoice_customer_accounts + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("invoice_customer_accounts")] + public System.Collections.Generic.IEnumerable invoice_customer_accounts + { + get + { + return this.GetRelatedEntities("invoice_customer_accounts", null); + } + set + { + this.OnPropertyChanging("invoice_customer_accounts"); + this.SetRelatedEntities("invoice_customer_accounts", null, value); + this.OnPropertyChanged("invoice_customer_accounts"); + } + } + + /// + /// 1:N lead_customer_accounts + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("lead_customer_accounts")] + public System.Collections.Generic.IEnumerable lead_customer_accounts + { + get + { + return this.GetRelatedEntities("lead_customer_accounts", null); + } + set + { + this.OnPropertyChanging("lead_customer_accounts"); + this.SetRelatedEntities("lead_customer_accounts", null, value); + this.OnPropertyChanged("lead_customer_accounts"); + } + } + + /// + /// 1:N opportunity_customer_accounts + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("opportunity_customer_accounts")] + public System.Collections.Generic.IEnumerable opportunity_customer_accounts + { + get + { + return this.GetRelatedEntities("opportunity_customer_accounts", null); + } + set + { + this.OnPropertyChanging("opportunity_customer_accounts"); + this.SetRelatedEntities("opportunity_customer_accounts", null, value); + this.OnPropertyChanged("opportunity_customer_accounts"); + } + } + + /// + /// 1:N order_customer_accounts + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("order_customer_accounts")] + public System.Collections.Generic.IEnumerable order_customer_accounts + { + get + { + return this.GetRelatedEntities("order_customer_accounts", null); + } + set + { + this.OnPropertyChanging("order_customer_accounts"); + this.SetRelatedEntities("order_customer_accounts", null, value); + this.OnPropertyChanged("order_customer_accounts"); + } + } + + /// + /// 1:N quote_customer_accounts + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("quote_customer_accounts")] + public System.Collections.Generic.IEnumerable quote_customer_accounts + { + get + { + return this.GetRelatedEntities("quote_customer_accounts", null); + } + set + { + this.OnPropertyChanging("quote_customer_accounts"); + this.SetRelatedEntities("quote_customer_accounts", null, value); + this.OnPropertyChanged("quote_customer_accounts"); + } + } + + /// + /// 1:N SourceAccount_BulkOperationLogs + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("SourceAccount_BulkOperationLogs")] + public System.Collections.Generic.IEnumerable SourceAccount_BulkOperationLogs + { + get + { + return this.GetRelatedEntities("SourceAccount_BulkOperationLogs", null); + } + set + { + this.OnPropertyChanging("SourceAccount_BulkOperationLogs"); + this.SetRelatedEntities("SourceAccount_BulkOperationLogs", null, value); + this.OnPropertyChanged("SourceAccount_BulkOperationLogs"); + } + } + + /// + /// 1:N userentityinstancedata_account + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("userentityinstancedata_account")] + public System.Collections.Generic.IEnumerable userentityinstancedata_account + { + get + { + return this.GetRelatedEntities("userentityinstancedata_account", null); + } + set + { + this.OnPropertyChanging("userentityinstancedata_account"); + this.SetRelatedEntities("userentityinstancedata_account", null, value); + this.OnPropertyChanged("userentityinstancedata_account"); + } + } + + /// + /// N:N accountleads_association + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("accountleads_association")] + public System.Collections.Generic.IEnumerable accountleads_association + { + get + { + return this.GetRelatedEntities("accountleads_association", null); + } + set + { + this.OnPropertyChanging("accountleads_association"); + this.SetRelatedEntities("accountleads_association", null, value); + this.OnPropertyChanged("accountleads_association"); + } + } + + /// + /// N:N listaccount_association + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("listaccount_association")] + public System.Collections.Generic.IEnumerable listaccount_association + { + get + { + return this.GetRelatedEntities("listaccount_association", null); + } + set + { + this.OnPropertyChanging("listaccount_association"); + this.SetRelatedEntities("listaccount_association", null, value); + this.OnPropertyChanged("listaccount_association"); + } + } + + /// + /// N:1 account_master_account + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("masterid")] + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("account_master_account", Microsoft.Xrm.Sdk.EntityRole.Referencing)] + public Account Referencingaccount_master_account + { + get + { + return this.GetRelatedEntity("account_master_account", Microsoft.Xrm.Sdk.EntityRole.Referencing); + } + } + + /// + /// N:1 account_originating_lead + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("originatingleadid")] + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("account_originating_lead")] + public Lead account_originating_lead + { + get + { + return this.GetRelatedEntity("account_originating_lead", null); + } + set + { + this.OnPropertyChanging("account_originating_lead"); + this.SetRelatedEntity("account_originating_lead", null, value); + this.OnPropertyChanged("account_originating_lead"); + } + } + + /// + /// N:1 account_parent_account + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("parentaccountid")] + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("account_parent_account", Microsoft.Xrm.Sdk.EntityRole.Referencing)] + public Account Referencingaccount_parent_account + { + get + { + return this.GetRelatedEntity("account_parent_account", Microsoft.Xrm.Sdk.EntityRole.Referencing); + } + set + { + this.OnPropertyChanging("Referencingaccount_parent_account"); + this.SetRelatedEntity("account_parent_account", Microsoft.Xrm.Sdk.EntityRole.Referencing, value); + this.OnPropertyChanged("Referencingaccount_parent_account"); + } + } + + /// + /// N:1 account_primary_contact + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("primarycontactid")] + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("account_primary_contact")] + public Contact account_primary_contact + { + get + { + return this.GetRelatedEntity("account_primary_contact", null); + } + set + { + this.OnPropertyChanging("account_primary_contact"); + this.SetRelatedEntity("account_primary_contact", null, value); + this.OnPropertyChanged("account_primary_contact"); + } + } + + /// + /// N:1 business_unit_accounts + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("owningbusinessunit")] + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("business_unit_accounts")] + public BusinessUnit business_unit_accounts + { + get + { + return this.GetRelatedEntity("business_unit_accounts", null); + } + } + + /// + /// N:1 equipment_accounts + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("preferredequipmentid")] + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("equipment_accounts")] + public Equipment equipment_accounts + { + get + { + return this.GetRelatedEntity("equipment_accounts", null); + } + set + { + this.OnPropertyChanging("equipment_accounts"); + this.SetRelatedEntity("equipment_accounts", null, value); + this.OnPropertyChanged("equipment_accounts"); + } + } + + /// + /// N:1 lk_accountbase_createdby + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("createdby")] + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("lk_accountbase_createdby")] + public SystemUser lk_accountbase_createdby + { + get + { + return this.GetRelatedEntity("lk_accountbase_createdby", null); + } + } + + /// + /// N:1 lk_accountbase_createdonbehalfby + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("createdonbehalfby")] + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("lk_accountbase_createdonbehalfby")] + public SystemUser lk_accountbase_createdonbehalfby + { + get + { + return this.GetRelatedEntity("lk_accountbase_createdonbehalfby", null); + } + } + + /// + /// N:1 lk_accountbase_modifiedby + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("modifiedby")] + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("lk_accountbase_modifiedby")] + public SystemUser lk_accountbase_modifiedby + { + get + { + return this.GetRelatedEntity("lk_accountbase_modifiedby", null); + } + } + + /// + /// N:1 lk_accountbase_modifiedonbehalfby + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("modifiedonbehalfby")] + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("lk_accountbase_modifiedonbehalfby")] + public SystemUser lk_accountbase_modifiedonbehalfby + { + get + { + return this.GetRelatedEntity("lk_accountbase_modifiedonbehalfby", null); + } + } + + /// + /// N:1 price_level_accounts + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("defaultpricelevelid")] + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("price_level_accounts")] + public PriceLevel price_level_accounts + { + get + { + return this.GetRelatedEntity("price_level_accounts", null); + } + set + { + this.OnPropertyChanging("price_level_accounts"); + this.SetRelatedEntity("price_level_accounts", null, value); + this.OnPropertyChanged("price_level_accounts"); + } + } + + /// + /// N:1 service_accounts + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("preferredserviceid")] + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("service_accounts")] + public Service service_accounts + { + get + { + return this.GetRelatedEntity("service_accounts", null); + } + set + { + this.OnPropertyChanging("service_accounts"); + this.SetRelatedEntity("service_accounts", null, value); + this.OnPropertyChanged("service_accounts"); + } + } + + /// + /// N:1 system_user_accounts + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("preferredsystemuserid")] + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("system_user_accounts")] + public SystemUser system_user_accounts + { + get + { + return this.GetRelatedEntity("system_user_accounts", null); + } + set + { + this.OnPropertyChanging("system_user_accounts"); + this.SetRelatedEntity("system_user_accounts", null, value); + this.OnPropertyChanged("system_user_accounts"); + } + } + + /// + /// N:1 team_accounts + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("owningteam")] + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("team_accounts")] + public Team team_accounts + { + get + { + return this.GetRelatedEntity("team_accounts", null); + } + } + + /// + /// N:1 territory_accounts + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("territoryid")] + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("territory_accounts")] + public Territory territory_accounts + { + get + { + return this.GetRelatedEntity("territory_accounts", null); + } + set + { + this.OnPropertyChanging("territory_accounts"); + this.SetRelatedEntity("territory_accounts", null, value); + this.OnPropertyChanged("territory_accounts"); + } + } + + /// + /// N:1 transactioncurrency_account + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("transactioncurrencyid")] + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("transactioncurrency_account")] + public TransactionCurrency transactioncurrency_account + { + get + { + return this.GetRelatedEntity("transactioncurrency_account", null); + } + set + { + this.OnPropertyChanging("transactioncurrency_account"); + this.SetRelatedEntity("transactioncurrency_account", null, value); + this.OnPropertyChanged("transactioncurrency_account"); + } + } + + /// + /// N:1 user_accounts + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("owninguser")] + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("user_accounts")] + public SystemUser user_accounts + { + get + { + return this.GetRelatedEntity("user_accounts", null); + } + } +} + +/// +/// +/// +[System.Runtime.Serialization.DataContractAttribute()] +[Microsoft.Xrm.Sdk.Client.EntityLogicalNameAttribute("accountleads")] +[System.CodeDom.Compiler.GeneratedCodeAttribute("CrmSvcUtil", "5.0.9690.2153")] +public partial class AccountLeads : Microsoft.Xrm.Sdk.Entity, System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged +{ + + /// + /// Default Constructor. + /// + public AccountLeads() : + base(EntityLogicalName) + { + } + + public const string EntityLogicalName = "accountleads"; + + public const int EntityTypeCode = 16; + + public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; + + public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging; + + private void OnPropertyChanged(string propertyName) + { + if ((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); + } + } + + private void OnPropertyChanging(string propertyName) + { + if ((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new System.ComponentModel.PropertyChangingEventArgs(propertyName)); + } + } + + /// + /// + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("accountid")] + public System.Nullable AccountId + { + get + { + return this.GetAttributeValue>("accountid"); + } + } + + /// + /// Unique identifier of the lead for the account. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("accountleadid")] + public System.Nullable AccountLeadId + { + get + { + return this.GetAttributeValue>("accountleadid"); + } + set + { + this.OnPropertyChanging("AccountLeadId"); + this.SetAttributeValue("accountleadid", value); + if (value.HasValue) + { + base.Id = value.Value; + } + else + { + base.Id = System.Guid.Empty; + } + this.OnPropertyChanged("AccountLeadId"); + } + } + + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("accountleadid")] + public override System.Guid Id + { + get + { + return base.Id; + } + set + { + this.AccountLeadId = value; + } + } + + /// + /// + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("leadid")] + public System.Nullable LeadId + { + get + { + return this.GetAttributeValue>("leadid"); + } + } + + /// + /// + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("versionnumber")] + public System.Nullable VersionNumber + { + get + { + return this.GetAttributeValue>("versionnumber"); + } + } + + /// + /// N:N accountleads_association + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("accountleads_association")] + public System.Collections.Generic.IEnumerable accountleads_association + { + get + { + return this.GetRelatedEntities("accountleads_association", null); + } + set + { + this.OnPropertyChanging("accountleads_association"); + this.SetRelatedEntities("accountleads_association", null, value); + this.OnPropertyChanged("accountleads_association"); + } + } +} + +/// +/// MIME attachment for an e-mail activity. +/// +[System.Runtime.Serialization.DataContractAttribute()] +[Microsoft.Xrm.Sdk.Client.EntityLogicalNameAttribute("activitymimeattachment")] +[System.CodeDom.Compiler.GeneratedCodeAttribute("CrmSvcUtil", "5.0.9690.2153")] +public partial class ActivityMimeAttachment : Microsoft.Xrm.Sdk.Entity, System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged +{ + + /// + /// Default Constructor. + /// + public ActivityMimeAttachment() : + base(EntityLogicalName) + { + } + + public const string EntityLogicalName = "activitymimeattachment"; + + public const int EntityTypeCode = 1001; + + public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; + + public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging; + + private void OnPropertyChanged(string propertyName) + { + if ((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); + } + } + + private void OnPropertyChanging(string propertyName) + { + if ((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new System.ComponentModel.PropertyChangingEventArgs(propertyName)); + } + } + + /// + /// Unique identifier of the activity with which the e-mail attachment is associated. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("activityid")] + [System.ObsoleteAttribute()] + public Microsoft.Xrm.Sdk.EntityReference ActivityId + { + get + { + return this.GetAttributeValue("activityid"); + } + set + { + this.OnPropertyChanging("ActivityId"); + this.SetAttributeValue("activityid", value); + this.OnPropertyChanged("ActivityId"); + } + } + + /// + /// Unique identifier of the e-mail attachment. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("activitymimeattachmentid")] + public System.Nullable ActivityMimeAttachmentId + { + get + { + return this.GetAttributeValue>("activitymimeattachmentid"); + } + set + { + this.OnPropertyChanging("ActivityMimeAttachmentId"); + this.SetAttributeValue("activitymimeattachmentid", value); + if (value.HasValue) + { + base.Id = value.Value; + } + else + { + base.Id = System.Guid.Empty; + } + this.OnPropertyChanged("ActivityMimeAttachmentId"); + } + } + + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("activitymimeattachmentid")] + public override System.Guid Id + { + get + { + return base.Id; + } + set + { + this.ActivityMimeAttachmentId = value; + } + } + + /// + /// For internal use only. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("activitymimeattachmentidunique")] + public System.Nullable ActivityMimeAttachmentIdUnique + { + get + { + return this.GetAttributeValue>("activitymimeattachmentidunique"); + } + set + { + this.OnPropertyChanging("ActivityMimeAttachmentIdUnique"); + this.SetAttributeValue("activitymimeattachmentidunique", value); + this.OnPropertyChanged("ActivityMimeAttachmentIdUnique"); + } + } + + /// + /// Unique identifier of the attachment with which this activitymimeattachment is associated. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("attachmentid")] + public Microsoft.Xrm.Sdk.EntityReference AttachmentId + { + get + { + return this.GetAttributeValue("attachmentid"); + } + set + { + this.OnPropertyChanging("AttachmentId"); + this.SetAttributeValue("attachmentid", value); + this.OnPropertyChanged("AttachmentId"); + } + } + + /// + /// Number of the e-mail attachment. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("attachmentnumber")] + public System.Nullable AttachmentNumber + { + get + { + return this.GetAttributeValue>("attachmentnumber"); + } + set + { + this.OnPropertyChanging("AttachmentNumber"); + this.SetAttributeValue("attachmentnumber", value); + this.OnPropertyChanged("AttachmentNumber"); + } + } + + /// + /// Contents of the e-mail attachment. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("body")] + public string Body + { + get + { + return this.GetAttributeValue("body"); + } + set + { + this.OnPropertyChanging("Body"); + this.SetAttributeValue("body", value); + this.OnPropertyChanged("Body"); + } + } + + /// + /// For internal use only. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("componentstate")] + public Microsoft.Xrm.Sdk.OptionSetValue ComponentState + { + get + { + return this.GetAttributeValue("componentstate"); + } + } + + /// + /// File name of the attachment. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("filename")] + public string FileName + { + get + { + return this.GetAttributeValue("filename"); + } + set + { + this.OnPropertyChanging("FileName"); + this.SetAttributeValue("filename", value); + this.OnPropertyChanged("FileName"); + } + } + + /// + /// File size of the e-mail attachment. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("filesize")] + public System.Nullable FileSize + { + get + { + return this.GetAttributeValue>("filesize"); + } + } + + /// + /// Indicates whether the solution component is part of a managed solution. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("ismanaged")] + public System.Nullable IsManaged + { + get + { + return this.GetAttributeValue>("ismanaged"); + } + } + + /// + /// MIME type of the e-mail attachment. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("mimetype")] + public string MimeType + { + get + { + return this.GetAttributeValue("mimetype"); + } + set + { + this.OnPropertyChanging("MimeType"); + this.SetAttributeValue("mimetype", value); + this.OnPropertyChanged("MimeType"); + } + } + + /// + /// Unique identifier of the record with which the attachment is associated + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("objectid")] + public Microsoft.Xrm.Sdk.EntityReference ObjectId + { + get + { + return this.GetAttributeValue("objectid"); + } + set + { + this.OnPropertyChanging("ObjectId"); + this.SetAttributeValue("objectid", value); + this.OnPropertyChanged("ObjectId"); + } + } + + /// + /// Object Type Code of the entity that is associated with the attachment. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("objecttypecode")] + public string ObjectTypeCode + { + get + { + return this.GetAttributeValue("objecttypecode"); + } + set + { + this.OnPropertyChanging("ObjectTypeCode"); + this.SetAttributeValue("objecttypecode", value); + this.OnPropertyChanged("ObjectTypeCode"); + } + } + + /// + /// For internal use only. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("overwritetime")] + public System.Nullable OverwriteTime + { + get + { + return this.GetAttributeValue>("overwritetime"); + } + } + + /// + /// Unique identifier of the user or team who owns the activity_mime_attachment. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("ownerid")] + public Microsoft.Xrm.Sdk.EntityReference OwnerId + { + get + { + return this.GetAttributeValue("ownerid"); + } + } + + /// + /// Unique identifier of the business unit that owns the activity mime attachment. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("owningbusinessunit")] + public Microsoft.Xrm.Sdk.EntityReference OwningBusinessUnit + { + get + { + return this.GetAttributeValue("owningbusinessunit"); + } + } + + /// + /// Unique identifier of the user who owns the activity mime attachment. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("owninguser")] + public Microsoft.Xrm.Sdk.EntityReference OwningUser + { + get + { + return this.GetAttributeValue("owninguser"); + } + } + + /// + /// Unique identifier of the associated solution. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("solutionid")] + public System.Nullable SolutionId + { + get + { + return this.GetAttributeValue>("solutionid"); + } + } + + /// + /// Descriptive subject for the e-mail attachment. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("subject")] + public string Subject + { + get + { + return this.GetAttributeValue("subject"); + } + set + { + this.OnPropertyChanging("Subject"); + this.SetAttributeValue("subject", value); + this.OnPropertyChanged("Subject"); + } + } + + /// + /// Version number of the activity mime attachment. + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("versionnumber")] + public System.Nullable VersionNumber + { + get + { + return this.GetAttributeValue>("versionnumber"); + } + } + + /// + /// 1:N ActivityMimeAttachment_AsyncOperations + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("ActivityMimeAttachment_AsyncOperations")] + public System.Collections.Generic.IEnumerable ActivityMimeAttachment_AsyncOperations + { + get + { + return this.GetRelatedEntities("ActivityMimeAttachment_AsyncOperations", null); + } + set + { + this.OnPropertyChanging("ActivityMimeAttachment_AsyncOperations"); + this.SetRelatedEntities("ActivityMimeAttachment_AsyncOperations", null, value); + this.OnPropertyChanged("ActivityMimeAttachment_AsyncOperations"); + } + } + + /// + /// 1:N ActivityMimeAttachment_BulkDeleteFailures + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("ActivityMimeAttachment_BulkDeleteFailures")] + public System.Collections.Generic.IEnumerable ActivityMimeAttachment_BulkDeleteFailures + { + get + { + return this.GetRelatedEntities("ActivityMimeAttachment_BulkDeleteFailures", null); + } + set + { + this.OnPropertyChanging("ActivityMimeAttachment_BulkDeleteFailures"); + this.SetRelatedEntities("ActivityMimeAttachment_BulkDeleteFailures", null, value); + this.OnPropertyChanged("ActivityMimeAttachment_BulkDeleteFailures"); + } + } + + /// + /// 1:N userentityinstancedata_activitymimeattachment + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("userentityinstancedata_activitymimeattachment")] + public System.Collections.Generic.IEnumerable userentityinstancedata_activitymimeattachment + { + get + { + return this.GetRelatedEntities("userentityinstancedata_activitymimeattachment", null); + } + set + { + this.OnPropertyChanging("userentityinstancedata_activitymimeattachment"); + this.SetRelatedEntities("userentityinstancedata_activitymimeattachment", null, value); + this.OnPropertyChanged("userentityinstancedata_activitymimeattachment"); + } + } + + /// + /// N:1 activity_pointer_activity_mime_attachment + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("objectid")] + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("activity_pointer_activity_mime_attachment")] + public ActivityPointer activity_pointer_activity_mime_attachment + { + get + { + return this.GetRelatedEntity("activity_pointer_activity_mime_attachment", null); + } + set + { + this.OnPropertyChanging("activity_pointer_activity_mime_attachment"); + this.SetRelatedEntity("activity_pointer_activity_mime_attachment", null, value); + this.OnPropertyChanged("activity_pointer_activity_mime_attachment"); + } + } + + /// + /// N:1 email_activity_mime_attachment + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("objectid")] + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("email_activity_mime_attachment")] + public Email email_activity_mime_attachment + { + get + { + return this.GetRelatedEntity("email_activity_mime_attachment", null); + } + set + { + this.OnPropertyChanging("email_activity_mime_attachment"); + this.SetRelatedEntity("email_activity_mime_attachment", null, value); + this.OnPropertyChanged("email_activity_mime_attachment"); + } + } + + /// + /// N:1 template_activity_mime_attachments + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("objectid")] + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("template_activity_mime_attachments")] + public Template template_activity_mime_attachments + { + get + { + return this.GetRelatedEntity