Added the DefaultTopPackage checkbox to the space page.

This commit is contained in:
Christiaan Swiers 2015-01-15 12:43:22 +01:00
parent a810e3c78b
commit cf079b2d11
11 changed files with 266 additions and 173 deletions

View file

@ -778,7 +778,7 @@ namespace WebsitePanel.EnterpriseServer
// update package
result.ExceedingQuotas = DataProvider.UpdatePackage(SecurityContext.User.UserId,
package.PackageId, package.PlanId, package.PackageName, package.PackageComments, package.StatusId,
package.PurchaseDate, package.OverrideQuotas, quotasXml);
package.PurchaseDate, package.OverrideQuotas, quotasXml, package.DefaultTopPackage);
if (result.ExceedingQuotas.Tables[0].Rows.Count > 0)
result.Result = BusinessErrorCodes.ERROR_PACKAGE_QUOTA_EXCEED;
@ -1742,6 +1742,21 @@ namespace WebsitePanel.EnterpriseServer
//}
}
public static bool SetDefaultTopPackage(int userId, int packageId) {
List<PackageInfo> lpi = GetPackages(userId);
foreach(PackageInfo pi in lpi) {
if(pi.DefaultTopPackage) {
pi.DefaultTopPackage = false;
UpdatePackage(pi);
}
if(pi.PackageId == packageId) {
pi.DefaultTopPackage = true;
UpdatePackage(pi);
}
}
return true;
}
#endregion
#region Quotas