Merge
This commit is contained in:
commit
a515c9a68c
116 changed files with 198344 additions and 6475 deletions
|
@ -2570,7 +2570,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
public static void UpdateExchangeAccount(int accountId, string accountName, ExchangeAccountType accountType,
|
||||
string displayName, string primaryEmailAddress, bool mailEnabledPublicFolder,
|
||||
string mailboxManagerActions, string samAccountName, string accountPassword, int mailboxPlanId, string subscriberNumber)
|
||||
string mailboxManagerActions, string samAccountName, string accountPassword, int mailboxPlanId, int archivePlanId, string subscriberNumber)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
|
@ -2586,6 +2586,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
new SqlParameter("@Password", string.IsNullOrEmpty(accountPassword) ? (object)DBNull.Value : (object)accountPassword),
|
||||
new SqlParameter("@SamAccountName", samAccountName),
|
||||
new SqlParameter("@MailboxPlanId", (mailboxPlanId == 0) ? (object)DBNull.Value : (object)mailboxPlanId),
|
||||
new SqlParameter("@ArchivingMailboxPlanId", (archivePlanId < 1) ? (object)DBNull.Value : (object)archivePlanId),
|
||||
new SqlParameter("@SubscriberNumber", (string.IsNullOrEmpty(subscriberNumber) ? (object)DBNull.Value : (object)subscriberNumber))
|
||||
);
|
||||
}
|
||||
|
@ -2709,7 +2710,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
}
|
||||
|
||||
public static DataSet GetExchangeAccountsPaged(int actorId, int itemId, string accountTypes,
|
||||
string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows)
|
||||
string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, bool archiving)
|
||||
{
|
||||
// check input parameters
|
||||
string[] types = accountTypes.Split(',');
|
||||
|
@ -2738,7 +2739,8 @@ namespace WebsitePanel.EnterpriseServer
|
|||
new SqlParameter("@FilterValue", VerifyColumnValue(filterValue)),
|
||||
new SqlParameter("@SortColumn", VerifyColumnName(sortColumn)),
|
||||
new SqlParameter("@StartRow", startRow),
|
||||
new SqlParameter("@MaximumRows", maximumRows)
|
||||
new SqlParameter("@MaximumRows", maximumRows),
|
||||
new SqlParameter("@Archiving", archiving)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2782,7 +2784,8 @@ 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, string litigationHoldUrl, string litigationHoldMsg)
|
||||
bool enabledLitigationHold, long recoverabelItemsSpace, long recoverabelItemsWarning, string litigationHoldUrl, string litigationHoldMsg,
|
||||
bool archiving, bool EnableArchiving)
|
||||
{
|
||||
SqlParameter outParam = new SqlParameter("@MailboxPlanId", SqlDbType.Int);
|
||||
outParam.Direction = ParameterDirection.Output;
|
||||
|
@ -2814,7 +2817,9 @@ namespace WebsitePanel.EnterpriseServer
|
|||
new SqlParameter("@RecoverableItemsWarningPct", recoverabelItemsWarning),
|
||||
new SqlParameter("@RecoverableItemsSpace", recoverabelItemsSpace),
|
||||
new SqlParameter("@LitigationHoldUrl", litigationHoldUrl),
|
||||
new SqlParameter("@LitigationHoldMsg", litigationHoldMsg)
|
||||
new SqlParameter("@LitigationHoldMsg", litigationHoldMsg),
|
||||
new SqlParameter("@Archiving", archiving),
|
||||
new SqlParameter("@EnableArchiving", EnableArchiving)
|
||||
);
|
||||
|
||||
return Convert.ToInt32(outParam.Value);
|
||||
|
@ -2825,7 +2830,8 @@ 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, string litigationHoldUrl, string litigationHoldMsg)
|
||||
bool enabledLitigationHold, long recoverabelItemsSpace, long recoverabelItemsWarning, string litigationHoldUrl, string litigationHoldMsg,
|
||||
bool Archiving, bool EnableArchiving)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
|
@ -2853,7 +2859,9 @@ namespace WebsitePanel.EnterpriseServer
|
|||
new SqlParameter("@RecoverableItemsWarningPct", recoverabelItemsWarning),
|
||||
new SqlParameter("@RecoverableItemsSpace", recoverabelItemsSpace),
|
||||
new SqlParameter("@LitigationHoldUrl", litigationHoldUrl),
|
||||
new SqlParameter("@LitigationHoldMsg", litigationHoldMsg)
|
||||
new SqlParameter("@LitigationHoldMsg", litigationHoldMsg),
|
||||
new SqlParameter("@Archiving", Archiving),
|
||||
new SqlParameter("@EnableArchiving", EnableArchiving)
|
||||
|
||||
);
|
||||
}
|
||||
|
@ -2881,13 +2889,14 @@ namespace WebsitePanel.EnterpriseServer
|
|||
);
|
||||
}
|
||||
|
||||
public static IDataReader GetExchangeMailboxPlans(int itemId)
|
||||
public static IDataReader GetExchangeMailboxPlans(int itemId, bool archiving)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetExchangeMailboxPlans",
|
||||
new SqlParameter("@ItemID", itemId)
|
||||
new SqlParameter("@ItemID", itemId),
|
||||
new SqlParameter("@Archiving", archiving)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2914,17 +2923,124 @@ namespace WebsitePanel.EnterpriseServer
|
|||
);
|
||||
}
|
||||
|
||||
public static void SetExchangeAccountMailboxPlan(int accountId, int mailboxPlanId)
|
||||
public static void SetExchangeAccountMailboxPlan(int accountId, int mailboxPlanId, int archivePlanId)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"SetExchangeAccountMailboxplan",
|
||||
new SqlParameter("@AccountID", accountId),
|
||||
new SqlParameter("@MailboxPlanId", (mailboxPlanId == 0) ? (object)DBNull.Value : (object)mailboxPlanId)
|
||||
new SqlParameter("@MailboxPlanId", (mailboxPlanId == 0) ? (object)DBNull.Value : (object)mailboxPlanId),
|
||||
new SqlParameter("@ArchivingMailboxPlanId", (archivePlanId < 1) ? (object)DBNull.Value : (object)archivePlanId)
|
||||
);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Exchange Retention Policy Tags
|
||||
public static int AddExchangeRetentionPolicyTag(int ItemID, string TagName, int TagType, int AgeLimitForRetention, int RetentionAction)
|
||||
{
|
||||
SqlParameter outParam = new SqlParameter("@TagID", SqlDbType.Int);
|
||||
outParam.Direction = ParameterDirection.Output;
|
||||
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"AddExchangeRetentionPolicyTag",
|
||||
outParam,
|
||||
new SqlParameter("@ItemID", ItemID),
|
||||
new SqlParameter("@TagName", TagName),
|
||||
new SqlParameter("@TagType", TagType),
|
||||
new SqlParameter("@AgeLimitForRetention", AgeLimitForRetention),
|
||||
new SqlParameter("@RetentionAction", RetentionAction)
|
||||
);
|
||||
|
||||
return Convert.ToInt32(outParam.Value);
|
||||
}
|
||||
|
||||
public static void UpdateExchangeRetentionPolicyTag(int TagID, int ItemID, string TagName, int TagType, int AgeLimitForRetention, int RetentionAction)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"UpdateExchangeRetentionPolicyTag",
|
||||
new SqlParameter("@TagID", TagID),
|
||||
new SqlParameter("@ItemID", ItemID),
|
||||
new SqlParameter("@TagName", TagName),
|
||||
new SqlParameter("@TagType", TagType),
|
||||
new SqlParameter("@AgeLimitForRetention", AgeLimitForRetention),
|
||||
new SqlParameter("@RetentionAction", RetentionAction)
|
||||
);
|
||||
}
|
||||
|
||||
public static void DeleteExchangeRetentionPolicyTag(int TagID)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"DeleteExchangeRetentionPolicyTag",
|
||||
new SqlParameter("@TagID", TagID)
|
||||
);
|
||||
}
|
||||
|
||||
public static IDataReader GetExchangeRetentionPolicyTag(int TagID)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetExchangeRetentionPolicyTag",
|
||||
new SqlParameter("@TagID", TagID)
|
||||
);
|
||||
}
|
||||
|
||||
public static IDataReader GetExchangeRetentionPolicyTags(int itemId)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetExchangeRetentionPolicyTags",
|
||||
new SqlParameter("@ItemID", itemId)
|
||||
);
|
||||
}
|
||||
|
||||
public static int AddExchangeMailboxPlanRetentionPolicyTag(int TagID, int MailboxPlanId)
|
||||
{
|
||||
SqlParameter outParam = new SqlParameter("@PlanTagID", SqlDbType.Int);
|
||||
outParam.Direction = ParameterDirection.Output;
|
||||
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"AddExchangeMailboxPlanRetentionPolicyTag",
|
||||
outParam,
|
||||
new SqlParameter("@TagID", TagID),
|
||||
new SqlParameter("@MailboxPlanId", MailboxPlanId)
|
||||
);
|
||||
|
||||
return Convert.ToInt32(outParam.Value);
|
||||
}
|
||||
|
||||
public static void DeleteExchangeMailboxPlanRetentionPolicyTag(int PlanTagID)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"DeleteExchangeMailboxPlanRetentionPolicyTag",
|
||||
new SqlParameter("@PlanTagID", PlanTagID)
|
||||
);
|
||||
}
|
||||
|
||||
public static IDataReader GetExchangeMailboxPlanRetentionPolicyTags(int MailboxPlanId)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetExchangeMailboxPlanRetentionPolicyTags",
|
||||
new SqlParameter("@MailboxPlanId", MailboxPlanId)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Exchange Disclaimers
|
||||
|
|
|
@ -950,7 +950,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
public static ExchangeAccountsPaged GetAccountsPaged(int itemId, string accountTypes,
|
||||
string filterColumn, string filterValue, string sortColumn,
|
||||
int startRow, int maximumRows)
|
||||
int startRow, int maximumRows, bool archiving)
|
||||
{
|
||||
#region Demo Mode
|
||||
if (IsDemoMode)
|
||||
|
@ -965,7 +965,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
#endregion
|
||||
|
||||
DataSet ds = DataProvider.GetExchangeAccountsPaged(SecurityContext.User.UserId, itemId,
|
||||
accountTypes, filterColumn, filterValue, sortColumn, startRow, maximumRows);
|
||||
accountTypes, filterColumn, filterValue, sortColumn, startRow, maximumRows, archiving);
|
||||
|
||||
ExchangeAccountsPaged result = new ExchangeAccountsPaged();
|
||||
result.RecordsCount = (int)ds.Tables[0].Rows[0][0];
|
||||
|
@ -1223,7 +1223,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
{
|
||||
DataProvider.UpdateExchangeAccount(account.AccountId, account.AccountName, account.AccountType, account.DisplayName,
|
||||
account.PrimaryEmailAddress, account.MailEnabledPublicFolder,
|
||||
account.MailboxManagerActions.ToString(), account.SamAccountName, account.AccountPassword, account.MailboxPlanId,
|
||||
account.MailboxManagerActions.ToString(), account.SamAccountName, account.AccountPassword, account.MailboxPlanId, account.ArchivingMailboxPlanId,
|
||||
(string.IsNullOrEmpty(account.SubscriberNumber) ? null : account.SubscriberNumber.Trim()));
|
||||
}
|
||||
|
||||
|
@ -1598,7 +1598,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
private static void UpdateExchangeAccount(int accountId, string accountName, ExchangeAccountType accountType,
|
||||
string displayName, string primaryEmailAddress, bool mailEnabledPublicFolder,
|
||||
string mailboxManagerActions, string samAccountName, string accountPassword, int mailboxPlanId, string subscriberNumber)
|
||||
string mailboxManagerActions, string samAccountName, string accountPassword, int mailboxPlanId, int archivePlanId, string subscriberNumber)
|
||||
{
|
||||
DataProvider.UpdateExchangeAccount(accountId,
|
||||
accountName,
|
||||
|
@ -1609,13 +1609,13 @@ namespace WebsitePanel.EnterpriseServer
|
|||
mailboxManagerActions,
|
||||
samAccountName,
|
||||
CryptoUtils.Encrypt(accountPassword),
|
||||
mailboxPlanId,
|
||||
mailboxPlanId, archivePlanId,
|
||||
(string.IsNullOrEmpty(subscriberNumber) ? null : subscriberNumber.Trim()));
|
||||
}
|
||||
|
||||
|
||||
public static int CreateMailbox(int itemId, int accountId, ExchangeAccountType accountType, string accountName,
|
||||
string displayName, string name, string domain, string password, bool sendSetupInstructions, string setupInstructionMailAddress, int mailboxPlanId, string subscriberNumber)
|
||||
string displayName, string name, string domain, string password, bool sendSetupInstructions, string setupInstructionMailAddress, int mailboxPlanId, int archivedPlanId, string subscriberNumber)
|
||||
{
|
||||
// check account
|
||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||
|
@ -1756,7 +1756,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
| MailboxManagerActions.EmailAddresses;
|
||||
|
||||
|
||||
UpdateExchangeAccount(accountId, accountName, accountType, displayName, email, false, pmmActions.ToString(), samAccount, password, mailboxPlanId, subscriberNumber);
|
||||
UpdateExchangeAccount(accountId, accountName, accountType, displayName, email, false, pmmActions.ToString(), samAccount, password, mailboxPlanId, archivedPlanId, subscriberNumber);
|
||||
|
||||
|
||||
|
||||
|
@ -2600,7 +2600,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
|
||||
#region Mailbox plan
|
||||
public static int SetExchangeMailboxPlan(int itemId, int accountId, int mailboxPlanId)
|
||||
public static int SetExchangeMailboxPlan(int itemId, int accountId, int mailboxPlanId, int archivePlanId)
|
||||
{
|
||||
// check account
|
||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||
|
@ -2679,6 +2679,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
int exchangeServiceId = GetExchangeServiceID(org.PackageId);
|
||||
ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);
|
||||
|
||||
//TDMX
|
||||
exchange.SetMailboxAdvancedSettings(
|
||||
org.OrganizationId,
|
||||
account.UserPrincipalName,
|
||||
|
@ -2700,7 +2701,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
plan.LitigationHoldUrl,
|
||||
plan.LitigationHoldMsg);
|
||||
|
||||
DataProvider.SetExchangeAccountMailboxPlan(accountId, mailboxPlanId);
|
||||
DataProvider.SetExchangeAccountMailboxPlan(accountId, mailboxPlanId, archivePlanId);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -2714,7 +2715,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
}
|
||||
}
|
||||
|
||||
public static List<ExchangeMailboxPlan> GetExchangeMailboxPlans(int itemId)
|
||||
public static List<ExchangeMailboxPlan> GetExchangeMailboxPlans(int itemId, bool archiving)
|
||||
{
|
||||
// place log record
|
||||
TaskManager.StartTask("EXCHANGE", "GET_EXCHANGE_MAILBOXPLANS", itemId);
|
||||
|
@ -2726,9 +2727,9 @@ namespace WebsitePanel.EnterpriseServer
|
|||
UserInfo user = ObjectUtils.FillObjectFromDataReader<UserInfo>(DataProvider.GetUserByExchangeOrganizationIdInternally(itemId));
|
||||
|
||||
if (user.Role == UserRole.User)
|
||||
ExchangeServerController.GetExchangeMailboxPlansByUser(itemId, user, ref mailboxPlans);
|
||||
ExchangeServerController.GetExchangeMailboxPlansByUser(itemId, user, ref mailboxPlans, archiving);
|
||||
else
|
||||
ExchangeServerController.GetExchangeMailboxPlansByUser(0, user, ref mailboxPlans);
|
||||
ExchangeServerController.GetExchangeMailboxPlansByUser(0, user, ref mailboxPlans, archiving);
|
||||
|
||||
|
||||
ExchangeOrganization ExchangeOrg = ObjectUtils.FillObjectFromDataReader<ExchangeOrganization>(DataProvider.GetExchangeOrganization(itemId));
|
||||
|
@ -2753,7 +2754,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
}
|
||||
}
|
||||
|
||||
private static void GetExchangeMailboxPlansByUser(int itemId, UserInfo user, ref List<ExchangeMailboxPlan> mailboxPlans)
|
||||
private static void GetExchangeMailboxPlansByUser(int itemId, UserInfo user, ref List<ExchangeMailboxPlan> mailboxPlans, bool archiving)
|
||||
{
|
||||
if ((user != null))
|
||||
{
|
||||
|
@ -2780,7 +2781,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
if (OrgId != -1)
|
||||
{
|
||||
List<ExchangeMailboxPlan> Plans = ObjectUtils.CreateListFromDataReader<ExchangeMailboxPlan>(DataProvider.GetExchangeMailboxPlans(OrgId));
|
||||
List<ExchangeMailboxPlan> Plans = ObjectUtils.CreateListFromDataReader<ExchangeMailboxPlan>(DataProvider.GetExchangeMailboxPlans(OrgId, archiving));
|
||||
|
||||
foreach (ExchangeMailboxPlan p in Plans)
|
||||
{
|
||||
|
@ -2790,7 +2791,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
UserInfo owner = UserController.GetUserInternally(user.OwnerId);
|
||||
|
||||
GetExchangeMailboxPlansByUser(0, owner, ref mailboxPlans);
|
||||
GetExchangeMailboxPlansByUser(0, owner, ref mailboxPlans, archiving);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2842,9 +2843,18 @@ namespace WebsitePanel.EnterpriseServer
|
|||
if (mailboxPlan.KeepDeletedItemsDays > cntx.Quotas[Quotas.EXCHANGE2007_KEEPDELETEDITEMSDAYS].QuotaAllocatedValue)
|
||||
mailboxPlan.KeepDeletedItemsDays = cntx.Quotas[Quotas.EXCHANGE2007_KEEPDELETEDITEMSDAYS].QuotaAllocatedValue;
|
||||
|
||||
if (cntx.Quotas[Quotas.EXCHANGE2007_DISKSPACE].QuotaAllocatedValue != -1)
|
||||
if (mailboxPlan.MailboxSizeMB > cntx.Quotas[Quotas.EXCHANGE2007_DISKSPACE].QuotaAllocatedValue)
|
||||
mailboxPlan.MailboxSizeMB = cntx.Quotas[Quotas.EXCHANGE2007_DISKSPACE].QuotaAllocatedValue;
|
||||
if (mailboxPlan.Archiving)
|
||||
{
|
||||
if (cntx.Quotas[Quotas.EXCHANGE2013_ARCHIVINGSTORAGE].QuotaAllocatedValue != -1)
|
||||
if (mailboxPlan.MailboxSizeMB > cntx.Quotas[Quotas.EXCHANGE2013_ARCHIVINGSTORAGE].QuotaAllocatedValue)
|
||||
mailboxPlan.MailboxSizeMB = cntx.Quotas[Quotas.EXCHANGE2013_ARCHIVINGSTORAGE].QuotaAllocatedValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cntx.Quotas[Quotas.EXCHANGE2007_DISKSPACE].QuotaAllocatedValue != -1)
|
||||
if (mailboxPlan.MailboxSizeMB > cntx.Quotas[Quotas.EXCHANGE2007_DISKSPACE].QuotaAllocatedValue)
|
||||
mailboxPlan.MailboxSizeMB = cntx.Quotas[Quotas.EXCHANGE2007_DISKSPACE].QuotaAllocatedValue;
|
||||
}
|
||||
|
||||
if (cntx.Quotas[Quotas.EXCHANGE2007_MAXRECEIVEMESSAGESIZEKB].QuotaAllocatedValue != -1)
|
||||
if (mailboxPlan.MaxReceiveMessageSizeKB > cntx.Quotas[Quotas.EXCHANGE2007_MAXRECEIVEMESSAGESIZEKB].QuotaAllocatedValue)
|
||||
|
@ -2871,7 +2881,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
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.LitigationHoldUrl, mailboxPlan.LitigationHoldMsg);
|
||||
mailboxPlan.LitigationHoldUrl, mailboxPlan.LitigationHoldMsg, mailboxPlan.Archiving, mailboxPlan.EnableArchiving);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -2941,7 +2951,8 @@ namespace WebsitePanel.EnterpriseServer
|
|||
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.LitigationHoldUrl, mailboxPlan.LitigationHoldMsg);
|
||||
mailboxPlan.LitigationHoldUrl, mailboxPlan.LitigationHoldMsg,
|
||||
mailboxPlan.Archiving, mailboxPlan.EnableArchiving);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -3002,6 +3013,262 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
#endregion
|
||||
|
||||
#region Exchange Retention Policy Tags
|
||||
|
||||
public static List<ExchangeRetentionPolicyTag> GetExchangeRetentionPolicyTags(int itemId)
|
||||
{
|
||||
// place log record
|
||||
TaskManager.StartTask("EXCHANGE", "GET_EXCHANGE_RETENTIONPOLICYTAGS", itemId);
|
||||
|
||||
try
|
||||
{
|
||||
List<ExchangeRetentionPolicyTag> retentionPolicyTags = new List<ExchangeRetentionPolicyTag>();
|
||||
|
||||
UserInfo user = ObjectUtils.FillObjectFromDataReader<UserInfo>(DataProvider.GetUserByExchangeOrganizationIdInternally(itemId));
|
||||
|
||||
if (user.Role == UserRole.User)
|
||||
ExchangeServerController.GetExchangeRetentionPolicyTagsByUser(itemId, user, ref retentionPolicyTags);
|
||||
else
|
||||
ExchangeServerController.GetExchangeRetentionPolicyTagsByUser(0, user, ref retentionPolicyTags);
|
||||
|
||||
return retentionPolicyTags;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw TaskManager.WriteError(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
TaskManager.CompleteTask();
|
||||
}
|
||||
}
|
||||
|
||||
private static void GetExchangeRetentionPolicyTagsByUser(int itemId, UserInfo user, ref List<ExchangeRetentionPolicyTag> retentionPolicyTags)
|
||||
{
|
||||
if ((user != null))
|
||||
{
|
||||
List<Organization> orgs = null;
|
||||
|
||||
if (user.UserId != 1)
|
||||
{
|
||||
List<PackageInfo> Packages = PackageController.GetPackages(user.UserId);
|
||||
|
||||
if ((Packages != null) & (Packages.Count > 0))
|
||||
{
|
||||
orgs = GetExchangeOrganizationsInternal(Packages[0].PackageId, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
orgs = GetExchangeOrganizationsInternal(1, false);
|
||||
}
|
||||
|
||||
int OrgId = -1;
|
||||
if (itemId > 0) OrgId = itemId;
|
||||
else if ((orgs != null) & (orgs.Count > 0)) OrgId = orgs[0].Id;
|
||||
|
||||
|
||||
if (OrgId != -1)
|
||||
{
|
||||
List<ExchangeRetentionPolicyTag> RetentionPolicy = ObjectUtils.CreateListFromDataReader<ExchangeRetentionPolicyTag>(DataProvider.GetExchangeRetentionPolicyTags(OrgId));
|
||||
|
||||
foreach (ExchangeRetentionPolicyTag p in RetentionPolicy)
|
||||
{
|
||||
retentionPolicyTags.Add(p);
|
||||
}
|
||||
}
|
||||
|
||||
UserInfo owner = UserController.GetUserInternally(user.OwnerId);
|
||||
|
||||
GetExchangeRetentionPolicyTagsByUser(0, owner, ref retentionPolicyTags);
|
||||
}
|
||||
}
|
||||
|
||||
public static ExchangeRetentionPolicyTag GetExchangeRetentionPolicyTag(int itemID, int tagId)
|
||||
{
|
||||
|
||||
// place log record
|
||||
TaskManager.StartTask("EXCHANGE", "GET_EXCHANGE_RETENTIONPOLICYTAG", tagId);
|
||||
|
||||
try
|
||||
{
|
||||
return ObjectUtils.FillObjectFromDataReader<ExchangeRetentionPolicyTag>(
|
||||
DataProvider.GetExchangeRetentionPolicyTag(tagId));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw TaskManager.WriteError(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
TaskManager.CompleteTask();
|
||||
}
|
||||
}
|
||||
|
||||
public static int AddExchangeRetentionPolicyTag(int itemID, ExchangeRetentionPolicyTag tag)
|
||||
{
|
||||
// place log record
|
||||
TaskManager.StartTask("EXCHANGE", "ADD_EXCHANGE_RETENTIONPOLICYTAG", itemID);
|
||||
|
||||
try
|
||||
{
|
||||
Organization org = GetOrganization(itemID);
|
||||
if (org == null)
|
||||
return -1;
|
||||
|
||||
// load package context
|
||||
PackageContext cntx = PackageController.GetPackageContext(org.PackageId);
|
||||
|
||||
if (org.PackageId > 1)
|
||||
{
|
||||
// quotas
|
||||
}
|
||||
|
||||
return DataProvider.AddExchangeRetentionPolicyTag(itemID, tag.TagName, tag.TagType, tag.AgeLimitForRetention, tag.RetentionAction );
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw TaskManager.WriteError(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
TaskManager.CompleteTask();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static int UpdateExchangeRetentionPolicyTag(int itemID, ExchangeRetentionPolicyTag tag)
|
||||
{
|
||||
// place log record
|
||||
TaskManager.StartTask("EXCHANGE", "UPDATE_EXCHANGE_RETENTIONPOLICYTAG", itemID);
|
||||
|
||||
try
|
||||
{
|
||||
Organization org = GetOrganization(itemID);
|
||||
if (org == null)
|
||||
return -1;
|
||||
|
||||
// load package context
|
||||
PackageContext cntx = PackageController.GetPackageContext(org.PackageId);
|
||||
|
||||
if (org.PackageId > 1)
|
||||
{
|
||||
// quotas
|
||||
}
|
||||
|
||||
DataProvider.UpdateExchangeRetentionPolicyTag(tag.TagID, tag.ItemID, tag.TagName, tag.TagType, tag.AgeLimitForRetention, tag.RetentionAction);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw TaskManager.WriteError(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
TaskManager.CompleteTask();
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int DeleteExchangeRetentionPolicyTag(int itemID, int tagId)
|
||||
{
|
||||
TaskManager.StartTask("EXCHANGE", "DELETE_EXCHANGE_RETENTIONPOLICYTAG", itemID);
|
||||
|
||||
try
|
||||
{
|
||||
DataProvider.DeleteExchangeRetentionPolicyTag(tagId);
|
||||
|
||||
return 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw TaskManager.WriteError(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
TaskManager.CompleteTask();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static List<ExchangeMailboxPlanRetentionPolicyTag> GetExchangeMailboxPlanRetentionPolicyTags(int policyId)
|
||||
{
|
||||
// place log record
|
||||
TaskManager.StartTask("EXCHANGE", "GET_EXCHANGE_RETENTIONPOLICYTAGS", policyId);
|
||||
|
||||
try
|
||||
{
|
||||
List<ExchangeMailboxPlanRetentionPolicyTag> tags =
|
||||
ObjectUtils.CreateListFromDataReader<ExchangeMailboxPlanRetentionPolicyTag>(DataProvider.GetExchangeMailboxPlanRetentionPolicyTags(policyId));
|
||||
|
||||
return tags;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw TaskManager.WriteError(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
TaskManager.CompleteTask();
|
||||
}
|
||||
}
|
||||
|
||||
public static int AddExchangeMailboxPlanRetentionPolicyTag(int itemID, ExchangeMailboxPlanRetentionPolicyTag planTag)
|
||||
{
|
||||
// place log record
|
||||
TaskManager.StartTask("EXCHANGE", "ADD_EXCHANGE_RETENTIONPOLICYTAG", itemID);
|
||||
|
||||
try
|
||||
{
|
||||
Organization org = GetOrganization(itemID);
|
||||
if (org == null)
|
||||
return -1;
|
||||
|
||||
// load package context
|
||||
PackageContext cntx = PackageController.GetPackageContext(org.PackageId);
|
||||
|
||||
if (org.PackageId > 1)
|
||||
{
|
||||
// quotas
|
||||
}
|
||||
|
||||
return DataProvider.AddExchangeMailboxPlanRetentionPolicyTag(planTag.TagID, planTag.MailboxPlanId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw TaskManager.WriteError(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
TaskManager.CompleteTask();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static int DeleteExchangeMailboxPlanRetentionPolicyTag(int itemID, int planTagId)
|
||||
{
|
||||
TaskManager.StartTask("EXCHANGE", "DELETE_EXCHANGE_RETENTIONPOLICYTAG", itemID);
|
||||
|
||||
try
|
||||
{
|
||||
DataProvider.DeleteExchangeMailboxPlanRetentionPolicyTag(planTagId);
|
||||
|
||||
return 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw TaskManager.WriteError(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
TaskManager.CompleteTask();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Contacts
|
||||
public static int CreateContact(int itemId, string displayName, string email)
|
||||
|
|
|
@ -49,8 +49,19 @@ namespace WebsitePanel.EnterpriseServer
|
|||
}
|
||||
|
||||
private static int GetCRMServiceId(int packageId)
|
||||
{
|
||||
int serviceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.HostedCRM);
|
||||
{
|
||||
int serviceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.HostedCRM2013);
|
||||
if (serviceId == 0)
|
||||
serviceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.HostedCRM);
|
||||
return serviceId;
|
||||
}
|
||||
|
||||
private static int GetCRMServiceId(int packageId, ResultObject res)
|
||||
{
|
||||
int serviceId = GetCRMServiceId(packageId);
|
||||
if (serviceId == 0)
|
||||
CompleteTask(res, CrmErrorCodes.CRM_IS_NOT_SELECTED_IN_HOSTING_PLAN, null,
|
||||
"CRM is not selected in hosting plan.");
|
||||
return serviceId;
|
||||
}
|
||||
|
||||
|
@ -226,7 +237,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return value;
|
||||
}
|
||||
|
||||
public static OrganizationResult CreateOrganization(int organizationId, string baseCurrencyCode, string baseCurrencyName, string baseCurrencySymbol, string regionName, int userId, string collation)
|
||||
public static OrganizationResult CreateOrganization(int organizationId, string baseCurrencyCode, string baseCurrencyName, string baseCurrencySymbol, string regionName, int userId, string collation, int baseLanguageCode)
|
||||
{
|
||||
OrganizationResult res = StartTask<OrganizationResult>("CRM", "CREATE_ORGANIZATION");
|
||||
|
||||
|
@ -269,7 +280,12 @@ namespace WebsitePanel.EnterpriseServer
|
|||
string rootOU = GetProviderProperty(serviceid, "rootou");
|
||||
|
||||
PackageContext cntx = PackageController.GetPackageContext(org.PackageId);
|
||||
long maxDBSize = cntx.Quotas[Quotas.CRM_MAXDATABASESIZE].QuotaAllocatedValue;
|
||||
|
||||
string maxDBSizeQuotaName = "";
|
||||
if (cntx.Groups.ContainsKey(ResourceGroups.HostedCRM2013)) maxDBSizeQuotaName = Quotas.CRM2013_MAXDATABASESIZE;
|
||||
else if (cntx.Groups.ContainsKey(ResourceGroups.HostedCRM)) maxDBSizeQuotaName = Quotas.CRM_MAXDATABASESIZE;
|
||||
|
||||
long maxDBSize = cntx.Quotas[maxDBSizeQuotaName].QuotaAllocatedValue;
|
||||
if (maxDBSize != -1) maxDBSize = maxDBSize * 1024 * 1024;
|
||||
|
||||
org.CrmAdministratorId = user.AccountId;
|
||||
|
@ -277,10 +293,12 @@ namespace WebsitePanel.EnterpriseServer
|
|||
string.Join("|", new[] {baseCurrencyCode, baseCurrencyName, baseCurrencySymbol, regionName});
|
||||
org.CrmCollation = collation;
|
||||
org.CrmOrgState = (int) CrmOrganizationState.Enabled;
|
||||
org.CrmLanguadgeCode = baseLanguageCode.ToString();
|
||||
org.CrmOrganizationId = orgId;
|
||||
|
||||
OrganizationResult serverRes =
|
||||
crm.CreateOrganization(orgId, org.OrganizationId, org.Name,
|
||||
baseLanguageCode,
|
||||
org.OrganizationId + "." + rootOU,
|
||||
baseCurrencyCode, baseCurrencyName,
|
||||
baseCurrencySymbol, user.SamAccountName, user.FirstName, user.LastName, user.PrimaryEmailAddress,
|
||||
|
@ -343,19 +361,35 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return res;
|
||||
}
|
||||
|
||||
public static StringArrayResultObject GetCollationNames(int packageId)
|
||||
public static StringArrayResultObject GetCollationByServiceId(int serviceId)
|
||||
{
|
||||
StringArrayResultObject ret = StartTask<StringArrayResultObject>("CRM", "GET_COLLATION_NAMES");
|
||||
ret.IsSuccess = true;
|
||||
try
|
||||
{
|
||||
CRM crm = new CRM();
|
||||
ServiceProviderProxy.Init(crm, serviceId);
|
||||
ret.Value = crm.GetSupportedCollationNames();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
CompleteTask(ret, CrmErrorCodes.CANNOT_GET_COLLATION_NAMES, ex);
|
||||
return ret;
|
||||
}
|
||||
CompleteTask();
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static StringArrayResultObject GetCollation(int packageId)
|
||||
{
|
||||
StringArrayResultObject ret = StartTask<StringArrayResultObject>("CRM", "GET_COLLATION_NAMES");
|
||||
ret.IsSuccess = true;
|
||||
|
||||
try
|
||||
{
|
||||
int serviceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.HostedCRM);
|
||||
int serviceId = GetCRMServiceId(packageId, ret);
|
||||
if (serviceId == 0)
|
||||
{
|
||||
CompleteTask(ret, CrmErrorCodes.CRM_IS_NOT_SELECTED_IN_HOSTING_PLAN);
|
||||
return ret;
|
||||
}
|
||||
|
||||
CRM crm = new CRM();
|
||||
ServiceProviderProxy.Init(crm, serviceId);
|
||||
|
@ -372,18 +406,35 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return ret;
|
||||
}
|
||||
|
||||
public static CurrencyArrayResultObject GetCurrencyByServiceId(int serviceId)
|
||||
{
|
||||
CurrencyArrayResultObject ret = StartTask<CurrencyArrayResultObject>("CRM", "GET_CURRENCY");
|
||||
ret.IsSuccess = true;
|
||||
try
|
||||
{
|
||||
CRM crm = new CRM();
|
||||
ServiceProviderProxy.Init(crm, serviceId);
|
||||
ret.Value = crm.GetCurrencyList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
CompleteTask(ret, CrmErrorCodes.CANNOT_GET_CURRENCY_LIST, ex);
|
||||
return ret;
|
||||
}
|
||||
CompleteTask();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static CurrencyArrayResultObject GetCurrency(int packageId)
|
||||
{
|
||||
CurrencyArrayResultObject ret = StartTask<CurrencyArrayResultObject>("CRM", "GET_CURRENCY");
|
||||
ret.IsSuccess = true;
|
||||
try
|
||||
{
|
||||
int serviceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.HostedCRM);
|
||||
int serviceId = GetCRMServiceId(packageId, ret);
|
||||
if (serviceId == 0)
|
||||
{
|
||||
CompleteTask(ret, CrmErrorCodes.CRM_IS_NOT_SELECTED_IN_HOSTING_PLAN, null, "CRM is not selected in hosting plan.");
|
||||
return ret;
|
||||
}
|
||||
|
||||
CRM crm = new CRM();
|
||||
ServiceProviderProxy.Init(crm, serviceId);
|
||||
|
@ -550,9 +601,12 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
|
||||
PackageContext cntx = PackageController.GetPackageContext(packageId);
|
||||
return (cntx.Quotas[Quotas.CRM_ORGANIZATION] != null && !cntx.Quotas[Quotas.CRM_ORGANIZATION].QuotaExhausted);
|
||||
|
||||
|
||||
|
||||
string quotaName = "";
|
||||
if (cntx.Groups.ContainsKey(ResourceGroups.HostedCRM2013)) quotaName = Quotas.CRM2013_ORGANIZATION;
|
||||
else if (cntx.Groups.ContainsKey(ResourceGroups.HostedCRM)) quotaName = Quotas.CRM_ORGANIZATION;
|
||||
|
||||
return (cntx.Quotas[quotaName] != null && !cntx.Quotas[quotaName].QuotaExhausted);
|
||||
|
||||
}
|
||||
catch(Exception ex)
|
||||
|
@ -676,19 +730,22 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
if (!quotaRes.Value)
|
||||
{
|
||||
CompleteTask(ret, CrmErrorCodes.USER_QUOTA_HAS_BEEN_REACHED + CALType.ToString(), null, "CRM user quota has been reached.");
|
||||
string errorCode = CrmErrorCodes.USER_QUOTA_HAS_BEEN_REACHED;
|
||||
PackageContext cntx = PackageController.GetPackageContext(packageId);
|
||||
if (cntx.Groups.ContainsKey(ResourceGroups.HostedCRM2013))
|
||||
errorCode += "2013_";
|
||||
errorCode += CALType.ToString();
|
||||
|
||||
CompleteTask(ret, errorCode , null, "CRM user quota has been reached.");
|
||||
return ret;
|
||||
}
|
||||
|
||||
Guid crmId;
|
||||
try
|
||||
{
|
||||
int serviceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.HostedCRM);
|
||||
int serviceId = GetCRMServiceId(packageId, ret);
|
||||
if (serviceId == 0)
|
||||
{
|
||||
CompleteTask(ret, CrmErrorCodes.CRM_IS_NOT_SELECTED_IN_HOSTING_PLAN, null, "CRM is not selected in hosting plan.");
|
||||
return ret;
|
||||
}
|
||||
|
||||
Organization org = OrganizationController.GetOrganization(itemId);
|
||||
|
||||
|
@ -735,12 +792,9 @@ namespace WebsitePanel.EnterpriseServer
|
|||
CRMBusinessUnitsResult res = StartTask<CRMBusinessUnitsResult>("CRM", "GET_CRM_BUSINESS_UNITS");
|
||||
try
|
||||
{
|
||||
int serviceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.HostedCRM);
|
||||
int serviceId = GetCRMServiceId(packageId, res);
|
||||
if (serviceId == 0)
|
||||
{
|
||||
CompleteTask(res, CrmErrorCodes.CRM_IS_NOT_SELECTED_IN_HOSTING_PLAN, null, "CRM is not selected in hosting plan.");
|
||||
return res;
|
||||
}
|
||||
|
||||
Organization org;
|
||||
try
|
||||
|
@ -784,12 +838,9 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
try
|
||||
{
|
||||
int serviceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.HostedCRM);
|
||||
int serviceId = GetCRMServiceId(packageId, res);
|
||||
if (serviceId == 0)
|
||||
{
|
||||
CompleteTask(res, CrmErrorCodes.CRM_IS_NOT_SELECTED_IN_HOSTING_PLAN, null, "CRM is not selected in hosting plan.");
|
||||
return res;
|
||||
}
|
||||
|
||||
CRM crm = new CRM();
|
||||
ServiceProviderProxy.Init(crm, serviceId);
|
||||
|
@ -874,13 +925,9 @@ namespace WebsitePanel.EnterpriseServer
|
|||
}
|
||||
|
||||
|
||||
int serviceId = PackageController.GetPackageServiceId(org.PackageId, ResourceGroups.HostedCRM);
|
||||
int serviceId = GetCRMServiceId(org.PackageId, res);
|
||||
if (serviceId == 0)
|
||||
{
|
||||
CompleteTask(res, CrmErrorCodes.CRM_IS_NOT_SELECTED_IN_HOSTING_PLAN, null,
|
||||
"CRM is not selected in hosting plan.");
|
||||
return res;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -919,13 +966,9 @@ namespace WebsitePanel.EnterpriseServer
|
|||
try
|
||||
{
|
||||
|
||||
int serviceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.HostedCRM);
|
||||
int serviceId = GetCRMServiceId(packageId, res);
|
||||
if (serviceId == 0)
|
||||
{
|
||||
CompleteTask(res, CrmErrorCodes.CRM_IS_NOT_SELECTED_IN_HOSTING_PLAN, null,
|
||||
"CRM is not selected in hosting plan.");
|
||||
return res;
|
||||
}
|
||||
|
||||
CRM crm = new CRM();
|
||||
ServiceProviderProxy.Init(crm, serviceId);
|
||||
|
@ -978,13 +1021,9 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return res;
|
||||
}
|
||||
|
||||
int serviceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.HostedCRM);
|
||||
int serviceId = GetCRMServiceId(packageId, res);
|
||||
if (serviceId == 0)
|
||||
{
|
||||
CompleteTask(res, CrmErrorCodes.CRM_IS_NOT_SELECTED_IN_HOSTING_PLAN, null,
|
||||
"CRM is not selected in hosting plan.");
|
||||
return res;
|
||||
}
|
||||
|
||||
CRM crm = new CRM();
|
||||
ServiceProviderProxy.Init(crm, serviceId);
|
||||
|
@ -1012,7 +1051,13 @@ namespace WebsitePanel.EnterpriseServer
|
|||
}
|
||||
if (!quotaRes.Value)
|
||||
{
|
||||
CompleteTask(res, CrmErrorCodes.USER_QUOTA_HAS_BEEN_REACHED + CALType.ToString(), null, "CRM user quota has been reached.");
|
||||
string errorCode = CrmErrorCodes.USER_QUOTA_HAS_BEEN_REACHED;
|
||||
PackageContext cntx = PackageController.GetPackageContext(packageId);
|
||||
if (cntx.Groups.ContainsKey(ResourceGroups.HostedCRM2013))
|
||||
errorCode += "2013_";
|
||||
errorCode += CALType.ToString();
|
||||
|
||||
CompleteTask(res, errorCode, null, "CRM user quota has been reached.");
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -1058,13 +1103,9 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return res;
|
||||
}
|
||||
|
||||
int serviceId = PackageController.GetPackageServiceId(org.PackageId, ResourceGroups.HostedCRM);
|
||||
int serviceId = GetCRMServiceId(org.PackageId, res);
|
||||
if (serviceId == 0)
|
||||
{
|
||||
CompleteTask(res, CrmErrorCodes.CRM_IS_NOT_SELECTED_IN_HOSTING_PLAN, null,
|
||||
"CRM is not selected in hosting plan.");
|
||||
return res;
|
||||
}
|
||||
|
||||
CRM crm = new CRM();
|
||||
ServiceProviderProxy.Init(crm, serviceId);
|
||||
|
@ -1105,19 +1146,37 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return res;
|
||||
}
|
||||
|
||||
string quotaName = Quotas.CRM_USERS;
|
||||
string quotaName = "";
|
||||
|
||||
switch (CALType)
|
||||
if (cntx.Groups.ContainsKey(ResourceGroups.HostedCRM2013))
|
||||
{
|
||||
case 0:
|
||||
quotaName = Quotas.CRM_USERS;
|
||||
break;
|
||||
case 2:
|
||||
quotaName = Quotas.CRM_LIMITEDUSERS;
|
||||
break;
|
||||
case 22:
|
||||
quotaName = Quotas.CRM_ESSUSERS;
|
||||
break;
|
||||
switch (CALType)
|
||||
{
|
||||
case CRMUserLycenseTypes.PROFESSIONAL:
|
||||
quotaName = Quotas.CRM2013_PROFESSIONALUSERS;
|
||||
break;
|
||||
case CRMUserLycenseTypes.BASIC:
|
||||
quotaName = Quotas.CRM2013_BASICUSERS;
|
||||
break;
|
||||
case CRMUserLycenseTypes.ESSENTIAL:
|
||||
quotaName = Quotas.CRM2013_ESSENTIALUSERS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (cntx.Groups.ContainsKey(ResourceGroups.HostedCRM))
|
||||
{
|
||||
switch (CALType)
|
||||
{
|
||||
case CRMUserLycenseTypes.FULL:
|
||||
quotaName = Quotas.CRM_USERS;
|
||||
break;
|
||||
case CRMUserLycenseTypes.LIMITED:
|
||||
quotaName = Quotas.CRM_LIMITEDUSERS;
|
||||
break;
|
||||
case CRMUserLycenseTypes.ESS:
|
||||
quotaName = Quotas.CRM_ESSUSERS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int allocatedCrmUsers = cntx.Quotas[quotaName].QuotaAllocatedValue;
|
||||
|
@ -1137,18 +1196,14 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
public static ResultObject SetMaxDBSize(int itemId, int packageId, long maxSize)
|
||||
{
|
||||
ResultObject res = StartTask<CrmRolesResult>("CRM", "SET_CRM_MAXDBSIZE");
|
||||
ResultObject res = StartTask<ResultObject>("CRM", "SET_CRM_MAXDBSIZE");
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
int serviceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.HostedCRM);
|
||||
int serviceId = GetCRMServiceId(packageId, res);
|
||||
if (serviceId == 0)
|
||||
{
|
||||
CompleteTask(res, CrmErrorCodes.CRM_IS_NOT_SELECTED_IN_HOSTING_PLAN, null,
|
||||
"CRM is not selected in hosting plan.");
|
||||
return res;
|
||||
}
|
||||
|
||||
CRM crm = new CRM();
|
||||
ServiceProviderProxy.Init(crm, serviceId);
|
||||
|
@ -1169,7 +1224,11 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
PackageContext cntx = PackageController.GetPackageContext(packageId);
|
||||
|
||||
long limitSize = cntx.Quotas[Quotas.CRM_MAXDATABASESIZE].QuotaAllocatedValue;
|
||||
string quotaName = "";
|
||||
if (cntx.Groups.ContainsKey(ResourceGroups.HostedCRM2013)) quotaName = Quotas.CRM2013_MAXDATABASESIZE;
|
||||
else if (cntx.Groups.ContainsKey(ResourceGroups.HostedCRM)) quotaName = Quotas.CRM_MAXDATABASESIZE;
|
||||
|
||||
long limitSize = cntx.Quotas[quotaName].QuotaAllocatedValue;
|
||||
|
||||
if (limitSize != -1)
|
||||
{
|
||||
|
@ -1199,19 +1258,15 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
public static long GetDBSize(int itemId, int packageId)
|
||||
{
|
||||
ResultObject res = StartTask<CrmRolesResult>("CRM", "GET_CRM_DBSIZE");
|
||||
ResultObject res = StartTask<ResultObject>("CRM", "GET_CRM_DBSIZE");
|
||||
long size = -1;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
int serviceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.HostedCRM);
|
||||
int serviceId = GetCRMServiceId(packageId, res);
|
||||
if (serviceId == 0)
|
||||
{
|
||||
CompleteTask(res, CrmErrorCodes.CRM_IS_NOT_SELECTED_IN_HOSTING_PLAN, null,
|
||||
"CRM is not selected in hosting plan.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
CRM crm = new CRM();
|
||||
ServiceProviderProxy.Init(crm, serviceId);
|
||||
|
@ -1244,19 +1299,15 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
public static long GetMaxDBSize(int itemId, int packageId)
|
||||
{
|
||||
ResultObject res = StartTask<CrmRolesResult>("CRM", "GET_CRM_MAXDBSIZE");
|
||||
ResultObject res = StartTask<ResultObject>("CRM", "GET_CRM_MAXDBSIZE");
|
||||
long size = -1;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
int serviceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.HostedCRM);
|
||||
int serviceId = GetCRMServiceId(packageId, res);
|
||||
if (serviceId == 0)
|
||||
{
|
||||
CompleteTask(res, CrmErrorCodes.CRM_IS_NOT_SELECTED_IN_HOSTING_PLAN, null,
|
||||
"CRM is not selected in hosting plan.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
CRM crm = new CRM();
|
||||
ServiceProviderProxy.Init(crm, serviceId);
|
||||
|
@ -1287,5 +1338,52 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return size;
|
||||
}
|
||||
|
||||
|
||||
public static int[] GetInstalledLanguagePacks(int packageId)
|
||||
{
|
||||
ResultObject res = StartTask<ResultObject>("CRM", "GET_CRM_MAXDBSIZE");
|
||||
int[] ret = null;
|
||||
|
||||
try
|
||||
{
|
||||
int serviceId = GetCRMServiceId(packageId, res);
|
||||
if (serviceId == 0)
|
||||
return null;
|
||||
|
||||
CRM crm = new CRM();
|
||||
ServiceProviderProxy.Init(crm, serviceId);
|
||||
|
||||
ret = crm.GetInstalledLanguagePacks();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
CompleteTask(res, CrmErrorCodes.CANNOT_CONFIGURE_CRM_ORGANIZATION, ex);
|
||||
return null;
|
||||
}
|
||||
CompleteTask();
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static int[] GetInstalledLanguagePacksByServiceId(int serviceId)
|
||||
{
|
||||
ResultObject res = StartTask<ResultObject>("CRM", "GET_CRM_MAXDBSIZE");
|
||||
int[] ret = null;
|
||||
|
||||
try
|
||||
{
|
||||
CRM crm = new CRM();
|
||||
ServiceProviderProxy.Init(crm, serviceId);
|
||||
|
||||
ret = crm.GetInstalledLanguagePacks();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
CompleteTask(res, CrmErrorCodes.CANNOT_CONFIGURE_CRM_ORGANIZATION, ex);
|
||||
return null;
|
||||
}
|
||||
CompleteTask();
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -932,12 +932,20 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
if (cntxTmp.Groups.ContainsKey(ResourceGroups.HostedCRM))
|
||||
{
|
||||
stats.CreatedCRMUsers = CRMController.GetCRMUsersCount(org.Id, string.Empty, string.Empty, 0).Value;
|
||||
stats.CreatedLimitedCRMUsers = CRMController.GetCRMUsersCount(org.Id, string.Empty, string.Empty, 2).Value;
|
||||
stats.CreatedESSCRMUsers = CRMController.GetCRMUsersCount(org.Id, string.Empty, string.Empty, 22).Value;
|
||||
stats.CreatedCRMUsers = CRMController.GetCRMUsersCount(org.Id, string.Empty, string.Empty, CRMUserLycenseTypes.FULL).Value;
|
||||
stats.CreatedLimitedCRMUsers = CRMController.GetCRMUsersCount(org.Id, string.Empty, string.Empty, CRMUserLycenseTypes.LIMITED).Value;
|
||||
stats.CreatedESSCRMUsers = CRMController.GetCRMUsersCount(org.Id, string.Empty, string.Empty, CRMUserLycenseTypes.ESS).Value;
|
||||
stats.UsedCRMDiskSpace = CRMController.GetDBSize(org.Id, org.PackageId);
|
||||
stats.AllocatedCRMDiskSpace = CRMController.GetMaxDBSize(org.Id, org.PackageId);
|
||||
}
|
||||
|
||||
if (cntxTmp.Groups.ContainsKey(ResourceGroups.HostedCRM2013))
|
||||
{
|
||||
stats.CreatedProfessionalCRMUsers = CRMController.GetCRMUsersCount(org.Id, string.Empty, string.Empty, CRMUserLycenseTypes.PROFESSIONAL).Value;
|
||||
stats.CreatedBasicCRMUsers = CRMController.GetCRMUsersCount(org.Id, string.Empty, string.Empty, CRMUserLycenseTypes.BASIC).Value;
|
||||
stats.CreatedEssentialCRMUsers = CRMController.GetCRMUsersCount(org.Id, string.Empty, string.Empty, CRMUserLycenseTypes.ESSENTIAL).Value;
|
||||
stats.UsedCRMDiskSpace = CRMController.GetDBSize(org.Id, org.PackageId);
|
||||
stats.AllocatedCRMDiskSpace = CRMController.GetMaxDBSize(org.Id, org.PackageId);
|
||||
|
||||
}
|
||||
|
||||
if (cntxTmp.Groups.ContainsKey(ResourceGroups.BlackBerry))
|
||||
|
@ -997,9 +1005,18 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
if (cntxTmp.Groups.ContainsKey(ResourceGroups.HostedCRM))
|
||||
{
|
||||
stats.CreatedCRMUsers += CRMController.GetCRMUsersCount(o.Id, string.Empty, string.Empty, 0 ).Value;
|
||||
stats.CreatedLimitedCRMUsers += CRMController.GetCRMUsersCount(o.Id, string.Empty, string.Empty, 2).Value;
|
||||
stats.CreatedESSCRMUsers += CRMController.GetCRMUsersCount(o.Id, string.Empty, string.Empty, 22).Value;
|
||||
stats.CreatedCRMUsers += CRMController.GetCRMUsersCount(o.Id, string.Empty, string.Empty, CRMUserLycenseTypes.FULL ).Value;
|
||||
stats.CreatedLimitedCRMUsers += CRMController.GetCRMUsersCount(o.Id, string.Empty, string.Empty, CRMUserLycenseTypes.LIMITED).Value;
|
||||
stats.CreatedESSCRMUsers += CRMController.GetCRMUsersCount(o.Id, string.Empty, string.Empty, CRMUserLycenseTypes.ESS).Value;
|
||||
stats.UsedCRMDiskSpace += CRMController.GetDBSize(o.Id, o.PackageId);
|
||||
stats.AllocatedCRMDiskSpace += CRMController.GetMaxDBSize(o.Id, o.PackageId);
|
||||
}
|
||||
|
||||
if (cntxTmp.Groups.ContainsKey(ResourceGroups.HostedCRM2013))
|
||||
{
|
||||
stats.CreatedProfessionalCRMUsers += CRMController.GetCRMUsersCount(o.Id, string.Empty, string.Empty, CRMUserLycenseTypes.PROFESSIONAL).Value;
|
||||
stats.CreatedBasicCRMUsers += CRMController.GetCRMUsersCount(o.Id, string.Empty, string.Empty, CRMUserLycenseTypes.BASIC).Value;
|
||||
stats.CreatedEssentialCRMUsers += CRMController.GetCRMUsersCount(o.Id, string.Empty, string.Empty, CRMUserLycenseTypes.ESSENTIAL).Value;
|
||||
stats.UsedCRMDiskSpace += CRMController.GetDBSize(o.Id, o.PackageId);
|
||||
stats.AllocatedCRMDiskSpace += CRMController.GetMaxDBSize(o.Id, o.PackageId);
|
||||
}
|
||||
|
@ -1051,6 +1068,13 @@ namespace WebsitePanel.EnterpriseServer
|
|||
stats.AllocatedESSCRMUsers = cntx.Quotas[Quotas.CRM_ESSUSERS].QuotaAllocatedValue;
|
||||
}
|
||||
|
||||
if (cntx.Groups.ContainsKey(ResourceGroups.HostedCRM2013))
|
||||
{
|
||||
stats.AllocatedProfessionalCRMUsers = cntx.Quotas[Quotas.CRM2013_PROFESSIONALUSERS].QuotaAllocatedValue;
|
||||
stats.AllocatedBasicCRMUsers = cntx.Quotas[Quotas.CRM2013_BASICUSERS].QuotaAllocatedValue;
|
||||
stats.AllocatedEssentialCRMUsers = cntx.Quotas[Quotas.CRM2013_ESSENTIALUSERS].QuotaAllocatedValue;
|
||||
}
|
||||
|
||||
if (cntx.Groups.ContainsKey(ResourceGroups.BlackBerry))
|
||||
{
|
||||
stats.AllocatedBlackBerryUsers = cntx.Quotas[Quotas.BLACKBERRY_USERS].QuotaAllocatedValue;
|
||||
|
@ -1290,7 +1314,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
DataSet ds =
|
||||
DataProvider.GetExchangeAccountsPaged(SecurityContext.User.UserId, itemId, accountTypes, filterColumn,
|
||||
filterValue, sortColumn, startRow, maximumRows);
|
||||
filterValue, sortColumn, startRow, maximumRows, false);
|
||||
|
||||
OrganizationUsersPaged result = new OrganizationUsersPaged();
|
||||
result.RecordsCount = (int)ds.Tables[0].Rows[0][0];
|
||||
|
@ -2054,7 +2078,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
{
|
||||
DataProvider.UpdateExchangeAccount(account.AccountId, account.AccountName, account.AccountType, account.DisplayName,
|
||||
account.PrimaryEmailAddress, account.MailEnabledPublicFolder,
|
||||
account.MailboxManagerActions.ToString(), account.SamAccountName, account.AccountPassword, account.MailboxPlanId,
|
||||
account.MailboxManagerActions.ToString(), account.SamAccountName, account.AccountPassword, account.MailboxPlanId, account.ArchivingMailboxPlanId,
|
||||
(string.IsNullOrEmpty(account.SubscriberNumber) ? null : account.SubscriberNumber.Trim()));
|
||||
}
|
||||
|
||||
|
@ -2611,7 +2635,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
DataSet ds =
|
||||
DataProvider.GetExchangeAccountsPaged(SecurityContext.User.UserId, itemId, accountTypes, filterColumn,
|
||||
filterValue, sortColumn, startRow, maximumRows);
|
||||
filterValue, sortColumn, startRow, maximumRows, false);
|
||||
|
||||
ExchangeAccountsPaged result = new ExchangeAccountsPaged();
|
||||
result.RecordsCount = (int)ds.Tables[0].Rows[0][0];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue