fixed bug with "Running Tasks"
This commit is contained in:
parent
9a10d75492
commit
b9cde075d6
7 changed files with 584 additions and 434 deletions
|
@ -814,3 +814,47 @@ GO
|
||||||
UPDATE ScheduleTasks SET TaskType = RTRIM(TaskType) + '.Code'
|
UPDATE ScheduleTasks SET TaskType = RTRIM(TaskType) + '.Code'
|
||||||
WHERE SUBSTRING(RTRIM(TaskType), LEN(RTRIM(TaskType)) - 3, 4) <> 'Code'
|
WHERE SUBSTRING(RTRIM(TaskType), LEN(RTRIM(TaskType)) - 3, 4) <> 'Code'
|
||||||
GO
|
GO
|
||||||
|
|
||||||
|
IF EXISTS (SELECT * FROM sys.objects WHERE type = 'P' AND name = 'GetRunningSchedules')
|
||||||
|
DROP PROCEDURE GetRunningSchedules
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE PROCEDURE [dbo].[GetRunningSchedules]
|
||||||
|
(
|
||||||
|
@ActorID int
|
||||||
|
)
|
||||||
|
AS
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
S.ScheduleID,
|
||||||
|
S.TaskID,
|
||||||
|
ST.TaskType,
|
||||||
|
ST.RoleID,
|
||||||
|
S.PackageID,
|
||||||
|
S.ScheduleName,
|
||||||
|
S.ScheduleTypeID,
|
||||||
|
S.Interval,
|
||||||
|
S.FromTime,
|
||||||
|
S.ToTime,
|
||||||
|
S.StartTime,
|
||||||
|
S.LastRun,
|
||||||
|
S.LastFinish,
|
||||||
|
S.NextRun,
|
||||||
|
S.Enabled,
|
||||||
|
1 AS StatusID,
|
||||||
|
S.PriorityID,
|
||||||
|
S.MaxExecutionTime,
|
||||||
|
S.WeekMonthDay,
|
||||||
|
ISNULL(0, (SELECT TOP 1 SeverityID FROM AuditLog WHERE ItemID = S.ScheduleID AND SourceName = 'SCHEDULER' ORDER BY StartDate DESC)) AS LastResult,
|
||||||
|
U.Username,
|
||||||
|
U.FirstName,
|
||||||
|
U.LastName,
|
||||||
|
U.FullName,
|
||||||
|
U.RoleID,
|
||||||
|
U.Email
|
||||||
|
FROM Schedule AS S
|
||||||
|
INNER JOIN Packages AS P ON S.PackageID = P.PackageID
|
||||||
|
INNER JOIN ScheduleTasks AS ST ON S.TaskID = ST.TaskID
|
||||||
|
INNER JOIN UsersDetailed AS U ON P.UserID = U.UserID
|
||||||
|
WHERE (U.UserID = @ActorID OR U.OwnerID = @ActorID) AND S.LastRun > S.LastFinish
|
||||||
|
GO
|
|
@ -77,35 +77,35 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region System Settings
|
#region System Settings
|
||||||
|
|
||||||
public static IDataReader GetSystemSettings(string settingsName)
|
public static IDataReader GetSystemSettings(string settingsName)
|
||||||
{
|
{
|
||||||
return SqlHelper.ExecuteReader(
|
return SqlHelper.ExecuteReader(
|
||||||
ConnectionString,
|
ConnectionString,
|
||||||
CommandType.StoredProcedure,
|
CommandType.StoredProcedure,
|
||||||
"GetSystemSettings",
|
"GetSystemSettings",
|
||||||
new SqlParameter("@SettingsName", settingsName)
|
new SqlParameter("@SettingsName", settingsName)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SetSystemSettings(string settingsName, string xml)
|
public static void SetSystemSettings(string settingsName, string xml)
|
||||||
{
|
{
|
||||||
SqlHelper.ExecuteNonQuery(
|
SqlHelper.ExecuteNonQuery(
|
||||||
ConnectionString,
|
ConnectionString,
|
||||||
CommandType.StoredProcedure,
|
CommandType.StoredProcedure,
|
||||||
"SetSystemSettings",
|
"SetSystemSettings",
|
||||||
new SqlParameter("@SettingsName", settingsName),
|
new SqlParameter("@SettingsName", settingsName),
|
||||||
new SqlParameter("@Xml", xml)
|
new SqlParameter("@Xml", xml)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Users
|
#region Users
|
||||||
public static bool CheckUserExists(string username)
|
public static bool CheckUserExists(string username)
|
||||||
{
|
{
|
||||||
SqlParameter prmExists = new SqlParameter("@Exists", SqlDbType.Bit);
|
SqlParameter prmExists = new SqlParameter("@Exists", SqlDbType.Bit);
|
||||||
prmExists.Direction = ParameterDirection.Output;
|
prmExists.Direction = ParameterDirection.Output;
|
||||||
|
@ -1296,11 +1296,11 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
|
|
||||||
public static IDataReader GetServiceItemTypes()
|
public static IDataReader GetServiceItemTypes()
|
||||||
{
|
{
|
||||||
return SqlHelper.ExecuteReader (
|
return SqlHelper.ExecuteReader(
|
||||||
ConnectionString,
|
ConnectionString,
|
||||||
CommandType.StoredProcedure,
|
CommandType.StoredProcedure,
|
||||||
"GetServiceItemTypes"
|
"GetServiceItemTypes"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -1851,6 +1851,13 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
new SqlParameter("@taskId", taskId));
|
new SqlParameter("@taskId", taskId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IDataReader GetRunningSchedules(int actorId)
|
||||||
|
{
|
||||||
|
return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure,
|
||||||
|
ObjectQualifier + "GetRunningSchedules",
|
||||||
|
new SqlParameter("@actorId", actorId));
|
||||||
|
}
|
||||||
|
|
||||||
public static DataSet GetSchedules(int actorId, int packageId)
|
public static DataSet GetSchedules(int actorId, int packageId)
|
||||||
{
|
{
|
||||||
return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure,
|
return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure,
|
||||||
|
@ -1901,17 +1908,17 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
new SqlParameter("@scheduleId", scheduleId));
|
new SqlParameter("@scheduleId", scheduleId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Loads view configuration for the task with specified id.
|
/// Loads view configuration for the task with specified id.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="taskId">Task id which points to task for which view configuration will be loaded.</param>
|
/// <param name="taskId">Task id which points to task for which view configuration will be loaded.</param>
|
||||||
/// <returns>View configuration for the task with supplied id.</returns>
|
/// <returns>View configuration for the task with supplied id.</returns>
|
||||||
public static IDataReader GetScheduleTaskViewConfigurations(string taskId)
|
public static IDataReader GetScheduleTaskViewConfigurations(string taskId)
|
||||||
{
|
{
|
||||||
return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure,
|
return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure,
|
||||||
ObjectQualifier + "GetScheduleTaskViewConfigurations",
|
ObjectQualifier + "GetScheduleTaskViewConfigurations",
|
||||||
new SqlParameter("@taskId", taskId));
|
new SqlParameter("@taskId", taskId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int AddSchedule(int actorId, string taskId, int packageId,
|
public static int AddSchedule(int actorId, string taskId, int packageId,
|
||||||
string scheduleName, string scheduleTypeId, int interval,
|
string scheduleName, string scheduleTypeId, int interval,
|
||||||
|
@ -2149,7 +2156,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Exchange Server
|
#region Exchange Server
|
||||||
|
|
||||||
|
|
||||||
public static int AddExchangeAccount(int itemId, int accountType, string accountName,
|
public static int AddExchangeAccount(int itemId, int accountType, string accountName,
|
||||||
|
@ -2181,39 +2188,39 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void AddExchangeAccountEmailAddress(int accountId, string emailAddress)
|
public static void AddExchangeAccountEmailAddress(int accountId, string emailAddress)
|
||||||
{
|
{
|
||||||
SqlHelper.ExecuteNonQuery(
|
SqlHelper.ExecuteNonQuery(
|
||||||
ConnectionString,
|
ConnectionString,
|
||||||
CommandType.StoredProcedure,
|
CommandType.StoredProcedure,
|
||||||
"AddExchangeAccountEmailAddress",
|
"AddExchangeAccountEmailAddress",
|
||||||
new SqlParameter("@AccountID", accountId),
|
new SqlParameter("@AccountID", accountId),
|
||||||
new SqlParameter("@EmailAddress", emailAddress)
|
new SqlParameter("@EmailAddress", emailAddress)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddExchangeOrganization(int itemId, string organizationId)
|
public static void AddExchangeOrganization(int itemId, string organizationId)
|
||||||
{
|
{
|
||||||
SqlHelper.ExecuteNonQuery(
|
SqlHelper.ExecuteNonQuery(
|
||||||
ConnectionString,
|
ConnectionString,
|
||||||
CommandType.StoredProcedure,
|
CommandType.StoredProcedure,
|
||||||
"AddExchangeOrganization",
|
"AddExchangeOrganization",
|
||||||
new SqlParameter("@ItemID", itemId),
|
new SqlParameter("@ItemID", itemId),
|
||||||
new SqlParameter("@OrganizationID", organizationId)
|
new SqlParameter("@OrganizationID", organizationId)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddExchangeOrganizationDomain(int itemId, int domainId, bool isHost)
|
public static void AddExchangeOrganizationDomain(int itemId, int domainId, bool isHost)
|
||||||
{
|
{
|
||||||
SqlHelper.ExecuteNonQuery(
|
SqlHelper.ExecuteNonQuery(
|
||||||
ConnectionString,
|
ConnectionString,
|
||||||
CommandType.StoredProcedure,
|
CommandType.StoredProcedure,
|
||||||
"AddExchangeOrganizationDomain",
|
"AddExchangeOrganizationDomain",
|
||||||
new SqlParameter("@ItemID", itemId),
|
new SqlParameter("@ItemID", itemId),
|
||||||
new SqlParameter("@DomainID", domainId),
|
new SqlParameter("@DomainID", domainId),
|
||||||
new SqlParameter("@IsHost", isHost)
|
new SqlParameter("@IsHost", isHost)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ChangeExchangeAcceptedDomainType(int itemId, int domainId, int domainTypeId)
|
public static void ChangeExchangeAcceptedDomainType(int itemId, int domainId, int domainTypeId)
|
||||||
{
|
{
|
||||||
|
@ -2227,15 +2234,15 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IDataReader GetExchangeOrganizationStatistics(int itemId)
|
public static IDataReader GetExchangeOrganizationStatistics(int itemId)
|
||||||
{
|
{
|
||||||
return SqlHelper.ExecuteReader(
|
return SqlHelper.ExecuteReader(
|
||||||
ConnectionString,
|
ConnectionString,
|
||||||
CommandType.StoredProcedure,
|
CommandType.StoredProcedure,
|
||||||
"GetExchangeOrganizationStatistics",
|
"GetExchangeOrganizationStatistics",
|
||||||
new SqlParameter("@ItemID", itemId)
|
new SqlParameter("@ItemID", itemId)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DeleteUserEmailAddresses(int accountId, string primaryAddress)
|
public static void DeleteUserEmailAddresses(int accountId, string primaryAddress)
|
||||||
{
|
{
|
||||||
|
@ -2249,112 +2256,112 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DeleteExchangeAccount(int itemId, int accountId)
|
public static void DeleteExchangeAccount(int itemId, int accountId)
|
||||||
{
|
{
|
||||||
SqlHelper.ExecuteNonQuery(
|
SqlHelper.ExecuteNonQuery(
|
||||||
ConnectionString,
|
ConnectionString,
|
||||||
CommandType.StoredProcedure,
|
CommandType.StoredProcedure,
|
||||||
"DeleteExchangeAccount",
|
"DeleteExchangeAccount",
|
||||||
new SqlParameter("@ItemID", itemId),
|
new SqlParameter("@ItemID", itemId),
|
||||||
new SqlParameter("@AccountID", accountId)
|
new SqlParameter("@AccountID", accountId)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void DeleteExchangeAccountEmailAddress(int accountId, string emailAddress)
|
public static void DeleteExchangeAccountEmailAddress(int accountId, string emailAddress)
|
||||||
{
|
{
|
||||||
SqlHelper.ExecuteNonQuery(
|
SqlHelper.ExecuteNonQuery(
|
||||||
ConnectionString,
|
ConnectionString,
|
||||||
CommandType.StoredProcedure,
|
CommandType.StoredProcedure,
|
||||||
"DeleteExchangeAccountEmailAddress",
|
"DeleteExchangeAccountEmailAddress",
|
||||||
new SqlParameter("@AccountID", accountId),
|
new SqlParameter("@AccountID", accountId),
|
||||||
new SqlParameter("@EmailAddress", emailAddress)
|
new SqlParameter("@EmailAddress", emailAddress)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DeleteExchangeOrganization(int itemId)
|
public static void DeleteExchangeOrganization(int itemId)
|
||||||
{
|
{
|
||||||
SqlHelper.ExecuteNonQuery(
|
SqlHelper.ExecuteNonQuery(
|
||||||
ConnectionString,
|
ConnectionString,
|
||||||
CommandType.StoredProcedure,
|
CommandType.StoredProcedure,
|
||||||
"DeleteExchangeOrganization",
|
"DeleteExchangeOrganization",
|
||||||
new SqlParameter("@ItemID", itemId)
|
new SqlParameter("@ItemID", itemId)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DeleteExchangeOrganizationDomain(int itemId, int domainId)
|
public static void DeleteExchangeOrganizationDomain(int itemId, int domainId)
|
||||||
{
|
{
|
||||||
SqlHelper.ExecuteNonQuery(
|
SqlHelper.ExecuteNonQuery(
|
||||||
ConnectionString,
|
ConnectionString,
|
||||||
CommandType.StoredProcedure,
|
CommandType.StoredProcedure,
|
||||||
"DeleteExchangeOrganizationDomain",
|
"DeleteExchangeOrganizationDomain",
|
||||||
new SqlParameter("@ItemId", itemId),
|
new SqlParameter("@ItemId", itemId),
|
||||||
new SqlParameter("@DomainID", domainId)
|
new SqlParameter("@DomainID", domainId)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool ExchangeAccountEmailAddressExists(string emailAddress)
|
public static bool ExchangeAccountEmailAddressExists(string emailAddress)
|
||||||
{
|
{
|
||||||
SqlParameter outParam = new SqlParameter("@Exists", SqlDbType.Bit);
|
SqlParameter outParam = new SqlParameter("@Exists", SqlDbType.Bit);
|
||||||
outParam.Direction = ParameterDirection.Output;
|
outParam.Direction = ParameterDirection.Output;
|
||||||
|
|
||||||
SqlHelper.ExecuteNonQuery(
|
SqlHelper.ExecuteNonQuery(
|
||||||
ConnectionString,
|
ConnectionString,
|
||||||
CommandType.StoredProcedure,
|
CommandType.StoredProcedure,
|
||||||
"ExchangeAccountEmailAddressExists",
|
"ExchangeAccountEmailAddressExists",
|
||||||
new SqlParameter("@EmailAddress", emailAddress),
|
new SqlParameter("@EmailAddress", emailAddress),
|
||||||
outParam
|
outParam
|
||||||
);
|
);
|
||||||
|
|
||||||
return Convert.ToBoolean(outParam.Value);
|
return Convert.ToBoolean(outParam.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool ExchangeOrganizationDomainExists(int domainId)
|
public static bool ExchangeOrganizationDomainExists(int domainId)
|
||||||
{
|
{
|
||||||
SqlParameter outParam = new SqlParameter("@Exists", SqlDbType.Bit);
|
SqlParameter outParam = new SqlParameter("@Exists", SqlDbType.Bit);
|
||||||
outParam.Direction = ParameterDirection.Output;
|
outParam.Direction = ParameterDirection.Output;
|
||||||
|
|
||||||
SqlHelper.ExecuteNonQuery(
|
SqlHelper.ExecuteNonQuery(
|
||||||
ConnectionString,
|
ConnectionString,
|
||||||
CommandType.StoredProcedure,
|
CommandType.StoredProcedure,
|
||||||
"ExchangeOrganizationDomainExists",
|
"ExchangeOrganizationDomainExists",
|
||||||
new SqlParameter("@DomainID", domainId),
|
new SqlParameter("@DomainID", domainId),
|
||||||
outParam
|
outParam
|
||||||
);
|
);
|
||||||
|
|
||||||
return Convert.ToBoolean(outParam.Value);
|
return Convert.ToBoolean(outParam.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool ExchangeOrganizationExists(string organizationId)
|
public static bool ExchangeOrganizationExists(string organizationId)
|
||||||
{
|
{
|
||||||
SqlParameter outParam = new SqlParameter("@Exists", SqlDbType.Bit);
|
SqlParameter outParam = new SqlParameter("@Exists", SqlDbType.Bit);
|
||||||
outParam.Direction = ParameterDirection.Output;
|
outParam.Direction = ParameterDirection.Output;
|
||||||
|
|
||||||
SqlHelper.ExecuteNonQuery(
|
SqlHelper.ExecuteNonQuery(
|
||||||
ConnectionString,
|
ConnectionString,
|
||||||
CommandType.StoredProcedure,
|
CommandType.StoredProcedure,
|
||||||
"ExchangeOrganizationExists",
|
"ExchangeOrganizationExists",
|
||||||
new SqlParameter("@OrganizationID", organizationId),
|
new SqlParameter("@OrganizationID", organizationId),
|
||||||
outParam
|
outParam
|
||||||
);
|
);
|
||||||
|
|
||||||
return Convert.ToBoolean(outParam.Value);
|
return Convert.ToBoolean(outParam.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool ExchangeAccountExists(string accountName)
|
public static bool ExchangeAccountExists(string accountName)
|
||||||
{
|
{
|
||||||
SqlParameter outParam = new SqlParameter("@Exists", SqlDbType.Bit);
|
SqlParameter outParam = new SqlParameter("@Exists", SqlDbType.Bit);
|
||||||
outParam.Direction = ParameterDirection.Output;
|
outParam.Direction = ParameterDirection.Output;
|
||||||
|
|
||||||
SqlHelper.ExecuteNonQuery(
|
SqlHelper.ExecuteNonQuery(
|
||||||
ConnectionString,
|
ConnectionString,
|
||||||
CommandType.StoredProcedure,
|
CommandType.StoredProcedure,
|
||||||
"ExchangeAccountExists",
|
"ExchangeAccountExists",
|
||||||
new SqlParameter("@AccountName", accountName),
|
new SqlParameter("@AccountName", accountName),
|
||||||
outParam
|
outParam
|
||||||
);
|
);
|
||||||
|
|
||||||
return Convert.ToBoolean(outParam.Value);
|
return Convert.ToBoolean(outParam.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void UpdateExchangeAccount(int accountId, string accountName, ExchangeAccountType accountType,
|
public static void UpdateExchangeAccount(int accountId, string accountName, ExchangeAccountType accountType,
|
||||||
string displayName, string primaryEmailAddress, bool mailEnabledPublicFolder,
|
string displayName, string primaryEmailAddress, bool mailEnabledPublicFolder,
|
||||||
|
@ -2388,16 +2395,16 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
new SqlParameter("@UserPrincipalName", userPrincipalName));
|
new SqlParameter("@UserPrincipalName", userPrincipalName));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IDataReader GetExchangeAccount(int itemId, int accountId)
|
public static IDataReader GetExchangeAccount(int itemId, int accountId)
|
||||||
{
|
{
|
||||||
return SqlHelper.ExecuteReader(
|
return SqlHelper.ExecuteReader(
|
||||||
ConnectionString,
|
ConnectionString,
|
||||||
CommandType.StoredProcedure,
|
CommandType.StoredProcedure,
|
||||||
"GetExchangeAccount",
|
"GetExchangeAccount",
|
||||||
new SqlParameter("@ItemID", itemId),
|
new SqlParameter("@ItemID", itemId),
|
||||||
new SqlParameter("@AccountID", accountId)
|
new SqlParameter("@AccountID", accountId)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IDataReader GetExchangeAccountByAccountName(int itemId, string accountName)
|
public static IDataReader GetExchangeAccountByAccountName(int itemId, string accountName)
|
||||||
{
|
{
|
||||||
|
@ -2422,37 +2429,37 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static IDataReader GetExchangeAccountEmailAddresses(int accountId)
|
public static IDataReader GetExchangeAccountEmailAddresses(int accountId)
|
||||||
{
|
{
|
||||||
return SqlHelper.ExecuteReader(
|
return SqlHelper.ExecuteReader(
|
||||||
ConnectionString,
|
ConnectionString,
|
||||||
CommandType.StoredProcedure,
|
CommandType.StoredProcedure,
|
||||||
"GetExchangeAccountEmailAddresses",
|
"GetExchangeAccountEmailAddresses",
|
||||||
new SqlParameter("@AccountID", accountId)
|
new SqlParameter("@AccountID", accountId)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IDataReader GetExchangeOrganizationDomains(int itemId)
|
public static IDataReader GetExchangeOrganizationDomains(int itemId)
|
||||||
{
|
{
|
||||||
return SqlHelper.ExecuteReader(
|
return SqlHelper.ExecuteReader(
|
||||||
ConnectionString,
|
ConnectionString,
|
||||||
CommandType.StoredProcedure,
|
CommandType.StoredProcedure,
|
||||||
"GetExchangeOrganizationDomains",
|
"GetExchangeOrganizationDomains",
|
||||||
new SqlParameter("@ItemID", itemId)
|
new SqlParameter("@ItemID", itemId)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static IDataReader GetExchangeAccounts(int itemId, int accountType)
|
public static IDataReader GetExchangeAccounts(int itemId, int accountType)
|
||||||
{
|
{
|
||||||
return SqlHelper.ExecuteReader(
|
return SqlHelper.ExecuteReader(
|
||||||
ConnectionString,
|
ConnectionString,
|
||||||
CommandType.StoredProcedure,
|
CommandType.StoredProcedure,
|
||||||
"GetExchangeAccounts",
|
"GetExchangeAccounts",
|
||||||
new SqlParameter("@ItemID", itemId),
|
new SqlParameter("@ItemID", itemId),
|
||||||
new SqlParameter("@AccountType", accountType)
|
new SqlParameter("@AccountType", accountType)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IDataReader GetExchangeMailboxes(int itemId)
|
public static IDataReader GetExchangeMailboxes(int itemId)
|
||||||
{
|
{
|
||||||
|
@ -2464,9 +2471,9 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DataSet GetExchangeAccountsPaged(int actorId, int itemId, string accountTypes,
|
public static DataSet GetExchangeAccountsPaged(int actorId, int itemId, string accountTypes,
|
||||||
string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows)
|
string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows)
|
||||||
{
|
{
|
||||||
// check input parameters
|
// check input parameters
|
||||||
string[] types = accountTypes.Split(',');
|
string[] types = accountTypes.Split(',');
|
||||||
for (int i = 0; i < types.Length; i++)
|
for (int i = 0; i < types.Length; i++)
|
||||||
|
@ -2483,41 +2490,41 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
|
|
||||||
string searchTypes = String.Join(",", types);
|
string searchTypes = String.Join(",", types);
|
||||||
|
|
||||||
return SqlHelper.ExecuteDataset(
|
return SqlHelper.ExecuteDataset(
|
||||||
ConnectionString,
|
ConnectionString,
|
||||||
CommandType.StoredProcedure,
|
CommandType.StoredProcedure,
|
||||||
"GetExchangeAccountsPaged",
|
"GetExchangeAccountsPaged",
|
||||||
new SqlParameter("@ActorID", actorId),
|
new SqlParameter("@ActorID", actorId),
|
||||||
new SqlParameter("@ItemID", itemId),
|
new SqlParameter("@ItemID", itemId),
|
||||||
new SqlParameter("@AccountTypes", searchTypes),
|
new SqlParameter("@AccountTypes", searchTypes),
|
||||||
new SqlParameter("@FilterColumn", VerifyColumnName(filterColumn)),
|
new SqlParameter("@FilterColumn", VerifyColumnName(filterColumn)),
|
||||||
new SqlParameter("@FilterValue", VerifyColumnValue(filterValue)),
|
new SqlParameter("@FilterValue", VerifyColumnValue(filterValue)),
|
||||||
new SqlParameter("@SortColumn", VerifyColumnName(sortColumn)),
|
new SqlParameter("@SortColumn", VerifyColumnName(sortColumn)),
|
||||||
new SqlParameter("@StartRow", startRow),
|
new SqlParameter("@StartRow", startRow),
|
||||||
new SqlParameter("@MaximumRows", maximumRows)
|
new SqlParameter("@MaximumRows", maximumRows)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IDataReader SearchExchangeAccounts(int actorId, int itemId, bool includeMailboxes,
|
public static IDataReader SearchExchangeAccounts(int actorId, int itemId, bool includeMailboxes,
|
||||||
bool includeContacts, bool includeDistributionLists, bool includeRooms, bool includeEquipment,
|
bool includeContacts, bool includeDistributionLists, bool includeRooms, bool includeEquipment,
|
||||||
string filterColumn, string filterValue, string sortColumn)
|
string filterColumn, string filterValue, string sortColumn)
|
||||||
{
|
{
|
||||||
return SqlHelper.ExecuteReader(
|
return SqlHelper.ExecuteReader(
|
||||||
ConnectionString,
|
ConnectionString,
|
||||||
CommandType.StoredProcedure,
|
CommandType.StoredProcedure,
|
||||||
"SearchExchangeAccounts",
|
"SearchExchangeAccounts",
|
||||||
new SqlParameter("@ActorID", actorId),
|
new SqlParameter("@ActorID", actorId),
|
||||||
new SqlParameter("@ItemID", itemId),
|
new SqlParameter("@ItemID", itemId),
|
||||||
new SqlParameter("@IncludeMailboxes", includeMailboxes),
|
new SqlParameter("@IncludeMailboxes", includeMailboxes),
|
||||||
new SqlParameter("@IncludeContacts", includeContacts),
|
new SqlParameter("@IncludeContacts", includeContacts),
|
||||||
new SqlParameter("@IncludeDistributionLists", includeDistributionLists),
|
new SqlParameter("@IncludeDistributionLists", includeDistributionLists),
|
||||||
new SqlParameter("@IncludeRooms", includeRooms),
|
new SqlParameter("@IncludeRooms", includeRooms),
|
||||||
new SqlParameter("@IncludeEquipment", includeEquipment),
|
new SqlParameter("@IncludeEquipment", includeEquipment),
|
||||||
new SqlParameter("@FilterColumn", VerifyColumnName(filterColumn)),
|
new SqlParameter("@FilterColumn", VerifyColumnName(filterColumn)),
|
||||||
new SqlParameter("@FilterValue", VerifyColumnValue(filterValue)),
|
new SqlParameter("@FilterValue", VerifyColumnValue(filterValue)),
|
||||||
new SqlParameter("@SortColumn", VerifyColumnName(sortColumn))
|
new SqlParameter("@SortColumn", VerifyColumnName(sortColumn))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IDataReader SearchExchangeAccount(int actorId, int accountType, string primaryEmailAddress)
|
public static IDataReader SearchExchangeAccount(int actorId, int accountType, string primaryEmailAddress)
|
||||||
{
|
{
|
||||||
|
@ -2531,7 +2538,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Exchange Mailbox Plans
|
#region Exchange Mailbox Plans
|
||||||
public static int AddExchangeMailboxPlan(int itemID, string mailboxPlan, bool enableActiveSync, bool enableIMAP, bool enableMAPI, bool enableOWA, bool enablePOP,
|
public static int AddExchangeMailboxPlan(int itemID, string mailboxPlan, bool enableActiveSync, bool enableIMAP, bool enableMAPI, bool enableOWA, bool enablePOP,
|
||||||
|
@ -2565,11 +2572,11 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
new SqlParameter("@ProhibitSendReceivePct", prohibitSendReceivePct),
|
new SqlParameter("@ProhibitSendReceivePct", prohibitSendReceivePct),
|
||||||
new SqlParameter("@HideFromAddressBook", hideFromAddressBook),
|
new SqlParameter("@HideFromAddressBook", hideFromAddressBook),
|
||||||
new SqlParameter("@MailboxPlanType", mailboxPlanType),
|
new SqlParameter("@MailboxPlanType", mailboxPlanType),
|
||||||
new SqlParameter("@AllowLitigationHold",enabledLitigationHold),
|
new SqlParameter("@AllowLitigationHold", enabledLitigationHold),
|
||||||
new SqlParameter("@RecoverableItemsWarningPct", recoverabelItemsWarning),
|
new SqlParameter("@RecoverableItemsWarningPct", recoverabelItemsWarning),
|
||||||
new SqlParameter("@RecoverableItemsSpace",recoverabelItemsSpace),
|
new SqlParameter("@RecoverableItemsSpace", recoverabelItemsSpace),
|
||||||
new SqlParameter("@LitigationHoldUrl",litigationHoldUrl),
|
new SqlParameter("@LitigationHoldUrl", litigationHoldUrl),
|
||||||
new SqlParameter("@LitigationHoldMsg",litigationHoldMsg)
|
new SqlParameter("@LitigationHoldMsg", litigationHoldMsg)
|
||||||
);
|
);
|
||||||
|
|
||||||
return Convert.ToInt32(outParam.Value);
|
return Convert.ToInt32(outParam.Value);
|
||||||
|
@ -2607,8 +2614,8 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
new SqlParameter("@AllowLitigationHold", enabledLitigationHold),
|
new SqlParameter("@AllowLitigationHold", enabledLitigationHold),
|
||||||
new SqlParameter("@RecoverableItemsWarningPct", recoverabelItemsWarning),
|
new SqlParameter("@RecoverableItemsWarningPct", recoverabelItemsWarning),
|
||||||
new SqlParameter("@RecoverableItemsSpace", recoverabelItemsSpace),
|
new SqlParameter("@RecoverableItemsSpace", recoverabelItemsSpace),
|
||||||
new SqlParameter("@LitigationHoldUrl",litigationHoldUrl),
|
new SqlParameter("@LitigationHoldUrl", litigationHoldUrl),
|
||||||
new SqlParameter("@LitigationHoldMsg",litigationHoldMsg)
|
new SqlParameter("@LitigationHoldMsg", litigationHoldMsg)
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -2691,7 +2698,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
|
|
||||||
public static int GetItemIdByOrganizationId(string id)
|
public static int GetItemIdByOrganizationId(string id)
|
||||||
{
|
{
|
||||||
object obj =SqlHelper.ExecuteScalar(ConnectionString, CommandType.StoredProcedure, "GetItemIdByOrganizationId",
|
object obj = SqlHelper.ExecuteScalar(ConnectionString, CommandType.StoredProcedure, "GetItemIdByOrganizationId",
|
||||||
new SqlParameter("@OrganizationId", id));
|
new SqlParameter("@OrganizationId", id));
|
||||||
|
|
||||||
return (obj == null || DBNull.Value == obj) ? 0 : (int)obj;
|
return (obj == null || DBNull.Value == obj) ? 0 : (int)obj;
|
||||||
|
@ -2737,7 +2744,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
GetFilterSqlParam("@Email", email),
|
GetFilterSqlParam("@Email", email),
|
||||||
};
|
};
|
||||||
|
|
||||||
return (int) SqlHelper.ExecuteScalar(ConnectionString, CommandType.StoredProcedure, "GetCRMUsersCount", sqlParams);
|
return (int)SqlHelper.ExecuteScalar(ConnectionString, CommandType.StoredProcedure, "GetCRMUsersCount", sqlParams);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2749,7 +2756,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
return new SqlParameter(paramName, value);
|
return new SqlParameter(paramName, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IDataReader GetCrmUsers(int itemId, string sortColumn, string sortDirection, string name, string email, int startRow, int count )
|
public static IDataReader GetCrmUsers(int itemId, string sortColumn, string sortDirection, string name, string email, int startRow, int count)
|
||||||
{
|
{
|
||||||
SqlParameter[] sqlParams = new SqlParameter[]
|
SqlParameter[] sqlParams = new SqlParameter[]
|
||||||
{
|
{
|
||||||
|
@ -2772,7 +2779,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
public static IDataReader GetCRMOrganizationUsers(int itemId)
|
public static IDataReader GetCRMOrganizationUsers(int itemId)
|
||||||
{
|
{
|
||||||
return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, "GetCRMOrganizationUsers",
|
return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, "GetCRMOrganizationUsers",
|
||||||
new SqlParameter[] {new SqlParameter("@ItemID", itemId)});
|
new SqlParameter[] { new SqlParameter("@ItemID", itemId) });
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CreateCRMUser(int itemId, Guid crmId, Guid businessUnitId)
|
public static void CreateCRMUser(int itemId, Guid crmId, Guid businessUnitId)
|
||||||
|
@ -2802,8 +2809,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
public static int GetCrmUserCount(int itemId)
|
public static int GetCrmUserCount(int itemId)
|
||||||
{
|
{
|
||||||
return (int)SqlHelper.ExecuteScalar(ConnectionString, CommandType.StoredProcedure, "GetOrganizationCRMUserCount",
|
return (int)SqlHelper.ExecuteScalar(ConnectionString, CommandType.StoredProcedure, "GetOrganizationCRMUserCount",
|
||||||
new SqlParameter[]
|
new SqlParameter[] { new SqlParameter("@ItemID", itemId) });
|
||||||
{ new SqlParameter("@ItemID",itemId)});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DeleteCrmOrganization(int organizationId)
|
public static void DeleteCrmOrganization(int organizationId)
|
||||||
|
@ -2833,8 +2839,8 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public static IDataReader GetVirtualMachinesForPCPaged(int actorId, int packageId, string filterColumn, string filterValue,
|
public static IDataReader GetVirtualMachinesForPCPaged(int actorId, int packageId, string filterColumn, string filterValue,
|
||||||
string sortColumn, int startRow, int maximumRows, bool recursive)
|
string sortColumn, int startRow, int maximumRows, bool recursive)
|
||||||
{
|
{
|
||||||
IDataReader reader = SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure,
|
IDataReader reader = SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure,
|
||||||
"GetVirtualMachinesPagedForPC",
|
"GetVirtualMachinesPagedForPC",
|
||||||
|
@ -3181,142 +3187,142 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region SSL
|
#region SSL
|
||||||
public static int AddSSLRequest(int actorId, int packageId, int siteID, int userID, string friendlyname, string hostname, string csr, int csrLength, string distinguishedName, bool isRenewal, int previousID)
|
public static int AddSSLRequest(int actorId, int packageId, int siteID, int userID, string friendlyname, string hostname, string csr, int csrLength, string distinguishedName, bool isRenewal, int previousID)
|
||||||
{
|
{
|
||||||
SqlParameter prmId = new SqlParameter("@SSLID", SqlDbType.Int);
|
SqlParameter prmId = new SqlParameter("@SSLID", SqlDbType.Int);
|
||||||
prmId.Direction = ParameterDirection.Output;
|
prmId.Direction = ParameterDirection.Output;
|
||||||
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure,
|
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure,
|
||||||
ObjectQualifier + "AddSSLRequest", prmId,
|
ObjectQualifier + "AddSSLRequest", prmId,
|
||||||
new SqlParameter("@ActorId", actorId),
|
new SqlParameter("@ActorId", actorId),
|
||||||
new SqlParameter("@PackageId", packageId),
|
new SqlParameter("@PackageId", packageId),
|
||||||
new SqlParameter("@UserID", userID),
|
new SqlParameter("@UserID", userID),
|
||||||
new SqlParameter("@WebSiteID", siteID),
|
new SqlParameter("@WebSiteID", siteID),
|
||||||
new SqlParameter("@FriendlyName", friendlyname),
|
new SqlParameter("@FriendlyName", friendlyname),
|
||||||
new SqlParameter("@HostName", hostname),
|
new SqlParameter("@HostName", hostname),
|
||||||
new SqlParameter("@CSR", csr),
|
new SqlParameter("@CSR", csr),
|
||||||
new SqlParameter("@CSRLength", csrLength),
|
new SqlParameter("@CSRLength", csrLength),
|
||||||
new SqlParameter("@DistinguishedName", distinguishedName),
|
new SqlParameter("@DistinguishedName", distinguishedName),
|
||||||
new SqlParameter("@IsRenewal", isRenewal),
|
new SqlParameter("@IsRenewal", isRenewal),
|
||||||
new SqlParameter("@PreviousId", previousID)
|
new SqlParameter("@PreviousId", previousID)
|
||||||
);
|
);
|
||||||
return Convert.ToInt32(prmId.Value);
|
return Convert.ToInt32(prmId.Value);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CompleteSSLRequest(int actorId, int packageId, int id, string certificate, string distinguishedName, string serialNumber, byte[] hash, DateTime validFrom, DateTime expiryDate)
|
public static void CompleteSSLRequest(int actorId, int packageId, int id, string certificate, string distinguishedName, string serialNumber, byte[] hash, DateTime validFrom, DateTime expiryDate)
|
||||||
{
|
{
|
||||||
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure,
|
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure,
|
||||||
ObjectQualifier + "CompleteSSLRequest",
|
ObjectQualifier + "CompleteSSLRequest",
|
||||||
new SqlParameter("@ActorID", actorId),
|
new SqlParameter("@ActorID", actorId),
|
||||||
new SqlParameter("@PackageID", packageId),
|
new SqlParameter("@PackageID", packageId),
|
||||||
new SqlParameter("@ID", id),
|
new SqlParameter("@ID", id),
|
||||||
new SqlParameter("@DistinguishedName", distinguishedName),
|
new SqlParameter("@DistinguishedName", distinguishedName),
|
||||||
new SqlParameter("@Certificate", certificate),
|
new SqlParameter("@Certificate", certificate),
|
||||||
new SqlParameter("@SerialNumber", serialNumber),
|
new SqlParameter("@SerialNumber", serialNumber),
|
||||||
new SqlParameter("@Hash", Convert.ToBase64String(hash)),
|
new SqlParameter("@Hash", Convert.ToBase64String(hash)),
|
||||||
new SqlParameter("@ValidFrom", validFrom),
|
new SqlParameter("@ValidFrom", validFrom),
|
||||||
new SqlParameter("@ExpiryDate", expiryDate));
|
new SqlParameter("@ExpiryDate", expiryDate));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddPFX(int actorId, int packageId, int siteID, int userID, string hostname, string friendlyName, string distinguishedName, int csrLength, string serialNumber, DateTime validFrom, DateTime expiryDate)
|
public static void AddPFX(int actorId, int packageId, int siteID, int userID, string hostname, string friendlyName, string distinguishedName, int csrLength, string serialNumber, DateTime validFrom, DateTime expiryDate)
|
||||||
{
|
{
|
||||||
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure,
|
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure,
|
||||||
ObjectQualifier + "AddPFX",
|
ObjectQualifier + "AddPFX",
|
||||||
new SqlParameter("@ActorId", actorId),
|
new SqlParameter("@ActorId", actorId),
|
||||||
new SqlParameter("@PackageId", packageId),
|
new SqlParameter("@PackageId", packageId),
|
||||||
new SqlParameter("@UserID", userID),
|
new SqlParameter("@UserID", userID),
|
||||||
new SqlParameter("@WebSiteID", siteID),
|
new SqlParameter("@WebSiteID", siteID),
|
||||||
new SqlParameter("@FriendlyName", friendlyName),
|
new SqlParameter("@FriendlyName", friendlyName),
|
||||||
new SqlParameter("@HostName", hostname),
|
new SqlParameter("@HostName", hostname),
|
||||||
new SqlParameter("@CSRLength", csrLength),
|
new SqlParameter("@CSRLength", csrLength),
|
||||||
new SqlParameter("@DistinguishedName", distinguishedName),
|
new SqlParameter("@DistinguishedName", distinguishedName),
|
||||||
new SqlParameter("@SerialNumber", serialNumber),
|
new SqlParameter("@SerialNumber", serialNumber),
|
||||||
new SqlParameter("@ValidFrom", validFrom),
|
new SqlParameter("@ValidFrom", validFrom),
|
||||||
new SqlParameter("@ExpiryDate", expiryDate));
|
new SqlParameter("@ExpiryDate", expiryDate));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DataSet GetSSL(int actorId, int packageId, int id)
|
public static DataSet GetSSL(int actorId, int packageId, int id)
|
||||||
{
|
{
|
||||||
return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure,
|
return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure,
|
||||||
ObjectQualifier + "GetSSL",
|
ObjectQualifier + "GetSSL",
|
||||||
new SqlParameter("@SSLID", id));
|
new SqlParameter("@SSLID", id));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DataSet GetCertificatesForSite(int actorId, int packageId, int siteId)
|
public static DataSet GetCertificatesForSite(int actorId, int packageId, int siteId)
|
||||||
{
|
{
|
||||||
return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure,
|
return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure,
|
||||||
ObjectQualifier + "GetCertificatesForSite",
|
ObjectQualifier + "GetCertificatesForSite",
|
||||||
new SqlParameter("@ActorId", actorId),
|
new SqlParameter("@ActorId", actorId),
|
||||||
new SqlParameter("@PackageId", packageId),
|
new SqlParameter("@PackageId", packageId),
|
||||||
new SqlParameter("@websiteid", siteId));
|
new SqlParameter("@websiteid", siteId));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DataSet GetPendingCertificates(int actorId, int packageId, int id, bool recursive)
|
public static DataSet GetPendingCertificates(int actorId, int packageId, int id, bool recursive)
|
||||||
{
|
{
|
||||||
return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure,
|
return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure,
|
||||||
ObjectQualifier + "GetPendingSSLForWebsite",
|
ObjectQualifier + "GetPendingSSLForWebsite",
|
||||||
new SqlParameter("@ActorId", actorId),
|
new SqlParameter("@ActorId", actorId),
|
||||||
new SqlParameter("@PackageId", packageId),
|
new SqlParameter("@PackageId", packageId),
|
||||||
new SqlParameter("@websiteid", id),
|
new SqlParameter("@websiteid", id),
|
||||||
new SqlParameter("@Recursive", recursive));
|
new SqlParameter("@Recursive", recursive));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IDataReader GetSSLCertificateByID(int actorId, int id)
|
public static IDataReader GetSSLCertificateByID(int actorId, int id)
|
||||||
{
|
{
|
||||||
return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure,
|
return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure,
|
||||||
ObjectQualifier + "GetSSLCertificateByID",
|
ObjectQualifier + "GetSSLCertificateByID",
|
||||||
new SqlParameter("@ActorId", actorId),
|
new SqlParameter("@ActorId", actorId),
|
||||||
new SqlParameter("@ID", id));
|
new SqlParameter("@ID", id));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int CheckSSL(int siteID, bool renewal)
|
public static int CheckSSL(int siteID, bool renewal)
|
||||||
{
|
{
|
||||||
SqlParameter prmId = new SqlParameter("@Result", SqlDbType.Int);
|
SqlParameter prmId = new SqlParameter("@Result", SqlDbType.Int);
|
||||||
prmId.Direction = ParameterDirection.Output;
|
prmId.Direction = ParameterDirection.Output;
|
||||||
|
|
||||||
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure,
|
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure,
|
||||||
ObjectQualifier + "CheckSSL",
|
ObjectQualifier + "CheckSSL",
|
||||||
prmId,
|
prmId,
|
||||||
new SqlParameter("@siteID", siteID),
|
new SqlParameter("@siteID", siteID),
|
||||||
new SqlParameter("@Renewal", renewal));
|
new SqlParameter("@Renewal", renewal));
|
||||||
|
|
||||||
return Convert.ToInt32(prmId.Value);
|
return Convert.ToInt32(prmId.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IDataReader GetSiteCert(int actorId, int siteID)
|
public static IDataReader GetSiteCert(int actorId, int siteID)
|
||||||
{
|
{
|
||||||
return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure,
|
return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure,
|
||||||
ObjectQualifier + "GetSSLCertificateByID",
|
ObjectQualifier + "GetSSLCertificateByID",
|
||||||
new SqlParameter("@ActorId", actorId),
|
new SqlParameter("@ActorId", actorId),
|
||||||
new SqlParameter("@ID", siteID));
|
new SqlParameter("@ID", siteID));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DeleteCertificate(int actorId, int packageId, int id)
|
public static void DeleteCertificate(int actorId, int packageId, int id)
|
||||||
{
|
{
|
||||||
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure,
|
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure,
|
||||||
ObjectQualifier + "DeleteCertificate",
|
ObjectQualifier + "DeleteCertificate",
|
||||||
new SqlParameter("@ActorID", actorId),
|
new SqlParameter("@ActorID", actorId),
|
||||||
new SqlParameter("@PackageID", packageId),
|
new SqlParameter("@PackageID", packageId),
|
||||||
new SqlParameter("@id", id));
|
new SqlParameter("@id", id));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool CheckSSLExistsForWebsite(int siteId)
|
public static bool CheckSSLExistsForWebsite(int siteId)
|
||||||
{
|
{
|
||||||
SqlParameter prmId = new SqlParameter("@Result", SqlDbType.Bit);
|
SqlParameter prmId = new SqlParameter("@Result", SqlDbType.Bit);
|
||||||
prmId.Direction = ParameterDirection.Output;
|
prmId.Direction = ParameterDirection.Output;
|
||||||
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure,
|
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure,
|
||||||
ObjectQualifier + "CheckSSLExistsForWebsite", prmId,
|
ObjectQualifier + "CheckSSLExistsForWebsite", prmId,
|
||||||
new SqlParameter("@siteID", siteId),
|
new SqlParameter("@siteID", siteId),
|
||||||
new SqlParameter("@SerialNumber", ""));
|
new SqlParameter("@SerialNumber", ""));
|
||||||
return Convert.ToBoolean(prmId.Value);
|
return Convert.ToBoolean(prmId.Value);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Lync
|
#region Lync
|
||||||
|
|
||||||
|
@ -3594,8 +3600,8 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
|
|
||||||
reader.Read();
|
reader.Read();
|
||||||
|
|
||||||
providerId = (int) reader["ProviderID"];
|
providerId = (int)reader["ProviderID"];
|
||||||
groupId = (int) reader["GroupID"];
|
groupId = (int)reader["GroupID"];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,12 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
DataProvider.GetScheduleTask(SecurityContext.User.UserId, taskId));
|
DataProvider.GetScheduleTask(SecurityContext.User.UserId, taskId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<ScheduleInfo> GetRunningSchedules()
|
||||||
|
{
|
||||||
|
return ObjectUtils.CreateListFromDataReader<ScheduleInfo>(
|
||||||
|
DataProvider.GetRunningSchedules(SecurityContext.User.UserId));
|
||||||
|
}
|
||||||
|
|
||||||
public static DataSet GetSchedules(int packageId)
|
public static DataSet GetSchedules(int packageId)
|
||||||
{
|
{
|
||||||
DataSet ds = DataProvider.GetSchedules(SecurityContext.User.UserId, packageId);
|
DataSet ds = DataProvider.GetSchedules(SecurityContext.User.UserId, packageId);
|
||||||
|
|
|
@ -134,13 +134,13 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
WriteLogRecord(0, parameterName + ": " + val, null, null);
|
WriteLogRecord(0, parameterName + ": " + val, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Write(string text, params string[] textParameters)
|
public static void Write(string text, params string[] textParameters)
|
||||||
{
|
{
|
||||||
// INFO
|
// INFO
|
||||||
WriteLogRecord(0, text, null, textParameters);
|
WriteLogRecord(0, text, null, textParameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void WriteWarning(string text, params string[] textParameters)
|
public static void WriteWarning(string text, params string[] textParameters)
|
||||||
{
|
{
|
||||||
// WARNING
|
// WARNING
|
||||||
WriteLogRecord(1, text, null, textParameters);
|
WriteLogRecord(1, text, null, textParameters);
|
||||||
|
@ -168,7 +168,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
WriteLogRecord(2, text, ex.Message + "\n" + ex.StackTrace, prms);
|
WriteLogRecord(2, text, ex.Message + "\n" + ex.StackTrace, prms);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void WriteError(string text, params string[] textParameters)
|
public static void WriteError(string text, params string[] textParameters)
|
||||||
{
|
{
|
||||||
// ERROR
|
// ERROR
|
||||||
WriteLogRecord(2, text, null, textParameters);
|
WriteLogRecord(2, text, null, textParameters);
|
||||||
|
@ -195,8 +195,8 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
|
|
||||||
public static void CompleteTask()
|
public static void CompleteTask()
|
||||||
{
|
{
|
||||||
if (TasksStack.Count == 0)
|
if (TasksStack.Count == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// call event handler
|
// call event handler
|
||||||
CallTaskEventHandler(TopTask, true);
|
CallTaskEventHandler(TopTask, true);
|
||||||
|
@ -320,7 +320,21 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
|
|
||||||
// remove tasks
|
// remove tasks
|
||||||
foreach (string taskId in completedTasks)
|
foreach (string taskId in completedTasks)
|
||||||
|
{
|
||||||
|
BackgroundTask task = GetTask(taskId);
|
||||||
|
if (task != null)
|
||||||
|
{
|
||||||
|
// update last finish time
|
||||||
|
SchedulerJob schedule = SchedulerController.GetScheduleComplete(task.ItemId);
|
||||||
|
if (schedule != null)
|
||||||
|
{
|
||||||
|
schedule.ScheduleInfo.LastFinish = DateTime.Now;
|
||||||
|
SchedulerController.UpdateSchedule(schedule.ScheduleInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tasks.Remove(taskId);
|
tasks.Remove(taskId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int PackageId
|
public static int PackageId
|
||||||
|
@ -449,6 +463,14 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
// nope
|
// nope
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// update last finish time
|
||||||
|
SchedulerJob schedule = SchedulerController.GetScheduleComplete(task.ItemId);
|
||||||
|
if (schedule != null)
|
||||||
|
{
|
||||||
|
schedule.ScheduleInfo.LastFinish = DateTime.Now;
|
||||||
|
SchedulerController.UpdateSchedule(schedule.ScheduleInfo);
|
||||||
|
}
|
||||||
|
|
||||||
// remove it from stack
|
// remove it from stack
|
||||||
tasks.Remove(taskId);
|
tasks.Remove(taskId);
|
||||||
}
|
}
|
||||||
|
@ -467,17 +489,37 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
{
|
{
|
||||||
List<BackgroundTask> list = new List<BackgroundTask>();
|
List<BackgroundTask> list = new List<BackgroundTask>();
|
||||||
|
|
||||||
// try to get user first
|
int effectiveUserId = SecurityContext.User.IsPeer ? SecurityContext.User.OwnerId : SecurityContext.User.UserId;
|
||||||
UserInfo user = UserController.GetUser(userId);
|
Dictionary<int, BackgroundTask> scheduledTasks = GetScheduledTasks();
|
||||||
if (user == null)
|
|
||||||
return list; // prohibited user
|
|
||||||
|
|
||||||
// get user tasks
|
List<ScheduleInfo> scheduleList = SchedulerController.GetRunningSchedules();
|
||||||
foreach (BackgroundTask task in tasks.Values)
|
|
||||||
|
foreach (var scheduleInfo in scheduleList)
|
||||||
{
|
{
|
||||||
if(task.EffectiveUserId == userId && !task.Completed)
|
if (effectiveUserId == userId && scheduleInfo.LastRun > scheduleInfo.LastFinish)
|
||||||
list.Add(task);
|
{
|
||||||
|
if (scheduledTasks.ContainsKey(scheduleInfo.ScheduleId) && !scheduledTasks[scheduleInfo.ScheduleId].Completed)
|
||||||
|
{
|
||||||
|
list.Add(scheduledTasks[scheduleInfo.ScheduleId]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
list.Add(new BackgroundTask
|
||||||
|
{
|
||||||
|
TaskId = "",
|
||||||
|
ItemId = scheduleInfo.ScheduleId,
|
||||||
|
StartDate = scheduleInfo.LastRun,
|
||||||
|
TaskName = scheduleInfo.ScheduleName,
|
||||||
|
UserId = SecurityContext.User.UserId,
|
||||||
|
Source = "RUN_SCHEDULE",
|
||||||
|
Severity = 0,
|
||||||
|
ItemName = scheduleInfo.ScheduleName,
|
||||||
|
Completed = false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -508,7 +550,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
string[] taskHandlers = GetTaskEventHandlers(task.Source, task.TaskName);
|
string[] taskHandlers = GetTaskEventHandlers(task.Source, task.TaskName);
|
||||||
if (taskHandlers != null)
|
if (taskHandlers != null)
|
||||||
{
|
{
|
||||||
foreach(string taskHandler in taskHandlers)
|
foreach (string taskHandler in taskHandlers)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,8 +13,9 @@
|
||||||
<asp:TemplateField HeaderText="gvTasksName">
|
<asp:TemplateField HeaderText="gvTasksName">
|
||||||
<ItemStyle Width="40%"></ItemStyle>
|
<ItemStyle Width="40%"></ItemStyle>
|
||||||
<ItemTemplate>
|
<ItemTemplate>
|
||||||
<asp:hyperlink id="lnkTaskName" runat="server">
|
<asp:hyperlink id="lnkTaskName" runat="server" Visible="false">
|
||||||
</asp:hyperlink>
|
</asp:hyperlink>
|
||||||
|
<asp:Literal ID="litTaskName" runat="server" Visible="false"></asp:Literal>
|
||||||
</ItemTemplate>
|
</ItemTemplate>
|
||||||
</asp:TemplateField>
|
</asp:TemplateField>
|
||||||
<asp:BoundField DataField="ItemName" HeaderText="gvTasksItemName"></asp:BoundField>
|
<asp:BoundField DataField="ItemName" HeaderText="gvTasksItemName"></asp:BoundField>
|
||||||
|
@ -26,15 +27,16 @@
|
||||||
</asp:TemplateField>
|
</asp:TemplateField>
|
||||||
<asp:TemplateField HeaderText="gvTasksProgress">
|
<asp:TemplateField HeaderText="gvTasksProgress">
|
||||||
<ItemTemplate>
|
<ItemTemplate>
|
||||||
<div class="ProgressBarContainer">
|
<asp:Panel ID="pnlProgressBarContainer" runat="server" class="ProgressBarContainer" Visible="false">
|
||||||
<asp:Panel id="pnlProgressIndicator" runat="server" CssClass="ProgressBarIndicator"></asp:Panel>
|
<asp:Panel id="pnlProgressIndicator" runat="server" CssClass="ProgressBarIndicator"></asp:Panel>
|
||||||
</div>
|
</asp:Panel>
|
||||||
|
<asp:Literal ID="litProgressIndicator" runat="server" Visible="false">In Progress</asp:Literal>
|
||||||
</ItemTemplate>
|
</ItemTemplate>
|
||||||
</asp:TemplateField>
|
</asp:TemplateField>
|
||||||
<asp:TemplateField HeaderText="gvTasksActions">
|
<asp:TemplateField HeaderText="gvTasksActions">
|
||||||
<ItemTemplate>
|
<ItemTemplate>
|
||||||
<asp:LinkButton ID="cmdStop" runat="server" CommandName="stop"
|
<asp:LinkButton ID="cmdStop" runat="server" CommandName="stop"
|
||||||
CausesValidation="false" Text="Stop" OnClientClick="return confirm('Do you really want to terminate this task?');"></asp:LinkButton>
|
CausesValidation="false" Text="Stop" OnClientClick="return confirm('Do you really want to terminate this task?');" Visible="false"></asp:LinkButton>
|
||||||
</ItemTemplate>
|
</ItemTemplate>
|
||||||
</asp:TemplateField>
|
</asp:TemplateField>
|
||||||
</Columns>
|
</Columns>
|
||||||
|
|
|
@ -66,13 +66,34 @@ namespace WebsitePanel.Portal
|
||||||
|
|
||||||
// find controls
|
// find controls
|
||||||
HyperLink lnkTaskName = (HyperLink)e.Row.FindControl("lnkTaskName");
|
HyperLink lnkTaskName = (HyperLink)e.Row.FindControl("lnkTaskName");
|
||||||
|
Literal litTaskName = (Literal)e.Row.FindControl("litTaskName");
|
||||||
Literal litTaskDuration = (Literal)e.Row.FindControl("litTaskDuration");
|
Literal litTaskDuration = (Literal)e.Row.FindControl("litTaskDuration");
|
||||||
|
Panel pnlProgressBarContainer = (Panel)e.Row.FindControl("pnlProgressBarContainer");
|
||||||
Panel pnlProgressIndicator = (Panel)e.Row.FindControl("pnlProgressIndicator");
|
Panel pnlProgressIndicator = (Panel)e.Row.FindControl("pnlProgressIndicator");
|
||||||
|
Literal litProgressIndicator = (Literal)e.Row.FindControl("litProgressIndicator");
|
||||||
LinkButton cmdStop = (LinkButton)e.Row.FindControl("cmdStop");
|
LinkButton cmdStop = (LinkButton)e.Row.FindControl("cmdStop");
|
||||||
|
|
||||||
// bind controls
|
if (String.IsNullOrEmpty(task.TaskId))
|
||||||
lnkTaskName.Text = GetAuditLogTaskName(task.Source, task.TaskName);
|
{
|
||||||
lnkTaskName.NavigateUrl = EditUrl("TaskID", task.TaskId, "view_details");
|
litTaskName.Visible = true;
|
||||||
|
litProgressIndicator.Visible = true;
|
||||||
|
|
||||||
|
// bind controls
|
||||||
|
litTaskName.Text = GetAuditLogTaskName(task.Source, task.TaskName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lnkTaskName.Visible = true;
|
||||||
|
pnlProgressBarContainer.Visible = true;
|
||||||
|
cmdStop.Visible = true;
|
||||||
|
|
||||||
|
// bind controls
|
||||||
|
lnkTaskName.NavigateUrl = EditUrl("TaskID", task.TaskId, "view_details");
|
||||||
|
lnkTaskName.Text = GetAuditLogTaskName(task.Source, task.TaskName);
|
||||||
|
|
||||||
|
// stop button
|
||||||
|
cmdStop.CommandArgument = task.TaskId;
|
||||||
|
}
|
||||||
|
|
||||||
// duration
|
// duration
|
||||||
TimeSpan duration = (TimeSpan)(DateTime.Now - task.StartDate);
|
TimeSpan duration = (TimeSpan)(DateTime.Now - task.StartDate);
|
||||||
|
@ -86,9 +107,6 @@ namespace WebsitePanel.Portal
|
||||||
if (task.IndicatorMaximum > 0)
|
if (task.IndicatorMaximum > 0)
|
||||||
percent = task.IndicatorCurrent * 100 / task.IndicatorMaximum;
|
percent = task.IndicatorCurrent * 100 / task.IndicatorMaximum;
|
||||||
pnlProgressIndicator.Width = Unit.Percentage(percent);
|
pnlProgressIndicator.Width = Unit.Percentage(percent);
|
||||||
|
|
||||||
// stop button
|
|
||||||
cmdStop.CommandArgument = task.TaskId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void gvTasks_RowCommand(object sender, GridViewCommandEventArgs e)
|
protected void gvTasks_RowCommand(object sender, GridViewCommandEventArgs e)
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// This code was generated by a tool.
|
// This code was generated by a tool.
|
||||||
// Runtime Version:2.0.50727.42
|
|
||||||
//
|
//
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
// the code is regenerated.
|
// the code is regenerated.
|
||||||
|
@ -10,10 +9,43 @@
|
||||||
|
|
||||||
namespace WebsitePanel.Portal {
|
namespace WebsitePanel.Portal {
|
||||||
|
|
||||||
|
|
||||||
public partial class Tasks {
|
public partial class Tasks {
|
||||||
protected System.Web.UI.Timer tasksTimer;
|
|
||||||
protected System.Web.UI.UpdatePanel tasksUpdatePanel;
|
/// <summary>
|
||||||
protected System.Web.UI.WebControls.GridView gvTasks;
|
/// tasksTimer control.
|
||||||
protected System.Web.UI.WebControls.ObjectDataSource odsTasks;
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Auto-generated field.
|
||||||
|
/// To modify move field declaration from designer file to code-behind file.
|
||||||
|
/// </remarks>
|
||||||
|
protected global::System.Web.UI.Timer tasksTimer;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// tasksUpdatePanel control.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Auto-generated field.
|
||||||
|
/// To modify move field declaration from designer file to code-behind file.
|
||||||
|
/// </remarks>
|
||||||
|
protected global::System.Web.UI.UpdatePanel tasksUpdatePanel;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// gvTasks control.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Auto-generated field.
|
||||||
|
/// To modify move field declaration from designer file to code-behind file.
|
||||||
|
/// </remarks>
|
||||||
|
protected global::System.Web.UI.WebControls.GridView gvTasks;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// odsTasks control.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Auto-generated field.
|
||||||
|
/// To modify move field declaration from designer file to code-behind file.
|
||||||
|
/// </remarks>
|
||||||
|
protected global::System.Web.UI.WebControls.ObjectDataSource odsTasks;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue