Merged with the latest changeset

This commit is contained in:
rdolezel 2012-09-18 21:08:40 +02:00
parent e2b7191c98
commit e2b94badfd
3 changed files with 113 additions and 0 deletions

View file

@ -5211,6 +5211,66 @@ 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='ExchangeOrganizationDomains' AND COLS.name='DomainTypeID')
BEGIN
ALTER TABLE [dbo].[ExchangeOrganizationDomains] ADD
[DomainTypeID] [int] NOT NULL CONSTRAINT DF_ExchangeOrganizationDomains_DomainTypeID DEFAULT 0
END
GO
ALTER PROCEDURE [dbo].[GetExchangeOrganizationDomains]
(
@ItemID int
)
AS
SELECT
ED.DomainID,
D.DomainName,
ED.IsHost,
ED.DomainTypeID
FROM
ExchangeOrganizationDomains AS ED
INNER JOIN Domains AS D ON ED.DomainID = D.DomainID
WHERE ED.ItemID = @ItemID
RETURN
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE type_desc = N'SQL_STORED_PROCEDURE' AND name = N'ChangeExchangeAcceptedDomainType')
BEGIN
EXEC sp_executesql N'
CREATE PROCEDURE [dbo].ChangeExchangeAcceptedDomainType
(
@ItemID int,
@DomainID int,
@DomainTypeID int
)
AS
UPDATE ExchangeOrganizationDomains
SET DomainTypeID=@DomainTypeID
WHERE ItemID=ItemID AND DomainID=@DomainID
RETURN'
END
GO
ALTER PROCEDURE [dbo].[GetPackages] ALTER PROCEDURE [dbo].[GetPackages]
( (
@ActorID int, @ActorID int,

View file

@ -2153,6 +2153,18 @@ namespace WebsitePanel.EnterpriseServer
); );
} }
public static void ChangeExchangeAcceptedDomainType(int itemId, int domainId, int domainTypeId)
{
SqlHelper.ExecuteNonQuery(
ConnectionString,
CommandType.StoredProcedure,
"ChangeExchangeAcceptedDomainType",
new SqlParameter("@ItemID", itemId),
new SqlParameter("@DomainID", domainId),
new SqlParameter("@DomainTypeID", domainTypeId)
);
}
public static IDataReader GetExchangeOrganizationStatistics(int itemId) public static IDataReader GetExchangeOrganizationStatistics(int itemId)
{ {
return SqlHelper.ExecuteReader( return SqlHelper.ExecuteReader(

View file

@ -230,6 +230,11 @@ namespace WebsitePanel.Providers.HostedSolution
{ {
DeleteAuthoritativeDomainInternal(domain); DeleteAuthoritativeDomainInternal(domain);
} }
public void ChangeAcceptedDomainType(string domainName, ExchangeAcceptedDomainType domainType)
{
ChangeAcceptedDomainTypeInternal(domainName, domainType);
}
#endregion #endregion
#region Mailboxes #region Mailboxes
@ -5954,6 +5959,31 @@ namespace WebsitePanel.Providers.HostedSolution
ExchangeLog.LogEnd("CreateAuthoritativeDomainInternal"); ExchangeLog.LogEnd("CreateAuthoritativeDomainInternal");
} }
private void ChangeAcceptedDomainTypeInternal(string domainName, ExchangeAcceptedDomainType domainType)
{
ExchangeLog.LogStart("ChangeAcceptedDomainType");
Runspace runSpace = null;
try
{
runSpace = OpenRunspace();
SetAcceptedDomainType(runSpace, domainName,domainType);
}
catch (Exception ex)
{
ExchangeLog.LogError("ChangeAcceptedDomainType", ex);
throw;
}
finally
{
CloseRunspace(runSpace);
}
ExchangeLog.LogEnd("ChangeAcceptedDomainType");
}
private void DeleteAcceptedDomain(string domainName) private void DeleteAcceptedDomain(string domainName)
{ {
ExchangeLog.LogStart("DeleteAcceptedDomain"); ExchangeLog.LogStart("DeleteAcceptedDomain");
@ -6018,6 +6048,17 @@ namespace WebsitePanel.Providers.HostedSolution
ExchangeLog.LogEnd("RemoveAcceptedDomain"); ExchangeLog.LogEnd("RemoveAcceptedDomain");
} }
private void SetAcceptedDomainType(Runspace runSpace, string id, ExchangeAcceptedDomainType domainType)
{
ExchangeLog.LogStart("SetAcceptedDomainType");
Command cmd = new Command("Set-AcceptedDomain");
cmd.Parameters.Add("Identity", id);
cmd.Parameters.Add("DomainType", domainType.ToString());
cmd.Parameters.Add("Confirm", false);
ExecuteShellCommand(runSpace, cmd);
ExchangeLog.LogEnd("SetAcceptedDomainType");
}
#endregion #endregion
#region ActiveSync #region ActiveSync