Lync Server 2010 Multitenant Core Unified Communications Support Added
Enterprise voice support to follow soon
This commit is contained in:
parent
3732b2143c
commit
a240fcebc6
94 changed files with 11276 additions and 39 deletions
|
@ -3140,5 +3140,163 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return Convert.ToBoolean(prmId.Value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Lync
|
||||
|
||||
public static void AddLyncUser(int accountId, int lyncUserPlanId)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"AddLyncUser",
|
||||
new[]
|
||||
{
|
||||
new SqlParameter("@AccountID", accountId),
|
||||
new SqlParameter("@LyncUserPlanID", lyncUserPlanId)
|
||||
});
|
||||
}
|
||||
|
||||
public static bool CheckLyncUserExists(int accountId)
|
||||
{
|
||||
int res = (int)SqlHelper.ExecuteScalar(ConnectionString, CommandType.StoredProcedure, "CheckLyncUserExists",
|
||||
new SqlParameter("@AccountID", accountId));
|
||||
return res > 0;
|
||||
}
|
||||
|
||||
public static IDataReader GetLyncUsers(int itemId, string sortColumn, string sortDirection, int startRow, int count)
|
||||
{
|
||||
SqlParameter[] sqlParams = new SqlParameter[]
|
||||
{
|
||||
new SqlParameter("@ItemID", itemId),
|
||||
new SqlParameter("@SortColumn", sortColumn),
|
||||
new SqlParameter("@SortDirection", sortDirection),
|
||||
new SqlParameter("@StartRow", startRow),
|
||||
new SqlParameter("Count", count)
|
||||
};
|
||||
|
||||
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetLyncUsers", sqlParams);
|
||||
}
|
||||
|
||||
public static int GetLyncUsersCount(int itemId)
|
||||
{
|
||||
SqlParameter[] sqlParams = new SqlParameter[]
|
||||
{
|
||||
new SqlParameter("@ItemID", itemId)
|
||||
};
|
||||
|
||||
return
|
||||
(int)
|
||||
SqlHelper.ExecuteScalar(ConnectionString, CommandType.StoredProcedure, "GetLyncUsersCount", sqlParams);
|
||||
}
|
||||
|
||||
public static void DeleteLyncUser(int accountId)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"DeleteLyncUser",
|
||||
new[]
|
||||
{
|
||||
new SqlParameter("@AccountId", accountId)
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public static int AddLyncUserPlan(int itemID, LyncUserPlan lyncUserPlan)
|
||||
{
|
||||
SqlParameter outParam = new SqlParameter("@LyncUserPlanId", SqlDbType.Int);
|
||||
outParam.Direction = ParameterDirection.Output;
|
||||
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"AddLyncUserPlan",
|
||||
outParam,
|
||||
|
||||
new SqlParameter("@ItemID", itemID),
|
||||
new SqlParameter("@LyncUserPlanName", lyncUserPlan.LyncUserPlanName),
|
||||
new SqlParameter("@IM", lyncUserPlan.IM),
|
||||
new SqlParameter("@Mobility", lyncUserPlan.Mobility),
|
||||
new SqlParameter("@MobilityEnableOutsideVoice", lyncUserPlan.MobilityEnableOutsideVoice),
|
||||
new SqlParameter("@Federation", lyncUserPlan.Federation),
|
||||
new SqlParameter("@Conferencing", lyncUserPlan.Conferencing),
|
||||
new SqlParameter("@EnterpriseVoice", lyncUserPlan.EnterpriseVoice),
|
||||
new SqlParameter("@VoicePolicy", lyncUserPlan.VoicePolicy),
|
||||
new SqlParameter("@IsDefault", lyncUserPlan.IsDefault)
|
||||
);
|
||||
|
||||
return Convert.ToInt32(outParam.Value);
|
||||
}
|
||||
|
||||
public static void DeleteLyncUserPlan(int lyncUserPlanId)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"DeleteLyncUserPlan",
|
||||
new SqlParameter("@LyncUserPlanId", lyncUserPlanId)
|
||||
);
|
||||
}
|
||||
|
||||
public static IDataReader GetLyncUserPlan(int lyncUserPlanId)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetLyncUserPlan",
|
||||
new SqlParameter("@LyncUserPlanId", lyncUserPlanId)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public static IDataReader GetLyncUserPlans(int itemId)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetLyncUserPlans",
|
||||
new SqlParameter("@ItemID", itemId)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public static void SetOrganizationDefaultLyncUserPlan(int itemId, int lyncUserPlanId)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"SetOrganizationDefaultLyncUserPlan",
|
||||
new SqlParameter("@ItemID", itemId),
|
||||
new SqlParameter("@LyncUserPlanId", lyncUserPlanId)
|
||||
);
|
||||
}
|
||||
|
||||
public static IDataReader GetLyncUserPlanByAccountId(int AccountId)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetLyncUserPlanByAccountId",
|
||||
new SqlParameter("@AccountID", AccountId)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public static void SetLyncUserLyncUserplan(int accountId, int lyncUserPlanId)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"SetLyncUserLyncUserplan",
|
||||
new SqlParameter("@AccountID", accountId),
|
||||
new SqlParameter("@LyncUserPlanId", (lyncUserPlanId == 0) ? (object)DBNull.Value : (object)lyncUserPlanId)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,821 @@
|
|||
// Copyright (c) 2012, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// - Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
//
|
||||
// - Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// - Neither the name of the Outercurve Foundation nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Data;
|
||||
using System.Xml;
|
||||
using WebsitePanel.Providers;
|
||||
using WebsitePanel.Providers.Common;
|
||||
using WebsitePanel.Providers.HostedSolution;
|
||||
using WebsitePanel.Providers.ResultObjects;
|
||||
using WebsitePanel.Providers.Lync;
|
||||
|
||||
namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
|
||||
{
|
||||
public class LyncController
|
||||
{
|
||||
|
||||
|
||||
public static LyncServer GetLyncServer(int lyncServiceId, int organizationServiceId)
|
||||
{
|
||||
LyncServer ws = new LyncServer();
|
||||
|
||||
ServiceProviderProxy.Init(ws, lyncServiceId);
|
||||
|
||||
string[] lyncSettings = ws.ServiceProviderSettingsSoapHeaderValue.Settings;
|
||||
|
||||
List<string> resSettings = new List<string>(lyncSettings);
|
||||
|
||||
ExtendLyncSettings(resSettings, "primarydomaincontroller", GetProviderProperty(organizationServiceId, "primarydomaincontroller"));
|
||||
ExtendLyncSettings(resSettings, "rootou", GetProviderProperty(organizationServiceId, "rootou"));
|
||||
ws.ServiceProviderSettingsSoapHeaderValue.Settings = resSettings.ToArray();
|
||||
return ws;
|
||||
}
|
||||
|
||||
private static string GetProviderProperty(int organizationServiceId, string property)
|
||||
{
|
||||
|
||||
Organizations orgProxy = new Organizations();
|
||||
|
||||
ServiceProviderProxy.Init(orgProxy, organizationServiceId);
|
||||
|
||||
string[] organizationSettings = orgProxy.ServiceProviderSettingsSoapHeaderValue.Settings;
|
||||
|
||||
string value = string.Empty;
|
||||
foreach (string str in organizationSettings)
|
||||
{
|
||||
string[] props = str.Split('=');
|
||||
if (props[0].ToLower() == property)
|
||||
{
|
||||
value = str;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
private static void ExtendLyncSettings(List<string> lyncSettings, string property, string value)
|
||||
{
|
||||
bool isAdded = false;
|
||||
for (int i = 0; i < lyncSettings.Count; i++)
|
||||
{
|
||||
string[] props = lyncSettings[i].Split('=');
|
||||
if (props[0].ToLower() == property)
|
||||
{
|
||||
lyncSettings[i] = value;
|
||||
isAdded = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isAdded)
|
||||
{
|
||||
lyncSettings.Add(value);
|
||||
}
|
||||
}
|
||||
|
||||
private static int GetLyncServiceID(int packageId)
|
||||
{
|
||||
return PackageController.GetPackageServiceId(packageId, ResourceGroups.Lync);
|
||||
}
|
||||
|
||||
|
||||
private static bool CheckQuota(int itemId)
|
||||
{
|
||||
Organization org = OrganizationController.GetOrganization(itemId);
|
||||
PackageContext cntx = PackageController.GetPackageContext(org.PackageId);
|
||||
|
||||
IntResult userCount = GetLyncUsersCount(itemId);
|
||||
|
||||
int allocatedUsers = cntx.Quotas[Quotas.LYNC_USERS].QuotaAllocatedValue;
|
||||
|
||||
return allocatedUsers == -1 || allocatedUsers > userCount.Value;
|
||||
}
|
||||
|
||||
|
||||
public static LyncUserResult CreateLyncUser(int itemId, int accountId, int lyncUserPlanId)
|
||||
{
|
||||
LyncUserResult res = TaskManager.StartResultTask<LyncUserResult>("LYNC", "CREATE_LYNC_USER");
|
||||
|
||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||
if (accountCheck < 0)
|
||||
{
|
||||
TaskManager.CompleteResultTask(res, LyncErrorCodes.NOT_AUTHORIZED);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
LyncUser retLyncUser = new LyncUser();
|
||||
bool isLyncUser;
|
||||
|
||||
isLyncUser = DataProvider.CheckLyncUserExists(accountId);
|
||||
if (isLyncUser)
|
||||
{
|
||||
TaskManager.CompleteResultTask(res, LyncErrorCodes.USER_IS_ALREADY_LYNC_USER);
|
||||
return res;
|
||||
}
|
||||
|
||||
OrganizationUser user;
|
||||
user = OrganizationController.GetAccount(itemId, accountId);
|
||||
if (user == null)
|
||||
{
|
||||
TaskManager.CompleteResultTask(res, ErrorCodes.CANNOT_GET_ACCOUNT);
|
||||
return res;
|
||||
}
|
||||
|
||||
user = OrganizationController.GetUserGeneralSettings(itemId, accountId);
|
||||
if (string.IsNullOrEmpty(user.FirstName))
|
||||
{
|
||||
TaskManager.CompleteResultTask(res, LyncErrorCodes.USER_FIRST_NAME_IS_NOT_SPECIFIED);
|
||||
return res;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(user.LastName))
|
||||
{
|
||||
TaskManager.CompleteResultTask(res, LyncErrorCodes.USER_LAST_NAME_IS_NOT_SPECIFIED);
|
||||
return res;
|
||||
}
|
||||
|
||||
bool quota = CheckQuota(itemId);
|
||||
if (!quota)
|
||||
{
|
||||
TaskManager.CompleteResultTask(res, LyncErrorCodes.USER_QUOTA_HAS_BEEN_REACHED);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
LyncServer lync;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
bool bReloadConfiguration = false;
|
||||
|
||||
Organization org = (Organization)PackageController.GetPackageItem(itemId);
|
||||
if (org == null)
|
||||
{
|
||||
throw new ApplicationException(
|
||||
string.Format("Organization is null. ItemId={0}", itemId));
|
||||
}
|
||||
|
||||
int lyncServiceId = GetLyncServiceID(org.PackageId);
|
||||
lync = GetLyncServer(lyncServiceId, org.ServiceId);
|
||||
|
||||
if (string.IsNullOrEmpty(org.LyncTenantId))
|
||||
{
|
||||
PackageContext cntx = PackageController.GetPackageContext(org.PackageId);
|
||||
|
||||
org.LyncTenantId = lync.CreateOrganization(org.OrganizationId,
|
||||
org.DefaultDomain,
|
||||
Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_CONFERENCING].QuotaAllocatedValue),
|
||||
Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_ALLOWVIDEO].QuotaAllocatedValue),
|
||||
Convert.ToInt32(cntx.Quotas[Quotas.LYNC_MAXPARTICIPANTS].QuotaAllocatedValue),
|
||||
Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_CONFERENCING].QuotaAllocatedValue),
|
||||
Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_CONFERENCING].QuotaAllocatedValue));
|
||||
|
||||
if (string.IsNullOrEmpty(org.LyncTenantId))
|
||||
{
|
||||
TaskManager.CompleteResultTask(res, LyncErrorCodes.CANNOT_ENABLE_ORG);
|
||||
return res;
|
||||
}
|
||||
else
|
||||
{
|
||||
PackageController.UpdatePackageItem(org);
|
||||
|
||||
bReloadConfiguration = true;
|
||||
}
|
||||
}
|
||||
|
||||
LyncUserPlan plan = GetLyncUserPlan(itemId, lyncUserPlanId);
|
||||
|
||||
if (!lync.CreateUser(org.OrganizationId, user.PrimaryEmailAddress, plan))
|
||||
{
|
||||
TaskManager.CompleteResultTask(res, LyncErrorCodes.CANNOT_ADD_LYNC_USER);
|
||||
return res;
|
||||
}
|
||||
|
||||
if (bReloadConfiguration)
|
||||
{
|
||||
LyncControllerAsync userWorker = new LyncControllerAsync();
|
||||
userWorker.LyncServiceId = lyncServiceId;
|
||||
userWorker.OrganizationServiceId = org.ServiceId;
|
||||
userWorker.Enable_CsComputerAsync();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TaskManager.CompleteResultTask(res, LyncErrorCodes.CANNOT_ADD_LYNC_USER, ex);
|
||||
return res;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
DataProvider.AddLyncUser(accountId, lyncUserPlanId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TaskManager.CompleteResultTask(res, LyncErrorCodes.CANNOT_ADD_LYNC_USER_TO_DATABASE, ex);
|
||||
return res;
|
||||
}
|
||||
|
||||
res.IsSuccess = true;
|
||||
TaskManager.CompleteResultTask();
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static int[] ParseMultiSetting(int lyncServiceId, string settingName)
|
||||
{
|
||||
List<int> retIds = new List<int>();
|
||||
StringDictionary settings = ServerController.GetServiceSettings(lyncServiceId);
|
||||
if (!String.IsNullOrEmpty(settings[settingName]))
|
||||
{
|
||||
string[] ids = settings[settingName].Split(',');
|
||||
|
||||
int res;
|
||||
foreach (string id in ids)
|
||||
{
|
||||
if (int.TryParse(id, out res))
|
||||
retIds.Add(res);
|
||||
}
|
||||
}
|
||||
|
||||
if (retIds.Count == 0)
|
||||
retIds.Add(lyncServiceId);
|
||||
|
||||
return retIds.ToArray();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void GetLyncServices(int lyncServiceId, out int[] lyncServiceIds)
|
||||
{
|
||||
lyncServiceIds = ParseMultiSetting(lyncServiceId, "LyncServersServiceID");
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static LyncUser GetLyncUserGeneralSettings(int itemId, int accountId)
|
||||
{
|
||||
TaskManager.StartTask("LYNC", "GET_LYNC_USER_GENERAL_SETTINGS");
|
||||
|
||||
LyncUser user = null;
|
||||
|
||||
try
|
||||
{
|
||||
Organization org = (Organization)PackageController.GetPackageItem(itemId);
|
||||
if (org == null)
|
||||
{
|
||||
throw new ApplicationException(
|
||||
string.Format("Organization is null. ItemId={0}", itemId));
|
||||
}
|
||||
|
||||
int lyncServiceId = GetLyncServiceID(org.PackageId);
|
||||
LyncServer lync = GetLyncServer(lyncServiceId, org.ServiceId);
|
||||
|
||||
OrganizationUser usr;
|
||||
usr = OrganizationController.GetAccount(itemId, accountId);
|
||||
|
||||
if (usr != null)
|
||||
user = lync.GetLyncUserGeneralSettings(org.OrganizationId, usr.PrimaryEmailAddress);
|
||||
|
||||
if (user != null)
|
||||
{
|
||||
LyncUserPlan plan = ObjectUtils.FillObjectFromDataReader<LyncUserPlan>(DataProvider.GetLyncUserPlanByAccountId(accountId));
|
||||
|
||||
if (plan != null)
|
||||
{
|
||||
user.LyncUserPlanId = plan.LyncUserPlanId;
|
||||
user.LyncUserPlanName = plan.LyncUserPlanName;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw TaskManager.WriteError(ex);
|
||||
|
||||
}
|
||||
TaskManager.CompleteTask();
|
||||
return user;
|
||||
|
||||
}
|
||||
|
||||
public static int DeleteOrganization(int itemId)
|
||||
{
|
||||
// check account
|
||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||
if (accountCheck < 0) return accountCheck;
|
||||
|
||||
// place log record
|
||||
TaskManager.StartTask("LYNC", "DELETE_ORG");
|
||||
TaskManager.ItemId = itemId;
|
||||
|
||||
try
|
||||
{
|
||||
// delete organization in Exchange
|
||||
//System.Threading.Thread.Sleep(5000);
|
||||
Organization org = (Organization)PackageController.GetPackageItem(itemId);
|
||||
|
||||
int lyncServiceId = GetLyncServiceID(org.PackageId);
|
||||
LyncServer lync = GetLyncServer(lyncServiceId, org.ServiceId);
|
||||
|
||||
bool successful = lync.DeleteOrganization(org.OrganizationId, org.DefaultDomain);
|
||||
|
||||
return successful ? 0 : BusinessErrorCodes.ERROR_LYNC_DELETE_SOME_PROBLEMS;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw TaskManager.WriteError(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
TaskManager.CompleteTask();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static LyncUserResult SetUserLyncPlan(int itemId, int accountId, int lyncUserPlanId)
|
||||
{
|
||||
LyncUserResult res = TaskManager.StartResultTask<LyncUserResult>("LYNC", "SET_LYNC_USER_LYNCPLAN");
|
||||
|
||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||
if (accountCheck < 0)
|
||||
{
|
||||
TaskManager.CompleteResultTask(res, LyncErrorCodes.NOT_AUTHORIZED);
|
||||
return res;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Organization org = (Organization)PackageController.GetPackageItem(itemId);
|
||||
if (org == null)
|
||||
{
|
||||
throw new ApplicationException(
|
||||
string.Format("Organization is null. ItemId={0}", itemId));
|
||||
}
|
||||
|
||||
int lyncServiceId = GetLyncServiceID(org.PackageId);
|
||||
LyncServer lync = GetLyncServer(lyncServiceId, org.ServiceId);
|
||||
|
||||
LyncUserPlan plan = GetLyncUserPlan(itemId, lyncUserPlanId);
|
||||
|
||||
OrganizationUser user;
|
||||
user = OrganizationController.GetAccount(itemId, accountId);
|
||||
|
||||
if (!lync.SetLyncUserPlan(org.OrganizationId, user.PrimaryEmailAddress, plan))
|
||||
{
|
||||
TaskManager.CompleteResultTask(res, LyncErrorCodes.CANNOT_ADD_LYNC_USER);
|
||||
return res;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
DataProvider.SetLyncUserLyncUserplan(accountId, lyncUserPlanId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TaskManager.CompleteResultTask(res, LyncErrorCodes.CANNOT_ADD_LYNC_USER_TO_DATABASE, ex);
|
||||
return res;
|
||||
}
|
||||
|
||||
res.IsSuccess = true;
|
||||
TaskManager.CompleteResultTask();
|
||||
return res;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TaskManager.CompleteResultTask(res, LyncErrorCodes.CANNOT_UPDATE_LYNC_USER, ex);
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static LyncUsersPagedResult GetLyncUsers(int itemId, string sortColumn, string sortDirection, int startRow, int count)
|
||||
{
|
||||
LyncUsersPagedResult res = TaskManager.StartResultTask<LyncUsersPagedResult>("LYNC", "GET_LYNC_USERS");
|
||||
|
||||
try
|
||||
{
|
||||
IDataReader reader =
|
||||
DataProvider.GetLyncUsers(itemId, sortColumn, sortDirection, startRow, count);
|
||||
List<LyncUser> accounts = new List<LyncUser>();
|
||||
ObjectUtils.FillCollectionFromDataReader(accounts, reader);
|
||||
res.Value = new LyncUsersPaged { PageUsers = accounts.ToArray() };
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TaskManager.CompleteResultTask(res, LyncErrorCodes.GET_LYNC_USERS, ex);
|
||||
return res;
|
||||
}
|
||||
|
||||
IntResult intRes = GetLyncUsersCount(itemId);
|
||||
res.ErrorCodes.AddRange(intRes.ErrorCodes);
|
||||
if (!intRes.IsSuccess)
|
||||
{
|
||||
TaskManager.CompleteResultTask(res);
|
||||
return res;
|
||||
}
|
||||
res.Value.RecordsCount = intRes.Value;
|
||||
|
||||
TaskManager.CompleteResultTask();
|
||||
return res;
|
||||
}
|
||||
|
||||
public static IntResult GetLyncUsersCount(int itemId)
|
||||
{
|
||||
IntResult res = TaskManager.StartResultTask<IntResult>("LYNC", "GET_LYNC_USERS_COUNT");
|
||||
try
|
||||
{
|
||||
res.Value = DataProvider.GetLyncUsersCount(itemId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TaskManager.CompleteResultTask(res, LyncErrorCodes.GET_LYNC_USER_COUNT, ex);
|
||||
return res;
|
||||
}
|
||||
|
||||
TaskManager.CompleteResultTask();
|
||||
return res;
|
||||
}
|
||||
|
||||
public static LyncUserResult DeleteLyncUser(int itemId, int accountId)
|
||||
{
|
||||
LyncUserResult res = TaskManager.StartResultTask<LyncUserResult>("LYNC", "DELETE_LYNC_USER");
|
||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||
|
||||
if (accountCheck < 0)
|
||||
{
|
||||
TaskManager.CompleteResultTask(res, LyncErrorCodes.NOT_AUTHORIZED);
|
||||
return res;
|
||||
}
|
||||
|
||||
LyncServer lync;
|
||||
|
||||
try
|
||||
{
|
||||
Organization org = (Organization)PackageController.GetPackageItem(itemId);
|
||||
if (org == null)
|
||||
{
|
||||
throw new ApplicationException(
|
||||
string.Format("Organization is null. ItemId={0}", itemId));
|
||||
}
|
||||
|
||||
int lyncServiceId = GetLyncServiceID(org.PackageId);
|
||||
lync = GetLyncServer(lyncServiceId, org.ServiceId);
|
||||
|
||||
OrganizationUser user;
|
||||
user = OrganizationController.GetAccount(itemId, accountId);
|
||||
|
||||
if (user != null)
|
||||
lync.DeleteUser(user.PrimaryEmailAddress);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TaskManager.CompleteResultTask(res, LyncErrorCodes.CANNOT_DELETE_LYNC_USER, ex);
|
||||
return res;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
DataProvider.DeleteLyncUser(accountId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TaskManager.CompleteResultTask(res, LyncErrorCodes.CANNOT_DELETE_LYNC_USER_FROM_METADATA, ex);
|
||||
return res;
|
||||
}
|
||||
|
||||
TaskManager.CompleteResultTask();
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
public static Organization GetOrganization(int itemId)
|
||||
{
|
||||
return (Organization)PackageController.GetPackageItem(itemId);
|
||||
}
|
||||
|
||||
|
||||
#region Lync Plans
|
||||
public static List<LyncUserPlan> GetLyncUserPlans(int itemId)
|
||||
{
|
||||
// place log record
|
||||
TaskManager.StartTask("LYNC", "GET_LYNC_LYNCUSERPLANS");
|
||||
TaskManager.ItemId = itemId;
|
||||
|
||||
try
|
||||
{
|
||||
return ObjectUtils.CreateListFromDataReader<LyncUserPlan>(
|
||||
DataProvider.GetLyncUserPlans(itemId));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw TaskManager.WriteError(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
TaskManager.CompleteTask();
|
||||
}
|
||||
}
|
||||
|
||||
public static LyncUserPlan GetLyncUserPlan(int itemID, int lyncUserPlanId)
|
||||
{
|
||||
|
||||
// place log record
|
||||
TaskManager.StartTask("LYNC", "GET_LYNC_LYNCUSERPLAN");
|
||||
TaskManager.ItemId = lyncUserPlanId;
|
||||
|
||||
try
|
||||
{
|
||||
return ObjectUtils.FillObjectFromDataReader<LyncUserPlan>(
|
||||
DataProvider.GetLyncUserPlan(lyncUserPlanId));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw TaskManager.WriteError(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
TaskManager.CompleteTask();
|
||||
}
|
||||
}
|
||||
|
||||
public static int AddLyncUserPlan(int itemID, LyncUserPlan lyncUserPlan)
|
||||
{
|
||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||
if (accountCheck < 0) return accountCheck;
|
||||
|
||||
// place log record
|
||||
TaskManager.StartTask("LYNC", "ADD_LYNC_LYNCUSERPLAN");
|
||||
TaskManager.ItemId = itemID;
|
||||
|
||||
try
|
||||
{
|
||||
Organization org = GetOrganization(itemID);
|
||||
if (org == null)
|
||||
return -1;
|
||||
|
||||
// load package context
|
||||
PackageContext cntx = PackageController.GetPackageContext(org.PackageId);
|
||||
|
||||
lyncUserPlan.Conferencing = lyncUserPlan.Conferencing & Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_CONFERENCING].QuotaAllocatedValue);
|
||||
lyncUserPlan.EnterpriseVoice = lyncUserPlan.EnterpriseVoice & Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_ENTERPRISEVOICE].QuotaAllocatedValue);
|
||||
if (!lyncUserPlan.EnterpriseVoice)
|
||||
lyncUserPlan.VoicePolicy = LyncVoicePolicyType.None;
|
||||
lyncUserPlan.IM = true;
|
||||
|
||||
return DataProvider.AddLyncUserPlan(itemID, lyncUserPlan);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw TaskManager.WriteError(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
TaskManager.CompleteTask();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static int DeleteLyncUserPlan(int itemID, int lyncUserPlanId)
|
||||
{
|
||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||
if (accountCheck < 0) return accountCheck;
|
||||
|
||||
TaskManager.StartTask("LYNC", "DELETE_LYNC_LYNCPLAN");
|
||||
TaskManager.ItemId = itemID;
|
||||
|
||||
try
|
||||
{
|
||||
DataProvider.DeleteLyncUserPlan(lyncUserPlanId);
|
||||
|
||||
return 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw TaskManager.WriteError(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
TaskManager.CompleteTask();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static int SetOrganizationDefaultLyncUserPlan(int itemId, int lyncUserPlanId)
|
||||
{
|
||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||
if (accountCheck < 0) return accountCheck;
|
||||
|
||||
TaskManager.StartTask("LYNC", "SET_LYNC_LYNCUSERPLAN");
|
||||
TaskManager.ItemId = itemId;
|
||||
|
||||
try
|
||||
{
|
||||
DataProvider.SetOrganizationDefaultLyncUserPlan(itemId, lyncUserPlanId);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw TaskManager.WriteError(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
TaskManager.CompleteTask();
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Federation Domains
|
||||
public static LyncFederationDomain[] GetFederationDomains(int itemId)
|
||||
{
|
||||
// place log record
|
||||
TaskManager.StartTask("LYNC", "GET_LYNC_FEDERATIONDOMAINS");
|
||||
TaskManager.ItemId = itemId;
|
||||
|
||||
LyncFederationDomain[] lyncFederationDomains = null;
|
||||
|
||||
try
|
||||
{
|
||||
Organization org = (Organization)PackageController.GetPackageItem(itemId);
|
||||
|
||||
int lyncServiceId = GetLyncServiceID(org.PackageId);
|
||||
LyncServer lync = GetLyncServer(lyncServiceId, org.ServiceId);
|
||||
|
||||
lyncFederationDomains = lync.GetFederationDomains(org.OrganizationId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw TaskManager.WriteError(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
TaskManager.CompleteTask();
|
||||
}
|
||||
|
||||
return lyncFederationDomains;
|
||||
}
|
||||
|
||||
public static LyncUserResult AddFederationDomain(int itemId, string domainName, string proxyFqdn)
|
||||
{
|
||||
LyncUserResult res = TaskManager.StartResultTask<LyncUserResult>("LYNC", "ADD_LYNC_FEDERATIONDOMAIN");
|
||||
TaskManager.ItemId = itemId;
|
||||
TaskManager.TaskParameters["domainName"] = domainName;
|
||||
TaskManager.TaskParameters["proxyFqdn"] = proxyFqdn;
|
||||
|
||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||
|
||||
if (accountCheck < 0)
|
||||
{
|
||||
TaskManager.CompleteResultTask(res, LyncErrorCodes.NOT_AUTHORIZED);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
Organization org = (Organization)PackageController.GetPackageItem(itemId);
|
||||
if (org == null)
|
||||
{
|
||||
throw new ApplicationException(
|
||||
string.Format("Organization is null. ItemId={0}", itemId));
|
||||
}
|
||||
|
||||
int lyncServiceId = GetLyncServiceID(org.PackageId);
|
||||
LyncServer lync = GetLyncServer(lyncServiceId, org.ServiceId);
|
||||
|
||||
if (string.IsNullOrEmpty(org.LyncTenantId))
|
||||
{
|
||||
PackageContext cntx = PackageController.GetPackageContext(org.PackageId);
|
||||
|
||||
org.LyncTenantId = lync.CreateOrganization(org.OrganizationId,
|
||||
org.DefaultDomain,
|
||||
Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_CONFERENCING].QuotaAllocatedValue),
|
||||
Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_ALLOWVIDEO].QuotaAllocatedValue),
|
||||
Convert.ToInt32(cntx.Quotas[Quotas.LYNC_MAXPARTICIPANTS].QuotaAllocatedValue),
|
||||
Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_CONFERENCING].QuotaAllocatedValue),
|
||||
Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_CONFERENCING].QuotaAllocatedValue));
|
||||
|
||||
if (string.IsNullOrEmpty(org.LyncTenantId))
|
||||
{
|
||||
TaskManager.CompleteResultTask(res, LyncErrorCodes.CANNOT_ENABLE_ORG);
|
||||
return res;
|
||||
}
|
||||
else
|
||||
PackageController.UpdatePackageItem(org);
|
||||
}
|
||||
|
||||
lync = GetLyncServer(lyncServiceId, org.ServiceId);
|
||||
|
||||
lync.AddFederationDomain(org.OrganizationId, domainName, proxyFqdn);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TaskManager.CompleteResultTask(res, LyncErrorCodes.CANNOT_ADD_LYNC_FEDERATIONDOMAIN, ex);
|
||||
return res;
|
||||
}
|
||||
|
||||
TaskManager.CompleteResultTask();
|
||||
return res;
|
||||
}
|
||||
|
||||
public static LyncUserResult RemoveFederationDomain(int itemId, string domainName)
|
||||
{
|
||||
LyncUserResult res = TaskManager.StartResultTask<LyncUserResult>("LYNC", "REMOVE_LYNC_FEDERATIONDOMAIN");
|
||||
TaskManager.ItemId = itemId;
|
||||
TaskManager.TaskParameters["domainName"] = domainName;
|
||||
|
||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||
|
||||
if (accountCheck < 0)
|
||||
{
|
||||
TaskManager.CompleteResultTask(res, LyncErrorCodes.NOT_AUTHORIZED);
|
||||
return res;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Organization org = (Organization)PackageController.GetPackageItem(itemId);
|
||||
if (org == null)
|
||||
{
|
||||
throw new ApplicationException(
|
||||
string.Format("Organization is null. ItemId={0}", itemId));
|
||||
}
|
||||
|
||||
int lyncServiceId = GetLyncServiceID(org.PackageId);
|
||||
LyncServer lync = GetLyncServer(lyncServiceId, org.ServiceId);
|
||||
|
||||
if (org.OrganizationId.ToLower() == domainName.ToLower())
|
||||
{
|
||||
TaskManager.CompleteResultTask(res, LyncErrorCodes.CANNOT_REMOVE_LYNC_FEDERATIONDOMAIN);
|
||||
return res;
|
||||
}
|
||||
|
||||
lync.RemoveFederationDomain(org.OrganizationId, domainName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TaskManager.CompleteResultTask(res, LyncErrorCodes.CANNOT_REMOVE_LYNC_FEDERATIONDOMAIN, ex);
|
||||
return res;
|
||||
}
|
||||
|
||||
TaskManager.CompleteResultTask();
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Private methods
|
||||
public static UInt64 ConvertPhoneNumberToLong(string ip)
|
||||
{
|
||||
return Convert.ToUInt64(ip);
|
||||
}
|
||||
|
||||
public static string ConvertLongToPhoneNumber(UInt64 ip)
|
||||
{
|
||||
if (ip == 0)
|
||||
return "";
|
||||
|
||||
return ip.ToString();
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
// Copyright (c) 2012, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// - Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
//
|
||||
// - Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// - Neither the name of the Outercurve Foundation nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using WebsitePanel.Providers;
|
||||
using WebsitePanel.Providers.Common;
|
||||
using WebsitePanel.Providers.HostedSolution;
|
||||
using WebsitePanel.Providers.ResultObjects;
|
||||
using WebsitePanel.Providers.Lync;
|
||||
using WebsitePanel.EnterpriseServer.Code.HostedSolution;
|
||||
|
||||
|
||||
namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
|
||||
{
|
||||
public class LyncControllerAsync
|
||||
{
|
||||
private int lyncServiceId;
|
||||
private int organizationServiceId;
|
||||
|
||||
public int LyncServiceId
|
||||
{
|
||||
get { return this.lyncServiceId; }
|
||||
set { this.lyncServiceId = value; }
|
||||
}
|
||||
|
||||
public int OrganizationServiceId
|
||||
{
|
||||
get { return this.organizationServiceId; }
|
||||
set { this.organizationServiceId = value; }
|
||||
}
|
||||
|
||||
|
||||
public void Enable_CsComputerAsync()
|
||||
{
|
||||
// start asynchronously
|
||||
Thread t = new Thread(new ThreadStart(Enable_CsComputer));
|
||||
t.Start();
|
||||
}
|
||||
|
||||
private void Enable_CsComputer()
|
||||
{
|
||||
int[] lyncServiceIds;
|
||||
|
||||
LyncController.GetLyncServices(lyncServiceId, out lyncServiceIds);
|
||||
|
||||
foreach (int id in lyncServiceIds)
|
||||
{
|
||||
LyncServer lync = null;
|
||||
try
|
||||
{
|
||||
lync = LyncController.GetLyncServer(id, organizationServiceId);
|
||||
if (lync != null)
|
||||
{
|
||||
lync.ReloadConfiguration();
|
||||
}
|
||||
}
|
||||
catch (Exception exe)
|
||||
{
|
||||
TaskManager.WriteError(exe);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -482,6 +482,66 @@ namespace WebsitePanel.EnterpriseServer
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private static bool DeleteLyncUsers(int itemId)
|
||||
{
|
||||
bool successful = false;
|
||||
|
||||
try
|
||||
{
|
||||
LyncUsersPagedResult res = LyncController.GetLyncUsers(itemId, string.Empty, string.Empty, 0, int.MaxValue);
|
||||
|
||||
if (res.IsSuccess)
|
||||
{
|
||||
successful = true;
|
||||
foreach (LyncUser user in res.Value.PageUsers)
|
||||
{
|
||||
try
|
||||
{
|
||||
ResultObject delUserResult = LyncController.DeleteLyncUser(itemId, user.AccountID);
|
||||
if (!delUserResult.IsSuccess)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (string str in delUserResult.ErrorCodes)
|
||||
{
|
||||
sb.Append(str);
|
||||
sb.Append('\n');
|
||||
}
|
||||
|
||||
throw new ApplicationException(sb.ToString());
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
successful = false;
|
||||
TaskManager.WriteError(ex);
|
||||
}
|
||||
}
|
||||
|
||||
return successful;
|
||||
}
|
||||
else
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (string str in res.ErrorCodes)
|
||||
{
|
||||
sb.Append(str);
|
||||
sb.Append('\n');
|
||||
}
|
||||
|
||||
throw new ApplicationException(sb.ToString());
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
successful = false;
|
||||
TaskManager.WriteError(ex);
|
||||
}
|
||||
|
||||
return successful;
|
||||
}
|
||||
|
||||
|
||||
public static int DeleteOrganization(int itemId)
|
||||
{
|
||||
// check account
|
||||
|
@ -570,7 +630,22 @@ namespace WebsitePanel.EnterpriseServer
|
|||
successful = false;
|
||||
TaskManager.WriteError(ex);
|
||||
}
|
||||
|
||||
|
||||
//Cleanup Lync
|
||||
try
|
||||
{
|
||||
if (!string.IsNullOrEmpty(org.LyncTenantId))
|
||||
if (DeleteLyncUsers(itemId))
|
||||
LyncController.DeleteOrganization(itemId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
successful = false;
|
||||
TaskManager.WriteError(ex);
|
||||
}
|
||||
|
||||
|
||||
//Cleanup Exchange
|
||||
try
|
||||
{
|
||||
if (!string.IsNullOrEmpty(org.GlobalAddressList))
|
||||
|
@ -791,6 +866,11 @@ namespace WebsitePanel.EnterpriseServer
|
|||
stats.AllocatedOCSUsers = cntx.Quotas[Quotas.OCS_USERS].QuotaAllocatedValue;
|
||||
}
|
||||
|
||||
if (cntx.Groups.ContainsKey(ResourceGroups.Lync))
|
||||
{
|
||||
stats.CreatedLyncUsers = LyncController.GetLyncUsersCount(org.Id).Value;
|
||||
stats.AllocatedLyncUsers = cntx.Quotas[Quotas.LYNC_USERS].QuotaAllocatedValue;
|
||||
}
|
||||
|
||||
return stats;
|
||||
}
|
||||
|
@ -1371,7 +1451,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
retUser.AccountType = account.AccountType;
|
||||
retUser.CrmUserId = CRMController.GetCrmUserId(accountId);
|
||||
retUser.IsOCSUser = DataProvider.CheckOCSUserExists(accountId);
|
||||
//retUser.IsLyncUser = DataProvider.CheckLyncUserExists(accountId);
|
||||
retUser.IsLyncUser = DataProvider.CheckLyncUserExists(accountId);
|
||||
retUser.IsBlackBerryUser = BlackBerryController.CheckBlackBerryUserExists(accountId);
|
||||
retUser.SubscriberNumber = account.SubscriberNumber;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue