This commit is contained in:
vfedosevich 2015-01-16 02:49:58 -08:00
commit 605428f419
47 changed files with 1063 additions and 417 deletions

View file

@ -1580,7 +1580,7 @@ namespace WebsitePanel.EnterpriseServer
public static DataSet UpdatePackage(int actorId, int packageId, int planId, string packageName,
string packageComments, int statusId, DateTime purchaseDate,
bool overrideQuotas, string quotasXml)
bool overrideQuotas, string quotasXml, bool defaultTopPackage)
{
return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure,
ObjectQualifier + "UpdatePackage",
@ -1592,7 +1592,8 @@ namespace WebsitePanel.EnterpriseServer
new SqlParameter("@planId", planId),
new SqlParameter("@purchaseDate", purchaseDate),
new SqlParameter("@overrideQuotas", overrideQuotas),
new SqlParameter("@quotasXml", quotasXml));
new SqlParameter("@quotasXml", quotasXml),
new SqlParameter("@defaultTopPackage", defaultTopPackage));
}
public static void UpdatePackageName(int actorId, int packageId, string packageName,

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