mergecommit

This commit is contained in:
robvde 2013-09-10 15:17:13 +04:00
commit aed1199470
81 changed files with 2467 additions and 1113 deletions

View file

@ -188,6 +188,22 @@ namespace WebsitePanel.EnterpriseServer
// get type properties
PropertyInfo[] props = GetTypeProperties(type);
// leave only a property from the DataReader
DataTable readerSchema = reader.GetSchemaTable();
if (readerSchema != null)
{
List<PropertyInfo> propslist = new List<PropertyInfo>();
foreach (DataRow field in readerSchema.Rows)
{
string columnName = System.Convert.ToString(field["ColumnName"]);
foreach (PropertyInfo prop in props)
if (columnName.ToLower() == prop.Name.ToLower())
propslist.Add(prop);
}
props = propslist.ToArray();
}
// iterate through reader
while (reader.Read())
{

View file

@ -1868,7 +1868,7 @@ namespace WebsitePanel.EnterpriseServer
public static IDataReader GetProcessBackgroundTasks(BackgroundTaskStatus status)
{
return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure,
ObjectQualifier + "GetProcessBackgroundTasks",
ObjectQualifier + "GetProcessBackgroundTasks",
new SqlParameter("@status", (int)status));
}
@ -1952,7 +1952,7 @@ namespace WebsitePanel.EnterpriseServer
new SqlParameter("@finishDate",
finishDate == DateTime.MinValue
? DBNull.Value
: (object) finishDate),
: (object)finishDate),
new SqlParameter("@indicatorCurrent", indicatorCurrent),
new SqlParameter("@indicatorMaximum", indicatorMaximum),
new SqlParameter("@maximumExecutionTime", maximumExecutionTime),
@ -2636,6 +2636,38 @@ namespace WebsitePanel.EnterpriseServer
);
}
public static IDataReader SearchExchangeAccountsByTypes(int actorId, int itemId, string accountTypes,
string filterColumn, string filterValue, string sortColumn)
{
// check input parameters
string[] types = accountTypes.Split(',');
for (int i = 0; i < types.Length; i++)
{
try
{
int type = Int32.Parse(types[i]);
}
catch
{
throw new ArgumentException("Wrong patameter", "accountTypes");
}
}
string searchTypes = String.Join(",", types);
return SqlHelper.ExecuteReader(
ConnectionString,
CommandType.StoredProcedure,
"SearchExchangeAccountsByTypes",
new SqlParameter("@ActorID", actorId),
new SqlParameter("@ItemID", itemId),
new SqlParameter("@AccountTypes", searchTypes),
new SqlParameter("@FilterColumn", VerifyColumnName(filterColumn)),
new SqlParameter("@FilterValue", VerifyColumnValue(filterValue)),
new SqlParameter("@SortColumn", VerifyColumnName(sortColumn))
);
}
public static DataSet GetExchangeAccountsPaged(int actorId, int itemId, string accountTypes,
string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows)
{
@ -2672,7 +2704,7 @@ namespace WebsitePanel.EnterpriseServer
public static IDataReader SearchExchangeAccounts(int actorId, int itemId, bool includeMailboxes,
bool includeContacts, bool includeDistributionLists, bool includeRooms, bool includeEquipment,
string filterColumn, string filterValue, string sortColumn)
bool includeSecurityGroups, string filterColumn, string filterValue, string sortColumn)
{
return SqlHelper.ExecuteReader(
ConnectionString,
@ -2685,6 +2717,7 @@ namespace WebsitePanel.EnterpriseServer
new SqlParameter("@IncludeDistributionLists", includeDistributionLists),
new SqlParameter("@IncludeRooms", includeRooms),
new SqlParameter("@IncludeEquipment", includeEquipment),
new SqlParameter("@IncludeSecurityGroups", includeSecurityGroups),
new SqlParameter("@FilterColumn", VerifyColumnName(filterColumn)),
new SqlParameter("@FilterValue", VerifyColumnValue(filterValue)),
new SqlParameter("@SortColumn", VerifyColumnName(sortColumn))

View file

@ -999,7 +999,7 @@ namespace WebsitePanel.EnterpriseServer
else if (accountType == ExchangeAccountType.Contact)
return SearchAccounts(0, false, true, false, false, false, "", "", "");
else if (accountType == ExchangeAccountType.DistributionList)
return SearchAccounts(0, false, false, true, false, false, "", "", "");
return SearchAccounts(0, false, false, true, false, false, false, "", "", "");
else
{
List<ExchangeAccount> demoAccounts = new List<ExchangeAccount>();
@ -1050,7 +1050,7 @@ namespace WebsitePanel.EnterpriseServer
public static List<ExchangeAccount> SearchAccounts(int itemId,
bool includeMailboxes, bool includeContacts, bool includeDistributionLists,
bool includeRooms, bool includeEquipment,
bool includeRooms, bool includeEquipment, bool includeSecurityGroups,
string filterColumn, string filterValue, string sortColumn)
{
#region Demo Mode
@ -1131,6 +1131,16 @@ namespace WebsitePanel.EnterpriseServer
demoAccounts.Add(d1);
}
if (includeSecurityGroups)
{
ExchangeAccount g1 = new ExchangeAccount();
g1.AccountId = 7;
g1.AccountName = "group_fabrikam";
g1.AccountType = ExchangeAccountType.SecurityGroup;
g1.DisplayName = "Fabrikam Sales Dept";
demoAccounts.Add(g1);
}
return demoAccounts;
}
#endregion
@ -3444,7 +3454,7 @@ namespace WebsitePanel.EnterpriseServer
ExchangeDistributionList dl = exchange.GetDistributionListGeneralSettings(accountName);
// add meta-item
int accountId = AddAccount(itemId, ExchangeAccountType.DistributionList, email,
int accountId = AddAccount(itemId, ExchangeAccountType.DistributionList, accountName,
displayName, email, false,
0, dl.SAMAccountName, null, 0, null);
@ -4039,7 +4049,8 @@ namespace WebsitePanel.EnterpriseServer
List<ExchangeAccount> DistributionLists = GetAccounts(itemId, ExchangeAccountType.DistributionList);
foreach (ExchangeAccount DistributionAccount in DistributionLists)
{
ExchangeDistributionList DistributionList = exchange.GetDistributionListGeneralSettings(DistributionAccount.AccountName);
//ExchangeDistributionList DistributionList = exchange.GetDistributionListGeneralSettings(DistributionAccount.AccountName);
OrganizationSecurityGroup DistributionList = OrganizationController.GetSecurityGroupGeneralSettings(itemId, DistributionAccount.AccountId);
foreach (ExchangeAccount member in DistributionList.MembersAccounts)
{
@ -4169,7 +4180,7 @@ namespace WebsitePanel.EnterpriseServer
}
return 0;
}
}
#endregion

View file

@ -1231,7 +1231,7 @@ namespace WebsitePanel.EnterpriseServer
}
// check quotas
string quotaName = GetIPAddressesQuotaByResourceGroup(groupName);
string quotaName = GetIPAddressesQuotaByResourceGroup(groupName, pool);
// get maximum server IPs
List<IPAddressInfo> ips = ServerController.GetUnallottedIPAddresses(packageId, groupName, pool);
@ -1249,15 +1249,15 @@ namespace WebsitePanel.EnterpriseServer
int quotaUsed = cntx.Quotas[quotaName].QuotaUsedValue;
// check the maximum allowed number
if (quotaAllocated != -1 &&
(addressesNumber > (quotaAllocated - quotaUsed)))
if (addressesNumber > (quotaAllocated - quotaUsed))
{
res.ErrorCodes.Add("IP_ADDRESSES_QUOTA_LIMIT_REACHED");
return res;
}
// check if requested more than available
if (addressesNumber > maxAvailableIPs)
if (maxAvailableIPs != -1 &&
(addressesNumber > maxAvailableIPs))
addressesNumber = maxAvailableIPs;
res = TaskManager.StartResultTask<ResultObject>("IP_ADDRESS", "ALLOCATE_PACKAGE_IP", packageId);
@ -1303,7 +1303,7 @@ namespace WebsitePanel.EnterpriseServer
int maxAvailableIPs = GetUnallottedIPAddresses(packageId, groupName, pool).Count;
// get quota name
string quotaName = GetIPAddressesQuotaByResourceGroup(groupName);
string quotaName = GetIPAddressesQuotaByResourceGroup(groupName, pool);
// get hosting plan IPs
int number = 0;
@ -1415,8 +1415,11 @@ namespace WebsitePanel.EnterpriseServer
return doc.InnerXml;
}
private static string GetIPAddressesQuotaByResourceGroup(string groupName)
private static string GetIPAddressesQuotaByResourceGroup(string groupName, IPAddressPool pool)
{
if (pool == IPAddressPool.PhoneNumbers)
return Quotas.LYNC_PHONE;
if (String.Compare(groupName, ResourceGroups.VPS, true) == 0)
{
return Quotas.VPS_EXTERNAL_IP_ADDRESSES_NUMBER;