wsp-10211 fixed: call DistributePackageServices after adding new service to server

This commit is contained in:
Ruslan Keba 2013-11-05 13:37:19 +02:00
parent e2283b5358
commit 0a16e252c9
2 changed files with 35 additions and 0 deletions

View file

@ -979,6 +979,8 @@ namespace WebsitePanel.EnterpriseServer
new SqlParameter("@ClusterId", clusterId), new SqlParameter("@ClusterId", clusterId),
new SqlParameter("@comments", comments)); new SqlParameter("@comments", comments));
UpdateServerPackageServices(serverId);
return Convert.ToInt32(prmServiceId.Value); return Convert.ToInt32(prmServiceId.Value);
} }
@ -1559,6 +1561,8 @@ namespace WebsitePanel.EnterpriseServer
// read identity // read identity
packageId = Convert.ToInt32(prmPackageId.Value); packageId = Convert.ToInt32(prmPackageId.Value);
DistributePackageServices(actorId, packageId);
return ds; return ds;
} }
@ -1660,6 +1664,33 @@ namespace WebsitePanel.EnterpriseServer
new SqlParameter("@PackageAddonID", packageAddonId)); new SqlParameter("@PackageAddonID", packageAddonId));
} }
public static void UpdateServerPackageServices(int serverId)
{
// FIXME
int defaultActorID = 1;
// get server packages
IDataReader packagesReader = SqlHelper.ExecuteReader(ConnectionString, CommandType.Text,
@"SELECT PackageID FROM Packages WHERE ServerID = @ServerID",
new SqlParameter("@ServerID", serverId)
);
// call DistributePackageServices for all packages on this server
while (packagesReader.Read())
{
int packageId = (int) packagesReader["PackageID"];
DistributePackageServices(defaultActorID, packageId);
}
}
public static void DistributePackageServices(int actorId, int packageId)
{
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure,
ObjectQualifier + "DistributePackageServices",
new SqlParameter("@ActorId", actorId),
new SqlParameter("@PackageID", packageId));
}
#endregion #endregion
#region Packages Settings #region Packages Settings

View file

@ -229,6 +229,8 @@ namespace WebsitePanel.EnterpriseServer
if (result.ExceedingQuotas.Tables[0].Rows.Count > 0) if (result.ExceedingQuotas.Tables[0].Rows.Count > 0)
result.Result = BusinessErrorCodes.ERROR_PACKAGE_QUOTA_EXCEED; result.Result = BusinessErrorCodes.ERROR_PACKAGE_QUOTA_EXCEED;
DataProvider.DistributePackageServices(SecurityContext.User.UserId, plan.PackageId);
return result; return result;
} }
@ -781,6 +783,8 @@ namespace WebsitePanel.EnterpriseServer
// Update the Hard quota on home folder in case it was enabled and in case there was a change in disk space // Update the Hard quota on home folder in case it was enabled and in case there was a change in disk space
UpdatePackageHardQuota(package.PackageId); UpdatePackageHardQuota(package.PackageId);
DataProvider.DistributePackageServices(SecurityContext.User.UserId, package.PackageId);
} }
finally finally
{ {