CheckLoadUserProfile

This commit is contained in:
Sergey 2012-09-13 16:16:23 +03:00
parent cfb58e3423
commit 444473a73d
10 changed files with 641 additions and 233 deletions

View file

@ -33,6 +33,7 @@ using System.Data.SqlClient;
using System.Text.RegularExpressions;
using WebsitePanel.Providers.HostedSolution;
using Microsoft.ApplicationBlocks.Data;
using System.Collections.Generic;
namespace WebsitePanel.EnterpriseServer
{
@ -3399,5 +3400,45 @@ namespace WebsitePanel.EnterpriseServer
#endregion
public static int GetPackageIdByName(string Name)
{
// get Helicon Zoo provider
int packageId = -1;
List<ProviderInfo> providers = ServerController.GetProviders();
foreach (ProviderInfo providerInfo in providers)
{
if (string.Equals(Name, providerInfo.ProviderName, StringComparison.OrdinalIgnoreCase))
{
packageId = providerInfo.ProviderId;
break;
}
}
if (-1 == packageId)
{
throw new Exception("Provider not found");
}
return packageId;
}
public static int GetServiceIdByProviderForServer(int providerId, int serverId)
{
IDataReader reader = SqlHelper.ExecuteReader(ConnectionString, CommandType.Text,
@"SELECT TOP 1
ServiceID
FROM Services
WHERE ProviderID = @ProviderID AND ServerID = @ServerID",
new SqlParameter("@ProviderID", providerId),
new SqlParameter("@ServerID", serverId));
if (reader.Read())
{
return (int)reader["ServiceID"];
}
return -1;
}
}
}