This commit is contained in:
vfedosevich 2015-01-16 05:21:33 -08:00
commit 15ff62dbab
2951 changed files with 72429 additions and 7413 deletions

View file

@ -1,4 +1,4 @@
// Copyright (c) 2014, Outercurve Foundation.
// Copyright (c) 2015, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,

View file

@ -1,4 +1,4 @@
// Copyright (c) 2014, Outercurve Foundation.
// Copyright (c) 2015, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,

View file

@ -1,4 +1,4 @@
// Copyright (c) 2014, Outercurve Foundation.
// Copyright (c) 2015, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,

View file

@ -1,4 +1,4 @@
// Copyright (c) 2014, Outercurve Foundation.
// Copyright (c) 2015, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
@ -94,4 +94,4 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
}
}
}

View file

@ -1,4 +1,4 @@
// Copyright (c) 2014, Outercurve Foundation.
// Copyright (c) 2015, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,

View file

@ -1,4 +1,4 @@
// Copyright (c) 2014, Outercurve Foundation.
// Copyright (c) 2015, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
@ -524,6 +524,15 @@ namespace WebsitePanel.EnterpriseServer
}
}
public static bool CheckDomainUsedByHostedOrganization(int itemId, int domainId)
{
DomainInfo domain = ServerController.GetDomain(domainId);
if (domain == null)
return false;
return (DataProvider.CheckDomainUsedByHostedOrganization(domain.DomainName) == 1);
}
private static void DeleteOCSUsers(int itemId, ref bool successful)
{
try
@ -1001,6 +1010,13 @@ namespace WebsitePanel.EnterpriseServer
stats.UsedEnterpriseStorageSpace = folders.Where(x => x.FRSMQuotaMB != -1).Sum(x => x.FRSMQuotaMB);
}
if (cntxTmp.Groups.ContainsKey(ResourceGroups.RDS))
{
stats.CreatedRdsUsers = RemoteDesktopServicesController.GetOrganizationRdsUsersCount(org.Id);
stats.CreatedRdsCollections = RemoteDesktopServicesController.GetOrganizationRdsCollectionsCount(org.Id);
stats.CreatedRdsServers = RemoteDesktopServicesController.GetOrganizationRdsServersCount(org.Id);
}
}
else
{
@ -1075,6 +1091,13 @@ namespace WebsitePanel.EnterpriseServer
stats.UsedEnterpriseStorageSpace += folders.Where(x => x.FRSMQuotaMB != -1).Sum(x => x.FRSMQuotaMB);
}
if (cntxTmp.Groups.ContainsKey(ResourceGroups.RDS))
{
stats.CreatedRdsUsers += RemoteDesktopServicesController.GetOrganizationRdsUsersCount(o.Id);
stats.CreatedRdsCollections += RemoteDesktopServicesController.GetOrganizationRdsCollectionsCount(o.Id);
stats.CreatedRdsServers += RemoteDesktopServicesController.GetOrganizationRdsServersCount(o.Id);
}
}
}
}
@ -1129,6 +1152,13 @@ namespace WebsitePanel.EnterpriseServer
stats.AllocatedEnterpriseStorageSpace = cntx.Quotas[Quotas.ENTERPRISESTORAGE_DISKSTORAGESPACE].QuotaAllocatedValue;
}
if (cntx.Groups.ContainsKey(ResourceGroups.RDS))
{
stats.AllocatedRdsServers = cntx.Quotas[Quotas.RDS_SERVERS].QuotaAllocatedValue;
stats.AllocatedRdsCollections = cntx.Quotas[Quotas.RDS_COLLECTIONS].QuotaAllocatedValue;
stats.AllocatedRdsUsers = cntx.Quotas[Quotas.RDS_USERS].QuotaAllocatedValue;
}
return stats;
}
catch (Exception ex)
@ -3460,5 +3490,10 @@ namespace WebsitePanel.EnterpriseServer
}
#endregion
public static DataSet GetOrganizationObjectsByDomain(int itemId, string domainName)
{
return DataProvider.GetOrganizationObjectsByDomain(itemId, domainName);
}
}
}

View file

