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'
|
||||
WHERE SUBSTRING(RTRIM(TaskType), LEN(RTRIM(TaskType)) - 3, 4) <> 'Code'
|
||||
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 "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region System Settings
|
||||
#region System Settings
|
||||
|
||||
public static IDataReader GetSystemSettings(string settingsName)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetSystemSettings",
|
||||
new SqlParameter("@SettingsName", settingsName)
|
||||
);
|
||||
}
|
||||
public static IDataReader GetSystemSettings(string settingsName)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetSystemSettings",
|
||||
new SqlParameter("@SettingsName", settingsName)
|
||||
);
|
||||
}
|
||||
|
||||
public static void SetSystemSettings(string settingsName, string xml)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"SetSystemSettings",
|
||||
new SqlParameter("@SettingsName", settingsName),
|
||||
new SqlParameter("@Xml", xml)
|
||||
);
|
||||
}
|
||||
public static void SetSystemSettings(string settingsName, string xml)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"SetSystemSettings",
|
||||
new SqlParameter("@SettingsName", settingsName),
|
||||
new SqlParameter("@Xml", xml)
|
||||
);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Users
|
||||
public static bool CheckUserExists(string username)
|
||||
#region Users
|
||||
public static bool CheckUserExists(string username)
|
||||
{
|
||||
SqlParameter prmExists = new SqlParameter("@Exists", SqlDbType.Bit);
|
||||
prmExists.Direction = ParameterDirection.Output;
|
||||
|
@ -1296,11 +1296,11 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
public static IDataReader GetServiceItemTypes()
|
||||
{
|
||||
return SqlHelper.ExecuteReader (
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetServiceItemTypes"
|
||||
);
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetServiceItemTypes"
|
||||
);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
@ -1851,6 +1851,13 @@ namespace WebsitePanel.EnterpriseServer
|
|||
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)
|
||||
{
|
||||
return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure,
|
||||
|
@ -1901,17 +1908,17 @@ namespace WebsitePanel.EnterpriseServer
|
|||
new SqlParameter("@scheduleId", scheduleId));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads view configuration for the task with specified id.
|
||||
/// </summary>
|
||||
/// <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>
|
||||
public static IDataReader GetScheduleTaskViewConfigurations(string taskId)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure,
|
||||
ObjectQualifier + "GetScheduleTaskViewConfigurations",
|
||||
new SqlParameter("@taskId", taskId));
|
||||
}
|
||||
/// <summary>
|
||||
/// Loads view configuration for the task with specified id.
|
||||
/// </summary>
|
||||
/// <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>
|
||||
public static IDataReader GetScheduleTaskViewConfigurations(string taskId)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure,
|
||||
ObjectQualifier + "GetScheduleTaskViewConfigurations",
|
||||
new SqlParameter("@taskId", taskId));
|
||||
}
|
||||
|
||||
public static int AddSchedule(int actorId, string taskId, int packageId,
|
||||
string scheduleName, string scheduleTypeId, int interval,
|
||||
|
@ -2149,7 +2156,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
}
|
||||
#endregion
|
||||
|
||||
#region Exchange Server
|
||||
#region Exchange Server
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"AddExchangeAccountEmailAddress",
|
||||
new SqlParameter("@AccountID", accountId),
|
||||
new SqlParameter("@EmailAddress", emailAddress)
|
||||
);
|
||||
}
|
||||
public static void AddExchangeAccountEmailAddress(int accountId, string emailAddress)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"AddExchangeAccountEmailAddress",
|
||||
new SqlParameter("@AccountID", accountId),
|
||||
new SqlParameter("@EmailAddress", emailAddress)
|
||||
);
|
||||
}
|
||||
|
||||
public static void AddExchangeOrganization(int itemId, string organizationId)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"AddExchangeOrganization",
|
||||
new SqlParameter("@ItemID", itemId),
|
||||
new SqlParameter("@OrganizationID", organizationId)
|
||||
);
|
||||
}
|
||||
public static void AddExchangeOrganization(int itemId, string organizationId)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"AddExchangeOrganization",
|
||||
new SqlParameter("@ItemID", itemId),
|
||||
new SqlParameter("@OrganizationID", organizationId)
|
||||
);
|
||||
}
|
||||
|
||||
public static void AddExchangeOrganizationDomain(int itemId, int domainId, bool isHost)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"AddExchangeOrganizationDomain",
|
||||
new SqlParameter("@ItemID", itemId),
|
||||
new SqlParameter("@DomainID", domainId),
|
||||
new SqlParameter("@IsHost", isHost)
|
||||
);
|
||||
}
|
||||
public static void AddExchangeOrganizationDomain(int itemId, int domainId, bool isHost)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"AddExchangeOrganizationDomain",
|
||||
new SqlParameter("@ItemID", itemId),
|
||||
new SqlParameter("@DomainID", domainId),
|
||||
new SqlParameter("@IsHost", isHost)
|
||||
);
|
||||
}
|
||||
|
||||
public static void ChangeExchangeAcceptedDomainType(int itemId, int domainId, int domainTypeId)
|
||||
{
|
||||
|
@ -2227,15 +2234,15 @@ namespace WebsitePanel.EnterpriseServer
|
|||
);
|
||||
}
|
||||
|
||||
public static IDataReader GetExchangeOrganizationStatistics(int itemId)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetExchangeOrganizationStatistics",
|
||||
new SqlParameter("@ItemID", itemId)
|
||||
);
|
||||
}
|
||||
public static IDataReader GetExchangeOrganizationStatistics(int itemId)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetExchangeOrganizationStatistics",
|
||||
new SqlParameter("@ItemID", itemId)
|
||||
);
|
||||
}
|
||||
|
||||
public static void DeleteUserEmailAddresses(int accountId, string primaryAddress)
|
||||
{
|
||||
|
@ -2249,112 +2256,112 @@ namespace WebsitePanel.EnterpriseServer
|
|||
}
|
||||
|
||||
public static void DeleteExchangeAccount(int itemId, int accountId)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"DeleteExchangeAccount",
|
||||
new SqlParameter("@ItemID", itemId),
|
||||
new SqlParameter("@AccountID", accountId)
|
||||
);
|
||||
}
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"DeleteExchangeAccount",
|
||||
new SqlParameter("@ItemID", itemId),
|
||||
new SqlParameter("@AccountID", accountId)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public static void DeleteExchangeAccountEmailAddress(int accountId, string emailAddress)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"DeleteExchangeAccountEmailAddress",
|
||||
new SqlParameter("@AccountID", accountId),
|
||||
new SqlParameter("@EmailAddress", emailAddress)
|
||||
);
|
||||
}
|
||||
public static void DeleteExchangeAccountEmailAddress(int accountId, string emailAddress)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"DeleteExchangeAccountEmailAddress",
|
||||
new SqlParameter("@AccountID", accountId),
|
||||
new SqlParameter("@EmailAddress", emailAddress)
|
||||
);
|
||||
}
|
||||
|
||||
public static void DeleteExchangeOrganization(int itemId)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"DeleteExchangeOrganization",
|
||||
new SqlParameter("@ItemID", itemId)
|
||||
);
|
||||
}
|
||||
public static void DeleteExchangeOrganization(int itemId)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"DeleteExchangeOrganization",
|
||||
new SqlParameter("@ItemID", itemId)
|
||||
);
|
||||
}
|
||||
|
||||
public static void DeleteExchangeOrganizationDomain(int itemId, int domainId)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"DeleteExchangeOrganizationDomain",
|
||||
new SqlParameter("@ItemId", itemId),
|
||||
new SqlParameter("@DomainID", domainId)
|
||||
);
|
||||
}
|
||||
public static void DeleteExchangeOrganizationDomain(int itemId, int domainId)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"DeleteExchangeOrganizationDomain",
|
||||
new SqlParameter("@ItemId", itemId),
|
||||
new SqlParameter("@DomainID", domainId)
|
||||
);
|
||||
}
|
||||
|
||||
public static bool ExchangeAccountEmailAddressExists(string emailAddress)
|
||||
{
|
||||
SqlParameter outParam = new SqlParameter("@Exists", SqlDbType.Bit);
|
||||
outParam.Direction = ParameterDirection.Output;
|
||||
public static bool ExchangeAccountEmailAddressExists(string emailAddress)
|
||||
{
|
||||
SqlParameter outParam = new SqlParameter("@Exists", SqlDbType.Bit);
|
||||
outParam.Direction = ParameterDirection.Output;
|
||||
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"ExchangeAccountEmailAddressExists",
|
||||
new SqlParameter("@EmailAddress", emailAddress),
|
||||
outParam
|
||||
);
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"ExchangeAccountEmailAddressExists",
|
||||
new SqlParameter("@EmailAddress", emailAddress),
|
||||
outParam
|
||||
);
|
||||
|
||||
return Convert.ToBoolean(outParam.Value);
|
||||
}
|
||||
return Convert.ToBoolean(outParam.Value);
|
||||
}
|
||||
|
||||
public static bool ExchangeOrganizationDomainExists(int domainId)
|
||||
{
|
||||
SqlParameter outParam = new SqlParameter("@Exists", SqlDbType.Bit);
|
||||
outParam.Direction = ParameterDirection.Output;
|
||||
{
|
||||
SqlParameter outParam = new SqlParameter("@Exists", SqlDbType.Bit);
|
||||
outParam.Direction = ParameterDirection.Output;
|
||||
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"ExchangeOrganizationDomainExists",
|
||||
new SqlParameter("@DomainID", domainId),
|
||||
outParam
|
||||
);
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"ExchangeOrganizationDomainExists",
|
||||
new SqlParameter("@DomainID", domainId),
|
||||
outParam
|
||||
);
|
||||
|
||||
return Convert.ToBoolean(outParam.Value);
|
||||
}
|
||||
return Convert.ToBoolean(outParam.Value);
|
||||
}
|
||||
|
||||
public static bool ExchangeOrganizationExists(string organizationId)
|
||||
{
|
||||
SqlParameter outParam = new SqlParameter("@Exists", SqlDbType.Bit);
|
||||
outParam.Direction = ParameterDirection.Output;
|
||||
public static bool ExchangeOrganizationExists(string organizationId)
|
||||
{
|
||||
SqlParameter outParam = new SqlParameter("@Exists", SqlDbType.Bit);
|
||||
outParam.Direction = ParameterDirection.Output;
|
||||
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"ExchangeOrganizationExists",
|
||||
new SqlParameter("@OrganizationID", organizationId),
|
||||
outParam
|
||||
);
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"ExchangeOrganizationExists",
|
||||
new SqlParameter("@OrganizationID", organizationId),
|
||||
outParam
|
||||
);
|
||||
|
||||
return Convert.ToBoolean(outParam.Value);
|
||||
}
|
||||
return Convert.ToBoolean(outParam.Value);
|
||||
}
|
||||
|
||||
public static bool ExchangeAccountExists(string accountName)
|
||||
{
|
||||
SqlParameter outParam = new SqlParameter("@Exists", SqlDbType.Bit);
|
||||
outParam.Direction = ParameterDirection.Output;
|
||||
public static bool ExchangeAccountExists(string accountName)
|
||||
{
|
||||
SqlParameter outParam = new SqlParameter("@Exists", SqlDbType.Bit);
|
||||
outParam.Direction = ParameterDirection.Output;
|
||||
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"ExchangeAccountExists",
|
||||
new SqlParameter("@AccountName", accountName),
|
||||
outParam
|
||||
);
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"ExchangeAccountExists",
|
||||
new SqlParameter("@AccountName", accountName),
|
||||
outParam
|
||||
);
|
||||
|
||||
return Convert.ToBoolean(outParam.Value);
|
||||
}
|
||||
return Convert.ToBoolean(outParam.Value);
|
||||
}
|
||||
|
||||
public static void UpdateExchangeAccount(int accountId, string accountName, ExchangeAccountType accountType,
|
||||
string displayName, string primaryEmailAddress, bool mailEnabledPublicFolder,
|
||||
|
@ -2388,16 +2395,16 @@ namespace WebsitePanel.EnterpriseServer
|
|||
new SqlParameter("@UserPrincipalName", userPrincipalName));
|
||||
}
|
||||
|
||||
public static IDataReader GetExchangeAccount(int itemId, int accountId)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetExchangeAccount",
|
||||
new SqlParameter("@ItemID", itemId),
|
||||
new SqlParameter("@AccountID", accountId)
|
||||
);
|
||||
}
|
||||
public static IDataReader GetExchangeAccount(int itemId, int accountId)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetExchangeAccount",
|
||||
new SqlParameter("@ItemID", itemId),
|
||||
new SqlParameter("@AccountID", accountId)
|
||||
);
|
||||
}
|
||||
|
||||
public static IDataReader GetExchangeAccountByAccountName(int itemId, string accountName)
|
||||
{
|
||||
|
@ -2422,37 +2429,37 @@ namespace WebsitePanel.EnterpriseServer
|
|||
}
|
||||
|
||||
|
||||
public static IDataReader GetExchangeAccountEmailAddresses(int accountId)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetExchangeAccountEmailAddresses",
|
||||
new SqlParameter("@AccountID", accountId)
|
||||
);
|
||||
}
|
||||
public static IDataReader GetExchangeAccountEmailAddresses(int accountId)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetExchangeAccountEmailAddresses",
|
||||
new SqlParameter("@AccountID", accountId)
|
||||
);
|
||||
}
|
||||
|
||||
public static IDataReader GetExchangeOrganizationDomains(int itemId)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetExchangeOrganizationDomains",
|
||||
new SqlParameter("@ItemID", itemId)
|
||||
);
|
||||
}
|
||||
public static IDataReader GetExchangeOrganizationDomains(int itemId)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetExchangeOrganizationDomains",
|
||||
new SqlParameter("@ItemID", itemId)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public static IDataReader GetExchangeAccounts(int itemId, int accountType)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetExchangeAccounts",
|
||||
new SqlParameter("@ItemID", itemId),
|
||||
new SqlParameter("@AccountType", accountType)
|
||||
);
|
||||
}
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetExchangeAccounts",
|
||||
new SqlParameter("@ItemID", itemId),
|
||||
new SqlParameter("@AccountType", accountType)
|
||||
);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
{
|
||||
// check input parameters
|
||||
string[] types = accountTypes.Split(',');
|
||||
for (int i = 0; i < types.Length; i++)
|
||||
|
@ -2483,41 +2490,41 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
string searchTypes = String.Join(",", types);
|
||||
|
||||
return SqlHelper.ExecuteDataset(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetExchangeAccountsPaged",
|
||||
new SqlParameter("@ActorID", actorId),
|
||||
new SqlParameter("@ItemID", itemId),
|
||||
return SqlHelper.ExecuteDataset(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetExchangeAccountsPaged",
|
||||
new SqlParameter("@ActorID", actorId),
|
||||
new SqlParameter("@ItemID", itemId),
|
||||
new SqlParameter("@AccountTypes", searchTypes),
|
||||
new SqlParameter("@FilterColumn", VerifyColumnName(filterColumn)),
|
||||
new SqlParameter("@FilterValue", VerifyColumnValue(filterValue)),
|
||||
new SqlParameter("@SortColumn", VerifyColumnName(sortColumn)),
|
||||
new SqlParameter("@StartRow", startRow),
|
||||
new SqlParameter("@MaximumRows", maximumRows)
|
||||
);
|
||||
}
|
||||
new SqlParameter("@FilterColumn", VerifyColumnName(filterColumn)),
|
||||
new SqlParameter("@FilterValue", VerifyColumnValue(filterValue)),
|
||||
new SqlParameter("@SortColumn", VerifyColumnName(sortColumn)),
|
||||
new SqlParameter("@StartRow", startRow),
|
||||
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,
|
||||
string filterColumn, string filterValue, string sortColumn)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"SearchExchangeAccounts",
|
||||
new SqlParameter("@ActorID", actorId),
|
||||
new SqlParameter("@ItemID", itemId),
|
||||
new SqlParameter("@IncludeMailboxes", includeMailboxes),
|
||||
new SqlParameter("@IncludeContacts", includeContacts),
|
||||
new SqlParameter("@IncludeDistributionLists", includeDistributionLists),
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"SearchExchangeAccounts",
|
||||
new SqlParameter("@ActorID", actorId),
|
||||
new SqlParameter("@ItemID", itemId),
|
||||
new SqlParameter("@IncludeMailboxes", includeMailboxes),
|
||||
new SqlParameter("@IncludeContacts", includeContacts),
|
||||
new SqlParameter("@IncludeDistributionLists", includeDistributionLists),
|
||||
new SqlParameter("@IncludeRooms", includeRooms),
|
||||
new SqlParameter("@IncludeEquipment", includeEquipment),
|
||||
new SqlParameter("@FilterColumn", VerifyColumnName(filterColumn)),
|
||||
new SqlParameter("@FilterValue", VerifyColumnValue(filterValue)),
|
||||
new SqlParameter("@SortColumn", VerifyColumnName(sortColumn))
|
||||
);
|
||||
}
|
||||
new SqlParameter("@FilterColumn", VerifyColumnName(filterColumn)),
|
||||
new SqlParameter("@FilterValue", VerifyColumnValue(filterValue)),
|
||||
new SqlParameter("@SortColumn", VerifyColumnName(sortColumn))
|
||||
);
|
||||
}
|
||||
|
||||
public static IDataReader SearchExchangeAccount(int actorId, int accountType, string primaryEmailAddress)
|
||||
{
|
||||
|
@ -2531,7 +2538,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Exchange Mailbox Plans
|
||||
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("@HideFromAddressBook", hideFromAddressBook),
|
||||
new SqlParameter("@MailboxPlanType", mailboxPlanType),
|
||||
new SqlParameter("@AllowLitigationHold",enabledLitigationHold),
|
||||
new SqlParameter("@AllowLitigationHold", enabledLitigationHold),
|
||||
new SqlParameter("@RecoverableItemsWarningPct", recoverabelItemsWarning),
|
||||
new SqlParameter("@RecoverableItemsSpace",recoverabelItemsSpace),
|
||||
new SqlParameter("@LitigationHoldUrl",litigationHoldUrl),
|
||||
new SqlParameter("@LitigationHoldMsg",litigationHoldMsg)
|
||||
new SqlParameter("@RecoverableItemsSpace", recoverabelItemsSpace),
|
||||
new SqlParameter("@LitigationHoldUrl", litigationHoldUrl),
|
||||
new SqlParameter("@LitigationHoldMsg", litigationHoldMsg)
|
||||
);
|
||||
|
||||
return Convert.ToInt32(outParam.Value);
|
||||
|
@ -2607,8 +2614,8 @@ namespace WebsitePanel.EnterpriseServer
|
|||
new SqlParameter("@AllowLitigationHold", enabledLitigationHold),
|
||||
new SqlParameter("@RecoverableItemsWarningPct", recoverabelItemsWarning),
|
||||
new SqlParameter("@RecoverableItemsSpace", recoverabelItemsSpace),
|
||||
new SqlParameter("@LitigationHoldUrl",litigationHoldUrl),
|
||||
new SqlParameter("@LitigationHoldMsg",litigationHoldMsg)
|
||||
new SqlParameter("@LitigationHoldUrl", litigationHoldUrl),
|
||||
new SqlParameter("@LitigationHoldMsg", litigationHoldMsg)
|
||||
|
||||
);
|
||||
}
|
||||
|
@ -2691,7 +2698,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
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));
|
||||
|
||||
return (obj == null || DBNull.Value == obj) ? 0 : (int)obj;
|
||||
|
@ -2737,7 +2744,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
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);
|
||||
}
|
||||
|
||||
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[]
|
||||
{
|
||||
|
@ -2772,7 +2779,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
public static IDataReader GetCRMOrganizationUsers(int itemId)
|
||||
{
|
||||
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)
|
||||
|
@ -2802,8 +2809,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
public static int GetCrmUserCount(int itemId)
|
||||
{
|
||||
return (int)SqlHelper.ExecuteScalar(ConnectionString, CommandType.StoredProcedure, "GetOrganizationCRMUserCount",
|
||||
new SqlParameter[]
|
||||
{ new SqlParameter("@ItemID",itemId)});
|
||||
new SqlParameter[] { new SqlParameter("@ItemID", itemId) });
|
||||
}
|
||||
|
||||
public static void DeleteCrmOrganization(int organizationId)
|
||||
|
@ -2833,8 +2839,8 @@ namespace WebsitePanel.EnterpriseServer
|
|||
}
|
||||
#endregion
|
||||
|
||||
public static IDataReader GetVirtualMachinesForPCPaged(int actorId, int packageId, string filterColumn, string filterValue,
|
||||
string sortColumn, int startRow, int maximumRows, bool recursive)
|
||||
public static IDataReader GetVirtualMachinesForPCPaged(int actorId, int packageId, string filterColumn, string filterValue,
|
||||
string sortColumn, int startRow, int maximumRows, bool recursive)
|
||||
{
|
||||
IDataReader reader = SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure,
|
||||
"GetVirtualMachinesPagedForPC",
|
||||
|
@ -3181,142 +3187,142 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
#endregion
|
||||
|
||||
#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)
|
||||
{
|
||||
SqlParameter prmId = new SqlParameter("@SSLID", SqlDbType.Int);
|
||||
prmId.Direction = ParameterDirection.Output;
|
||||
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure,
|
||||
ObjectQualifier + "AddSSLRequest", prmId,
|
||||
new SqlParameter("@ActorId", actorId),
|
||||
new SqlParameter("@PackageId", packageId),
|
||||
new SqlParameter("@UserID", userID),
|
||||
new SqlParameter("@WebSiteID", siteID),
|
||||
new SqlParameter("@FriendlyName", friendlyname),
|
||||
new SqlParameter("@HostName", hostname),
|
||||
new SqlParameter("@CSR", csr),
|
||||
new SqlParameter("@CSRLength", csrLength),
|
||||
new SqlParameter("@DistinguishedName", distinguishedName),
|
||||
new SqlParameter("@IsRenewal", isRenewal),
|
||||
new SqlParameter("@PreviousId", previousID)
|
||||
);
|
||||
return Convert.ToInt32(prmId.Value);
|
||||
#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)
|
||||
{
|
||||
SqlParameter prmId = new SqlParameter("@SSLID", SqlDbType.Int);
|
||||
prmId.Direction = ParameterDirection.Output;
|
||||
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure,
|
||||
ObjectQualifier + "AddSSLRequest", prmId,
|
||||
new SqlParameter("@ActorId", actorId),
|
||||
new SqlParameter("@PackageId", packageId),
|
||||
new SqlParameter("@UserID", userID),
|
||||
new SqlParameter("@WebSiteID", siteID),
|
||||
new SqlParameter("@FriendlyName", friendlyname),
|
||||
new SqlParameter("@HostName", hostname),
|
||||
new SqlParameter("@CSR", csr),
|
||||
new SqlParameter("@CSRLength", csrLength),
|
||||
new SqlParameter("@DistinguishedName", distinguishedName),
|
||||
new SqlParameter("@IsRenewal", isRenewal),
|
||||
new SqlParameter("@PreviousId", previousID)
|
||||
);
|
||||
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)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure,
|
||||
ObjectQualifier + "CompleteSSLRequest",
|
||||
new SqlParameter("@ActorID", actorId),
|
||||
new SqlParameter("@PackageID", packageId),
|
||||
new SqlParameter("@ID", id),
|
||||
new SqlParameter("@DistinguishedName", distinguishedName),
|
||||
new SqlParameter("@Certificate", certificate),
|
||||
new SqlParameter("@SerialNumber", serialNumber),
|
||||
new SqlParameter("@Hash", Convert.ToBase64String(hash)),
|
||||
new SqlParameter("@ValidFrom", validFrom),
|
||||
new SqlParameter("@ExpiryDate", 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,
|
||||
ObjectQualifier + "CompleteSSLRequest",
|
||||
new SqlParameter("@ActorID", actorId),
|
||||
new SqlParameter("@PackageID", packageId),
|
||||
new SqlParameter("@ID", id),
|
||||
new SqlParameter("@DistinguishedName", distinguishedName),
|
||||
new SqlParameter("@Certificate", certificate),
|
||||
new SqlParameter("@SerialNumber", serialNumber),
|
||||
new SqlParameter("@Hash", Convert.ToBase64String(hash)),
|
||||
new SqlParameter("@ValidFrom", validFrom),
|
||||
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)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure,
|
||||
ObjectQualifier + "AddPFX",
|
||||
new SqlParameter("@ActorId", actorId),
|
||||
new SqlParameter("@PackageId", packageId),
|
||||
new SqlParameter("@UserID", userID),
|
||||
new SqlParameter("@WebSiteID", siteID),
|
||||
new SqlParameter("@FriendlyName", friendlyName),
|
||||
new SqlParameter("@HostName", hostname),
|
||||
new SqlParameter("@CSRLength", csrLength),
|
||||
new SqlParameter("@DistinguishedName", distinguishedName),
|
||||
new SqlParameter("@SerialNumber", serialNumber),
|
||||
new SqlParameter("@ValidFrom", validFrom),
|
||||
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)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure,
|
||||
ObjectQualifier + "AddPFX",
|
||||
new SqlParameter("@ActorId", actorId),
|
||||
new SqlParameter("@PackageId", packageId),
|
||||
new SqlParameter("@UserID", userID),
|
||||
new SqlParameter("@WebSiteID", siteID),
|
||||
new SqlParameter("@FriendlyName", friendlyName),
|
||||
new SqlParameter("@HostName", hostname),
|
||||
new SqlParameter("@CSRLength", csrLength),
|
||||
new SqlParameter("@DistinguishedName", distinguishedName),
|
||||
new SqlParameter("@SerialNumber", serialNumber),
|
||||
new SqlParameter("@ValidFrom", validFrom),
|
||||
new SqlParameter("@ExpiryDate", expiryDate));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static DataSet GetSSL(int actorId, int packageId, int id)
|
||||
{
|
||||
return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure,
|
||||
ObjectQualifier + "GetSSL",
|
||||
new SqlParameter("@SSLID", id));
|
||||
public static DataSet GetSSL(int actorId, int packageId, int id)
|
||||
{
|
||||
return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure,
|
||||
ObjectQualifier + "GetSSL",
|
||||
new SqlParameter("@SSLID", id));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static DataSet GetCertificatesForSite(int actorId, int packageId, int siteId)
|
||||
{
|
||||
return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure,
|
||||
ObjectQualifier + "GetCertificatesForSite",
|
||||
new SqlParameter("@ActorId", actorId),
|
||||
new SqlParameter("@PackageId", packageId),
|
||||
new SqlParameter("@websiteid", siteId));
|
||||
public static DataSet GetCertificatesForSite(int actorId, int packageId, int siteId)
|
||||
{
|
||||
return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure,
|
||||
ObjectQualifier + "GetCertificatesForSite",
|
||||
new SqlParameter("@ActorId", actorId),
|
||||
new SqlParameter("@PackageId", packageId),
|
||||
new SqlParameter("@websiteid", siteId));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static DataSet GetPendingCertificates(int actorId, int packageId, int id, bool recursive)
|
||||
{
|
||||
return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure,
|
||||
ObjectQualifier + "GetPendingSSLForWebsite",
|
||||
new SqlParameter("@ActorId", actorId),
|
||||
new SqlParameter("@PackageId", packageId),
|
||||
new SqlParameter("@websiteid", id),
|
||||
new SqlParameter("@Recursive", recursive));
|
||||
public static DataSet GetPendingCertificates(int actorId, int packageId, int id, bool recursive)
|
||||
{
|
||||
return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure,
|
||||
ObjectQualifier + "GetPendingSSLForWebsite",
|
||||
new SqlParameter("@ActorId", actorId),
|
||||
new SqlParameter("@PackageId", packageId),
|
||||
new SqlParameter("@websiteid", id),
|
||||
new SqlParameter("@Recursive", recursive));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static IDataReader GetSSLCertificateByID(int actorId, int id)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure,
|
||||
ObjectQualifier + "GetSSLCertificateByID",
|
||||
new SqlParameter("@ActorId", actorId),
|
||||
new SqlParameter("@ID", id));
|
||||
}
|
||||
public static IDataReader GetSSLCertificateByID(int actorId, int id)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure,
|
||||
ObjectQualifier + "GetSSLCertificateByID",
|
||||
new SqlParameter("@ActorId", actorId),
|
||||
new SqlParameter("@ID", id));
|
||||
}
|
||||
|
||||
public static int CheckSSL(int siteID, bool renewal)
|
||||
{
|
||||
SqlParameter prmId = new SqlParameter("@Result", SqlDbType.Int);
|
||||
prmId.Direction = ParameterDirection.Output;
|
||||
public static int CheckSSL(int siteID, bool renewal)
|
||||
{
|
||||
SqlParameter prmId = new SqlParameter("@Result", SqlDbType.Int);
|
||||
prmId.Direction = ParameterDirection.Output;
|
||||
|
||||
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure,
|
||||
ObjectQualifier + "CheckSSL",
|
||||
prmId,
|
||||
new SqlParameter("@siteID", siteID),
|
||||
new SqlParameter("@Renewal", renewal));
|
||||
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure,
|
||||
ObjectQualifier + "CheckSSL",
|
||||
prmId,
|
||||
new SqlParameter("@siteID", siteID),
|
||||
new SqlParameter("@Renewal", renewal));
|
||||
|
||||
return Convert.ToInt32(prmId.Value);
|
||||
}
|
||||
return Convert.ToInt32(prmId.Value);
|
||||
}
|
||||
|
||||
public static IDataReader GetSiteCert(int actorId, int siteID)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure,
|
||||
ObjectQualifier + "GetSSLCertificateByID",
|
||||
new SqlParameter("@ActorId", actorId),
|
||||
new SqlParameter("@ID", siteID));
|
||||
}
|
||||
public static IDataReader GetSiteCert(int actorId, int siteID)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure,
|
||||
ObjectQualifier + "GetSSLCertificateByID",
|
||||
new SqlParameter("@ActorId", actorId),
|
||||
new SqlParameter("@ID", siteID));
|
||||
}
|
||||
|
||||
public static void DeleteCertificate(int actorId, int packageId, int id)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure,
|
||||
ObjectQualifier + "DeleteCertificate",
|
||||
new SqlParameter("@ActorID", actorId),
|
||||
new SqlParameter("@PackageID", packageId),
|
||||
new SqlParameter("@id", id));
|
||||
}
|
||||
public static void DeleteCertificate(int actorId, int packageId, int id)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure,
|
||||
ObjectQualifier + "DeleteCertificate",
|
||||
new SqlParameter("@ActorID", actorId),
|
||||
new SqlParameter("@PackageID", packageId),
|
||||
new SqlParameter("@id", id));
|
||||
}
|
||||
|
||||
public static bool CheckSSLExistsForWebsite(int siteId)
|
||||
{
|
||||
SqlParameter prmId = new SqlParameter("@Result", SqlDbType.Bit);
|
||||
prmId.Direction = ParameterDirection.Output;
|
||||
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure,
|
||||
ObjectQualifier + "CheckSSLExistsForWebsite", prmId,
|
||||
new SqlParameter("@siteID", siteId),
|
||||
new SqlParameter("@SerialNumber", ""));
|
||||
return Convert.ToBoolean(prmId.Value);
|
||||
}
|
||||
#endregion
|
||||
public static bool CheckSSLExistsForWebsite(int siteId)
|
||||
{
|
||||
SqlParameter prmId = new SqlParameter("@Result", SqlDbType.Bit);
|
||||
prmId.Direction = ParameterDirection.Output;
|
||||
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure,
|
||||
ObjectQualifier + "CheckSSLExistsForWebsite", prmId,
|
||||
new SqlParameter("@siteID", siteId),
|
||||
new SqlParameter("@SerialNumber", ""));
|
||||
return Convert.ToBoolean(prmId.Value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Lync
|
||||
|
||||
|
@ -3594,8 +3600,8 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
reader.Read();
|
||||
|
||||
providerId = (int) reader["ProviderID"];
|
||||
groupId = (int) reader["GroupID"];
|
||||
providerId = (int)reader["ProviderID"];
|
||||
groupId = (int)reader["GroupID"];
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,12 @@ namespace WebsitePanel.EnterpriseServer
|
|||
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)
|
||||
{
|
||||
DataSet ds = DataProvider.GetSchedules(SecurityContext.User.UserId, packageId);
|
||||
|
|
|
@ -134,13 +134,13 @@ namespace WebsitePanel.EnterpriseServer
|
|||
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
|
||||
WriteLogRecord(0, text, null, textParameters);
|
||||
}
|
||||
|
||||
public static void WriteWarning(string text, params string[] textParameters)
|
||||
public static void WriteWarning(string text, params string[] textParameters)
|
||||
{
|
||||
// WARNING
|
||||
WriteLogRecord(1, text, null, textParameters);
|
||||
|
@ -168,7 +168,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
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
|
||||
WriteLogRecord(2, text, null, textParameters);
|
||||
|
@ -195,8 +195,8 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
public static void CompleteTask()
|
||||
{
|
||||
if (TasksStack.Count == 0)
|
||||
return;
|
||||
if (TasksStack.Count == 0)
|
||||
return;
|
||||
|
||||
// call event handler
|
||||
CallTaskEventHandler(TopTask, true);
|
||||
|
@ -320,7 +320,21 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
// remove tasks
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
public static int PackageId
|
||||
|
@ -449,6 +463,14 @@ namespace WebsitePanel.EnterpriseServer
|
|||
// 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
|
||||
tasks.Remove(taskId);
|
||||
}
|
||||
|
@ -467,17 +489,37 @@ namespace WebsitePanel.EnterpriseServer
|
|||
{
|
||||
List<BackgroundTask> list = new List<BackgroundTask>();
|
||||
|
||||
// try to get user first
|
||||
UserInfo user = UserController.GetUser(userId);
|
||||
if (user == null)
|
||||
return list; // prohibited user
|
||||
int effectiveUserId = SecurityContext.User.IsPeer ? SecurityContext.User.OwnerId : SecurityContext.User.UserId;
|
||||
Dictionary<int, BackgroundTask> scheduledTasks = GetScheduledTasks();
|
||||
|
||||
// get user tasks
|
||||
foreach (BackgroundTask task in tasks.Values)
|
||||
List<ScheduleInfo> scheduleList = SchedulerController.GetRunningSchedules();
|
||||
|
||||
foreach (var scheduleInfo in scheduleList)
|
||||
{
|
||||
if(task.EffectiveUserId == userId && !task.Completed)
|
||||
list.Add(task);
|
||||
if (effectiveUserId == userId && scheduleInfo.LastRun > scheduleInfo.LastFinish)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -508,7 +550,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
string[] taskHandlers = GetTaskEventHandlers(task.Source, task.TaskName);
|
||||
if (taskHandlers != null)
|
||||
{
|
||||
foreach(string taskHandler in taskHandlers)
|
||||
foreach (string taskHandler in taskHandlers)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -13,8 +13,9 @@
|
|||
<asp:TemplateField HeaderText="gvTasksName">
|
||||
<ItemStyle Width="40%"></ItemStyle>
|
||||
<ItemTemplate>
|
||||
<asp:hyperlink id="lnkTaskName" runat="server">
|
||||
<asp:hyperlink id="lnkTaskName" runat="server" Visible="false">
|
||||
</asp:hyperlink>
|
||||
<asp:Literal ID="litTaskName" runat="server" Visible="false"></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField DataField="ItemName" HeaderText="gvTasksItemName"></asp:BoundField>
|
||||
|
@ -26,15 +27,16 @@
|
|||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="gvTasksProgress">
|
||||
<ItemTemplate>
|
||||
<div class="ProgressBarContainer">
|
||||
<asp:Panel ID="pnlProgressBarContainer" runat="server" class="ProgressBarContainer" Visible="false">
|
||||
<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>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="gvTasksActions">
|
||||
<ItemTemplate>
|
||||
<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>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
|
|
|
@ -66,13 +66,34 @@ namespace WebsitePanel.Portal
|
|||
|
||||
// find controls
|
||||
HyperLink lnkTaskName = (HyperLink)e.Row.FindControl("lnkTaskName");
|
||||
Literal litTaskName = (Literal)e.Row.FindControl("litTaskName");
|
||||
Literal litTaskDuration = (Literal)e.Row.FindControl("litTaskDuration");
|
||||
Panel pnlProgressBarContainer = (Panel)e.Row.FindControl("pnlProgressBarContainer");
|
||||
Panel pnlProgressIndicator = (Panel)e.Row.FindControl("pnlProgressIndicator");
|
||||
Literal litProgressIndicator = (Literal)e.Row.FindControl("litProgressIndicator");
|
||||
LinkButton cmdStop = (LinkButton)e.Row.FindControl("cmdStop");
|
||||
|
||||
// bind controls
|
||||
lnkTaskName.Text = GetAuditLogTaskName(task.Source, task.TaskName);
|
||||
lnkTaskName.NavigateUrl = EditUrl("TaskID", task.TaskId, "view_details");
|
||||
if (String.IsNullOrEmpty(task.TaskId))
|
||||
{
|
||||
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
|
||||
TimeSpan duration = (TimeSpan)(DateTime.Now - task.StartDate);
|
||||
|
@ -86,9 +107,6 @@ namespace WebsitePanel.Portal
|
|||
if (task.IndicatorMaximum > 0)
|
||||
percent = task.IndicatorCurrent * 100 / task.IndicatorMaximum;
|
||||
pnlProgressIndicator.Width = Unit.Percentage(percent);
|
||||
|
||||
// stop button
|
||||
cmdStop.CommandArgument = task.TaskId;
|
||||
}
|
||||
|
||||
protected void gvTasks_RowCommand(object sender, GridViewCommandEventArgs e)
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 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
|
||||
// the code is regenerated.
|
||||
|
@ -10,10 +9,43 @@
|
|||
|
||||
namespace WebsitePanel.Portal {
|
||||
|
||||
|
||||
public partial class Tasks {
|
||||
protected System.Web.UI.Timer tasksTimer;
|
||||
protected System.Web.UI.UpdatePanel tasksUpdatePanel;
|
||||
protected System.Web.UI.WebControls.GridView gvTasks;
|
||||
protected System.Web.UI.WebControls.ObjectDataSource odsTasks;
|
||||
|
||||
/// <summary>
|
||||
/// tasksTimer control.
|
||||
/// </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