@ -1,4 +1,4 @@
// Copyright (c) 2014, Outercurve Foundation.
// Copyright (c) 2015, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
@ -278,11 +278,16 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
}
private static void PopulateOrganizationData(Organization org, EnterpriseSolutionStatisticsReport report, string topReseller)
{
{
TaskManager.Write("Stat populate organization data "+org.Name);
if (report.ExchangeReport != null)
{
try
{
TaskManager.Write("Populate exchange report items");
PopulateExchangeReportItems(org, report, topReseller);
}
catch(Exception ex)
@ -295,6 +300,8 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
{
try
{
TaskManager.Write("Populate populate CRM report items");
PopulateCRMReportItems(org, report, topReseller);
}
catch(Exception ex)
@ -307,6 +314,8 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
{
try
{
TaskManager.Write("Populate SharePoint item ");
PopulateSharePointItem(org, report, topReseller);
}
catch(Exception ex)
@ -319,6 +328,8 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
{
try
{
TaskManager.Write("Populate Lync report items");
PopulateLyncReportItems(org, report, topReseller);
}
catch (Exception ex)
@ -331,6 +342,8 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
{
try
{
TaskManager.Write("Populate Organization statistics report");
PopulateOrganizationStatisticsReport(org, report, topReseller);
}
catch(Exception ex)
@ -339,7 +352,7 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
}
}
TaskManager.Write("End populate organization data " + org.Name);
}
private static int GetExchangeServiceID(int packageId)
@ -408,6 +421,8 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
private static void PopulateExchangeReportItems(Organization org, EnterpriseSolutionStatisticsReport report, string topReseller)
{
TaskManager.Write("Exchange Report Items " + org.Name);
//Check if exchange organization
if (string.IsNullOrEmpty(org.GlobalAddressList))
return;
@ -420,10 +435,14 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
}
catch (Exception ex)
{
TaskManager.WriteError(ex);
throw new ApplicationException(
string.Format("Could not get mailboxes for current organization {0}", org.Id), ex);
}
TaskManager.WriteParameter("mailboxes.Count", mailboxes.Count);
try
{
int exchangeServiceId = GetExchangeServiceID(org.PackageId);
@ -431,6 +450,8 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
}
catch(Exception ex)
{
TaskManager.WriteError(ex);
throw new ApplicationException(
string.Format("Could not get exchange server. PackageId: {0}", org.PackageId), ex);
}
@ -440,6 +461,8 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
{
try
{
TaskManager.WriteParameter("mailbox", mailbox.UserPrincipalName);
stats = null;
try
{
@ -448,6 +471,8 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
}
catch (Exception ex)
{
TaskManager.WriteError(ex);
TaskManager.WriteError(ex, "Could not get mailbox statistics. AccountName: {0}",
mailbox.UserPrincipalName);
}
@ -466,6 +491,8 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
stats.BlackberryEnabled = BlackBerryController.CheckBlackBerryUserExists(mailbox.AccountId);
report.ExchangeReport.Items.Add(stats);
TaskManager.Write("Items.Add");
}
}
catch(Exception ex)
@ -473,7 +500,8 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
TaskManager.WriteError(ex);
}
}
TaskManager.Write("End Populate Exchange Report Items " + org.Name);
}
@ -547,6 +575,8 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
private static void PopulateSpaceData(int packageId, EnterpriseSolutionStatisticsReport report, string topReseller)
{
TaskManager.Write("Populate SpaceData " + packageId);
List<Organization> organizations;
try
@ -570,10 +600,14 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
TaskManager.WriteError(ex);
}
}
TaskManager.Write("End Populate SpaceData " + packageId);
}
private static void PopulateUserData(UserInfo user, EnterpriseSolutionStatisticsReport report, string topReseller)
{
TaskManager.Write("Populate UserData " + user.Username);
DataSet ds;
try
{
@ -596,11 +630,14 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
TaskManager.WriteError(ex);
}
}
TaskManager.Write("End Populate UserData " + user.Username);
}
private static void GetUsersData(EnterpriseSolutionStatisticsReport report, int userId, bool generateExchangeReport, bool generateSharePointReport, bool generateCRMReport, bool generateOrganizationReport, bool generateLyncReport, string topReseller)
{
TaskManager.Write("Get UsersData " + userId);
List<UserInfo> users;
try
{
@ -611,9 +648,12 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
throw new ApplicationException("Cannot get users for report", ex);
}
TaskManager.WriteParameter("users.Count", users.Count);
foreach (UserInfo user in users)
{
TaskManager.WriteParameter("User", user.Username);
try
{
PopulateUserData(user, report, topReseller);
@ -631,11 +671,16 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
{
TaskManager.WriteError(ex);
}
}
}
TaskManager.Write("End get UsersData " + userId);
}
public static EnterpriseSolutionStatisticsReport GetEnterpriseSolutionStatisticsReport(int userId, bool generateExchangeReport, bool generateSharePointReport, bool generateCRMReport, bool generateOrganizationReport, bool generateLyncReport)
{
TaskManager.Write("Get enterprise solution statistics report " + userId);
EnterpriseSolutionStatisticsReport report = new EnterpriseSolutionStatisticsReport();
if (generateExchangeReport || generateOrganizationReport)
@ -647,7 +692,6 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
if (generateLyncReport || generateOrganizationReport)
report.LyncReport = new LyncStatisticsReport();
if (generateCRMReport || generateOrganizationReport)
report.CRMReport = new CRMStatisticsReport();
@ -664,6 +708,8 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
TaskManager.WriteError(ex, "Cannot get enterprise solution statistics report");
}
TaskManager.Write("End get enterprise solution statistics report " + userId);
return report;
}