Merge
This commit is contained in:
commit
14eb9aa172
155 changed files with 13952 additions and 2570 deletions
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Include>
|
||||||
|
<?define PROJECTPATH = "..\..\..\WebsitePanel"?>
|
||||||
|
<?define BUILDPATH = "$(var.PROJECTPATH)\Build\$(var.BUILD)\SchedulerService\bin"?>
|
||||||
|
<?define SERVERBUILDPATH = "$(var.PROJECTPATH)\Build\$(var.BUILD)\Server\bin"?>
|
||||||
|
</Include>
|
Binary file not shown.
|
@ -0,0 +1,132 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
|
||||||
|
<?include Config.wxi?>
|
||||||
|
<?define VERSION="2.1"?>
|
||||||
|
<Product Id="*" Name="WebsitePanel Scheduler Service Installer" Language="1033" Version="$(var.VERSION)" Manufacturer="Outercurve Foundation" UpgradeCode="629ccd5c-1f6d-4168-bbe6-01c69e232f44">
|
||||||
|
<Package InstallerVersion="200" Compressed="yes" />
|
||||||
|
<Media Id="1" EmbedCab="yes" Cabinet="schedulerservice.cab" />
|
||||||
|
<Feature Id="ProductFeature" Title="WebsitePanel Scheduler Service Installer" Level="1">
|
||||||
|
<ComponentRef Id="ProductFiles" />
|
||||||
|
</Feature>
|
||||||
|
<Property Id="BannerBitmap">bannrbmp</Property>
|
||||||
|
<WixVariable Id="WixUIBannerBmp" Value="bannrbmp.bmp" />
|
||||||
|
<WixVariable Id="WixUIDialogBmp" Value="dlgbmp.bmp" />
|
||||||
|
<WixVariable Id="WixUILicenseRtf" Value="License.rtf" />
|
||||||
|
<Icon Id="WebSitePanel.ico" SourceFile="WebSitePanel.ico" />
|
||||||
|
<Property Id="ARPPRODUCTICON" Value="WebSitePanel.ico" />
|
||||||
|
<Property Id="SERVERNAME" Value="localhost\SQLExpress" />
|
||||||
|
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
|
||||||
|
<Property Id="INSTALLFOLDER" Value="c:\WebsitePanel\SchedulerService" />
|
||||||
|
<Property Id="CONNECTIONSTRING" Value="1" />
|
||||||
|
<Property Id="DATABASENAME" Value="WebsitePanel" />
|
||||||
|
<Property Id="AUTHENTICATIONTYPE" Value="Windows Authentication" />
|
||||||
|
<Binary Id="bannrbmp" SourceFile="bannrbmp.bmp" />
|
||||||
|
<UI Id="CustomInstaller">
|
||||||
|
<UIRef Id="WixUI_Mondo" />
|
||||||
|
<Dialog Id="DatabaseConnectionDlg" Width="370" Height="270" NoMinimize="yes" Title="[ProductName] Setup">
|
||||||
|
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="Back">
|
||||||
|
<Publish Event="NewDialog" Value="InstallLocationDlg">1</Publish>
|
||||||
|
</Control>
|
||||||
|
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="Next">
|
||||||
|
<Publish Event="DoAction" Value="CheckConnection">1</Publish>
|
||||||
|
<Publish Event="SpawnDialog" Value="ConnectionWarningDlg">CORRECTCONNECTION = "0"</Publish>
|
||||||
|
<Publish Event="NewDialog" Value="VerifyReadyDlg">CORRECTCONNECTION = "1"</Publish>
|
||||||
|
</Control>
|
||||||
|
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
|
||||||
|
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
|
||||||
|
</Control>
|
||||||
|
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="[BannerBitmap]" />
|
||||||
|
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
|
||||||
|
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
|
||||||
|
<Control Id="Description" Type="Text" X="20" Y="23" Width="280" Height="20" Transparent="yes" NoPrefix="yes" Text="Configure WebsitePanel database connection string" />
|
||||||
|
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="{\WixUI_Font_Title}Database connection string" />
|
||||||
|
<Control Type="Text" Id="ServerLabel" Width="50" Height="17" X="75" Y="68" Text="SQL Server:" />
|
||||||
|
<Control Type="Edit" Id="ServerEdit" Width="163" Height="15" X="142" Y="68" Property="SERVERNAME" />
|
||||||
|
<Control Type="Text" Id="AuthenticationLabel" Width="70" Height="17" X="62" Y="94" Text="Authentication:" />
|
||||||
|
<Control Type="ComboBox" Id="AuthenticationCombo" Width="163" Height="16" X="142" Y="94" Property="AUTHENTICATIONTYPE">
|
||||||
|
<ComboBox Property="AUTHENTICATIONTYPE">
|
||||||
|
<ListItem Text="Windows Authentication" Value="Windows Authentication" />
|
||||||
|
<ListItem Text="SQL Server Authentication" Value="SQL Server Authentication" />
|
||||||
|
</ComboBox>
|
||||||
|
</Control>
|
||||||
|
<Control Type="Text" Id="LoginLabel" Width="50" Height="17" X="71" Y="120" Text="Login Name:" />
|
||||||
|
<Control Type="Edit" Id="LoginEdit" Width="163" Height="15" X="142" Y="120" Property="LOGIN">
|
||||||
|
<Condition Action="disable">AUTHENTICATIONTYPE = "Windows Authentication"</Condition>
|
||||||
|
<Condition Action="enable">NOT(AUTHENTICATIONTYPE = "Windows Authentication")</Condition>
|
||||||
|
</Control>
|
||||||
|
<Control Type="Text" Id="PasswordLabel" Width="50" Height="17" X="80" Y="146" Text="Password:" />
|
||||||
|
<Control Type="Edit" Id="PasswordEdit" Width="163" Height="17" X="142" Y="146" Property="PASSWORD" Hidden="no" Password="yes">
|
||||||
|
<Condition Action="disable">AUTHENTICATIONTYPE = "Windows Authentication"</Condition>
|
||||||
|
<Condition Action="enable">NOT(AUTHENTICATIONTYPE = "Windows Authentication")</Condition>
|
||||||
|
</Control>
|
||||||
|
<Control Type="Text" Id="DatabaseLabel" Width="50" Height="17" X="80" Y="172" Text="Database:" />
|
||||||
|
<Control Type="Edit" Id="DatabaseEdit" Width="163" Height="17" X="142" Y="172" Property="DATABASENAME" />
|
||||||
|
</Dialog>
|
||||||
|
<Dialog Id="ConnectionWarningDlg" Width="250" Height="85" Title="[ProductName] Setup" NoMinimize="yes">
|
||||||
|
<Control Id="Ok" Type="PushButton" X="184" Y="60" Width="56" Height="17" Text="Ok">
|
||||||
|
<Publish Event="EndDialog" Value="Return">1</Publish>
|
||||||
|
</Control>
|
||||||
|
<Control Id="Text" Type="Text" X="8" Y="8" Width="221" Height="30">
|
||||||
|
<Text>Connection not valid.</Text>
|
||||||
|
</Control>
|
||||||
|
</Dialog>
|
||||||
|
<Dialog Id="InstallLocationDlg" Width="370" Height="270" Title="[ProductName] Setup">
|
||||||
|
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="Next">
|
||||||
|
<Publish Event="NewDialog" Value="DatabaseConnectionDlg" Order="3">1</Publish>
|
||||||
|
</Control>
|
||||||
|
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="Back">
|
||||||
|
<Publish Event="NewDialog" Value="LicenseAgreementDlg" Order="3">1</Publish>
|
||||||
|
</Control>
|
||||||
|
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
|
||||||
|
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
|
||||||
|
</Control>
|
||||||
|
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="Configure Scheduler Service Install location" />
|
||||||
|
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="{\WixUI_Font_Title}Install Location" />
|
||||||
|
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="[BannerBitmap]" />
|
||||||
|
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
|
||||||
|
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
|
||||||
|
<Control Id="FolderLabel" Type="Text" X="20" Y="60" Width="290" Height="30" NoPrefix="yes" Text="Folder Name:" />
|
||||||
|
<Control Id="Folder" Type="PathEdit" X="22" Y="90" Width="320" Height="15" Property="WIXUI_INSTALLDIR" Indirect="yes" />
|
||||||
|
</Dialog>
|
||||||
|
<Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="InstallLocationDlg" Order="3">
|
||||||
|
LicenseAccepted = "1"
|
||||||
|
</Publish>
|
||||||
|
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="DatabaseConnectionDlg">1</Publish>
|
||||||
|
<TextStyle Id="DlgTitleFont" FaceName="Tahoma" Size="8" Bold="yes" />
|
||||||
|
</UI>
|
||||||
|
<InstallExecuteSequence>
|
||||||
|
<Custom Action="FinalizeInstall" After="InstallFinalize" />
|
||||||
|
</InstallExecuteSequence>
|
||||||
|
</Product>
|
||||||
|
<Fragment>
|
||||||
|
<CustomAction Id="CheckConnection" BinaryKey="CheckConnection.CA" DllEntry="CheckConnection" />
|
||||||
|
<Binary Id="CheckConnection.CA" SourceFile="bin\WebsitePanel.SchedulerServiceInstaller.CA.dll" />
|
||||||
|
</Fragment>
|
||||||
|
<Fragment>
|
||||||
|
<CustomAction Id="FinalizeInstall" BinaryKey="CheckConnection.CA" DllEntry="FinalizeInstall" />
|
||||||
|
</Fragment>
|
||||||
|
<Fragment>
|
||||||
|
<Directory Id="TARGETDIR" Name="SourceDir">
|
||||||
|
<Directory Id="WEBSITEPANELFOLDER" Name="WebsitePanel">
|
||||||
|
<Directory Id="INSTALLFOLDER" Name="SchedulerService" />
|
||||||
|
</Directory>
|
||||||
|
</Directory>
|
||||||
|
</Fragment>
|
||||||
|
<Fragment>
|
||||||
|
<DirectoryRef Id="INSTALLFOLDER">
|
||||||
|
<Component Id="ProductFiles" Guid="A89FA6CF-53E2-4390-9E9D-11CD4297D739">
|
||||||
|
<File Id="WebsitePanel.SchedulerService.exe" Source="$(var.BUILDPATH)\WebsitePanel.SchedulerService.exe" />
|
||||||
|
<File Id="WebsitePanel.SchedulerService.exe.config" Source="$(var.BUILDPATH)\WebsitePanel.SchedulerService.exe.config" />
|
||||||
|
<File Id="Ionic.Zip.Reduced.dll" Source="$(var.SERVERBUILDPATH)\Ionic.Zip.Reduced.dll"/>
|
||||||
|
<File Id="Microsoft.Web.Services3.dll" Source="$(var.SERVERBUILDPATH)\Microsoft.Web.Services3.dll"/>
|
||||||
|
<File Id="WebsitePanel.Common.Utils.dll" Source="$(var.BUILDPATH)\WebsitePanel.Common.Utils.dll"/>
|
||||||
|
<File Id="WebsitePanel.EnterpriseServer.Base.dll" Source="$(var.BUILDPATH)\WebsitePanel.EnterpriseServer.Base.dll"/>
|
||||||
|
<File Id="WebsitePanel.EnterpriseServer.Code.dll" Source="$(var.BUILDPATH)\WebsitePanel.EnterpriseServer.Code.dll"/>
|
||||||
|
<File Id="WebsitePanel.Providers.Base.dll" Source="$(var.BUILDPATH)\WebsitePanel.Providers.Base.dll"/>
|
||||||
|
<File Id="WebsitePanel.Server.Client.dll" Source="$(var.BUILDPATH)\WebsitePanel.Server.Client.dll"/>
|
||||||
|
<File Id="WebsitePanel.Templates.dll" Source="$(var.BUILDPATH)\WebsitePanel.Templates.dll"/>
|
||||||
|
<File Id="WebsitePanel.Whois.dll" Source="$(var.BUILDPATH)\WebsitePanel.Whois.dll"/>
|
||||||
|
</Component>
|
||||||
|
</DirectoryRef>
|
||||||
|
</Fragment>
|
||||||
|
</Wix>
|
|
@ -0,0 +1,52 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||||
|
<ProductVersion>3.7</ProductVersion>
|
||||||
|
<ProjectGuid>{ead7c528-ea3d-40e8-9688-9f1d8dc8d758}</ProjectGuid>
|
||||||
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
|
<OutputName>Setup.SchedulerService</OutputName>
|
||||||
|
<OutputType>Package</OutputType>
|
||||||
|
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
|
||||||
|
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||||
|
<OutputPath>bin\</OutputPath>
|
||||||
|
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
|
||||||
|
<DefineConstants>Debug;BUILD=debug</DefineConstants>
|
||||||
|
<SuppressValidation>False</SuppressValidation>
|
||||||
|
<SuppressIces>
|
||||||
|
</SuppressIces>
|
||||||
|
<CompilerAdditionalOptions>
|
||||||
|
</CompilerAdditionalOptions>
|
||||||
|
<LinkerAdditionalOptions>
|
||||||
|
</LinkerAdditionalOptions>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||||
|
<OutputPath>bin\$(Configuration)\</OutputPath>
|
||||||
|
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
|
||||||
|
<DefineConstants>BUILD=release</DefineConstants>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Product.wxs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="Config.wxi" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<WixExtension Include="WixUIExtension">
|
||||||
|
<HintPath>..\..\..\tools\WIX\WixUIExtension.dll</HintPath>
|
||||||
|
<Name>WixUIExtension</Name>
|
||||||
|
</WixExtension>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(WixTargetsPath)" />
|
||||||
|
<!--
|
||||||
|
To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Wix.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
</Project>
|
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
Binary file not shown.
After Width: | Height: | Size: 84 KiB |
BIN
WebsitePanel.Installer/Sources/Setup.SchedulerService/dlgbmp.bmp
Normal file
BIN
WebsitePanel.Installer/Sources/Setup.SchedulerService/dlgbmp.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 451 KiB |
|
@ -1,7 +1,7 @@
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// This code was generated by a tool.
|
// This code was generated by a tool.
|
||||||
// Runtime Version:4.0.30319.18010
|
// Runtime Version:4.0.30319.18033
|
||||||
//
|
//
|
||||||
// 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.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 2012
|
# Visual Studio 2010
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{129305D5-A9E6-4DCE-BFF6-41809E13EEEE}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{129305D5-A9E6-4DCE-BFF6-41809E13EEEE}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
..\..\WebsitePanel\build.xml = ..\..\WebsitePanel\build.xml
|
..\..\WebsitePanel\build.xml = ..\..\WebsitePanel\build.xml
|
||||||
|
@ -24,6 +24,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Installer.Core
|
||||||
EndProject
|
EndProject
|
||||||
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "Setup.WIX", "Setup.WIX\Setup.WIX.wixproj", "{F963A4AF-CC72-4512-B636-829345C35318}"
|
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "Setup.WIX", "Setup.WIX\Setup.WIX.wixproj", "{F963A4AF-CC72-4512-B636-829345C35318}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "Setup.SchedulerService", "Setup.SchedulerService\Setup.SchedulerService.wixproj", "{EAD7C528-EA3D-40E8-9688-9F1D8DC8D758}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.SchedulerServiceInstaller", "WebsitePanel.SchedulerServiceInstaller\WebsitePanel.SchedulerServiceInstaller.csproj", "{24A4C231-73A9-4F03-ABAD-9A8FE5324495}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
@ -96,6 +100,26 @@ Global
|
||||||
{F963A4AF-CC72-4512-B636-829345C35318}.Release|Mixed Platforms.Build.0 = Release|x86
|
{F963A4AF-CC72-4512-B636-829345C35318}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||||
{F963A4AF-CC72-4512-B636-829345C35318}.Release|x86.ActiveCfg = Release|x86
|
{F963A4AF-CC72-4512-B636-829345C35318}.Release|x86.ActiveCfg = Release|x86
|
||||||
{F963A4AF-CC72-4512-B636-829345C35318}.Release|x86.Build.0 = Release|x86
|
{F963A4AF-CC72-4512-B636-829345C35318}.Release|x86.Build.0 = Release|x86
|
||||||
|
{EAD7C528-EA3D-40E8-9688-9F1D8DC8D758}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||||
|
{EAD7C528-EA3D-40E8-9688-9F1D8DC8D758}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||||
|
{EAD7C528-EA3D-40E8-9688-9F1D8DC8D758}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||||
|
{EAD7C528-EA3D-40E8-9688-9F1D8DC8D758}.Debug|x86.ActiveCfg = Debug|x86
|
||||||
|
{EAD7C528-EA3D-40E8-9688-9F1D8DC8D758}.Debug|x86.Build.0 = Debug|x86
|
||||||
|
{EAD7C528-EA3D-40E8-9688-9F1D8DC8D758}.Release|Any CPU.ActiveCfg = Release|x86
|
||||||
|
{EAD7C528-EA3D-40E8-9688-9F1D8DC8D758}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||||
|
{EAD7C528-EA3D-40E8-9688-9F1D8DC8D758}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||||
|
{EAD7C528-EA3D-40E8-9688-9F1D8DC8D758}.Release|x86.ActiveCfg = Release|x86
|
||||||
|
{EAD7C528-EA3D-40E8-9688-9F1D8DC8D758}.Release|x86.Build.0 = Release|x86
|
||||||
|
{24A4C231-73A9-4F03-ABAD-9A8FE5324495}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||||
|
{24A4C231-73A9-4F03-ABAD-9A8FE5324495}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||||
|
{24A4C231-73A9-4F03-ABAD-9A8FE5324495}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||||
|
{24A4C231-73A9-4F03-ABAD-9A8FE5324495}.Debug|x86.ActiveCfg = Debug|x86
|
||||||
|
{24A4C231-73A9-4F03-ABAD-9A8FE5324495}.Debug|x86.Build.0 = Debug|x86
|
||||||
|
{24A4C231-73A9-4F03-ABAD-9A8FE5324495}.Release|Any CPU.ActiveCfg = Release|x86
|
||||||
|
{24A4C231-73A9-4F03-ABAD-9A8FE5324495}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||||
|
{24A4C231-73A9-4F03-ABAD-9A8FE5324495}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||||
|
{24A4C231-73A9-4F03-ABAD-9A8FE5324495}.Release|x86.ActiveCfg = Release|x86
|
||||||
|
{24A4C231-73A9-4F03-ABAD-9A8FE5324495}.Release|x86.Build.0 = Release|x86
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<configuration>
|
||||||
|
<startup useLegacyV2RuntimeActivationPolicy="true">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Use supportedRuntime tags to explicitly specify the version(s) of the .NET Framework runtime that
|
||||||
|
the custom action should run on. If no versions are specified, the chosen version of the runtime
|
||||||
|
will be the "best" match to what Microsoft.Deployment.WindowsInstaller.dll was built against.
|
||||||
|
|
||||||
|
WARNING: leaving the version unspecified is dangerous as it introduces a risk of compatibility
|
||||||
|
problems with future versions of the .NET Framework runtime. It is highly recommended that you specify
|
||||||
|
only the version(s) of the .NET Framework runtime that you have tested against.
|
||||||
|
|
||||||
|
Note for .NET Framework v3.0 and v3.5, the runtime version is still v2.0.
|
||||||
|
|
||||||
|
In order to enable .NET Framework version 2.0 runtime activation policy, which is to load all assemblies
|
||||||
|
by using the latest supported runtime, @useLegacyV2RuntimeActivationPolicy="true".
|
||||||
|
|
||||||
|
For more information, see http://msdn.microsoft.com/en-us/library/bbx34a2h.aspx
|
||||||
|
-->
|
||||||
|
|
||||||
|
<supportedRuntime version="v4.0" />
|
||||||
|
<supportedRuntime version="v2.0.50727"/>
|
||||||
|
|
||||||
|
</startup>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Add additional configuration settings here. For more information on application config files,
|
||||||
|
see http://msdn.microsoft.com/en-us/library/kza1yk3a.aspx
|
||||||
|
-->
|
||||||
|
|
||||||
|
</configuration>
|
|
@ -0,0 +1,142 @@
|
||||||
|
using System;
|
||||||
|
using System.Configuration.Install;
|
||||||
|
using System.Data;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.ServiceProcess;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using Microsoft.Deployment.WindowsInstaller;
|
||||||
|
|
||||||
|
namespace WebsitePanel.SchedulerServiceInstaller
|
||||||
|
{
|
||||||
|
public class CustomActions
|
||||||
|
{
|
||||||
|
[CustomAction]
|
||||||
|
public static ActionResult CheckConnection(Session session)
|
||||||
|
{
|
||||||
|
string testConnectionString = session["AUTHENTICATIONTYPE"].Equals("Windows Authentication") ? GetConnectionString(session["SERVERNAME"], "master") : GetConnectionString(session["SERVERNAME"], "master", session["LOGIN"], session["PASSWORD"]);
|
||||||
|
|
||||||
|
if (CheckConnection(testConnectionString))
|
||||||
|
{
|
||||||
|
session["CORRECTCONNECTION"] = "1";
|
||||||
|
session["CONNECTIONSTRING"] = session["AUTHENTICATIONTYPE"].Equals("Windows Authentication") ? GetConnectionString(session["SERVERNAME"], session["DATABASENAME"]) : GetConnectionString(session["SERVERNAME"], session["DATABASENAME"], session["LOGIN"], session["PASSWORD"]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
session["CORRECTCONNECTION"] = "0";
|
||||||
|
}
|
||||||
|
|
||||||
|
return ActionResult.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
[CustomAction]
|
||||||
|
public static ActionResult FinalizeInstall(Session session)
|
||||||
|
{
|
||||||
|
ChangeConfigString("installer.connectionstring", session["CONNECTIONSTRING"], session["INSTALLFOLDER"]);
|
||||||
|
ChangeCryptoKey(session["INSTALLFOLDER"]);
|
||||||
|
InstallService(session["INSTALLFOLDER"]);
|
||||||
|
|
||||||
|
return ActionResult.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void InstallService(string installFolder)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ServiceController.GetServices().Any(s => s.DisplayName.Equals("WebsitePanel Scheduler", StringComparison.CurrentCultureIgnoreCase)))
|
||||||
|
{
|
||||||
|
ManagedInstallerClass.InstallHelper(new[] {"/i", Path.Combine(installFolder, "WebsitePanel.SchedulerService.exe")});
|
||||||
|
}
|
||||||
|
|
||||||
|
StartService("WebsitePanel Scheduler");
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ChangeCryptoKey(string installFolder)
|
||||||
|
{
|
||||||
|
string path = Path.Combine(installFolder.Replace("SchedulerService", "Enterprise Server"), "web.config");
|
||||||
|
string cryptoKey = "0123456789";
|
||||||
|
|
||||||
|
if (File.Exists(path))
|
||||||
|
{
|
||||||
|
using (var reader = new StreamReader(path))
|
||||||
|
{
|
||||||
|
string content = reader.ReadToEnd();
|
||||||
|
var pattern = new Regex(@"(?<=<add key=""WebsitePanel.CryptoKey"" .*?value\s*=\s*"")[^""]+(?="".*?>)");
|
||||||
|
Match match = pattern.Match(content);
|
||||||
|
cryptoKey = match.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ChangeConfigString("installer.cryptokey", cryptoKey, installFolder);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ChangeConfigString(string searchString, string replaceValue, string installFolder)
|
||||||
|
{
|
||||||
|
string content;
|
||||||
|
string path = Path.Combine(installFolder, "WebsitePanel.SchedulerService.exe.config");
|
||||||
|
|
||||||
|
using (var reader = new StreamReader(path))
|
||||||
|
{
|
||||||
|
content = reader.ReadToEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
var re = new Regex("\\$\\{" + searchString + "\\}+", RegexOptions.IgnoreCase);
|
||||||
|
content = re.Replace(content, replaceValue);
|
||||||
|
|
||||||
|
using (var writer = new StreamWriter(path))
|
||||||
|
{
|
||||||
|
writer.Write(content);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void StartService(string serviceName)
|
||||||
|
{
|
||||||
|
var sc = new ServiceController(serviceName);
|
||||||
|
|
||||||
|
if (sc.Status == ServiceControllerStatus.Stopped)
|
||||||
|
{
|
||||||
|
sc.Start();
|
||||||
|
sc.WaitForStatus(ServiceControllerStatus.Running);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string GetConnectionString(string serverName, string databaseName)
|
||||||
|
{
|
||||||
|
return string.Format("Server={0};database={1};Trusted_Connection=true;", serverName, databaseName);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string GetConnectionString(string serverName, string databaseName, string login, string password)
|
||||||
|
{
|
||||||
|
return string.Format("Server={0};database={1};uid={2};password={3};", serverName, databaseName, login, password);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool CheckConnection(string connectionString)
|
||||||
|
{
|
||||||
|
var connection = new SqlConnection(connectionString);
|
||||||
|
bool result = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
connection.Open();
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (connection != null && connection.State == ConnectionState.Open)
|
||||||
|
{
|
||||||
|
connection.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("WebsitePanel.SchedulerServiceInstaller")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("WebsitePanel.SchedulerServiceInstaller")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2013")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("64885563-cef3-4553-9006-31282c033b3b")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,52 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||||
|
<ProductVersion>8.0.30703</ProductVersion>
|
||||||
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
|
<ProjectGuid>{24A4C231-73A9-4F03-ABAD-9A8FE5324495}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>WebsitePanel.SchedulerServiceInstaller</RootNamespace>
|
||||||
|
<AssemblyName>WebsitePanel.SchedulerServiceInstaller</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<WixCATargetsPath Condition=" '$(WixCATargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.CA.targets</WixCATargetsPath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>..\Setup.SchedulerService\bin\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>..\Setup.SchedulerService\bin\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Configuration.Install" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.ServiceProcess" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="Microsoft.Deployment.WindowsInstaller" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="CustomAction.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Content Include="CustomAction.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<Import Project="$(WixCATargetsPath)" />
|
||||||
|
</Project>
|
|
@ -28,6 +28,9 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration.Install;
|
||||||
|
using System.Linq;
|
||||||
|
using System.ServiceProcess;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
@ -97,7 +100,7 @@ namespace WebsitePanel.Setup.Actions
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CreateDatabaseAction : Action, IInstallAction, IUninstallAction
|
public class CreateDatabaseAction : Action, IInstallAction, IUninstallAction
|
||||||
{
|
{
|
||||||
|
@ -347,7 +350,7 @@ namespace WebsitePanel.Setup.Actions
|
||||||
Log.WriteEnd(String.Format("Updated {0} file", vars.ConfigurationFile));
|
Log.WriteEnd(String.Format("Updated {0} file", vars.ConfigurationFile));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SaveEntServerConfigSettingsAction : Action, IInstallAction
|
public class SaveEntServerConfigSettingsAction : Action, IInstallAction
|
||||||
{
|
{
|
||||||
void IInstallAction.Run(SetupVariables vars)
|
void IInstallAction.Run(SetupVariables vars)
|
||||||
|
@ -390,7 +393,7 @@ namespace WebsitePanel.Setup.Actions
|
||||||
new UpdateServeradminPasswAction(),
|
new UpdateServeradminPasswAction(),
|
||||||
new SaveAspNetDbConnectionStringAction(),
|
new SaveAspNetDbConnectionStringAction(),
|
||||||
new SaveComponentConfigSettingsAction(),
|
new SaveComponentConfigSettingsAction(),
|
||||||
new SaveEntServerConfigSettingsAction()
|
new SaveEntServerConfigSettingsAction()
|
||||||
};
|
};
|
||||||
|
|
||||||
public EntServerActionManager(SetupVariables sessionVars) : base(sessionVars)
|
public EntServerActionManager(SetupVariables sessionVars) : base(sessionVars)
|
||||||
|
|
|
@ -76,7 +76,7 @@ namespace WebsitePanel.Setup
|
||||||
public const string DatabaseName = "DatabaseName";
|
public const string DatabaseName = "DatabaseName";
|
||||||
public const string ConnectionString = "ConnectionString";
|
public const string ConnectionString = "ConnectionString";
|
||||||
public const string InstallConnectionString = "InstallConnectionString";
|
public const string InstallConnectionString = "InstallConnectionString";
|
||||||
public const string Release = "Release";
|
public const string Release = "Release";
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class Messages
|
public abstract class Messages
|
||||||
|
|
|
@ -74,6 +74,7 @@
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.configuration" />
|
<Reference Include="System.configuration" />
|
||||||
|
<Reference Include="System.Configuration.Install" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.DirectoryServices" />
|
<Reference Include="System.DirectoryServices" />
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
|
|
|
@ -27,11 +27,14 @@
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Configuration.Install;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
using System.Linq;
|
||||||
|
using System.ServiceProcess;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
@ -208,17 +211,19 @@ namespace WebsitePanel.Setup
|
||||||
Log.WriteError("Windows service stop error", ex);
|
Log.WriteError("Windows service stop error", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
int exitCode = Utils.RunProcess(path, "/u");
|
try
|
||||||
if (exitCode == 0)
|
{
|
||||||
{
|
ManagedInstallerClass.InstallHelper(new[] {"/u", path});
|
||||||
Log.WriteEnd("Removed Windows service");
|
}
|
||||||
InstallLog.AppendLine(string.Format("- Removed \"{0}\" Windows service", serviceName));
|
catch(Exception)
|
||||||
}
|
{
|
||||||
else
|
Log.WriteError(string.Format("Unable to remove \"{0}\" Windows service.", serviceName), null);
|
||||||
{
|
InstallLog.AppendLine(string.Format("- Failed to remove \"{0}\" Windows service", serviceName));
|
||||||
Log.WriteError(string.Format("Unable to remove \"{0}\" Windows service. Error code: {1}", serviceName, exitCode), null);
|
throw;
|
||||||
InstallLog.AppendLine(string.Format("- Failed to remove \"{0}\" Windows service", serviceName));
|
}
|
||||||
}
|
|
||||||
|
Log.WriteEnd("Removed Windows service");
|
||||||
|
InstallLog.AppendLine(string.Format("- Removed \"{0}\" Windows service", serviceName));
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -268,7 +273,7 @@ namespace WebsitePanel.Setup
|
||||||
|
|
||||||
internal List<InstallAction> GetUninstallActions(string componentId)
|
internal List<InstallAction> GetUninstallActions(string componentId)
|
||||||
{
|
{
|
||||||
List<InstallAction> list = new List<InstallAction>();
|
var list = new List<InstallAction>();
|
||||||
InstallAction action = null;
|
InstallAction action = null;
|
||||||
|
|
||||||
//windows service
|
//windows service
|
||||||
|
@ -283,8 +288,7 @@ namespace WebsitePanel.Setup
|
||||||
action.Description = "Removing Windows service...";
|
action.Description = "Removing Windows service...";
|
||||||
action.Log = string.Format("- Remove {0} Windows service", serviceName);
|
action.Log = string.Format("- Remove {0} Windows service", serviceName);
|
||||||
list.Add(action);
|
list.Add(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//database
|
//database
|
||||||
bool deleteDatabase = AppConfig.GetComponentSettingBooleanValue(componentId, "NewDatabase");
|
bool deleteDatabase = AppConfig.GetComponentSettingBooleanValue(componentId, "NewDatabase");
|
||||||
|
|
|
@ -450,10 +450,996 @@ INSERT [dbo].[Providers] ([ProviderID], [GroupID], [ProviderName], [DisplayName]
|
||||||
VALUES (1401, 41, N'Lync2013', N'Microsoft Lync Server 2013 Multitenant Hosting Pack', N'WebsitePanel.Providers.HostedSolution.Lync2013, WebsitePanel.Providers.HostedSolution.Lync2013', N'Lync', NULL)
|
VALUES (1401, 41, N'Lync2013', N'Microsoft Lync Server 2013 Multitenant Hosting Pack', N'WebsitePanel.Providers.HostedSolution.Lync2013, WebsitePanel.Providers.HostedSolution.Lync2013', N'Lync', NULL)
|
||||||
END
|
END
|
||||||
GO
|
GO
|
||||||
|
|
||||||
-- add Application Pools Restart Quota
|
-- add Application Pools Restart Quota
|
||||||
INSERT [dbo].[Quotas] ([QuotaID], [GroupID], [QuotaOrder], [QuotaName], [QuotaDescription], [QuotaTypeID], [ServiceQuota], [ItemTypeID], [HideQuota]) VALUES (411, 2, 13, N'Web.AppPoolsRestart', N'Application Pools Restart', 1, 0, NULL, NULL)
|
INSERT [dbo].[Quotas] ([QuotaID], [GroupID], [QuotaOrder], [QuotaName], [QuotaDescription], [QuotaTypeID], [ServiceQuota], [ItemTypeID], [HideQuota]) VALUES (411, 2, 13, N'Web.AppPoolsRestart', N'Application Pools Restart', 1, 0, NULL, NULL)
|
||||||
GO
|
GO
|
||||||
|
-------------------------------- Scheduler Service------------------------------------------------------
|
||||||
|
|
||||||
|
IF EXISTS( SELECT * FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
|
WHERE TABLE_NAME = 'Schedule'
|
||||||
|
AND COLUMN_NAME = 'LastFinish')
|
||||||
|
ALTER TABLE Schedule
|
||||||
|
DROP COLUMN LastFinish
|
||||||
|
GO
|
||||||
|
|
||||||
|
ALTER PROCEDURE [dbo].[GetSchedule]
|
||||||
|
(
|
||||||
|
@ActorID int,
|
||||||
|
@ScheduleID int
|
||||||
|
)
|
||||||
|
AS
|
||||||
|
|
||||||
|
-- select schedule
|
||||||
|
SELECT TOP 1
|
||||||
|
S.ScheduleID,
|
||||||
|
S.TaskID,
|
||||||
|
S.PackageID,
|
||||||
|
S.ScheduleName,
|
||||||
|
S.ScheduleTypeID,
|
||||||
|
S.Interval,
|
||||||
|
S.FromTime,
|
||||||
|
S.ToTime,
|
||||||
|
S.StartTime,
|
||||||
|
S.LastRun,
|
||||||
|
S.NextRun,
|
||||||
|
S.Enabled,
|
||||||
|
S.HistoriesNumber,
|
||||||
|
S.PriorityID,
|
||||||
|
S.MaxExecutionTime,
|
||||||
|
S.WeekMonthDay,
|
||||||
|
1 AS StatusID
|
||||||
|
FROM Schedule AS S
|
||||||
|
WHERE
|
||||||
|
S.ScheduleID = @ScheduleID
|
||||||
|
AND dbo.CheckActorPackageRights(@ActorID, S.PackageID) = 1
|
||||||
|
|
||||||
|
-- select task
|
||||||
|
SELECT
|
||||||
|
ST.TaskID,
|
||||||
|
ST.TaskType,
|
||||||
|
ST.RoleID
|
||||||
|
FROM Schedule AS S
|
||||||
|
INNER JOIN ScheduleTasks AS ST ON S.TaskID = ST.TaskID
|
||||||
|
WHERE
|
||||||
|
S.ScheduleID = @ScheduleID
|
||||||
|
AND dbo.CheckActorPackageRights(@ActorID, S.PackageID) = 1
|
||||||
|
|
||||||
|
-- select schedule parameters
|
||||||
|
SELECT
|
||||||
|
S.ScheduleID,
|
||||||
|
STP.ParameterID,
|
||||||
|
STP.DataTypeID,
|
||||||
|
ISNULL(SP.ParameterValue, STP.DefaultValue) AS ParameterValue
|
||||||
|
FROM Schedule AS S
|
||||||
|
INNER JOIN ScheduleTaskParameters AS STP ON S.TaskID = STP.TaskID
|
||||||
|
LEFT OUTER JOIN ScheduleParameters AS SP ON STP.ParameterID = SP.ParameterID AND SP.ScheduleID = S.ScheduleID
|
||||||
|
WHERE
|
||||||
|
S.ScheduleID = @ScheduleID
|
||||||
|
AND dbo.CheckActorPackageRights(@ActorID, S.PackageID) = 1
|
||||||
|
|
||||||
|
RETURN
|
||||||
|
GO
|
||||||
|
|
||||||
|
ALTER PROCEDURE [dbo].[GetScheduleInternal]
|
||||||
|
(
|
||||||
|
@ScheduleID int
|
||||||
|
)
|
||||||
|
AS
|
||||||
|
|
||||||
|
-- select schedule
|
||||||
|
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.NextRun,
|
||||||
|
S.Enabled,
|
||||||
|
1 AS StatusID,
|
||||||
|
S.PriorityID,
|
||||||
|
S.HistoriesNumber,
|
||||||
|
S.MaxExecutionTime,
|
||||||
|
S.WeekMonthDay
|
||||||
|
FROM Schedule AS S
|
||||||
|
INNER JOIN ScheduleTasks AS ST ON S.TaskID = ST.TaskID
|
||||||
|
WHERE ScheduleID = @ScheduleID
|
||||||
|
RETURN
|
||||||
|
GO
|
||||||
|
|
||||||
|
ALTER PROCEDURE [dbo].[GetSchedules]
|
||||||
|
(
|
||||||
|
@ActorID int,
|
||||||
|
@PackageID int,
|
||||||
|
@Recursive bit
|
||||||
|
)
|
||||||
|
AS
|
||||||
|
|
||||||
|
-- check rights
|
||||||
|
IF dbo.CheckActorPackageRights(@ActorID, @PackageID) = 0
|
||||||
|
RAISERROR('You are not allowed to access this package', 16, 1)
|
||||||
|
|
||||||
|
DECLARE @Schedules TABLE
|
||||||
|
(
|
||||||
|
ScheduleID int
|
||||||
|
)
|
||||||
|
|
||||||
|
INSERT INTO @Schedules (ScheduleID)
|
||||||
|
SELECT
|
||||||
|
S.ScheduleID
|
||||||
|
FROM Schedule AS S
|
||||||
|
INNER JOIN PackagesTree(@PackageID, @Recursive) AS PT ON S.PackageID = PT.PackageID
|
||||||
|
ORDER BY S.Enabled DESC, S.NextRun
|
||||||
|
|
||||||
|
|
||||||
|
-- select schedules
|
||||||
|
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.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 @Schedules AS STEMP
|
||||||
|
INNER JOIN Schedule AS S ON STEMP.ScheduleID = S.ScheduleID
|
||||||
|
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
|
||||||
|
|
||||||
|
-- select schedule parameters
|
||||||
|
SELECT
|
||||||
|
S.ScheduleID,
|
||||||
|
STP.ParameterID,
|
||||||
|
STP.DataTypeID,
|
||||||
|
ISNULL(SP.ParameterValue, STP.DefaultValue) AS ParameterValue
|
||||||
|
FROM @Schedules AS STEMP
|
||||||
|
INNER JOIN Schedule AS S ON STEMP.ScheduleID = S.ScheduleID
|
||||||
|
INNER JOIN ScheduleTaskParameters AS STP ON S.TaskID = STP.TaskID
|
||||||
|
LEFT OUTER JOIN ScheduleParameters AS SP ON STP.ParameterID = SP.ParameterID AND SP.ScheduleID = S.ScheduleID
|
||||||
|
RETURN
|
||||||
|
GO
|
||||||
|
|
||||||
|
ALTER PROCEDURE [dbo].[GetSchedulesPaged]
|
||||||
|
(
|
||||||
|
@ActorID int,
|
||||||
|
@PackageID int,
|
||||||
|
@Recursive bit,
|
||||||
|
@FilterColumn nvarchar(50) = '',
|
||||||
|
@FilterValue nvarchar(50) = '',
|
||||||
|
@SortColumn nvarchar(50),
|
||||||
|
@StartRow int,
|
||||||
|
@MaximumRows int
|
||||||
|
)
|
||||||
|
AS
|
||||||
|
BEGIN
|
||||||
|
|
||||||
|
-- check rights
|
||||||
|
IF dbo.CheckActorPackageRights(@ActorID, @PackageID) = 0
|
||||||
|
RAISERROR('You are not allowed to access this package', 16, 1)
|
||||||
|
|
||||||
|
DECLARE @condition nvarchar(400)
|
||||||
|
SET @condition = ' 1 = 1 '
|
||||||
|
|
||||||
|
IF @FilterColumn <> '' AND @FilterColumn IS NOT NULL
|
||||||
|
AND @FilterValue <> '' AND @FilterValue IS NOT NULL
|
||||||
|
SET @condition = @condition + ' AND ' + @FilterColumn + ' LIKE ''' + @FilterValue + ''''
|
||||||
|
|
||||||
|
IF @SortColumn IS NULL OR @SortColumn = ''
|
||||||
|
SET @SortColumn = 'S.ScheduleName ASC'
|
||||||
|
|
||||||
|
DECLARE @sql nvarchar(3500)
|
||||||
|
|
||||||
|
set @sql = '
|
||||||
|
SELECT COUNT(S.ScheduleID) FROM Schedule AS S
|
||||||
|
INNER JOIN PackagesTree(@PackageID, @Recursive) AS PT ON S.PackageID = PT.PackageID
|
||||||
|
INNER JOIN Packages AS P ON S.PackageID = P.PackageID
|
||||||
|
INNER JOIN UsersDetailed AS U ON P.UserID = U.UserID
|
||||||
|
WHERE ' + @condition + '
|
||||||
|
|
||||||
|
DECLARE @Schedules AS TABLE
|
||||||
|
(
|
||||||
|
ScheduleID int
|
||||||
|
);
|
||||||
|
|
||||||
|
WITH TempSchedules AS (
|
||||||
|
SELECT ROW_NUMBER() OVER (ORDER BY ' + @SortColumn + ') as Row,
|
||||||
|
S.ScheduleID
|
||||||
|
FROM Schedule AS S
|
||||||
|
INNER JOIN Packages AS P ON S.PackageID = P.PackageID
|
||||||
|
INNER JOIN PackagesTree(@PackageID, @Recursive) AS PT ON S.PackageID = PT.PackageID
|
||||||
|
INNER JOIN UsersDetailed AS U ON P.UserID = U.UserID
|
||||||
|
WHERE ' + @condition + '
|
||||||
|
)
|
||||||
|
|
||||||
|
INSERT INTO @Schedules
|
||||||
|
SELECT ScheduleID FROM TempSchedules
|
||||||
|
WHERE TempSchedules.Row BETWEEN @StartRow and @StartRow + @MaximumRows - 1
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
S.ScheduleID,
|
||||||
|
S.TaskID,
|
||||||
|
ST.TaskType,
|
||||||
|
ST.RoleID,
|
||||||
|
S.ScheduleName,
|
||||||
|
S.ScheduleTypeID,
|
||||||
|
S.Interval,
|
||||||
|
S.FromTime,
|
||||||
|
S.ToTime,
|
||||||
|
S.StartTime,
|
||||||
|
S.LastRun,
|
||||||
|
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,
|
||||||
|
|
||||||
|
-- packages
|
||||||
|
P.PackageID,
|
||||||
|
P.PackageName,
|
||||||
|
|
||||||
|
-- user
|
||||||
|
P.UserID,
|
||||||
|
U.Username,
|
||||||
|
U.FirstName,
|
||||||
|
U.LastName,
|
||||||
|
U.FullName,
|
||||||
|
U.RoleID,
|
||||||
|
U.Email
|
||||||
|
FROM @Schedules AS STEMP
|
||||||
|
INNER JOIN Schedule AS S ON STEMP.ScheduleID = S.ScheduleID
|
||||||
|
INNER JOIN ScheduleTasks AS ST ON S.TaskID = ST.TaskID
|
||||||
|
INNER JOIN Packages AS P ON S.PackageID = P.PackageID
|
||||||
|
INNER JOIN UsersDetailed AS U ON P.UserID = U.UserID'
|
||||||
|
|
||||||
|
exec sp_executesql @sql, N'@PackageID int, @StartRow int, @MaximumRows int, @Recursive bit',
|
||||||
|
@PackageID, @StartRow, @MaximumRows, @Recursive
|
||||||
|
|
||||||
|
END
|
||||||
|
RETURN
|
||||||
|
GO
|
||||||
|
|
||||||
|
ALTER PROCEDURE [dbo].[UpdateSchedule]
|
||||||
|
(
|
||||||
|
@ActorID int,
|
||||||
|
@ScheduleID int,
|
||||||
|
@TaskID nvarchar(100),
|
||||||
|
@ScheduleName nvarchar(100),
|
||||||
|
@ScheduleTypeID nvarchar(50),
|
||||||
|
@Interval int,
|
||||||
|
@FromTime datetime,
|
||||||
|
@ToTime datetime,
|
||||||
|
@StartTime datetime,
|
||||||
|
@LastRun datetime,
|
||||||
|
@NextRun datetime,
|
||||||
|
@Enabled bit,
|
||||||
|
@PriorityID nvarchar(50),
|
||||||
|
@HistoriesNumber int,
|
||||||
|
@MaxExecutionTime int,
|
||||||
|
@WeekMonthDay int,
|
||||||
|
@XmlParameters ntext
|
||||||
|
)
|
||||||
|
AS
|
||||||
|
|
||||||
|
-- check rights
|
||||||
|
DECLARE @PackageID int
|
||||||
|
SELECT @PackageID = PackageID FROM Schedule
|
||||||
|
WHERE ScheduleID = @ScheduleID
|
||||||
|
|
||||||
|
IF dbo.CheckActorPackageRights(@ActorID, @PackageID) = 0
|
||||||
|
RAISERROR('You are not allowed to access this package', 16, 1)
|
||||||
|
|
||||||
|
BEGIN TRAN
|
||||||
|
|
||||||
|
UPDATE Schedule
|
||||||
|
SET
|
||||||
|
TaskID = @TaskID,
|
||||||
|
ScheduleName = @ScheduleName,
|
||||||
|
ScheduleTypeID = @ScheduleTypeID,
|
||||||
|
Interval = @Interval,
|
||||||
|
FromTime = @FromTime,
|
||||||
|
ToTime = @ToTime,
|
||||||
|
StartTime = @StartTime,
|
||||||
|
LastRun = @LastRun,
|
||||||
|
NextRun = @NextRun,
|
||||||
|
Enabled = @Enabled,
|
||||||
|
PriorityID = @PriorityID,
|
||||||
|
HistoriesNumber = @HistoriesNumber,
|
||||||
|
MaxExecutionTime = @MaxExecutionTime,
|
||||||
|
WeekMonthDay = @WeekMonthDay
|
||||||
|
WHERE
|
||||||
|
ScheduleID = @ScheduleID
|
||||||
|
|
||||||
|
DECLARE @idoc int
|
||||||
|
--Create an internal representation of the XML document.
|
||||||
|
EXEC sp_xml_preparedocument @idoc OUTPUT, @XmlParameters
|
||||||
|
|
||||||
|
-- Execute a SELECT statement that uses the OPENXML rowset provider.
|
||||||
|
DELETE FROM ScheduleParameters
|
||||||
|
WHERE ScheduleID = @ScheduleID
|
||||||
|
|
||||||
|
INSERT INTO ScheduleParameters
|
||||||
|
(
|
||||||
|
ScheduleID,
|
||||||
|
ParameterID,
|
||||||
|
ParameterValue
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
@ScheduleID,
|
||||||
|
ParameterID,
|
||||||
|
ParameterValue
|
||||||
|
FROM OPENXML(@idoc, '/parameters/parameter',1) WITH
|
||||||
|
(
|
||||||
|
ParameterID nvarchar(50) '@id',
|
||||||
|
ParameterValue nvarchar(3000) '@value'
|
||||||
|
) as PV
|
||||||
|
|
||||||
|
-- remove document
|
||||||
|
exec sp_xml_removedocument @idoc
|
||||||
|
|
||||||
|
COMMIT TRAN
|
||||||
|
RETURN
|
||||||
|
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
|
||||||
|
|
||||||
|
IF EXISTS (SELECT * FROM SYS.TABLES WHERE name = 'BackgroundTaskStack')
|
||||||
|
DROP TABLE BackgroundTaskStack
|
||||||
|
GO
|
||||||
|
|
||||||
|
IF EXISTS (SELECT * FROM SYS.TABLES WHERE name = 'BackgroundTaskLogs')
|
||||||
|
DROP TABLE BackgroundTaskLogs
|
||||||
|
GO
|
||||||
|
|
||||||
|
IF EXISTS (SELECT * FROM SYS.TABLES WHERE name = 'BackgroundTaskParameters')
|
||||||
|
DROP TABLE BackgroundTaskParameters
|
||||||
|
GO
|
||||||
|
|
||||||
|
IF EXISTS (SELECT * FROM SYS.TABLES WHERE name = 'BackgroundTasks')
|
||||||
|
DROP TABLE BackgroundTasks
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE TABLE BackgroundTasks
|
||||||
|
(
|
||||||
|
ID INT IDENTITY(1,1) NOT NULL PRIMARY KEY,
|
||||||
|
Guid UNIQUEIDENTIFIER NOT NULL,
|
||||||
|
TaskID NVARCHAR(255),
|
||||||
|
ScheduleID INT NOT NULL,
|
||||||
|
PackageID INT NOT NULL,
|
||||||
|
UserID INT NOT NULL,
|
||||||
|
EffectiveUserID INT NOT NULL,
|
||||||
|
TaskName NVARCHAR(255),
|
||||||
|
ItemID INT,
|
||||||
|
ItemName NVARCHAR(255),
|
||||||
|
StartDate DATETIME NOT NULL,
|
||||||
|
FinishDate DATETIME,
|
||||||
|
IndicatorCurrent INT NOT NULL,
|
||||||
|
IndicatorMaximum INT NOT NULL,
|
||||||
|
MaximumExecutionTime INT NOT NULL,
|
||||||
|
Source NVARCHAR(MAX),
|
||||||
|
Severity INT NOT NULL,
|
||||||
|
Completed BIT,
|
||||||
|
NotifyOnComplete BIT,
|
||||||
|
Status INT NOT NULL
|
||||||
|
)
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE TABLE BackgroundTaskParameters
|
||||||
|
(
|
||||||
|
ParameterID INT IDENTITY(1,1) NOT NULL PRIMARY KEY,
|
||||||
|
TaskID INT NOT NULL,
|
||||||
|
Name NVARCHAR(255),
|
||||||
|
SerializerValue NTEXT,
|
||||||
|
TypeName NVARCHAR(255),
|
||||||
|
FOREIGN KEY (TaskID) REFERENCES BackgroundTasks (ID)
|
||||||
|
)
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE TABLE BackgroundTaskLogs
|
||||||
|
(
|
||||||
|
LogID INT IDENTITY(1,1) NOT NULL PRIMARY KEY,
|
||||||
|
TaskID INT NOT NULL,
|
||||||
|
Date DATETIME,
|
||||||
|
ExceptionStackTrace NTEXT,
|
||||||
|
InnerTaskStart INT,
|
||||||
|
Severity INT,
|
||||||
|
Text NTEXT,
|
||||||
|
TextIdent INT,
|
||||||
|
XmlParameters NTEXT,
|
||||||
|
FOREIGN KEY (TaskID) REFERENCES BackgroundTasks (ID)
|
||||||
|
)
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE TABLE BackgroundTaskStack
|
||||||
|
(
|
||||||
|
TaskStackID INT IDENTITY(1,1) NOT NULL PRIMARY KEY,
|
||||||
|
TaskID INT NOT NULL,
|
||||||
|
FOREIGN KEY (TaskID) REFERENCES BackgroundTasks (ID)
|
||||||
|
)
|
||||||
|
GO
|
||||||
|
|
||||||
|
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'AddBackgroundTask')
|
||||||
|
DROP PROCEDURE AddBackgroundTask
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE PROCEDURE [dbo].[AddBackgroundTask]
|
||||||
|
(
|
||||||
|
@BackgroundTaskID INT OUTPUT,
|
||||||
|
@Guid UNIQUEIDENTIFIER,
|
||||||
|
@TaskID NVARCHAR(255),
|
||||||
|
@ScheduleID INT,
|
||||||
|
@PackageID INT,
|
||||||
|
@UserID INT,
|
||||||
|
@EffectiveUserID INT,
|
||||||
|
@TaskName NVARCHAR(255),
|
||||||
|
@ItemID INT,
|
||||||
|
@ItemName NVARCHAR(255),
|
||||||
|
@StartDate DATETIME,
|
||||||
|
@IndicatorCurrent INT,
|
||||||
|
@IndicatorMaximum INT,
|
||||||
|
@MaximumExecutionTime INT,
|
||||||
|
@Source NVARCHAR(MAX),
|
||||||
|
@Severity INT,
|
||||||
|
@Completed BIT,
|
||||||
|
@NotifyOnComplete BIT,
|
||||||
|
@Status INT
|
||||||
|
)
|
||||||
|
AS
|
||||||
|
|
||||||
|
INSERT INTO BackgroundTasks
|
||||||
|
(
|
||||||
|
Guid,
|
||||||
|
TaskID,
|
||||||
|
ScheduleID,
|
||||||
|
PackageID,
|
||||||
|
UserID,
|
||||||
|
EffectiveUserID,
|
||||||
|
TaskName,
|
||||||
|
ItemID,
|
||||||
|
ItemName,
|
||||||
|
StartDate,
|
||||||
|
IndicatorCurrent,
|
||||||
|
IndicatorMaximum,
|
||||||
|
MaximumExecutionTime,
|
||||||
|
Source,
|
||||||
|
Severity,
|
||||||
|
Completed,
|
||||||
|
NotifyOnComplete,
|
||||||
|
Status
|
||||||
|
)
|
||||||
|
VALUES
|
||||||
|
(
|
||||||
|
@Guid,
|
||||||
|
@TaskID,
|
||||||
|
@ScheduleID,
|
||||||
|
@PackageID,
|
||||||
|
@UserID,
|
||||||
|
@EffectiveUserID,
|
||||||
|
@TaskName,
|
||||||
|
@ItemID,
|
||||||
|
@ItemName,
|
||||||
|
@StartDate,
|
||||||
|
@IndicatorCurrent,
|
||||||
|
@IndicatorMaximum,
|
||||||
|
@MaximumExecutionTime,
|
||||||
|
@Source,
|
||||||
|
@Severity,
|
||||||
|
@Completed,
|
||||||
|
@NotifyOnComplete,
|
||||||
|
@Status
|
||||||
|
)
|
||||||
|
|
||||||
|
SET @BackgroundTaskID = SCOPE_IDENTITY()
|
||||||
|
|
||||||
|
RETURN
|
||||||
|
GO
|
||||||
|
|
||||||
|
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetBackgroundTask')
|
||||||
|
DROP PROCEDURE GetBackgroundTask
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE PROCEDURE [dbo].[GetBackgroundTask]
|
||||||
|
(
|
||||||
|
@TaskID NVARCHAR(255)
|
||||||
|
)
|
||||||
|
AS
|
||||||
|
|
||||||
|
SELECT TOP 1
|
||||||
|
T.ID,
|
||||||
|
T.Guid,
|
||||||
|
T.TaskID,
|
||||||
|
T.ScheduleID,
|
||||||
|
T.PackageID,
|
||||||
|
T.UserID,
|
||||||
|
T.EffectiveUserID,
|
||||||
|
T.TaskName,
|
||||||
|
T.ItemID,
|
||||||
|
T.ItemName,
|
||||||
|
T.StartDate,
|
||||||
|
T.FinishDate,
|
||||||
|
T.IndicatorCurrent,
|
||||||
|
T.IndicatorMaximum,
|
||||||
|
T.MaximumExecutionTime,
|
||||||
|
T.Source,
|
||||||
|
T.Severity,
|
||||||
|
T.Completed,
|
||||||
|
T.NotifyOnComplete,
|
||||||
|
T.Status
|
||||||
|
FROM BackgroundTasks AS T
|
||||||
|
INNER JOIN BackgroundTaskStack AS TS
|
||||||
|
ON TS.TaskId = T.ID
|
||||||
|
WHERE T.TaskID = @TaskID
|
||||||
|
GO
|
||||||
|
|
||||||
|
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetBackgroundTasks')
|
||||||
|
DROP PROCEDURE GetBackgroundTasks
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE PROCEDURE [dbo].[GetBackgroundTasks]
|
||||||
|
(
|
||||||
|
@ActorID INT
|
||||||
|
)
|
||||||
|
AS
|
||||||
|
|
||||||
|
with GetChildUsersId(id) as (
|
||||||
|
select UserID
|
||||||
|
from Users
|
||||||
|
where UserID = @ActorID
|
||||||
|
union all
|
||||||
|
select C.UserId
|
||||||
|
from GetChildUsersId P
|
||||||
|
inner join Users C on P.id = C.OwnerID
|
||||||
|
)
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
T.ID,
|
||||||
|
T.Guid,
|
||||||
|
T.TaskID,
|
||||||
|
T.ScheduleId,
|
||||||
|
T.PackageId,
|
||||||
|
T.UserId,
|
||||||
|
T.EffectiveUserId,
|
||||||
|
T.TaskName,
|
||||||
|
T.ItemId,
|
||||||
|
T.ItemName,
|
||||||
|
T.StartDate,
|
||||||
|
T.FinishDate,
|
||||||
|
T.IndicatorCurrent,
|
||||||
|
T.IndicatorMaximum,
|
||||||
|
T.MaximumExecutionTime,
|
||||||
|
T.Source,
|
||||||
|
T.Severity,
|
||||||
|
T.Completed,
|
||||||
|
T.NotifyOnComplete,
|
||||||
|
T.Status
|
||||||
|
FROM BackgroundTasks AS T
|
||||||
|
INNER JOIN (SELECT T.Guid, MIN(T.StartDate) AS Date
|
||||||
|
FROM BackgroundTasks AS T
|
||||||
|
INNER JOIN BackgroundTaskStack AS TS
|
||||||
|
ON TS.TaskId = T.ID
|
||||||
|
WHERE T.UserID in (select id from GetChildUsersId)
|
||||||
|
GROUP BY T.Guid) AS TT ON TT.Guid = T.Guid AND TT.Date = T.StartDate
|
||||||
|
GO
|
||||||
|
|
||||||
|
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetThreadBackgroundTasks')
|
||||||
|
DROP PROCEDURE GetThreadBackgroundTasks
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE PROCEDURE [dbo].GetThreadBackgroundTasks
|
||||||
|
(
|
||||||
|
@Guid UNIQUEIDENTIFIER
|
||||||
|
)
|
||||||
|
AS
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
T.ID,
|
||||||
|
T.Guid,
|
||||||
|
T.TaskID,
|
||||||
|
T.ScheduleId,
|
||||||
|
T.PackageId,
|
||||||
|
T.UserId,
|
||||||
|
T.EffectiveUserId,
|
||||||
|
T.TaskName,
|
||||||
|
T.ItemId,
|
||||||
|
T.ItemName,
|
||||||
|
T.StartDate,
|
||||||
|
T.FinishDate,
|
||||||
|
T.IndicatorCurrent,
|
||||||
|
T.IndicatorMaximum,
|
||||||
|
T.MaximumExecutionTime,
|
||||||
|
T.Source,
|
||||||
|
T.Severity,
|
||||||
|
T.Completed,
|
||||||
|
T.NotifyOnComplete,
|
||||||
|
T.Status
|
||||||
|
FROM BackgroundTasks AS T
|
||||||
|
INNER JOIN BackgroundTaskStack AS TS
|
||||||
|
ON TS.TaskId = T.ID
|
||||||
|
WHERE T.Guid = @Guid
|
||||||
|
GO
|
||||||
|
|
||||||
|
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetBackgroundTopTask')
|
||||||
|
DROP PROCEDURE GetBackgroundTopTask
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE PROCEDURE [dbo].[GetBackgroundTopTask]
|
||||||
|
(
|
||||||
|
@Guid UNIQUEIDENTIFIER
|
||||||
|
)
|
||||||
|
AS
|
||||||
|
|
||||||
|
SELECT TOP 1
|
||||||
|
T.ID,
|
||||||
|
T.Guid,
|
||||||
|
T.TaskID,
|
||||||
|
T.ScheduleId,
|
||||||
|
T.PackageId,
|
||||||
|
T.UserId,
|
||||||
|
T.EffectiveUserId,
|
||||||
|
T.TaskName,
|
||||||
|
T.ItemId,
|
||||||
|
T.ItemName,
|
||||||
|
T.StartDate,
|
||||||
|
T.FinishDate,
|
||||||
|
T.IndicatorCurrent,
|
||||||
|
T.IndicatorMaximum,
|
||||||
|
T.MaximumExecutionTime,
|
||||||
|
T.Source,
|
||||||
|
T.Severity,
|
||||||
|
T.Completed,
|
||||||
|
T.NotifyOnComplete,
|
||||||
|
T.Status
|
||||||
|
FROM BackgroundTasks AS T
|
||||||
|
INNER JOIN BackgroundTaskStack AS TS
|
||||||
|
ON TS.TaskId = T.ID
|
||||||
|
WHERE T.Guid = @Guid
|
||||||
|
ORDER BY T.StartDate ASC
|
||||||
|
GO
|
||||||
|
|
||||||
|
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'AddBackgroundTaskLog')
|
||||||
|
DROP PROCEDURE AddBackgroundTaskLog
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE PROCEDURE [dbo].[AddBackgroundTaskLog]
|
||||||
|
(
|
||||||
|
@TaskID INT,
|
||||||
|
@Date DATETIME,
|
||||||
|
@ExceptionStackTrace NTEXT,
|
||||||
|
@InnerTaskStart INT,
|
||||||
|
@Severity INT,
|
||||||
|
@Text NTEXT,
|
||||||
|
@TextIdent INT,
|
||||||
|
@XmlParameters NTEXT
|
||||||
|
)
|
||||||
|
AS
|
||||||
|
|
||||||
|
INSERT INTO BackgroundTaskLogs
|
||||||
|
(
|
||||||
|
TaskID,
|
||||||
|
Date,
|
||||||
|
ExceptionStackTrace,
|
||||||
|
InnerTaskStart,
|
||||||
|
Severity,
|
||||||
|
Text,
|
||||||
|
TextIdent,
|
||||||
|
XmlParameters
|
||||||
|
)
|
||||||
|
VALUES
|
||||||
|
(
|
||||||
|
@TaskID,
|
||||||
|
@Date,
|
||||||
|
@ExceptionStackTrace,
|
||||||
|
@InnerTaskStart,
|
||||||
|
@Severity,
|
||||||
|
@Text,
|
||||||
|
@TextIdent,
|
||||||
|
@XmlParameters
|
||||||
|
)
|
||||||
|
GO
|
||||||
|
|
||||||
|
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetBackgroundTaskLogs')
|
||||||
|
DROP PROCEDURE GetBackgroundTaskLogs
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE PROCEDURE [dbo].[GetBackgroundTaskLogs]
|
||||||
|
(
|
||||||
|
@TaskID INT,
|
||||||
|
@StartLogTime DATETIME
|
||||||
|
)
|
||||||
|
AS
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
L.LogID,
|
||||||
|
L.TaskID,
|
||||||
|
L.Date,
|
||||||
|
L.ExceptionStackTrace,
|
||||||
|
L.InnerTaskStart,
|
||||||
|
L.Severity,
|
||||||
|
L.Text,
|
||||||
|
L.XmlParameters
|
||||||
|
FROM BackgroundTaskLogs AS L
|
||||||
|
WHERE L.TaskID = @TaskID AND L.Date >= @StartLogTime
|
||||||
|
ORDER BY L.Date
|
||||||
|
GO
|
||||||
|
|
||||||
|
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'UpdateBackgroundTask')
|
||||||
|
DROP PROCEDURE UpdateBackgroundTask
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE PROCEDURE [dbo].[UpdateBackgroundTask]
|
||||||
|
(
|
||||||
|
@Guid UNIQUEIDENTIFIER,
|
||||||
|
@TaskID INT,
|
||||||
|
@ScheduleID INT,
|
||||||
|
@PackageID INT,
|
||||||
|
@TaskName NVARCHAR(255),
|
||||||
|
@ItemID INT,
|
||||||
|
@ItemName NVARCHAR(255),
|
||||||
|
@FinishDate DATETIME,
|
||||||
|
@IndicatorCurrent INT,
|
||||||
|
@IndicatorMaximum INT,
|
||||||
|
@MaximumExecutionTime INT,
|
||||||
|
@Source NVARCHAR(MAX),
|
||||||
|
@Severity INT,
|
||||||
|
@Completed BIT,
|
||||||
|
@NotifyOnComplete BIT,
|
||||||
|
@Status INT
|
||||||
|
)
|
||||||
|
AS
|
||||||
|
|
||||||
|
UPDATE BackgroundTasks
|
||||||
|
SET
|
||||||
|
Guid = @Guid,
|
||||||
|
ScheduleID = @ScheduleID,
|
||||||
|
PackageID = @PackageID,
|
||||||
|
TaskName = @TaskName,
|
||||||
|
ItemID = @ItemID,
|
||||||
|
ItemName = @ItemName,
|
||||||
|
FinishDate = @FinishDate,
|
||||||
|
IndicatorCurrent = @IndicatorCurrent,
|
||||||
|
IndicatorMaximum = @IndicatorMaximum,
|
||||||
|
MaximumExecutionTime = @MaximumExecutionTime,
|
||||||
|
Source = @Source,
|
||||||
|
Severity = @Severity,
|
||||||
|
Completed = @Completed,
|
||||||
|
NotifyOnComplete = @NotifyOnComplete,
|
||||||
|
Status = @Status
|
||||||
|
WHERE ID = @TaskID
|
||||||
|
GO
|
||||||
|
|
||||||
|
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetBackgroundTaskParams')
|
||||||
|
DROP PROCEDURE GetBackgroundTaskParams
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE PROCEDURE [dbo].[GetBackgroundTaskParams]
|
||||||
|
(
|
||||||
|
@TaskID INT
|
||||||
|
)
|
||||||
|
AS
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
P.ParameterID,
|
||||||
|
P.TaskID,
|
||||||
|
P.Name,
|
||||||
|
P.SerializerValue,
|
||||||
|
P.TypeName
|
||||||
|
FROM BackgroundTaskParameters AS P
|
||||||
|
WHERE P.TaskID = @TaskID
|
||||||
|
GO
|
||||||
|
|
||||||
|
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'AddBackgroundTaskParam')
|
||||||
|
DROP PROCEDURE AddBackgroundTaskParam
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE PROCEDURE [dbo].[AddBackgroundTaskParam]
|
||||||
|
(
|
||||||
|
@TaskID INT,
|
||||||
|
@Name NVARCHAR(255),
|
||||||
|
@Value NTEXT,
|
||||||
|
@TypeName NVARCHAR(255)
|
||||||
|
)
|
||||||
|
AS
|
||||||
|
|
||||||
|
INSERT INTO BackgroundTaskParameters
|
||||||
|
(
|
||||||
|
TaskID,
|
||||||
|
Name,
|
||||||
|
SerializerValue,
|
||||||
|
TypeName
|
||||||
|
)
|
||||||
|
VALUES
|
||||||
|
(
|
||||||
|
@TaskID,
|
||||||
|
@Name,
|
||||||
|
@Value,
|
||||||
|
@TypeName
|
||||||
|
)
|
||||||
|
GO
|
||||||
|
|
||||||
|
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'DeleteBackgroundTaskParams')
|
||||||
|
DROP PROCEDURE DeleteBackgroundTaskParams
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE PROCEDURE [dbo].[DeleteBackgroundTaskParams]
|
||||||
|
(
|
||||||
|
@TaskID INT
|
||||||
|
)
|
||||||
|
AS
|
||||||
|
|
||||||
|
DELETE FROM BackgroundTaskParameters
|
||||||
|
WHERE TaskID = @TaskID
|
||||||
|
GO
|
||||||
|
|
||||||
|
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'AddBackgroundTaskStack')
|
||||||
|
DROP PROCEDURE AddBackgroundTaskStack
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE PROCEDURE [dbo].[AddBackgroundTaskStack]
|
||||||
|
(
|
||||||
|
@TaskID INT
|
||||||
|
)
|
||||||
|
AS
|
||||||
|
|
||||||
|
INSERT INTO BackgroundTaskStack
|
||||||
|
(
|
||||||
|
TaskID
|
||||||
|
)
|
||||||
|
VALUES
|
||||||
|
(
|
||||||
|
@TaskID
|
||||||
|
)
|
||||||
|
GO
|
||||||
|
|
||||||
|
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'DeleteBackgroundTasks')
|
||||||
|
DROP PROCEDURE DeleteBackgroundTasks
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE PROCEDURE [dbo].[DeleteBackgroundTasks]
|
||||||
|
(
|
||||||
|
@Guid UNIQUEIDENTIFIER
|
||||||
|
)
|
||||||
|
AS
|
||||||
|
|
||||||
|
DELETE FROM BackgroundTaskStack
|
||||||
|
WHERE TaskID IN (SELECT ID FROM BackgroundTasks WHERE Guid = @Guid)
|
||||||
|
|
||||||
|
DELETE FROM BackgroundTaskLogs
|
||||||
|
WHERE TaskID IN (SELECT ID FROM BackgroundTasks WHERE Guid = @Guid)
|
||||||
|
|
||||||
|
DELETE FROM BackgroundTaskParameters
|
||||||
|
WHERE TaskID IN (SELECT ID FROM BackgroundTasks WHERE Guid = @Guid)
|
||||||
|
|
||||||
|
DELETE FROM BackgroundTasks
|
||||||
|
WHERE ID IN (SELECT ID FROM BackgroundTasks WHERE Guid = @Guid)
|
||||||
|
GO
|
||||||
|
|
||||||
|
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'DeleteBackgroundTask')
|
||||||
|
DROP PROCEDURE DeleteBackgroundTask
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE PROCEDURE [dbo].[DeleteBackgroundTask]
|
||||||
|
(
|
||||||
|
@ID INT
|
||||||
|
)
|
||||||
|
AS
|
||||||
|
|
||||||
|
DELETE FROM BackgroundTaskStack
|
||||||
|
WHERE TaskID = @ID
|
||||||
|
|
||||||
|
DELETE FROM BackgroundTaskLogs
|
||||||
|
WHERE TaskID = @ID
|
||||||
|
|
||||||
|
DELETE FROM BackgroundTaskParameters
|
||||||
|
WHERE TaskID = @ID
|
||||||
|
|
||||||
|
DELETE FROM BackgroundTasks
|
||||||
|
WHERE ID = @ID
|
||||||
|
GO
|
||||||
|
|
||||||
|
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetProcessBackgroundTasks')
|
||||||
|
DROP PROCEDURE GetProcessBackgroundTasks
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE PROCEDURE [dbo].[GetProcessBackgroundTasks]
|
||||||
|
(
|
||||||
|
@Status INT
|
||||||
|
)
|
||||||
|
AS
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
T.ID,
|
||||||
|
T.TaskID,
|
||||||
|
T.ScheduleId,
|
||||||
|
T.PackageId,
|
||||||
|
T.UserId,
|
||||||
|
T.EffectiveUserId,
|
||||||
|
T.TaskName,
|
||||||
|
T.ItemId,
|
||||||
|
T.ItemName,
|
||||||
|
T.StartDate,
|
||||||
|
T.FinishDate,
|
||||||
|
T.IndicatorCurrent,
|
||||||
|
T.IndicatorMaximum,
|
||||||
|
T.MaximumExecutionTime,
|
||||||
|
T.Source,
|
||||||
|
T.Severity,
|
||||||
|
T.Completed,
|
||||||
|
T.NotifyOnComplete,
|
||||||
|
T.Status
|
||||||
|
FROM BackgroundTasks AS T
|
||||||
|
WHERE T.Completed = 0 AND T.Status = @Status
|
||||||
|
GO
|
||||||
|
|
||||||
|
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetScheduleBackgroundTasks')
|
||||||
|
DROP PROCEDURE GetScheduleBackgroundTasks
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE PROCEDURE [dbo].[GetScheduleBackgroundTasks]
|
||||||
|
(
|
||||||
|
@ScheduleID INT
|
||||||
|
)
|
||||||
|
AS
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
T.ID,
|
||||||
|
T.Guid,
|
||||||
|
T.TaskID,
|
||||||
|
T.ScheduleId,
|
||||||
|
T.PackageId,
|
||||||
|
T.UserId,
|
||||||
|
T.EffectiveUserId,
|
||||||
|
T.TaskName,
|
||||||
|
T.ItemId,
|
||||||
|
T.ItemName,
|
||||||
|
T.StartDate,
|
||||||
|
T.FinishDate,
|
||||||
|
T.IndicatorCurrent,
|
||||||
|
T.IndicatorMaximum,
|
||||||
|
T.MaximumExecutionTime,
|
||||||
|
T.Source,
|
||||||
|
T.Severity,
|
||||||
|
T.Completed,
|
||||||
|
T.NotifyOnComplete,
|
||||||
|
T.Status
|
||||||
|
FROM BackgroundTasks AS T
|
||||||
|
WHERE T.Guid = (
|
||||||
|
SELECT Guid FROM BackgroundTasks
|
||||||
|
WHERE ScheduleID = @ScheduleID
|
||||||
|
AND Completed = 0 AND Status IN (1, 3))
|
||||||
|
GO
|
||||||
|
|
||||||
-- Disclaimers
|
-- Disclaimers
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,9 @@
|
||||||
<Reference Include="WebsitePanel.EnterpriseServer.Client">
|
<Reference Include="WebsitePanel.EnterpriseServer.Client">
|
||||||
<HintPath>..\..\..\Bin\WebsitePanel.EnterpriseServer.Client.dll</HintPath>
|
<HintPath>..\..\..\Bin\WebsitePanel.EnterpriseServer.Client.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="WebsitePanel.EnterpriseServer.Code">
|
||||||
|
<HintPath>..\..\..\Bin\WebsitePanel.EnterpriseServer.Code.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="WebsitePanel.Providers.Base">
|
<Reference Include="WebsitePanel.Providers.Base">
|
||||||
<HintPath>..\..\..\Bin\WebsitePanel.Providers.Base.dll</HintPath>
|
<HintPath>..\..\..\Bin\WebsitePanel.Providers.Base.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// This code was generated by a tool.
|
// This code was generated by a tool.
|
||||||
// Runtime Version:4.0.30319.18010
|
// Runtime Version:4.0.30319.18033
|
||||||
//
|
//
|
||||||
// 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.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'------------------------------------------------------------------------------
|
'------------------------------------------------------------------------------
|
||||||
' <auto-generated>
|
' <auto-generated>
|
||||||
' This code was generated by a tool.
|
' This code was generated by a tool.
|
||||||
' Runtime Version:4.0.30319.18010
|
' Runtime Version:4.0.30319.18033
|
||||||
'
|
'
|
||||||
' 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.
|
||||||
|
@ -15,9 +15,9 @@ Imports System
|
||||||
Imports System.Reflection
|
Imports System.Reflection
|
||||||
Imports System.Runtime.CompilerServices
|
Imports System.Runtime.CompilerServices
|
||||||
Imports System.Runtime.InteropServices
|
Imports System.Runtime.InteropServices
|
||||||
<Assembly: AssemblyCompany("Outercurve Foundation"), _
|
<Assembly: AssemblyCompany("Outercurve Foundation"), _
|
||||||
Assembly: AssemblyCopyright("Copyright © 2012 Outercurve Foundation."), _
|
Assembly: AssemblyCopyright("Copyright © 2012 Outercurve Foundation."), _
|
||||||
Assembly: AssemblyVersion("2.1.0.1"), _
|
Assembly: AssemblyVersion("2.1.0.1"), _
|
||||||
Assembly: AssemblyFileVersion("2.1.0.1"), _
|
Assembly: AssemblyFileVersion("2.1.0.1"), _
|
||||||
Assembly: AssemblyInformationalVersion("2.1.0")>
|
Assembly: AssemblyInformationalVersion("2.1.0")>
|
||||||
|
|
||||||
|
|
|
@ -36,162 +36,171 @@ using System.Xml.Serialization;
|
||||||
|
|
||||||
namespace WebsitePanel.EnterpriseServer
|
namespace WebsitePanel.EnterpriseServer
|
||||||
{
|
{
|
||||||
|
|
||||||
public class BackgroundTask
|
public class BackgroundTask
|
||||||
{
|
{
|
||||||
private string taskId;
|
#region Fields
|
||||||
private int userId;
|
|
||||||
private int packageId;
|
|
||||||
private int effectiveUserId;
|
|
||||||
private DateTime startDate = DateTime.MinValue;
|
|
||||||
private DateTime finishDate = DateTime.MinValue;
|
|
||||||
private int maximumExecutionTime = -1; // seconds
|
|
||||||
private string source;
|
|
||||||
private string taskName;
|
|
||||||
private int scheduleId;
|
|
||||||
private string itemName;
|
|
||||||
private int itemId = 0;
|
|
||||||
private int severity = 0; /* 0 - Info, 1 - Warning, 2 - Error */
|
|
||||||
private List<BackgroundTaskLogRecord> logRecords = new List<BackgroundTaskLogRecord>();
|
|
||||||
private List<BackgroundTaskLogRecord> lastLogRecords = new List<BackgroundTaskLogRecord>();
|
|
||||||
private BackgroundTaskLogRecord lastLogRecord;
|
|
||||||
private Hashtable parameters = new Hashtable();
|
|
||||||
private int indicatorMaximum;
|
|
||||||
private int indicatorCurrent;
|
|
||||||
private bool completed;
|
|
||||||
private bool notifyOnComplete;
|
|
||||||
private Thread taskThread;
|
|
||||||
|
|
||||||
public System.DateTime StartDate
|
public List<BackgroundTaskParameter> Params = new List<BackgroundTaskParameter>();
|
||||||
|
|
||||||
|
public List<BackgroundTaskLogRecord> Logs = new List<BackgroundTaskLogRecord>();
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public Guid Guid { get; set; }
|
||||||
|
|
||||||
|
public string TaskId { get; set; }
|
||||||
|
|
||||||
|
public int ScheduleId { get; set; }
|
||||||
|
|
||||||
|
public int PackageId { get; set; }
|
||||||
|
|
||||||
|
public int UserId { get; set; }
|
||||||
|
|
||||||
|
public int EffectiveUserId { get; set; }
|
||||||
|
|
||||||
|
public string TaskName { get; set; }
|
||||||
|
|
||||||
|
public int ItemId { get; set; }
|
||||||
|
|
||||||
|
public string ItemName { get; set; }
|
||||||
|
|
||||||
|
public DateTime StartDate { get; set; }
|
||||||
|
|
||||||
|
public DateTime FinishDate { get; set; }
|
||||||
|
|
||||||
|
public int IndicatorCurrent { get; set; }
|
||||||
|
|
||||||
|
public int IndicatorMaximum { get; set; }
|
||||||
|
|
||||||
|
public int MaximumExecutionTime { get; set; }
|
||||||
|
|
||||||
|
public string Source { get; set; }
|
||||||
|
|
||||||
|
public int Severity { get; set; }
|
||||||
|
|
||||||
|
public bool Completed { get; set; }
|
||||||
|
|
||||||
|
public bool NotifyOnComplete { get; set; }
|
||||||
|
|
||||||
|
public BackgroundTaskStatus Status { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
|
public BackgroundTask()
|
||||||
{
|
{
|
||||||
get { return this.startDate; }
|
StartDate = DateTime.Now;
|
||||||
set { this.startDate = value; }
|
Severity = 0;
|
||||||
|
IndicatorCurrent = 0;
|
||||||
|
IndicatorMaximum = 0;
|
||||||
|
Status = BackgroundTaskStatus.Run;
|
||||||
|
|
||||||
|
Completed = false;
|
||||||
|
NotifyOnComplete = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public System.DateTime FinishDate
|
public BackgroundTask(Guid guid, String taskId, int userId, int effectiveUserId, String source, String taskName, String itemName,
|
||||||
|
int itemId, int scheduleId, int packageId, int maximumExecutionTime, List<BackgroundTaskParameter> parameters)
|
||||||
|
: this()
|
||||||
{
|
{
|
||||||
get { return this.finishDate; }
|
Guid = guid;
|
||||||
set { this.finishDate = value; }
|
TaskId = taskId;
|
||||||
|
UserId = userId;
|
||||||
|
EffectiveUserId = effectiveUserId;
|
||||||
|
Source = source;
|
||||||
|
TaskName = taskName;
|
||||||
|
ItemName = itemName;
|
||||||
|
ItemId = itemId;
|
||||||
|
ScheduleId = scheduleId;
|
||||||
|
PackageId = packageId;
|
||||||
|
MaximumExecutionTime = maximumExecutionTime;
|
||||||
|
Params = parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Source
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
public List<BackgroundTaskLogRecord> GetLogs()
|
||||||
{
|
{
|
||||||
get { return this.source; }
|
return Logs;
|
||||||
set { this.source = value; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string TaskName
|
public Object GetParamValue(String name)
|
||||||
{
|
{
|
||||||
get { return this.taskName; }
|
foreach(BackgroundTaskParameter param in Params)
|
||||||
set { this.taskName = value; }
|
{
|
||||||
|
if (param.Name == name)
|
||||||
|
return param.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int ItemId
|
public void UpdateParamValue(String name, object value)
|
||||||
{
|
{
|
||||||
get { return this.itemId; }
|
foreach (BackgroundTaskParameter param in Params)
|
||||||
set { this.itemId = value; }
|
{
|
||||||
|
if (param.Name == name)
|
||||||
|
{
|
||||||
|
param.Value = value;
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Params.Add(new BackgroundTaskParameter(name, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int PackageId
|
public bool ContainsParam(String name)
|
||||||
{
|
{
|
||||||
get { return this.packageId; }
|
foreach (BackgroundTaskParameter param in Params)
|
||||||
set { this.packageId = value; }
|
{
|
||||||
|
if (param.Name == name)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Severity
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
public class BackgroundTaskParameter
|
||||||
|
{
|
||||||
|
#region Properties
|
||||||
|
|
||||||
|
public int ParameterId { get; set; }
|
||||||
|
|
||||||
|
public int TaskId { get; set; }
|
||||||
|
|
||||||
|
public String Name { get; set; }
|
||||||
|
|
||||||
|
public Object Value { get; set; }
|
||||||
|
|
||||||
|
public String TypeName { get; set; }
|
||||||
|
|
||||||
|
public String SerializerValue { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
|
public BackgroundTaskParameter() { }
|
||||||
|
|
||||||
|
public BackgroundTaskParameter(String name, Object value)
|
||||||
{
|
{
|
||||||
get { return this.severity; }
|
Name = name;
|
||||||
set { this.severity = value; }
|
Value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[XmlIgnore]
|
#endregion
|
||||||
public List<BackgroundTaskLogRecord> LogRecords
|
|
||||||
{
|
|
||||||
get { return this.logRecords; }
|
|
||||||
set { this.logRecords = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<BackgroundTaskLogRecord> LastLogRecords
|
|
||||||
{
|
|
||||||
get { return this.lastLogRecords; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string ItemName
|
|
||||||
{
|
|
||||||
get { return this.itemName; }
|
|
||||||
set { this.itemName = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public BackgroundTaskLogRecord LastLogRecord
|
|
||||||
{
|
|
||||||
get { return this.lastLogRecord; }
|
|
||||||
set { this.lastLogRecord = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string TaskId
|
|
||||||
{
|
|
||||||
get { return this.taskId; }
|
|
||||||
set { this.taskId = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public int UserId
|
|
||||||
{
|
|
||||||
get { return this.userId; }
|
|
||||||
set { this.userId = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
[XmlIgnore]
|
|
||||||
public Hashtable Parameters
|
|
||||||
{
|
|
||||||
get { return this.parameters; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public int IndicatorMaximum
|
|
||||||
{
|
|
||||||
get { return this.indicatorMaximum; }
|
|
||||||
set { this.indicatorMaximum = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public int IndicatorCurrent
|
|
||||||
{
|
|
||||||
get { return this.indicatorCurrent; }
|
|
||||||
set { this.indicatorCurrent = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Completed
|
|
||||||
{
|
|
||||||
get { return this.completed; }
|
|
||||||
set { this.completed = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool NotifyOnComplete
|
|
||||||
{
|
|
||||||
get { return this.notifyOnComplete; }
|
|
||||||
set { this.notifyOnComplete = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public int EffectiveUserId
|
|
||||||
{
|
|
||||||
get { return this.effectiveUserId; }
|
|
||||||
set { this.effectiveUserId = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
[XmlIgnore]
|
|
||||||
public System.Threading.Thread TaskThread
|
|
||||||
{
|
|
||||||
get { return this.taskThread; }
|
|
||||||
set { this.taskThread = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public int ScheduleId
|
|
||||||
{
|
|
||||||
get { return this.scheduleId; }
|
|
||||||
set { this.scheduleId = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public int MaximumExecutionTime
|
|
||||||
{
|
|
||||||
get { return this.maximumExecutionTime; }
|
|
||||||
set { this.maximumExecutionTime = value; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,54 +34,54 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
{
|
{
|
||||||
public class BackgroundTaskLogRecord
|
public class BackgroundTaskLogRecord
|
||||||
{
|
{
|
||||||
private DateTime date = DateTime.Now;
|
#region Properties
|
||||||
private string text;
|
|
||||||
private int severity; /* 0 - Info, 1 - Warning, 2 - Error */
|
|
||||||
private string[] textParameters;
|
|
||||||
private int textIdent = 0;
|
|
||||||
private bool innerTaskStart;
|
|
||||||
private string exceptionStackTrace;
|
|
||||||
|
|
||||||
public System.DateTime Date
|
public int LogId { get; set; }
|
||||||
|
|
||||||
|
public int TaskId { get; set; }
|
||||||
|
|
||||||
|
public DateTime Date { get; set; }
|
||||||
|
|
||||||
|
public String ExceptionStackTrace { get; set; }
|
||||||
|
|
||||||
|
public bool InnerTaskStart { get; set; }
|
||||||
|
|
||||||
|
public int Severity { get; set; }
|
||||||
|
|
||||||
|
public String Text { get; set; }
|
||||||
|
|
||||||
|
public int TextIdent { get; set; }
|
||||||
|
|
||||||
|
public string[] TextParameters { get; set; }
|
||||||
|
|
||||||
|
public string XmlParameters { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
|
public BackgroundTaskLogRecord()
|
||||||
{
|
{
|
||||||
get { return this.date; }
|
Date = DateTime.Now;
|
||||||
set { this.date = value; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Text
|
public BackgroundTaskLogRecord(int taskId, int textIdent, bool innerTaskStart, String text, string[] textParameters)
|
||||||
|
: this()
|
||||||
{
|
{
|
||||||
get { return this.text; }
|
TaskId = taskId;
|
||||||
set { this.text = value; }
|
TextIdent = textIdent;
|
||||||
|
Text = text;
|
||||||
|
InnerTaskStart = innerTaskStart;
|
||||||
|
TextParameters = textParameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Severity
|
public BackgroundTaskLogRecord(int taskId, int textIdent, bool innerTaskStart, String text,
|
||||||
|
String exceptionStackTrace, string[] textParameters)
|
||||||
|
: this(taskId, textIdent, innerTaskStart, text, textParameters)
|
||||||
{
|
{
|
||||||
get { return this.severity; }
|
ExceptionStackTrace = exceptionStackTrace;
|
||||||
set { this.severity = value; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string[] TextParameters
|
#endregion
|
||||||
{
|
|
||||||
get { return this.textParameters; }
|
|
||||||
set { this.textParameters = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public int TextIdent
|
|
||||||
{
|
|
||||||
get { return this.textIdent; }
|
|
||||||
set { this.textIdent = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool InnerTaskStart
|
|
||||||
{
|
|
||||||
get { return this.innerTaskStart; }
|
|
||||||
set { this.innerTaskStart = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string ExceptionStackTrace
|
|
||||||
{
|
|
||||||
get { return this.exceptionStackTrace; }
|
|
||||||
set { this.exceptionStackTrace = value; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
namespace WebsitePanel.EnterpriseServer
|
||||||
|
{
|
||||||
|
public enum BackgroundTaskStatus
|
||||||
|
{
|
||||||
|
Run = 1,
|
||||||
|
Abort = 2,
|
||||||
|
Starting = 3,
|
||||||
|
Stopping = 4
|
||||||
|
}
|
||||||
|
}
|
|
@ -156,6 +156,7 @@
|
||||||
<Compile Include="System\SystemSettings.cs" />
|
<Compile Include="System\SystemSettings.cs" />
|
||||||
<Compile Include="Tasks\BackgroundTask.cs" />
|
<Compile Include="Tasks\BackgroundTask.cs" />
|
||||||
<Compile Include="Tasks\BackgroundTaskLogRecord.cs" />
|
<Compile Include="Tasks\BackgroundTaskLogRecord.cs" />
|
||||||
|
<Compile Include="Tasks\BackgroundTaskStatus.cs" />
|
||||||
<Compile Include="Users\UserInfo.cs" />
|
<Compile Include="Users\UserInfo.cs" />
|
||||||
<Compile Include="Users\UserLoginStatus.cs" />
|
<Compile Include="Users\UserLoginStatus.cs" />
|
||||||
<Compile Include="Users\UsernamePolicy.cs" />
|
<Compile Include="Users\UsernamePolicy.cs" />
|
||||||
|
|
|
@ -0,0 +1,668 @@
|
||||||
|
// Copyright (c) 2012, Outercurve Foundation.
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
// are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this
|
||||||
|
// list of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the Outercurve Foundation nor the names of its
|
||||||
|
// contributors may be used to endorse or promote products derived from this
|
||||||
|
// software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Data;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
using WebsitePanel.Providers;
|
||||||
|
|
||||||
|
namespace WebsitePanel.EnterpriseServer
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Summary description for ObjectUtils.
|
||||||
|
/// </summary>
|
||||||
|
public class ObjectUtils
|
||||||
|
{
|
||||||
|
public static DT ConvertObject<ST, DT>(ST so)
|
||||||
|
{
|
||||||
|
Dictionary<string, PropertyInfo> sProps = GetTypePropertiesHash(typeof(ST));
|
||||||
|
Dictionary<string, PropertyInfo> dProps = GetTypePropertiesHash(typeof(DT));
|
||||||
|
|
||||||
|
DT dobj = (DT)Activator.CreateInstance(typeof(DT));
|
||||||
|
|
||||||
|
// copy properties
|
||||||
|
foreach (string propName in sProps.Keys)
|
||||||
|
{
|
||||||
|
if (dProps.ContainsKey(propName) && sProps[propName].Name != "Item")
|
||||||
|
{
|
||||||
|
if (sProps[propName].CanRead)
|
||||||
|
{
|
||||||
|
object val = sProps[propName].GetValue(so, null);
|
||||||
|
if (dProps[propName] != null)
|
||||||
|
{
|
||||||
|
if (val != null && dProps[propName].CanWrite)
|
||||||
|
{
|
||||||
|
dProps[propName].SetValue(dobj, val, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dobj;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Hashtable typeProperties = new Hashtable();
|
||||||
|
|
||||||
|
public static Hashtable GetObjectProperties(object obj, bool persistentOnly)
|
||||||
|
{
|
||||||
|
Hashtable hash = new Hashtable();
|
||||||
|
|
||||||
|
Type type = obj.GetType();
|
||||||
|
PropertyInfo[] props = type.GetProperties(BindingFlags.Instance
|
||||||
|
| BindingFlags.Public);
|
||||||
|
foreach (PropertyInfo prop in props)
|
||||||
|
{
|
||||||
|
// check for persistent attribute
|
||||||
|
object[] attrs = prop.GetCustomAttributes(typeof(PersistentAttribute), false);
|
||||||
|
if (!persistentOnly || (persistentOnly && attrs.Length > 0) && !hash.ContainsKey(prop.Name))
|
||||||
|
{
|
||||||
|
object val = prop.GetValue(obj, null);
|
||||||
|
string s = "";
|
||||||
|
if (val != null)
|
||||||
|
{
|
||||||
|
if (prop.PropertyType == typeof(string[]))
|
||||||
|
s = String.Join(";", (string[])val);
|
||||||
|
else if (prop.PropertyType == typeof(int[]))
|
||||||
|
{
|
||||||
|
int[] ivals = (int[])val;
|
||||||
|
string[] svals = new string[ivals.Length];
|
||||||
|
for (int i = 0; i < svals.Length; i++)
|
||||||
|
svals[i] = ivals[i].ToString();
|
||||||
|
s = String.Join(";", svals);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
s = val.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
// add property to hash
|
||||||
|
hash.Add(prop.Name, s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void FillCollectionFromDataSet<T>(List<T> list, DataSet ds)
|
||||||
|
{
|
||||||
|
if (ds.Tables.Count == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
FillCollectionFromDataView<T>(list, ds.Tables[0].DefaultView);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void FillCollectionFromDataView<T>(List<T> list, DataView dv)
|
||||||
|
{
|
||||||
|
Type type = typeof(T);
|
||||||
|
|
||||||
|
PropertyInfo[] props = GetTypeProperties(type);
|
||||||
|
|
||||||
|
foreach (DataRowView dr in dv)
|
||||||
|
{
|
||||||
|
// create an instance
|
||||||
|
T obj = (T)Activator.CreateInstance(type);
|
||||||
|
list.Add(obj);
|
||||||
|
|
||||||
|
// fill properties
|
||||||
|
for (int i = 0; i < props.Length; i++)
|
||||||
|
{
|
||||||
|
string propName = props[i].Name;
|
||||||
|
if (dv.Table.Columns[propName] == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
object propVal = dr[propName];
|
||||||
|
if (propVal == DBNull.Value)
|
||||||
|
props[i].SetValue(obj, GetNull(props[i].PropertyType), null);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// try implicit type conversion
|
||||||
|
props[i].SetValue(obj, propVal, null);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// convert to string and then set property value
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string strVal = propVal.ToString();
|
||||||
|
props[i].SetValue(obj, Cast(strVal, props[i].PropertyType), null);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// skip property init
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // for properties
|
||||||
|
} // for rows
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<T> CreateListFromDataReader<T>(IDataReader reader)
|
||||||
|
{
|
||||||
|
List<T> list = new List<T>();
|
||||||
|
FillCollectionFromDataReader<T>(list, reader);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<T> CreateListFromDataSet<T>(DataSet ds)
|
||||||
|
{
|
||||||
|
List<T> list = new List<T>();
|
||||||
|
FillCollectionFromDataSet<T>(list, ds);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void FillCollectionFromDataReader<T>(List<T> list, IDataReader reader)
|
||||||
|
{
|
||||||
|
Type type = typeof(T);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// get type properties
|
||||||
|
PropertyInfo[] props = GetTypeProperties(type);
|
||||||
|
|
||||||
|
// iterate through reader
|
||||||
|
while (reader.Read())
|
||||||
|
{
|
||||||
|
T obj = (T)Activator.CreateInstance(type);
|
||||||
|
list.Add(obj);
|
||||||
|
|
||||||
|
// set properties
|
||||||
|
for (int i = 0; i < props.Length; i++)
|
||||||
|
{
|
||||||
|
string propName = props[i].Name;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
object propVal = reader[propName];
|
||||||
|
if (propVal == DBNull.Value)
|
||||||
|
props[i].SetValue(obj, GetNull(props[i].PropertyType), null);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// try implicit type conversion
|
||||||
|
props[i].SetValue(obj, propVal, null);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// convert to string and then set property value
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string strVal = propVal.ToString();
|
||||||
|
props[i].SetValue(obj, Cast(strVal, props[i].PropertyType), null);
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { } // just skip
|
||||||
|
} // for properties
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
reader.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static T FillObjectFromDataView<T>(DataView dv)
|
||||||
|
{
|
||||||
|
Type type = typeof(T);
|
||||||
|
T obj = default(T);
|
||||||
|
|
||||||
|
// get type properties
|
||||||
|
PropertyInfo[] props = GetTypeProperties(type);
|
||||||
|
|
||||||
|
// iterate through reader
|
||||||
|
foreach (DataRowView dr in dv)
|
||||||
|
{
|
||||||
|
obj = (T)Activator.CreateInstance(type);
|
||||||
|
|
||||||
|
// set properties
|
||||||
|
for (int i = 0; i < props.Length; i++)
|
||||||
|
{
|
||||||
|
string propName = props[i].Name;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// verify if there is such a column
|
||||||
|
if (!dr.Row.Table.Columns.Contains(propName.ToLower()))
|
||||||
|
{
|
||||||
|
// if not, we move to another property
|
||||||
|
// because this one we cannot set
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
object propVal = dr[propName];
|
||||||
|
if (propVal == DBNull.Value)
|
||||||
|
props[i].SetValue(obj, GetNull(props[i].PropertyType), null);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string strVal = propVal.ToString();
|
||||||
|
|
||||||
|
//convert to DateTime
|
||||||
|
if (props[i].PropertyType.UnderlyingSystemType.FullName == typeof(DateTime).FullName)
|
||||||
|
{
|
||||||
|
DateTime date = DateTime.MinValue;
|
||||||
|
if (DateTime.TryParse(strVal, out date))
|
||||||
|
{
|
||||||
|
props[i].SetValue(obj, date, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Convert generic
|
||||||
|
props[i].SetValue(obj, Cast(strVal, props[i].PropertyType), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// skip property init
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { } // just skip
|
||||||
|
} // for properties
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static T FillObjectFromDataReader<T>(IDataReader reader)
|
||||||
|
{
|
||||||
|
Type type = typeof(T);
|
||||||
|
|
||||||
|
T obj = default(T);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// get type properties
|
||||||
|
PropertyInfo[] props = GetTypeProperties(type);
|
||||||
|
|
||||||
|
// iterate through reader
|
||||||
|
while (reader.Read())
|
||||||
|
{
|
||||||
|
obj = (T)Activator.CreateInstance(type);
|
||||||
|
|
||||||
|
// set properties
|
||||||
|
for (int i = 0; i < props.Length; i++)
|
||||||
|
{
|
||||||
|
string propName = props[i].Name;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!IsColumnExists(propName, reader.GetSchemaTable()))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
object propVal = reader[propName];
|
||||||
|
|
||||||
|
if (propVal == DBNull.Value)
|
||||||
|
props[i].SetValue(obj, GetNull(props[i].PropertyType), null);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//try string first
|
||||||
|
if (props[i].PropertyType.UnderlyingSystemType.FullName == typeof(String).FullName)
|
||||||
|
{
|
||||||
|
props[i].SetValue(obj, propVal.ToString(), null);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// then, try implicit type conversion
|
||||||
|
props[i].SetValue(obj, propVal, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// convert to string and then set property value
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string strVal = propVal.ToString();
|
||||||
|
props[i].SetValue(obj, Cast(strVal, props[i].PropertyType), null);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// skip property init
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { } // just skip
|
||||||
|
} // for properties
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
reader.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Hashtable propertiesCache = new Hashtable();
|
||||||
|
|
||||||
|
public static object CreateObjectFromDataview(Type type, DataView dv,
|
||||||
|
string nameColumn, string valueColumn, bool persistentOnly)
|
||||||
|
{
|
||||||
|
// create hash of properties from datareader
|
||||||
|
Hashtable propValues = new Hashtable();
|
||||||
|
foreach (DataRowView dr in dv)
|
||||||
|
{
|
||||||
|
if (propValues[dr[nameColumn]] == null && !propValues.ContainsKey(dr[nameColumn]))
|
||||||
|
propValues.Add(dr[nameColumn], dr[valueColumn]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return CreateObjectFromHash(type, propValues, persistentOnly);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static object CreateObjectFromDataReader(Type type, IDataReader reader,
|
||||||
|
string nameColumn, string valueColumn, bool persistentOnly)
|
||||||
|
{
|
||||||
|
// create hash of properties from datareader
|
||||||
|
Hashtable propValues = new Hashtable();
|
||||||
|
while (reader.Read())
|
||||||
|
{
|
||||||
|
if (propValues[reader[nameColumn]] == null && !propValues.ContainsKey(reader[nameColumn]))
|
||||||
|
propValues.Add(reader[nameColumn], reader[valueColumn]);
|
||||||
|
}
|
||||||
|
reader.Close();
|
||||||
|
|
||||||
|
return CreateObjectFromHash(type, propValues, persistentOnly);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static object CreateObjectFromHash(Type type, Hashtable propValues, bool persistentOnly)
|
||||||
|
{
|
||||||
|
// create object
|
||||||
|
object obj = Activator.CreateInstance(type);
|
||||||
|
|
||||||
|
CreateObjectFromHash(obj, propValues, persistentOnly);
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void CopyPersistentPropertiesFromSource<T>(T source, T target)
|
||||||
|
where T : ServiceProviderItem
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var typeSource = source.GetType();
|
||||||
|
var typeTarget = target.GetType();
|
||||||
|
// get all property infos
|
||||||
|
Hashtable props = null;
|
||||||
|
if (propertiesCache[typeSource.Name] != null)
|
||||||
|
{
|
||||||
|
// load properties from cache
|
||||||
|
props = (Hashtable)propertiesCache[typeSource.Name];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// create properties cache
|
||||||
|
props = new Hashtable();
|
||||||
|
//
|
||||||
|
PropertyInfo[] objProps = typeSource.GetProperties(BindingFlags.Instance
|
||||||
|
//| BindingFlags.DeclaredOnly
|
||||||
|
| BindingFlags.Public);
|
||||||
|
foreach (PropertyInfo prop in objProps)
|
||||||
|
{
|
||||||
|
// check for persistent attribute
|
||||||
|
object[] attrs = prop.GetCustomAttributes(typeof(PersistentAttribute), false);
|
||||||
|
// Persistent only
|
||||||
|
if (attrs.Length > 0 && !props.ContainsKey(prop.Name))
|
||||||
|
{
|
||||||
|
// add property to hash
|
||||||
|
props.Add(prop.Name, prop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!propertiesCache.ContainsKey(typeSource.Name))
|
||||||
|
{
|
||||||
|
// add to cache
|
||||||
|
propertiesCache.Add(typeSource.Name, props);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy the data
|
||||||
|
foreach (PropertyInfo propertyInfo in props.Values)
|
||||||
|
{
|
||||||
|
propertyInfo.SetValue(target, propertyInfo.GetValue(source, null), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void CreateObjectFromHash(object obj, Hashtable propValues, bool persistentOnly)
|
||||||
|
{
|
||||||
|
Type type = obj.GetType();
|
||||||
|
|
||||||
|
// get all property infos
|
||||||
|
Hashtable props = null;
|
||||||
|
if (propertiesCache[type.Name] != null)
|
||||||
|
{
|
||||||
|
// load properties from cache
|
||||||
|
props = (Hashtable)propertiesCache[type.Name];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// create properties cache
|
||||||
|
props = new Hashtable();
|
||||||
|
PropertyInfo[] objProps = type.GetProperties(BindingFlags.Instance
|
||||||
|
//| BindingFlags.DeclaredOnly
|
||||||
|
| BindingFlags.Public);
|
||||||
|
foreach (PropertyInfo prop in objProps)
|
||||||
|
{
|
||||||
|
// check for persistent attribute
|
||||||
|
object[] attrs = prop.GetCustomAttributes(typeof(PersistentAttribute), false);
|
||||||
|
if (!persistentOnly || (persistentOnly && attrs.Length > 0) && !props.ContainsKey(prop.Name))
|
||||||
|
{
|
||||||
|
// add property to hash
|
||||||
|
props.Add(prop.Name, prop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!propertiesCache.ContainsKey(type.Name))
|
||||||
|
{
|
||||||
|
// add to cache
|
||||||
|
propertiesCache.Add(type.Name, props);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// fill properties
|
||||||
|
foreach (string propName in propValues.Keys)
|
||||||
|
{
|
||||||
|
// try to locate specified property
|
||||||
|
if (props[propName] != null)
|
||||||
|
{
|
||||||
|
// set property
|
||||||
|
// we support:
|
||||||
|
// String
|
||||||
|
// Int32
|
||||||
|
// Boolean
|
||||||
|
// Float
|
||||||
|
PropertyInfo prop = (PropertyInfo)props[propName];
|
||||||
|
string val = propValues[propName].ToString();
|
||||||
|
if (prop.PropertyType == typeof(String))
|
||||||
|
prop.SetValue(obj, val, null);
|
||||||
|
else if (prop.PropertyType == typeof(Int32))
|
||||||
|
prop.SetValue(obj, Int32.Parse(val), null);
|
||||||
|
else
|
||||||
|
if (prop.PropertyType == typeof(long))
|
||||||
|
prop.SetValue(obj, long.Parse(val), null);
|
||||||
|
else
|
||||||
|
if (prop.PropertyType == typeof(Boolean))
|
||||||
|
prop.SetValue(obj, Boolean.Parse(val), null);
|
||||||
|
else if (prop.PropertyType == typeof(Single))
|
||||||
|
prop.SetValue(obj, Single.Parse(val), null);
|
||||||
|
else if (prop.PropertyType.IsEnum)
|
||||||
|
prop.SetValue(obj, Enum.Parse(prop.PropertyType, val, true), null);
|
||||||
|
else
|
||||||
|
if (prop.PropertyType == typeof(Guid))
|
||||||
|
prop.SetValue(obj, new Guid(val), null);
|
||||||
|
else
|
||||||
|
if (prop.PropertyType == typeof(string[]))
|
||||||
|
{
|
||||||
|
if (val == "")
|
||||||
|
prop.SetValue(obj, new string[0], null);
|
||||||
|
else
|
||||||
|
prop.SetValue(obj, val.Split(';'), null);
|
||||||
|
}
|
||||||
|
else if (prop.PropertyType == typeof(int[]))
|
||||||
|
{
|
||||||
|
string[] svals = val.Split(';');
|
||||||
|
int[] ivals = new int[svals.Length];
|
||||||
|
|
||||||
|
for (int i = 0; i < svals.Length; i++)
|
||||||
|
ivals[i] = Int32.Parse(svals[i]);
|
||||||
|
|
||||||
|
if (val == "")
|
||||||
|
ivals = new int[0];
|
||||||
|
|
||||||
|
prop.SetValue(obj, ivals, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Dictionary<string, PropertyInfo> GetTypePropertiesHash(Type type)
|
||||||
|
{
|
||||||
|
Dictionary<string, PropertyInfo> hash = new Dictionary<string, PropertyInfo>();
|
||||||
|
PropertyInfo[] props = GetTypeProperties(type);
|
||||||
|
foreach (PropertyInfo prop in props)
|
||||||
|
{
|
||||||
|
if (!hash.ContainsKey(prop.Name))
|
||||||
|
{
|
||||||
|
hash.Add(prop.Name, prop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static PropertyInfo[] GetTypeProperties(Type type)
|
||||||
|
{
|
||||||
|
string typeName = type.AssemblyQualifiedName;
|
||||||
|
if (typeProperties[typeName] != null)
|
||||||
|
return (PropertyInfo[])typeProperties[typeName];
|
||||||
|
|
||||||
|
PropertyInfo[] props = type.GetProperties(BindingFlags.Instance | BindingFlags.Public);
|
||||||
|
typeProperties[typeName] = props;
|
||||||
|
return props;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static object GetNull(Type type)
|
||||||
|
{
|
||||||
|
if (type == typeof(string))
|
||||||
|
return null;
|
||||||
|
if (type == typeof(Int32))
|
||||||
|
return 0;
|
||||||
|
if (type == typeof(Int64))
|
||||||
|
return 0;
|
||||||
|
if (type == typeof(Boolean))
|
||||||
|
return false;
|
||||||
|
if (type == typeof(Decimal))
|
||||||
|
return 0M;
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static object Cast(string val, Type type)
|
||||||
|
{
|
||||||
|
if (type == typeof(string))
|
||||||
|
return val;
|
||||||
|
if (type == typeof(Int32))
|
||||||
|
return Int32.Parse(val);
|
||||||
|
if (type == typeof(Int64))
|
||||||
|
return Int64.Parse(val);
|
||||||
|
if (type == typeof(Boolean))
|
||||||
|
return Boolean.Parse(val);
|
||||||
|
if (type == typeof(Decimal))
|
||||||
|
return Decimal.Parse(val);
|
||||||
|
if (type == typeof(string[]) && val != null)
|
||||||
|
{
|
||||||
|
return val.Split(';');
|
||||||
|
}
|
||||||
|
if (type.IsEnum)
|
||||||
|
return Enum.Parse(type, val, true);
|
||||||
|
|
||||||
|
if (type == typeof(int[]) && val != null)
|
||||||
|
{
|
||||||
|
string[] sarr = val.Split(';');
|
||||||
|
int[] iarr = new int[sarr.Length];
|
||||||
|
for (int i = 0; i < sarr.Length; i++)
|
||||||
|
iarr[i] = Int32.Parse(sarr[i]);
|
||||||
|
return iarr;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string GetTypeFullName(Type type)
|
||||||
|
{
|
||||||
|
return type.FullName + ", " + type.Assembly.GetName().Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#region Helper Functions
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This function is used to determine whether IDataReader contains a Column.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="columnName">Name of the column.</param>
|
||||||
|
/// <param name="schemaTable">The schema <see cref="DataTable"/> that decribes result-set <see cref="IDataReader"/> contains.</param>
|
||||||
|
/// <returns>True, when required column exists in the <paramref name="schemaTable"/>. Otherwise, false.</returns>
|
||||||
|
/// <remark>
|
||||||
|
/// The followin example shows how to look for the "Role" column in the <see cref="IDataReader"/>.
|
||||||
|
/// <example>
|
||||||
|
/// IDataReader reader = ....
|
||||||
|
/// if (!IsColumnExists("Role", reader.GetSchemaTable())
|
||||||
|
/// {
|
||||||
|
/// continue;
|
||||||
|
/// }
|
||||||
|
///
|
||||||
|
/// object roleValue = reader["Role"];
|
||||||
|
/// </example>
|
||||||
|
/// </remark>
|
||||||
|
static bool IsColumnExists(string columnName, DataTable schemaTable)
|
||||||
|
{
|
||||||
|
foreach (DataRow row in schemaTable.Rows)
|
||||||
|
{
|
||||||
|
if (String.Compare(row[0].ToString(), columnName, StringComparison.OrdinalIgnoreCase) == 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load diff
|
@ -200,8 +200,8 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
if (packageCheck < 0) return packageCheck;
|
if (packageCheck < 0) return packageCheck;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("SQL_DATABASE", "UPDATE", origItem.Name);
|
TaskManager.StartTask("SQL_DATABASE", "UPDATE", origItem.Name, item.Id);
|
||||||
TaskManager.ItemId = item.Id;
|
|
||||||
TaskManager.WriteParameter("Provider", origItem.GroupName);
|
TaskManager.WriteParameter("Provider", origItem.GroupName);
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -237,9 +237,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
return BusinessErrorCodes.ERROR_MSSQL_DATABASES_PACKAGE_ITEM_NOT_FOUND;
|
return BusinessErrorCodes.ERROR_MSSQL_DATABASES_PACKAGE_ITEM_NOT_FOUND;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("SQL_DATABASE", "DELETE", origItem.Name);
|
TaskManager.StartTask("SQL_DATABASE", "DELETE", origItem.Name, itemId, new BackgroundTaskParameter("Provider", origItem.GroupName));
|
||||||
TaskManager.ItemId = itemId;
|
|
||||||
TaskManager.WriteParameter("Provider", origItem.GroupName);
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -305,8 +303,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("SQL_DATABASE", "BACKUP", item.Name);
|
TaskManager.StartTask("SQL_DATABASE", "BACKUP", item.Name, itemId);
|
||||||
TaskManager.ItemId = itemId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -398,8 +395,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
if (packageCheck < 0) return packageCheck;
|
if (packageCheck < 0) return packageCheck;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("SQL_DATABASE", "RESTORE", item.Name);
|
TaskManager.StartTask("SQL_DATABASE", "RESTORE", item.Name, itemId);
|
||||||
TaskManager.ItemId = itemId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -468,8 +464,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
return BusinessErrorCodes.ERROR_MSSQL_DATABASES_PACKAGE_ITEM_NOT_FOUND;
|
return BusinessErrorCodes.ERROR_MSSQL_DATABASES_PACKAGE_ITEM_NOT_FOUND;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("SQL_DATABASE", "TRUNCATE", origItem.Name);
|
TaskManager.StartTask("SQL_DATABASE", "TRUNCATE", origItem.Name, itemId);
|
||||||
TaskManager.ItemId = itemId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -701,8 +696,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
if (packageCheck < 0) return packageCheck;
|
if (packageCheck < 0) return packageCheck;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("SQL_USER", "UPDATE", origItem.Name);
|
TaskManager.StartTask("SQL_USER", "UPDATE", origItem.Name, item.Id);
|
||||||
TaskManager.ItemId = item.Id;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -746,8 +740,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
return BusinessErrorCodes.ERROR_MSSQL_USERS_PACKAGE_ITEM_NOT_FOUND;
|
return BusinessErrorCodes.ERROR_MSSQL_USERS_PACKAGE_ITEM_NOT_FOUND;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("SQL_USER", "DELETE", origItem.Name);
|
TaskManager.StartTask("SQL_USER", "DELETE", origItem.Name, itemId);
|
||||||
TaskManager.ItemId = itemId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
|
@ -214,12 +214,10 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
//
|
//
|
||||||
if (zoneItem != null)
|
if (zoneItem != null)
|
||||||
{
|
{
|
||||||
TaskManager.StartTask("DNS_ZONE", "DELETE", zoneItem.Name);
|
TaskManager.StartTask("DNS_ZONE", "DELETE", zoneItem.Name, zoneItemId);
|
||||||
//
|
//
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//
|
|
||||||
TaskManager.ItemId = zoneItemId;
|
|
||||||
// delete DNS zone
|
// delete DNS zone
|
||||||
DNSServer dns = new DNSServer();
|
DNSServer dns = new DNSServer();
|
||||||
ServiceProviderProxy.Init(dns, zoneItem.ServiceId);
|
ServiceProviderProxy.Init(dns, zoneItem.ServiceId);
|
|
@ -84,8 +84,10 @@ namespace WebsitePanel.Ecommerce.EnterpriseServer.ContractSystem
|
||||||
//
|
//
|
||||||
result.Succeed = true;
|
result.Succeed = true;
|
||||||
result.SetProperty("ContractId", contractId);
|
result.SetProperty("ContractId", contractId);
|
||||||
|
|
||||||
// Add contract object
|
// Add contract object
|
||||||
ES.TaskManager.TaskParameters[SystemTaskParams.PARAM_CONTRACT] = GetContract(contractId);
|
ES.TaskManager.UpdateParam(SystemTaskParams.PARAM_CONTRACT, GetContract(contractId));
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
|
@ -224,10 +224,15 @@ namespace WebsitePanel.Ecommerce.EnterpriseServer
|
||||||
InvoiceController.UpdateInvoice(invoice.InvoiceId, invoice.InvoiceNumber, invoice.DueDate,
|
InvoiceController.UpdateInvoice(invoice.InvoiceId, invoice.InvoiceNumber, invoice.DueDate,
|
||||||
invoice.Total, invoice.SubTotal, invoice.TaxationId, invoice.TaxAmount, invoice.Currency);
|
invoice.Total, invoice.SubTotal, invoice.TaxationId, invoice.TaxAmount, invoice.Currency);
|
||||||
//
|
//
|
||||||
ES.TaskManager.TaskParameters[SystemTaskParams.PARAM_CONTRACT] = contract;
|
|
||||||
ES.TaskManager.TaskParameters[SystemTaskParams.PARAM_INVOICE] = invoice;
|
Hashtable parameters = new Hashtable();
|
||||||
ES.TaskManager.TaskParameters[SystemTaskParams.PARAM_INVOICE_LINES] = invoiceLines;
|
|
||||||
ES.TaskManager.TaskParameters[SystemTaskParams.PARAM_EXTRA_ARGS] = extraArgs;
|
parameters.Add(SystemTaskParams.PARAM_CONTRACT, contract);
|
||||||
|
parameters.Add(SystemTaskParams.PARAM_INVOICE, invoice);
|
||||||
|
parameters.Add(SystemTaskParams.PARAM_INVOICE_LINES, invoiceLines);
|
||||||
|
parameters.Add(SystemTaskParams.PARAM_EXTRA_ARGS, extraArgs);
|
||||||
|
|
||||||
|
TaskManager.UpdateParams(parameters);
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -248,7 +253,7 @@ namespace WebsitePanel.Ecommerce.EnterpriseServer
|
||||||
invoiceNumber, dueDate, total, subTotal, taxationId, taxAmount, currency);
|
invoiceNumber, dueDate, total, subTotal, taxationId, taxAmount, currency);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static Invoice GetCustomerInvoiceInternally(int invoiceId)
|
public static Invoice GetCustomerInvoiceInternally(int invoiceId)
|
||||||
{
|
{
|
||||||
return ES.ObjectUtils.FillObjectFromDataReader<Invoice>(
|
return ES.ObjectUtils.FillObjectFromDataReader<Invoice>(
|
||||||
EcommerceProvider.GetCustomerInvoice(ES.SecurityContext.User.UserId, invoiceId));
|
EcommerceProvider.GetCustomerInvoice(ES.SecurityContext.User.UserId, invoiceId));
|
||||||
|
@ -260,7 +265,7 @@ namespace WebsitePanel.Ecommerce.EnterpriseServer
|
||||||
EcommerceProvider.GetCustomerInvoiceItems(ES.SecurityContext.User.UserId, invoiceId));
|
EcommerceProvider.GetCustomerInvoiceItems(ES.SecurityContext.User.UserId, invoiceId));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string GetCustomerInvoiceFormattedInternally(int invoiceId, string cultureName)
|
public static string GetCustomerInvoiceFormattedInternally(int invoiceId, string cultureName)
|
||||||
{
|
{
|
||||||
Invoice invoice = GetCustomerInvoiceInternally(invoiceId);
|
Invoice invoice = GetCustomerInvoiceInternally(invoiceId);
|
||||||
//
|
//
|
|
@ -162,7 +162,8 @@ namespace WebsitePanel.Ecommerce.EnterpriseServer
|
||||||
TaskManager.WriteParameter(USERNAME_PARAM, context.ConsumerInfo[ContractAccount.USERNAME]);
|
TaskManager.WriteParameter(USERNAME_PARAM, context.ConsumerInfo[ContractAccount.USERNAME]);
|
||||||
TaskManager.WriteParameter(SVC_PARAM, context.ServiceInfo.ServiceName);
|
TaskManager.WriteParameter(SVC_PARAM, context.ServiceInfo.ServiceName);
|
||||||
TaskManager.WriteParameter(SVC_ID_PARAM, context.ServiceInfo.ServiceId);
|
TaskManager.WriteParameter(SVC_ID_PARAM, context.ServiceInfo.ServiceId);
|
||||||
TaskManager.TaskParameters[SystemTaskParams.PARAM_SEND_EMAIL] = context.SendEmail;
|
|
||||||
|
TaskManager.UpdateParam(SystemTaskParams.PARAM_SEND_EMAIL, context.SendEmail);
|
||||||
|
|
||||||
// 0. Do security checks
|
// 0. Do security checks
|
||||||
if (!CheckOperationClientPermissions(result))
|
if (!CheckOperationClientPermissions(result))
|
|
@ -235,10 +235,13 @@ namespace WebsitePanel.Ecommerce.EnterpriseServer
|
||||||
protected void SetOutboundParameters(ProvisioningContext context)
|
protected void SetOutboundParameters(ProvisioningContext context)
|
||||||
{
|
{
|
||||||
// set task outbound parameters
|
// set task outbound parameters
|
||||||
TaskManager.TaskParameters[SystemTaskParams.PARAM_SERVICE] = context.ServiceInfo;
|
Hashtable parameters = new Hashtable();
|
||||||
TaskManager.TaskParameters[SystemTaskParams.PARAM_CONTRACT] = context.ContractInfo;
|
parameters.Add(SystemTaskParams.PARAM_SERVICE, context.ServiceInfo);
|
||||||
TaskManager.TaskParameters[SystemTaskParams.PARAM_CONTRACT_ACCOUNT] = context.ConsumerInfo;
|
parameters.Add(SystemTaskParams.PARAM_CONTRACT, context.ContractInfo);
|
||||||
TaskManager.TaskParameters[SystemTaskParams.PARAM_SEND_EMAIL] = context.SendEmail;
|
parameters.Add(SystemTaskParams.PARAM_CONTRACT_ACCOUNT, context.ConsumerInfo);
|
||||||
|
parameters.Add(SystemTaskParams.PARAM_SEND_EMAIL, context.SendEmail);
|
||||||
|
|
||||||
|
TaskManager.UpdateParams(parameters);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -763,7 +763,7 @@ namespace WebsitePanel.Ecommerce.EnterpriseServer
|
||||||
return EcommerceProvider.DeleteTaxation(SecurityContext.User.UserId, userId, taxationId);
|
return EcommerceProvider.DeleteTaxation(SecurityContext.User.UserId, userId, taxationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void SetPaymentProfile(string contractId, CheckoutDetails newProfile)
|
public static void SetPaymentProfile(string contractId, CheckoutDetails newProfile)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -864,7 +864,7 @@ namespace WebsitePanel.Ecommerce.EnterpriseServer
|
||||||
return details;
|
return details;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static bool PaymentProfileExists(string contractId)
|
public static bool PaymentProfileExists(string contractId)
|
||||||
{
|
{
|
||||||
return EcommerceProvider.PaymentProfileExists(SecurityContext.User.UserId, contractId);
|
return EcommerceProvider.PaymentProfileExists(SecurityContext.User.UserId, contractId);
|
||||||
}
|
}
|
||||||
|
@ -1145,10 +1145,15 @@ namespace WebsitePanel.Ecommerce.EnterpriseServer
|
||||||
//
|
//
|
||||||
int resultCode = EcommerceProvider.UpdateCustomerPayment(SecurityContext.User.UserId, paymentId, invoiceId,
|
int resultCode = EcommerceProvider.UpdateCustomerPayment(SecurityContext.User.UserId, paymentId, invoiceId,
|
||||||
transactionId, total, currency, methodName, pluginId, (int)status);
|
transactionId, total, currency, methodName, pluginId, (int)status);
|
||||||
|
|
||||||
//
|
//
|
||||||
TaskManager.TaskParameters[SystemTaskParams.PARAM_CONTRACT] = ContractSystem.ContractController.GetContract(contractId);
|
Hashtable parameters = new Hashtable();
|
||||||
TaskManager.TaskParameters[SystemTaskParams.PARAM_INVOICE] = InvoiceController.GetCustomerInvoiceInternally(invoiceId);
|
parameters[SystemTaskParams.PARAM_CONTRACT] = ContractSystem.ContractController.GetContract(contractId);
|
||||||
TaskManager.TaskParameters[SystemTaskParams.PARAM_PAYMENT] = GetCustomerPayment(paymentId);
|
parameters[SystemTaskParams.PARAM_INVOICE] = InvoiceController.GetCustomerInvoiceInternally(invoiceId);
|
||||||
|
parameters[SystemTaskParams.PARAM_PAYMENT] = GetCustomerPayment(paymentId);
|
||||||
|
|
||||||
|
TaskManager.UpdateParams(parameters);
|
||||||
|
|
||||||
//
|
//
|
||||||
return resultCode;
|
return resultCode;
|
||||||
}
|
}
|
||||||
|
@ -1209,9 +1214,12 @@ namespace WebsitePanel.Ecommerce.EnterpriseServer
|
||||||
// TRACE
|
// TRACE
|
||||||
TaskManager.WriteParameter("PaymentID", resultCode);
|
TaskManager.WriteParameter("PaymentID", resultCode);
|
||||||
//
|
//
|
||||||
TaskManager.TaskParameters[SystemTaskParams.PARAM_CONTRACT] = contract;
|
Hashtable parameters = new Hashtable();
|
||||||
TaskManager.TaskParameters[SystemTaskParams.PARAM_INVOICE] = invoice;
|
parameters[SystemTaskParams.PARAM_CONTRACT] = contract;
|
||||||
TaskManager.TaskParameters[SystemTaskParams.PARAM_PAYMENT] = GetCustomerPayment(resultCode);
|
parameters[SystemTaskParams.PARAM_INVOICE] = invoice;
|
||||||
|
parameters[SystemTaskParams.PARAM_PAYMENT] = GetCustomerPayment(resultCode);
|
||||||
|
|
||||||
|
TaskManager.UpdateParams(parameters);
|
||||||
//
|
//
|
||||||
return resultCode;
|
return resultCode;
|
||||||
}
|
}
|
|
@ -252,7 +252,7 @@ namespace WebsitePanel.Ecommerce.EnterpriseServer
|
||||||
EcommerceProvider.GetSupportedPluginById(pluginId));
|
EcommerceProvider.GetSupportedPluginById(pluginId));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static CheckoutFormParams GetCheckoutFormParams(string contractId, int invoiceId,
|
public static CheckoutFormParams GetCheckoutFormParams(string contractId, int invoiceId,
|
||||||
string methodName, KeyValueBunch options)
|
string methodName, KeyValueBunch options)
|
||||||
{
|
{
|
||||||
Contract contractInfo = ContractSystem.ContractController.GetContract(contractId);
|
Contract contractInfo = ContractSystem.ContractController.GetContract(contractId);
|
|
@ -45,9 +45,11 @@ namespace WebsitePanel.Ecommerce.EnterpriseServer.TaskEventHandlers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override void OnComplete()
|
public override void OnComplete()
|
||||||
{
|
{
|
||||||
if (!TaskManager.HasErrors)
|
BackgroundTask topTask = TaskManager.TopTask;
|
||||||
|
|
||||||
|
if (!TaskManager.HasErrors(topTask))
|
||||||
{
|
{
|
||||||
switch (TaskManager.TaskName)
|
switch (topTask.TaskName)
|
||||||
{
|
{
|
||||||
case SystemTasks.SVC_SUSPEND:
|
case SystemTasks.SVC_SUSPEND:
|
||||||
case SystemTasks.SVC_CANCEL:
|
case SystemTasks.SVC_CANCEL:
|
||||||
|
@ -72,7 +74,10 @@ namespace WebsitePanel.Ecommerce.EnterpriseServer.TaskEventHandlers
|
||||||
// send an e-mail notification
|
// send an e-mail notification
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
bool sendNotification = (bool)TaskManager.TaskParameters[SystemTaskParams.PARAM_SEND_EMAIL];
|
BackgroundTask topTask = TaskManager.TopTask;
|
||||||
|
|
||||||
|
bool sendNotification = Utils.ParseBool(topTask.GetParamValue(SystemTaskParams.PARAM_SEND_EMAIL), false);
|
||||||
|
|
||||||
// Ensure notification is required
|
// Ensure notification is required
|
||||||
if (!sendNotification)
|
if (!sendNotification)
|
||||||
{
|
{
|
||||||
|
@ -80,7 +85,7 @@ namespace WebsitePanel.Ecommerce.EnterpriseServer.TaskEventHandlers
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Service service = (Service)TaskManager.TaskParameters[SystemTaskParams.PARAM_SERVICE];
|
Service service = (Service)topTask.GetParamValue(SystemTaskParams.PARAM_SERVICE);
|
||||||
int smtpResult = 0;
|
int smtpResult = 0;
|
||||||
switch (service.Status)
|
switch (service.Status)
|
||||||
{
|
{
|
||||||
|
@ -112,9 +117,11 @@ namespace WebsitePanel.Ecommerce.EnterpriseServer.TaskEventHandlers
|
||||||
//
|
//
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
BackgroundTask topTask = TaskManager.TopTask;
|
||||||
|
|
||||||
// Read task parameters
|
// Read task parameters
|
||||||
Invoice invoice = (Invoice)TaskManager.TaskParameters[SystemTaskParams.PARAM_INVOICE];
|
Invoice invoice = (Invoice)topTask.GetParamValue(SystemTaskParams.PARAM_INVOICE);
|
||||||
CustomerPayment payment = (CustomerPayment)TaskManager.TaskParameters[SystemTaskParams.PARAM_PAYMENT];
|
CustomerPayment payment = (CustomerPayment)topTask.GetParamValue(SystemTaskParams.PARAM_PAYMENT);
|
||||||
//
|
//
|
||||||
if (payment.Status == TransactionStatus.Approved)
|
if (payment.Status == TransactionStatus.Approved)
|
||||||
{
|
{
|
||||||
|
@ -139,11 +146,13 @@ namespace WebsitePanel.Ecommerce.EnterpriseServer.TaskEventHandlers
|
||||||
//
|
//
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
BackgroundTask topTask = TaskManager.TopTask;
|
||||||
|
|
||||||
// Read task parameters
|
// Read task parameters
|
||||||
Contract contract = (Contract)TaskManager.TaskParameters[SystemTaskParams.PARAM_CONTRACT];
|
Contract contract = (Contract)topTask.GetParamValue(SystemTaskParams.PARAM_CONTRACT);
|
||||||
Invoice invoice = (Invoice)TaskManager.TaskParameters[SystemTaskParams.PARAM_INVOICE];
|
Invoice invoice = (Invoice)topTask.GetParamValue(SystemTaskParams.PARAM_INVOICE);
|
||||||
List<InvoiceItem> invoiceLines = (List<InvoiceItem>)TaskManager.TaskParameters[SystemTaskParams.PARAM_INVOICE_LINES];
|
List<InvoiceItem> invoiceLines = (List<InvoiceItem>)topTask.GetParamValue(SystemTaskParams.PARAM_INVOICE_LINES);
|
||||||
KeyValueBunch extraArgs = (KeyValueBunch)TaskManager.TaskParameters[SystemTaskParams.PARAM_EXTRA_ARGS];
|
KeyValueBunch extraArgs = (KeyValueBunch)topTask.GetParamValue(SystemTaskParams.PARAM_EXTRA_ARGS);
|
||||||
// modify invoice direct url
|
// modify invoice direct url
|
||||||
if (extraArgs != null && !String.IsNullOrEmpty(extraArgs["InvoiceDirectURL"]))
|
if (extraArgs != null && !String.IsNullOrEmpty(extraArgs["InvoiceDirectURL"]))
|
||||||
extraArgs["InvoiceDirectURL"] += "&InvoiceId=" + invoice.InvoiceId;
|
extraArgs["InvoiceDirectURL"] += "&InvoiceId=" + invoice.InvoiceId;
|
|
@ -44,9 +44,11 @@ namespace WebsitePanel.Ecommerce.EnterpriseServer.TaskEventHandlers
|
||||||
|
|
||||||
public override void OnComplete()
|
public override void OnComplete()
|
||||||
{
|
{
|
||||||
if (!TaskManager.HasErrors)
|
BackgroundTask topTask = TaskManager.TopTask;
|
||||||
|
|
||||||
|
if (!TaskManager.HasErrors(topTask))
|
||||||
{
|
{
|
||||||
switch (TaskManager.TaskName)
|
switch (topTask.TaskName)
|
||||||
{
|
{
|
||||||
case SystemTasks.TASK_ADD_INVOICE:
|
case SystemTasks.TASK_ADD_INVOICE:
|
||||||
RegisterInvoiceActivationTrigger();
|
RegisterInvoiceActivationTrigger();
|
||||||
|
@ -65,7 +67,7 @@ namespace WebsitePanel.Ecommerce.EnterpriseServer.TaskEventHandlers
|
||||||
private void RegisterInvoiceActivationTrigger()
|
private void RegisterInvoiceActivationTrigger()
|
||||||
{
|
{
|
||||||
// Read contract invoice
|
// Read contract invoice
|
||||||
Invoice invoice = (Invoice)TaskManager.TaskParameters[SystemTaskParams.PARAM_INVOICE];
|
Invoice invoice = (Invoice)TaskManager.TopTask.GetParamValue(SystemTaskParams.PARAM_INVOICE);
|
||||||
//
|
//
|
||||||
TriggerSystem.TriggerController.AddSystemTrigger(invoice.InvoiceId.ToString(),
|
TriggerSystem.TriggerController.AddSystemTrigger(invoice.InvoiceId.ToString(),
|
||||||
ActivateInvoiceTrigger.STATUS_AWAITING_PAYMENT, typeof(ActivateInvoiceTrigger));
|
ActivateInvoiceTrigger.STATUS_AWAITING_PAYMENT, typeof(ActivateInvoiceTrigger));
|
||||||
|
@ -73,10 +75,12 @@ namespace WebsitePanel.Ecommerce.EnterpriseServer.TaskEventHandlers
|
||||||
|
|
||||||
private void RegisterContractActivationTrigger()
|
private void RegisterContractActivationTrigger()
|
||||||
{
|
{
|
||||||
|
BackgroundTask topTask = TaskManager.TopTask;
|
||||||
|
|
||||||
// Ensure the contract has been registered successfully
|
// Ensure the contract has been registered successfully
|
||||||
if (TaskManager.TaskParameters.ContainsKey(SystemTaskParams.PARAM_CONTRACT))
|
if (topTask.ContainsParam(SystemTaskParams.PARAM_CONTRACT))
|
||||||
{
|
{
|
||||||
Contract contract = (Contract)TaskManager.TaskParameters[SystemTaskParams.PARAM_CONTRACT];
|
Contract contract = (Contract)topTask.GetParamValue(SystemTaskParams.PARAM_CONTRACT);
|
||||||
//
|
//
|
||||||
if (contract.Status == ContractStatus.Pending)
|
if (contract.Status == ContractStatus.Pending)
|
||||||
{
|
{
|
||||||
|
@ -88,8 +92,10 @@ namespace WebsitePanel.Ecommerce.EnterpriseServer.TaskEventHandlers
|
||||||
|
|
||||||
private void ActivatePaymentSystemTriggers()
|
private void ActivatePaymentSystemTriggers()
|
||||||
{
|
{
|
||||||
CustomerPayment payment = (CustomerPayment)TaskManager.TaskParameters[SystemTaskParams.PARAM_PAYMENT];
|
BackgroundTask topTask = TaskManager.TopTask;
|
||||||
Contract contract = (Contract)TaskManager.TaskParameters[SystemTaskParams.PARAM_CONTRACT];
|
|
||||||
|
CustomerPayment payment = (CustomerPayment)topTask.GetParamValue(SystemTaskParams.PARAM_PAYMENT);
|
||||||
|
Contract contract = (Contract)topTask.GetParamValue(SystemTaskParams.PARAM_CONTRACT);
|
||||||
|
|
||||||
// Run activate contract trigger if the transaction was approved
|
// Run activate contract trigger if the transaction was approved
|
||||||
if (payment.Status == TransactionStatus.Approved)
|
if (payment.Status == TransactionStatus.Approved)
|
File diff suppressed because it is too large
Load diff
|
@ -169,8 +169,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
if (packageCheck < 0) return packageCheck;
|
if (packageCheck < 0) return packageCheck;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("FILES", "UPDATE_BINARY_CONTENT", path);
|
TaskManager.StartTask("FILES", "UPDATE_BINARY_CONTENT", path, packageId);
|
||||||
TaskManager.ItemId = packageId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -204,8 +203,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
if (packageCheck < 0) return packageCheck;
|
if (packageCheck < 0) return packageCheck;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("FILES", "UPDATE_BINARY_CONTENT", path);
|
TaskManager.StartTask("FILES", "UPDATE_BINARY_CONTENT", path, packageId);
|
||||||
TaskManager.ItemId = packageId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -260,8 +258,8 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
if (accountCheck < 0) return accountCheck;
|
if (accountCheck < 0) return accountCheck;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("FILES", "DELETE_FILES");
|
TaskManager.StartTask("FILES", "DELETE_FILES", packageId);
|
||||||
TaskManager.ItemId = packageId;
|
|
||||||
if (files != null)
|
if (files != null)
|
||||||
{
|
{
|
||||||
foreach (string file in files)
|
foreach (string file in files)
|
||||||
|
@ -302,8 +300,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
if (packageCheck < 0) return packageCheck;
|
if (packageCheck < 0) return packageCheck;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("FILES", "CREATE_FILE", path);
|
TaskManager.StartTask("FILES", "CREATE_FILE", path, packageId);
|
||||||
TaskManager.ItemId = packageId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -356,8 +353,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
if (packageCheck < 0) return packageCheck;
|
if (packageCheck < 0) return packageCheck;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("FILES", "CREATE_FOLDER", path);
|
TaskManager.StartTask("FILES", "CREATE_FOLDER", path, packageId);
|
||||||
TaskManager.ItemId = packageId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -396,8 +392,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
if (!DirectoryExists(packageId, destFolder)) return BusinessErrorCodes.ERROR_FILE_DEST_FOLDER_NONEXISTENT;
|
if (!DirectoryExists(packageId, destFolder)) return BusinessErrorCodes.ERROR_FILE_DEST_FOLDER_NONEXISTENT;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("FILES", "COPY_FILES");
|
TaskManager.StartTask("FILES", "COPY_FILES", packageId);
|
||||||
TaskManager.ItemId = packageId;
|
|
||||||
TaskManager.WriteParameter("Destination folder", destFolder);
|
TaskManager.WriteParameter("Destination folder", destFolder);
|
||||||
if (files != null)
|
if (files != null)
|
||||||
{
|
{
|
||||||
|
@ -455,8 +450,8 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
if (!DirectoryExists(packageId, destFolder)) return BusinessErrorCodes.ERROR_FILE_DEST_FOLDER_NONEXISTENT;
|
if (!DirectoryExists(packageId, destFolder)) return BusinessErrorCodes.ERROR_FILE_DEST_FOLDER_NONEXISTENT;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("FILES", "MOVE_FILES");
|
TaskManager.StartTask("FILES", "MOVE_FILES", packageId);
|
||||||
TaskManager.ItemId = packageId;
|
|
||||||
TaskManager.WriteParameter("Destination folder", destFolder);
|
TaskManager.WriteParameter("Destination folder", destFolder);
|
||||||
if (files != null)
|
if (files != null)
|
||||||
{
|
{
|
||||||
|
@ -514,8 +509,8 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
if (accountCheck < 0) return accountCheck;
|
if (accountCheck < 0) return accountCheck;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("FILES", "RENAME_FILE", oldPath);
|
TaskManager.StartTask("FILES", "RENAME_FILE", oldPath, packageId);
|
||||||
TaskManager.ItemId = packageId;
|
|
||||||
TaskManager.WriteParameter("New name", newPath);
|
TaskManager.WriteParameter("New name", newPath);
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -551,8 +546,8 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
if (packageCheck < 0) return null;
|
if (packageCheck < 0) return null;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("FILES", "UNZIP_FILES");
|
TaskManager.StartTask("FILES", "UNZIP_FILES", packageId);
|
||||||
TaskManager.ItemId = packageId;
|
|
||||||
if (files != null)
|
if (files != null)
|
||||||
{
|
{
|
||||||
foreach (string file in files)
|
foreach (string file in files)
|
||||||
|
@ -596,8 +591,8 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
if (packageCheck < 0) return packageCheck;
|
if (packageCheck < 0) return packageCheck;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("FILES", "ZIP_FILES", archivePath);
|
TaskManager.StartTask("FILES", "ZIP_FILES", archivePath, packageId);
|
||||||
TaskManager.ItemId = packageId;
|
|
||||||
if (files != null)
|
if (files != null)
|
||||||
{
|
{
|
||||||
foreach (string file in files)
|
foreach (string file in files)
|
||||||
|
@ -647,8 +642,8 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
if (packageCheck < 0) return packageCheck;
|
if (packageCheck < 0) return packageCheck;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("FILES", "ZIP_FILES", archivePath);
|
TaskManager.StartTask("FILES", "ZIP_FILES", archivePath, packageId);
|
||||||
TaskManager.ItemId = packageId;
|
|
||||||
if (files != null)
|
if (files != null)
|
||||||
{
|
{
|
||||||
foreach (string file in files)
|
foreach (string file in files)
|
||||||
|
@ -706,8 +701,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
if (packageCheck < 0) return packageCheck;
|
if (packageCheck < 0) return packageCheck;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("FILES", "CREATE_ACCESS_DATABASE", dbPath);
|
TaskManager.StartTask("FILES", "CREATE_ACCESS_DATABASE", dbPath, packageId);
|
||||||
TaskManager.ItemId = packageId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -737,8 +731,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
if (accountCheck < 0) return accountCheck;
|
if (accountCheck < 0) return accountCheck;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("SPACE", "CALCULATE_DISKSPACE");
|
TaskManager.StartTask("SPACE", "CALCULATE_DISKSPACE", packageId);
|
||||||
TaskManager.ItemId = packageId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -813,8 +806,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
if (accountCheck < 0) return accountCheck;
|
if (accountCheck < 0) return accountCheck;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("FILES", "SET_PERMISSIONS", path);
|
TaskManager.StartTask("FILES", "SET_PERMISSIONS", path, packageId);
|
||||||
TaskManager.ItemId = packageId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -925,8 +917,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
if (packageCheck < 0) return packageCheck;
|
if (packageCheck < 0) return packageCheck;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("FILES", "SET_QUOTA_ON_FOLDER", path);
|
TaskManager.StartTask("FILES", "SET_QUOTA_ON_FOLDER", path, packageId);
|
||||||
TaskManager.ItemId = packageId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1046,8 +1037,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
if (packageCheck < 0) return packageCheck;
|
if (packageCheck < 0) return packageCheck;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("FILES", "DELETE_DIRECTORY_RECURSIVE", rootPath);
|
TaskManager.StartTask("FILES", "DELETE_DIRECTORY_RECURSIVE", rootPath, packageId);
|
||||||
TaskManager.ItemId = packageId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
|
@ -215,8 +215,8 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
if (packageCheck < 0) return packageCheck;
|
if (packageCheck < 0) return packageCheck;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("FTP_ACCOUNT", "UPDATE", origItem.Name);
|
TaskManager.StartTask("FTP_ACCOUNT", "UPDATE", origItem.Name, item.Id);
|
||||||
TaskManager.ItemId = item.Id;
|
|
||||||
TaskManager.WriteParameter("Folder", item.Folder);
|
TaskManager.WriteParameter("Folder", item.Folder);
|
||||||
TaskManager.WriteParameter("CanRead", item.CanRead);
|
TaskManager.WriteParameter("CanRead", item.CanRead);
|
||||||
TaskManager.WriteParameter("CanWrite", item.CanWrite);
|
TaskManager.WriteParameter("CanWrite", item.CanWrite);
|
||||||
|
@ -279,8 +279,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
return BusinessErrorCodes.ERROR_FTP_PACKAGE_ITEM_NOT_FOUND;
|
return BusinessErrorCodes.ERROR_FTP_PACKAGE_ITEM_NOT_FOUND;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("FTP_ACCOUNT", "DELETE", origItem.Name);
|
TaskManager.StartTask("FTP_ACCOUNT", "DELETE", origItem.Name, itemId);
|
||||||
TaskManager.ItemId = itemId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
|
@ -419,8 +419,7 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
|
||||||
if (accountCheck < 0) return accountCheck;
|
if (accountCheck < 0) return accountCheck;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("LYNC", "DELETE_ORG");
|
TaskManager.StartTask("LYNC", "DELETE_ORG", itemId);
|
||||||
TaskManager.ItemId = itemId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -622,8 +621,7 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
|
||||||
public static List<LyncUserPlan> GetLyncUserPlans(int itemId)
|
public static List<LyncUserPlan> GetLyncUserPlans(int itemId)
|
||||||
{
|
{
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("LYNC", "GET_LYNC_LYNCUSERPLANS");
|
TaskManager.StartTask("LYNC", "GET_LYNC_LYNCUSERPLANS", itemId);
|
||||||
TaskManager.ItemId = itemId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -705,8 +703,7 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
|
||||||
{
|
{
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("LYNC", "GET_LYNC_LYNCUSERPLAN");
|
TaskManager.StartTask("LYNC", "GET_LYNC_LYNCUSERPLAN", lyncUserPlanId);
|
||||||
TaskManager.ItemId = lyncUserPlanId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -729,8 +726,7 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
|
||||||
if (accountCheck < 0) return accountCheck;
|
if (accountCheck < 0) return accountCheck;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("LYNC", "ADD_LYNC_LYNCUSERPLAN");
|
TaskManager.StartTask("LYNC", "ADD_LYNC_LYNCUSERPLAN", itemID);
|
||||||
TaskManager.ItemId = itemID;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -770,8 +766,7 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
|
||||||
if (accountCheck < 0) return accountCheck;
|
if (accountCheck < 0) return accountCheck;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("LYNC", "ADD_LYNC_LYNCUSERPLAN");
|
TaskManager.StartTask("LYNC", "ADD_LYNC_LYNCUSERPLAN", itemID);
|
||||||
TaskManager.ItemId = itemID;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -809,8 +804,7 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
|
||||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||||
if (accountCheck < 0) return accountCheck;
|
if (accountCheck < 0) return accountCheck;
|
||||||
|
|
||||||
TaskManager.StartTask("LYNC", "DELETE_LYNC_LYNCPLAN");
|
TaskManager.StartTask("LYNC", "DELETE_LYNC_LYNCPLAN", itemID);
|
||||||
TaskManager.ItemId = itemID;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -834,8 +828,7 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
|
||||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||||
if (accountCheck < 0) return accountCheck;
|
if (accountCheck < 0) return accountCheck;
|
||||||
|
|
||||||
TaskManager.StartTask("LYNC", "SET_LYNC_LYNCUSERPLAN");
|
TaskManager.StartTask("LYNC", "SET_LYNC_LYNCUSERPLAN", itemId);
|
||||||
TaskManager.ItemId = itemId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -861,8 +854,7 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
|
||||||
public static LyncFederationDomain[] GetFederationDomains(int itemId)
|
public static LyncFederationDomain[] GetFederationDomains(int itemId)
|
||||||
{
|
{
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("LYNC", "GET_LYNC_FEDERATIONDOMAINS");
|
TaskManager.StartTask("LYNC", "GET_LYNC_FEDERATIONDOMAINS", itemId);
|
||||||
TaskManager.ItemId = itemId;
|
|
||||||
|
|
||||||
LyncFederationDomain[] lyncFederationDomains = null;
|
LyncFederationDomain[] lyncFederationDomains = null;
|
||||||
|
|
||||||
|
@ -889,10 +881,11 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
|
||||||
|
|
||||||
public static LyncUserResult AddFederationDomain(int itemId, string domainName, string proxyFqdn)
|
public static LyncUserResult AddFederationDomain(int itemId, string domainName, string proxyFqdn)
|
||||||
{
|
{
|
||||||
LyncUserResult res = TaskManager.StartResultTask<LyncUserResult>("LYNC", "ADD_LYNC_FEDERATIONDOMAIN");
|
List<BackgroundTaskParameter> parameters = new List<BackgroundTaskParameter>();
|
||||||
TaskManager.ItemId = itemId;
|
parameters.Add(new BackgroundTaskParameter("domainName", domainName));
|
||||||
TaskManager.TaskParameters["domainName"] = domainName;
|
parameters.Add(new BackgroundTaskParameter("proxyFqdn", proxyFqdn));
|
||||||
TaskManager.TaskParameters["proxyFqdn"] = proxyFqdn;
|
|
||||||
|
LyncUserResult res = TaskManager.StartResultTask<LyncUserResult>("LYNC", "ADD_LYNC_FEDERATIONDOMAIN", itemId, parameters);
|
||||||
|
|
||||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||||
|
|
||||||
|
@ -966,9 +959,7 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
|
||||||
|
|
||||||
public static LyncUserResult RemoveFederationDomain(int itemId, string domainName)
|
public static LyncUserResult RemoveFederationDomain(int itemId, string domainName)
|
||||||
{
|
{
|
||||||
LyncUserResult res = TaskManager.StartResultTask<LyncUserResult>("LYNC", "REMOVE_LYNC_FEDERATIONDOMAIN");
|
LyncUserResult res = TaskManager.StartResultTask<LyncUserResult>("LYNC", "REMOVE_LYNC_FEDERATIONDOMAIN", itemId, new BackgroundTaskParameter("domainName", domainName));
|
||||||
TaskManager.ItemId = itemId;
|
|
||||||
TaskManager.TaskParameters["domainName"] = domainName;
|
|
||||||
|
|
||||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||||
|
|
|
@ -291,9 +291,11 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
return errorCode;
|
return errorCode;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("ORGANIZATION", "CREATE_ORG", organizationName);
|
List<BackgroundTaskParameter> parameters = new List<BackgroundTaskParameter>();
|
||||||
TaskManager.TaskParameters["Organization ID"] = organizationId;
|
parameters.Add(new BackgroundTaskParameter("Organization ID", organizationId));
|
||||||
TaskManager.TaskParameters["DomainName"] = domainName;
|
parameters.Add(new BackgroundTaskParameter("DomainName", domainName));
|
||||||
|
|
||||||
|
TaskManager.StartTask("ORGANIZATION", "CREATE_ORG", organizationName, parameters);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -411,9 +413,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
if (accountCheck < 0) return accountCheck;
|
if (accountCheck < 0) return accountCheck;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("ORGANIZATION", "DELETE_DOMAIN");
|
TaskManager.StartTask("ORGANIZATION", "DELETE_DOMAIN", itemId, new BackgroundTaskParameter("Domain ID", domainId));
|
||||||
TaskManager.TaskParameters["Domain ID"] = domainId;
|
|
||||||
TaskManager.ItemId = itemId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -586,8 +586,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
if (accountCheck < 0) return accountCheck;
|
if (accountCheck < 0) return accountCheck;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("ORGANIZATION", "DELETE_ORG");
|
TaskManager.StartTask("ORGANIZATION", "DELETE_ORG", itemId);
|
||||||
TaskManager.ItemId = itemId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -869,8 +868,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("ORGANIZATION", "GET_ORG_STATS");
|
TaskManager.StartTask("ORGANIZATION", "GET_ORG_STATS", itemId);
|
||||||
TaskManager.ItemId = itemId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1022,8 +1020,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
if (accountCheck < 0) return accountCheck;
|
if (accountCheck < 0) return accountCheck;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("ORGANIZATION", "CHANGE_DOMAIN_TYPE", domainId);
|
TaskManager.StartTask("ORGANIZATION", "CHANGE_DOMAIN_TYPE", domainId, itemId);
|
||||||
TaskManager.ItemId = itemId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1060,8 +1057,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
return BusinessErrorCodes.ERROR_EXCHANGE_DOMAINS_QUOTA_LIMIT;
|
return BusinessErrorCodes.ERROR_EXCHANGE_DOMAINS_QUOTA_LIMIT;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("ORGANIZATION", "ADD_DOMAIN", domainName);
|
TaskManager.StartTask("ORGANIZATION", "ADD_DOMAIN", domainName, itemId);
|
||||||
TaskManager.ItemId = itemId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1291,8 +1287,8 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
|
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("ORGANIZATION", "CREATE_USER");
|
TaskManager.StartTask("ORGANIZATION", "CREATE_USER", itemId);
|
||||||
TaskManager.ItemId = itemId;
|
|
||||||
TaskManager.Write("Organization ID :" + itemId);
|
TaskManager.Write("Organization ID :" + itemId);
|
||||||
TaskManager.Write("name :" + name);
|
TaskManager.Write("name :" + name);
|
||||||
TaskManager.Write("domain :" + domain);
|
TaskManager.Write("domain :" + domain);
|
||||||
|
@ -1414,8 +1410,8 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
|
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("ORGANIZATION", "IMPORT_USER");
|
TaskManager.StartTask("ORGANIZATION", "IMPORT_USER", itemId);
|
||||||
TaskManager.ItemId = itemId;
|
|
||||||
TaskManager.Write("Organization ID :" + itemId);
|
TaskManager.Write("Organization ID :" + itemId);
|
||||||
TaskManager.Write("account :" + accountName);
|
TaskManager.Write("account :" + accountName);
|
||||||
TaskManager.Write("name :" + name);
|
TaskManager.Write("name :" + name);
|
||||||
|
@ -1572,8 +1568,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
if (accountCheck < 0) return accountCheck;
|
if (accountCheck < 0) return accountCheck;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("ORGANIZATION", "DELETE_USER");
|
TaskManager.StartTask("ORGANIZATION", "DELETE_USER", itemId);
|
||||||
TaskManager.ItemId = itemId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1676,8 +1671,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("ORGANIZATION", "GET_USER_GENERAL");
|
TaskManager.StartTask("ORGANIZATION", "GET_USER_GENERAL", itemId);
|
||||||
TaskManager.ItemId = itemId;
|
|
||||||
|
|
||||||
OrganizationUser account = null;
|
OrganizationUser account = null;
|
||||||
Organization org = null;
|
Organization org = null;
|
||||||
|
@ -1700,8 +1694,8 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
// get mailbox settings
|
// get mailbox settings
|
||||||
Organizations orgProxy = GetOrganizationProxy(org.ServiceId);
|
Organizations orgProxy = GetOrganizationProxy(org.ServiceId);
|
||||||
string accountName = GetAccountName(account.AccountName);
|
string accountName = GetAccountName(account.AccountName);
|
||||||
|
|
||||||
|
|
||||||
OrganizationUser retUser = orgProxy.GetUserGeneralSettings(accountName, org.OrganizationId);
|
OrganizationUser retUser = orgProxy.GetUserGeneralSettings(accountName, org.OrganizationId);
|
||||||
retUser.AccountId = accountId;
|
retUser.AccountId = accountId;
|
||||||
retUser.AccountName = account.AccountName;
|
retUser.AccountName = account.AccountName;
|
||||||
|
@ -1712,13 +1706,10 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
retUser.IsLyncUser = DataProvider.CheckLyncUserExists(accountId);
|
retUser.IsLyncUser = DataProvider.CheckLyncUserExists(accountId);
|
||||||
retUser.IsBlackBerryUser = BlackBerryController.CheckBlackBerryUserExists(accountId);
|
retUser.IsBlackBerryUser = BlackBerryController.CheckBlackBerryUserExists(accountId);
|
||||||
retUser.SubscriberNumber = account.SubscriberNumber;
|
retUser.SubscriberNumber = account.SubscriberNumber;
|
||||||
|
|
||||||
return retUser;
|
return retUser;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch { }
|
||||||
{
|
|
||||||
//throw TaskManager.WriteError(ex);
|
|
||||||
}
|
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
TaskManager.CompleteTask();
|
TaskManager.CompleteTask();
|
||||||
|
@ -1740,8 +1731,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
if (accountCheck < 0) return accountCheck;
|
if (accountCheck < 0) return accountCheck;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("ORGANIZATION", "UPDATE_USER_GENERAL");
|
TaskManager.StartTask("ORGANIZATION", "UPDATE_USER_GENERAL", itemId);
|
||||||
TaskManager.ItemId = itemId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1832,8 +1822,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
|
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("ORGANIZATION", "SET_USER_USERPRINCIPALNAME");
|
TaskManager.StartTask("ORGANIZATION", "SET_USER_USERPRINCIPALNAME", itemId);
|
||||||
TaskManager.ItemId = itemId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1931,8 +1920,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
if (accountCheck < 0) return accountCheck;
|
if (accountCheck < 0) return accountCheck;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("ORGANIZATION", "SET_USER_PASSWORD");
|
TaskManager.StartTask("ORGANIZATION", "SET_USER_PASSWORD", itemId);
|
||||||
TaskManager.ItemId = itemId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -2048,8 +2036,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
public static int GetAccountIdByUserPrincipalName(int itemId, string userPrincipalName)
|
public static int GetAccountIdByUserPrincipalName(int itemId, string userPrincipalName)
|
||||||
{
|
{
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("ORGANIZATION", "GET_ACCOUNT_BYUPN");
|
TaskManager.StartTask("ORGANIZATION", "GET_ACCOUNT_BYUPN", itemId);
|
||||||
TaskManager.ItemId = itemId;
|
|
||||||
|
|
||||||
int accounId = -1;
|
int accounId = -1;
|
||||||
|
|
|
@ -92,10 +92,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
DataProvider.AddAuditLogRecord(recordId, severityId, userId, username, packageId, itemId, itemName,
|
DataProvider.AddAuditLogRecord(recordId, severityId, userId, username, packageId, itemId, itemName,
|
||||||
startDate, finishDate, sourceName, taskName, executionLog);
|
startDate, finishDate, sourceName, taskName, executionLog);
|
||||||
}
|
}
|
||||||
catch
|
catch { }
|
||||||
{
|
|
||||||
// skip error
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static DateTime GetStartDate(DateTime d)
|
private static DateTime GetStartDate(DateTime d)
|
|
@ -191,8 +191,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
return BusinessErrorCodes.ERROR_MAIL_ACCOUNT_MAX_MAILBOX_SIZE_LIMIT;
|
return BusinessErrorCodes.ERROR_MAIL_ACCOUNT_MAX_MAILBOX_SIZE_LIMIT;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("MAIL_ACCOUNT", "UPDATE", origItem.Name);
|
TaskManager.StartTask("MAIL_ACCOUNT", "UPDATE", origItem.Name, item.Id);
|
||||||
TaskManager.ItemId = item.Id;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -245,8 +244,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
return BusinessErrorCodes.ERROR_MAIL_ACCOUNTS_PACKAGE_ITEM_NOT_FOUND;
|
return BusinessErrorCodes.ERROR_MAIL_ACCOUNTS_PACKAGE_ITEM_NOT_FOUND;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("MAIL_ACCOUNT", "DELETE", origItem.Name);
|
TaskManager.StartTask("MAIL_ACCOUNT", "DELETE", origItem.Name, itemId);
|
||||||
TaskManager.ItemId = itemId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -402,7 +400,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
item.ServiceId = serviceId;
|
item.ServiceId = serviceId;
|
||||||
int itemId = PackageController.AddPackageItem(item);
|
int itemId = PackageController.AddPackageItem(item);
|
||||||
|
|
||||||
TaskManager.ItemId = itemId;
|
TaskManager.ItemId = itemId;
|
||||||
|
|
||||||
return itemId;
|
return itemId;
|
||||||
}
|
}
|
||||||
|
@ -432,8 +430,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
if (packageCheck < 0) return packageCheck;
|
if (packageCheck < 0) return packageCheck;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("MAIL_FORWARDING", "UPDATE", origItem.Name);
|
TaskManager.StartTask("MAIL_FORWARDING", "UPDATE", origItem.Name, item.Id);
|
||||||
TaskManager.ItemId = item.Id;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -477,8 +474,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
return BusinessErrorCodes.ERROR_MAIL_FORWARDINGS_PACKAGE_ITEM_NOT_FOUND;
|
return BusinessErrorCodes.ERROR_MAIL_FORWARDINGS_PACKAGE_ITEM_NOT_FOUND;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("MAIL_FORWARDING", "DELETE", origItem.Name);
|
TaskManager.StartTask("MAIL_FORWARDING", "DELETE", origItem.Name, itemId);
|
||||||
TaskManager.ItemId = itemId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -638,8 +634,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
return BusinessErrorCodes.ERROR_MAIL_GROUPS_RECIPIENTS_LIMIT;
|
return BusinessErrorCodes.ERROR_MAIL_GROUPS_RECIPIENTS_LIMIT;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("MAIL_GROUP", "UPDATE", origItem.Name);
|
TaskManager.StartTask("MAIL_GROUP", "UPDATE", origItem.Name, item.Id);
|
||||||
TaskManager.ItemId = item.Id;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -679,8 +674,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
return BusinessErrorCodes.ERROR_MAIL_GROUPS_PACKAGE_ITEM_NOT_FOUND;
|
return BusinessErrorCodes.ERROR_MAIL_GROUPS_PACKAGE_ITEM_NOT_FOUND;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("MAIL_GROUP", "DELETE", origItem.Name);
|
TaskManager.StartTask("MAIL_GROUP", "DELETE", origItem.Name, itemId);
|
||||||
TaskManager.ItemId = itemId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -889,8 +883,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
return BusinessErrorCodes.ERROR_MAIL_LISTS_RECIPIENTS_LIMIT;
|
return BusinessErrorCodes.ERROR_MAIL_LISTS_RECIPIENTS_LIMIT;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("MAIL_LIST", "UPDATE", origItem.Name);
|
TaskManager.StartTask("MAIL_LIST", "UPDATE", origItem.Name, item.Id);
|
||||||
TaskManager.ItemId = item.Id;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -938,8 +931,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
return BusinessErrorCodes.ERROR_MAIL_LISTS_PACKAGE_ITEM_NOT_FOUND;
|
return BusinessErrorCodes.ERROR_MAIL_LISTS_PACKAGE_ITEM_NOT_FOUND;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("MAIL_LIST", "DELETE", origItem.Name);
|
TaskManager.StartTask("MAIL_LIST", "DELETE", origItem.Name, itemId);
|
||||||
TaskManager.ItemId = itemId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1073,7 +1065,8 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskManager.ItemId = itemId;
|
TaskManager.ItemId = itemId;
|
||||||
return itemId;
|
|
||||||
|
return itemId;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -1101,8 +1094,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
if (packageCheck < 0) return packageCheck;
|
if (packageCheck < 0) return packageCheck;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("MAIL_DOMAIN", "UPDATE", origItem.Name);
|
TaskManager.StartTask("MAIL_DOMAIN", "UPDATE", origItem.Name, item.Id);
|
||||||
TaskManager.ItemId = item.Id;
|
|
||||||
|
|
||||||
// get service
|
// get service
|
||||||
MailServer mail = new MailServer();
|
MailServer mail = new MailServer();
|
||||||
|
@ -1148,8 +1140,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
return BusinessErrorCodes.ERROR_MAIL_DOMAIN_IS_NOT_EMPTY; // mail domain is not empty
|
return BusinessErrorCodes.ERROR_MAIL_DOMAIN_IS_NOT_EMPTY; // mail domain is not empty
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("MAIL_DOMAIN", "DELETE", origItem.Name);
|
TaskManager.StartTask("MAIL_DOMAIN", "DELETE", origItem.Name, itemId);
|
||||||
TaskManager.ItemId = itemId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1222,10 +1213,9 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
return BusinessErrorCodes.ERROR_DOMAIN_PACKAGE_ITEM_NOT_FOUND;
|
return BusinessErrorCodes.ERROR_DOMAIN_PACKAGE_ITEM_NOT_FOUND;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("MAIL_DOMAIN", "ADD_POINTER", mailDomain.Name);
|
TaskManager.StartTask("MAIL_DOMAIN", "ADD_POINTER", mailDomain.Name, itemId, new BackgroundTaskParameter("Domain ID", domain.DomainId));
|
||||||
TaskManager.ItemId = itemId;
|
|
||||||
TaskManager.TaskParameters["Domain ID"] = domain.DomainId;
|
TaskManager.WriteParameter("Domain pointer", domain.DomainName);
|
||||||
TaskManager.WriteParameter("Domain pointer", domain.DomainName);
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1277,10 +1267,12 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
return BusinessErrorCodes.ERROR_DOMAIN_PACKAGE_ITEM_NOT_FOUND;
|
return BusinessErrorCodes.ERROR_DOMAIN_PACKAGE_ITEM_NOT_FOUND;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("MAIL_DOMAIN", "DELETE_POINTER", mailDomain.Name);
|
|
||||||
TaskManager.ItemId = itemId;
|
List<BackgroundTaskParameter> parameters = new List<BackgroundTaskParameter>();
|
||||||
TaskManager.TaskParameters["Domain ID"] = domain.DomainId;
|
parameters.Add(new BackgroundTaskParameter("Domain ID", domain.DomainId));
|
||||||
TaskManager.WriteParameter("Domain pointer", domain.DomainName);
|
parameters.Add(new BackgroundTaskParameter("Domain pointer", domain.DomainName));
|
||||||
|
|
||||||
|
TaskManager.StartTask("MAIL_DOMAIN", "DELETE_POINTER", mailDomain.Name, itemId, parameters);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
|
@ -191,8 +191,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
if (packageCheck < 0) return packageCheck;
|
if (packageCheck < 0) return packageCheck;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("ODBC_DSN", "UPDATE", origItem.Name);
|
TaskManager.StartTask("ODBC_DSN", "UPDATE", origItem.Name, item.Id);
|
||||||
TaskManager.ItemId = item.Id;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -265,8 +264,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
return BusinessErrorCodes.ERROR_OS_DSN_PACKAGE_ITEM_NOT_FOUND;
|
return BusinessErrorCodes.ERROR_OS_DSN_PACKAGE_ITEM_NOT_FOUND;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("ODBC_DSN", "DELETE", origItem.Name);
|
TaskManager.StartTask("ODBC_DSN", "DELETE", origItem.Name, itemId);
|
||||||
TaskManager.ItemId = itemId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -316,8 +314,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
ServerInfo server = ServerController.GetServerById(serverId);
|
ServerInfo server = ServerController.GetServerById(serverId);
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("SERVER", "RESET_TERMINAL_SESSION", sessionId);
|
TaskManager.StartTask("SERVER", "RESET_TERMINAL_SESSION", sessionId, serverId);
|
||||||
TaskManager.ItemId = serverId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -352,8 +349,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
ServerInfo server = ServerController.GetServerById(serverId);
|
ServerInfo server = ServerController.GetServerById(serverId);
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("SERVER", "TERMINATE_SYSTEM_PROCESS", pid);
|
TaskManager.StartTask("SERVER", "TERMINATE_SYSTEM_PROCESS", pid, serverId);
|
||||||
TaskManager.ItemId = serverId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -388,8 +384,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
ServerInfo server = ServerController.GetServerById(serverId);
|
ServerInfo server = ServerController.GetServerById(serverId);
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("SERVER", "CHANGE_WINDOWS_SERVICE_STATUS", id);
|
TaskManager.StartTask("SERVER", "CHANGE_WINDOWS_SERVICE_STATUS", id, serverId);
|
||||||
TaskManager.ItemId = serverId;
|
|
||||||
TaskManager.WriteParameter("New Status", status);
|
TaskManager.WriteParameter("New Status", status);
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -555,8 +550,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
| DemandAccount.IsActive);
|
| DemandAccount.IsActive);
|
||||||
if (accountCheck < 0) return accountCheck;
|
if (accountCheck < 0) return accountCheck;
|
||||||
|
|
||||||
TaskManager.StartTask("SERVER", "CLEAR_EVENT_LOG", logName);
|
TaskManager.StartTask("SERVER", "CLEAR_EVENT_LOG", logName, serverId);
|
||||||
TaskManager.ItemId = serverId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -587,8 +581,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
ServerInfo server = ServerController.GetServerById(serverId);
|
ServerInfo server = ServerController.GetServerById(serverId);
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("SERVER", "REBOOT");
|
TaskManager.StartTask("SERVER", "REBOOT", serverId);
|
||||||
TaskManager.ItemId = serverId;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
|
@ -617,8 +617,12 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskManager.ItemId = result.Result;
|
BackgroundTask topTask = TaskManager.TopTask;
|
||||||
TaskManager.TaskParameters["SendLetter"] = sendLetter;
|
|
||||||
|
topTask.ItemId = userId;
|
||||||
|
topTask.UpdateParamValue("SendLetter", sendLetter);
|
||||||
|
|
||||||
|
TaskController.UpdateTaskWithParams(topTask);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -718,10 +722,14 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
if (homeId < 0)
|
if (homeId < 0)
|
||||||
result.Result = homeId;
|
result.Result = homeId;
|
||||||
|
|
||||||
TaskManager.ItemId = result.Result;
|
BackgroundTask topTask = TaskManager.TopTask;
|
||||||
TaskManager.TaskParameters["Signup"] = signup;
|
|
||||||
TaskManager.TaskParameters["UserId"] = userId;
|
topTask.ItemId = userId;
|
||||||
TaskManager.TaskParameters["SendLetter"] = sendLetter;
|
topTask.UpdateParamValue("Signup", signup);
|
||||||
|
topTask.UpdateParamValue("UserId", userId);
|
||||||
|
topTask.UpdateParamValue("SendLetter", sendLetter);
|
||||||
|
|
||||||
|
TaskController.UpdateTaskWithParams(topTask);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
|
@ -0,0 +1,36 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("WebsitePanel.EnterpriseServer.Code")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("OM-3")]
|
||||||
|
[assembly: AssemblyProduct("WebsitePanel.EnterpriseServer.Code")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © OM-3 2013")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("e5f16c8f-9560-459d-88d4-9c6ee9b71283")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -31,6 +31,7 @@ using System.IO;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Threading;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Security.Cryptography.Xml;
|
using System.Security.Cryptography.Xml;
|
||||||
|
@ -116,10 +117,9 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
TaskManager.StartTask(taskId, "BACKUP", "BACKUP", backupFileName);
|
TaskManager.StartTask(taskId, "BACKUP", "BACKUP", backupFileName, SecurityContext.User.UserId);
|
||||||
TaskManager.ItemId = SecurityContext.User.UserId;
|
|
||||||
|
|
||||||
// get the list of items to backup
|
// get the list of items to backup
|
||||||
TaskManager.Write("Calculate items to backup");
|
TaskManager.Write("Calculate items to backup");
|
||||||
List<ServiceProviderItem> items = GetBackupItems(userId, packageId, serviceId, serverId);
|
List<ServiceProviderItem> items = GetBackupItems(userId, packageId, serviceId, serverId);
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
|
|
||||||
// increment progress
|
// increment progress
|
||||||
TaskManager.IndicatorCurrent += 1;
|
TaskManager.IndicatorCurrent += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -343,7 +343,11 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskManager.IndicatorCurrent = TaskManager.IndicatorMaximum;
|
BackgroundTask topTask = TaskManager.TopTask;
|
||||||
|
|
||||||
|
topTask.IndicatorCurrent = topTask.IndicatorMaximum;
|
||||||
|
|
||||||
|
TaskController.UpdateTask(topTask);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -490,8 +494,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
string backupFileName = (storePackageId > 0)
|
string backupFileName = (storePackageId > 0)
|
||||||
? Path.GetFileName(storePackageBackupPath) : Path.GetFileName(storeServerBackupPath);
|
? Path.GetFileName(storePackageBackupPath) : Path.GetFileName(storeServerBackupPath);
|
||||||
|
|
||||||
TaskManager.StartTask(taskId, "BACKUP", "RESTORE", backupFileName);
|
TaskManager.StartTask(taskId, "BACKUP", "RESTORE", backupFileName, SecurityContext.User.UserId);
|
||||||
TaskManager.ItemId = SecurityContext.User.UserId;
|
|
||||||
|
|
||||||
// create temp folder
|
// create temp folder
|
||||||
string tempFolder = GetTempBackupFolder();
|
string tempFolder = GetTempBackupFolder();
|
||||||
|
@ -804,8 +807,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{ //
|
||||||
//
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -171,8 +171,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
{
|
{
|
||||||
PackageInfo package = PackageController.GetPackage(packageId);
|
PackageInfo package = PackageController.GetPackage(packageId);
|
||||||
|
|
||||||
TaskManager.StartTask(taskId, "IMPORT", "IMPORT", package.PackageName);
|
TaskManager.StartTask(taskId, "IMPORT", "IMPORT", package.PackageName, packageId);
|
||||||
TaskManager.ItemId = packageId;
|
|
||||||
|
|
||||||
TaskManager.IndicatorMaximum = items.Length;
|
TaskManager.IndicatorMaximum = items.Length;
|
||||||
TaskManager.IndicatorCurrent = 0;
|
TaskManager.IndicatorCurrent = 0;
|
|
@ -46,11 +46,13 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
// - BACKUP_NAME
|
// - BACKUP_NAME
|
||||||
// - ZIP_BACKUP
|
// - ZIP_BACKUP
|
||||||
|
|
||||||
string databaseGroup = (string)TaskManager.TaskParameters["DATABASE_GROUP"];
|
BackgroundTask topTask = TaskManager.TopTask;
|
||||||
string databaseName = (string)TaskManager.TaskParameters["DATABASE_NAME"];
|
|
||||||
string backupFolder = (string)TaskManager.TaskParameters["BACKUP_FOLDER"];
|
string databaseGroup = (string)topTask.GetParamValue("DATABASE_GROUP");
|
||||||
string backupName = (string)TaskManager.TaskParameters["BACKUP_NAME"];
|
string databaseName = (string)topTask.GetParamValue("DATABASE_NAME");
|
||||||
string strZipBackup = (string)TaskManager.TaskParameters["ZIP_BACKUP"];
|
string backupFolder = (string)topTask.GetParamValue("BACKUP_FOLDER");
|
||||||
|
string backupName = (string)topTask.GetParamValue("BACKUP_NAME");
|
||||||
|
string strZipBackup = (string)topTask.GetParamValue("ZIP_BACKUP");
|
||||||
|
|
||||||
// check input parameters
|
// check input parameters
|
||||||
if (String.IsNullOrEmpty(databaseName))
|
if (String.IsNullOrEmpty(databaseName))
|
||||||
|
@ -77,7 +79,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
}
|
}
|
||||||
|
|
||||||
// try to find database
|
// try to find database
|
||||||
SqlDatabase item = (SqlDatabase)PackageController.GetPackageItemByName(TaskManager.PackageId, databaseGroup,
|
SqlDatabase item = (SqlDatabase)PackageController.GetPackageItemByName(topTask.PackageId, databaseGroup,
|
||||||
databaseName, typeof(SqlDatabase));
|
databaseName, typeof(SqlDatabase));
|
||||||
|
|
||||||
if (item == null)
|
if (item == null)
|
|
@ -29,6 +29,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
|
using System.Threading;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Security;
|
using System.Web.Security;
|
||||||
using System.Web.UI;
|
using System.Web.UI;
|
||||||
|
@ -48,18 +49,22 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override void DoWork()
|
public override void DoWork()
|
||||||
{
|
{
|
||||||
|
|
||||||
string backupFileName;
|
string backupFileName;
|
||||||
int storePackageId;
|
int storePackageId;
|
||||||
string storePackageFolder;
|
string storePackageFolder;
|
||||||
string storeServerFolder;
|
string storeServerFolder;
|
||||||
bool deleteTempBackup;
|
bool deleteTempBackup;
|
||||||
|
|
||||||
|
BackgroundTask topTask = TaskManager.TopTask;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
backupFileName = (string)TaskManager.TaskParameters["BACKUP_FILE_NAME"];
|
backupFileName = (string)topTask.GetParamValue("BACKUP_FILE_NAME");
|
||||||
storePackageId = Convert.ToInt32(TaskManager.TaskParameters["STORE_PACKAGE_ID"]);
|
storePackageId = Convert.ToInt32(topTask.GetParamValue("STORE_PACKAGE_ID"));
|
||||||
storePackageFolder = (string)TaskManager.TaskParameters["STORE_PACKAGE_FOLDER"];
|
storePackageFolder = (string)topTask.GetParamValue("STORE_PACKAGE_FOLDER");
|
||||||
storeServerFolder = (string)TaskManager.TaskParameters["STORE_SERVER_FOLDER"];
|
storeServerFolder = (string)topTask.GetParamValue("STORE_SERVER_FOLDER");
|
||||||
deleteTempBackup = Convert.ToBoolean(TaskManager.TaskParameters["DELETE_TEMP_BACKUP"]);
|
deleteTempBackup = Convert.ToBoolean(topTask.GetParamValue("DELETE_TEMP_BACKUP"));
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -69,7 +74,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PackageInfo package = PackageController.GetPackage(TaskManager.PackageId);
|
PackageInfo package = PackageController.GetPackage(topTask.PackageId);
|
||||||
// We do not take into account service id as long as scheduled tasks run against packages.
|
// We do not take into account service id as long as scheduled tasks run against packages.
|
||||||
BackupController.Backup(false, "BackupTask", package.UserId, package.PackageId, 0, 0,
|
BackupController.Backup(false, "BackupTask", package.UserId, package.PackageId, 0, 0,
|
||||||
backupFileName, storePackageId, storePackageFolder, storeServerFolder, deleteTempBackup);
|
backupFileName, storePackageId, storePackageFolder, storeServerFolder, deleteTempBackup);
|
|
@ -46,7 +46,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
public void CalculateDiskspace()
|
public void CalculateDiskspace()
|
||||||
{
|
{
|
||||||
// get all space organizations recursively
|
// get all space organizations recursively
|
||||||
List<Organization> items = ExchangeServerController.GetExchangeOrganizations(TaskManager.PackageId, true);
|
List<Organization> items = ExchangeServerController.GetExchangeOrganizations(TaskManager.TopTask.PackageId, true);
|
||||||
|
|
||||||
foreach (Organization item in items)
|
foreach (Organization item in items)
|
||||||
{
|
{
|
|
@ -51,7 +51,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
public void CalculateBandwidth()
|
public void CalculateBandwidth()
|
||||||
{
|
{
|
||||||
// get all owned packages
|
// get all owned packages
|
||||||
List<PackageInfo> packages = PackageController.GetPackagePackages(TaskManager.PackageId, true);
|
List<PackageInfo> packages = PackageController.GetPackagePackages(TaskManager.TopTask.PackageId, true);
|
||||||
TaskManager.Write("Packages to calculate: " + packages.Count.ToString());
|
TaskManager.Write("Packages to calculate: " + packages.Count.ToString());
|
||||||
|
|
||||||
foreach (PackageInfo package in packages)
|
foreach (PackageInfo package in packages)
|
|
@ -52,7 +52,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
public void CalculateDiskspace()
|
public void CalculateDiskspace()
|
||||||
{
|
{
|
||||||
// get all owned packages
|
// get all owned packages
|
||||||
List<PackageInfo> packages = PackageController.GetPackagePackages(TaskManager.PackageId, true);
|
List<PackageInfo> packages = PackageController.GetPackagePackages(TaskManager.TopTask.PackageId, true);
|
||||||
TaskManager.Write("Packages to calculate: " + packages.Count.ToString());
|
TaskManager.Write("Packages to calculate: " + packages.Count.ToString());
|
||||||
|
|
||||||
foreach (PackageInfo package in packages)
|
foreach (PackageInfo package in packages)
|
|
@ -57,17 +57,19 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
// - MAIL_SUBJECT
|
// - MAIL_SUBJECT
|
||||||
// - MAIL_BODY
|
// - MAIL_BODY
|
||||||
|
|
||||||
// get input parameters
|
BackgroundTask topTask = TaskManager.TopTask;
|
||||||
string url = (string)TaskManager.TaskParameters["URL"];
|
|
||||||
string username = (string)TaskManager.TaskParameters["USERNAME"];
|
|
||||||
string password = (string)TaskManager.TaskParameters["PASSWORD"];
|
|
||||||
string strResponseStatus = (string)TaskManager.TaskParameters["RESPONSE_STATUS"];
|
|
||||||
string responseContains = (string)TaskManager.TaskParameters["RESPONSE_CONTAIN"];
|
|
||||||
string responseNotContains = (string)TaskManager.TaskParameters["RESPONSE_DOESNT_CONTAIN"];
|
|
||||||
|
|
||||||
bool useResponseStatus = Convert.ToBoolean(TaskManager.TaskParameters["USE_RESPONSE_STATUS"]);
|
// get input parameters
|
||||||
bool useResponseContains = Convert.ToBoolean(TaskManager.TaskParameters["USE_RESPONSE_CONTAIN"]);
|
string url = (string)topTask.GetParamValue("URL");
|
||||||
bool useResponseDoesntContain = Convert.ToBoolean(TaskManager.TaskParameters["USE_RESPONSE_DOESNT_CONTAIN"]);
|
string username = (string)topTask.GetParamValue("USERNAME");
|
||||||
|
string password = (string)topTask.GetParamValue("PASSWORD");
|
||||||
|
string strResponseStatus = (string)topTask.GetParamValue("RESPONSE_STATUS");
|
||||||
|
string responseContains = (string)topTask.GetParamValue("RESPONSE_CONTAIN");
|
||||||
|
string responseNotContains = (string)topTask.GetParamValue("RESPONSE_DOESNT_CONTAIN");
|
||||||
|
|
||||||
|
bool useResponseStatus = Convert.ToBoolean(topTask.GetParamValue("USE_RESPONSE_STATUS"));
|
||||||
|
bool useResponseContains = Convert.ToBoolean(topTask.GetParamValue("USE_RESPONSE_CONTAIN"));
|
||||||
|
bool useResponseDoesntContain = Convert.ToBoolean(topTask.GetParamValue("USE_RESPONSE_DOESNT_CONTAIN"));
|
||||||
|
|
||||||
// check input parameters
|
// check input parameters
|
||||||
if (String.IsNullOrEmpty(url))
|
if (String.IsNullOrEmpty(url))
|
||||||
|
@ -126,11 +128,13 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
|
|
||||||
private void SendMailMessage(string url, string message, string content)
|
private void SendMailMessage(string url, string message, string content)
|
||||||
{
|
{
|
||||||
|
BackgroundTask topTask = TaskManager.TopTask;
|
||||||
|
|
||||||
// input parameters
|
// input parameters
|
||||||
string mailFrom = (string)TaskManager.TaskParameters["MAIL_FROM"];
|
string mailFrom = (string)topTask.GetParamValue("MAIL_FROM");
|
||||||
string mailTo = (string)TaskManager.TaskParameters["MAIL_TO"];
|
string mailTo = (string)topTask.GetParamValue("MAIL_TO");
|
||||||
string mailSubject = (string)TaskManager.TaskParameters["MAIL_SUBJECT"];
|
string mailSubject = (string)topTask.GetParamValue("MAIL_SUBJECT");
|
||||||
string mailBody = (string)TaskManager.TaskParameters["MAIL_BODY"];
|
string mailBody = (string)topTask.GetParamValue("MAIL_BODY");
|
||||||
|
|
||||||
if (String.IsNullOrEmpty(mailTo))
|
if (String.IsNullOrEmpty(mailTo))
|
||||||
{
|
{
|
|
@ -46,12 +46,14 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
// - FTP_PASSWORD
|
// - FTP_PASSWORD
|
||||||
// - FTP_FOLDER
|
// - FTP_FOLDER
|
||||||
|
|
||||||
|
BackgroundTask topTask = TaskManager.TopTask;
|
||||||
|
|
||||||
// get input parameters
|
// get input parameters
|
||||||
string filePath = (string)TaskManager.TaskParameters["FILE_PATH"];
|
string filePath = (string)topTask.GetParamValue("FILE_PATH");
|
||||||
string ftpServer = (string)TaskManager.TaskParameters["FTP_SERVER"];
|
string ftpServer = (string)topTask.GetParamValue("FTP_SERVER");
|
||||||
string ftpUsername = (string)TaskManager.TaskParameters["FTP_USERNAME"];
|
string ftpUsername = (string)topTask.GetParamValue("FTP_USERNAME");
|
||||||
string ftpPassword = (string)TaskManager.TaskParameters["FTP_PASSWORD"];
|
string ftpPassword = (string)topTask.GetParamValue("FTP_PASSWORD");
|
||||||
string ftpFolder = (string)TaskManager.TaskParameters["FTP_FOLDER"];
|
string ftpFolder = (string)topTask.GetParamValue("FTP_FOLDER");
|
||||||
|
|
||||||
// check input parameters
|
// check input parameters
|
||||||
if (String.IsNullOrEmpty(filePath))
|
if (String.IsNullOrEmpty(filePath))
|
||||||
|
@ -100,7 +102,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
|
|
||||||
// file to send
|
// file to send
|
||||||
writer.WriteLine("binary");
|
writer.WriteLine("binary");
|
||||||
writer.WriteLine("put " + FilesController.GetFullPackagePath(TaskManager.PackageId, filePath));
|
writer.WriteLine("put " + FilesController.GetFullPackagePath(topTask.PackageId, filePath));
|
||||||
|
|
||||||
// bye
|
// bye
|
||||||
writer.WriteLine("bye");
|
writer.WriteLine("bye");
|
||||||
|
@ -109,14 +111,14 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
|
|
||||||
// create temp file in user space
|
// create temp file in user space
|
||||||
string cmdPath = Utils.GetRandomString(10) + ".txt";
|
string cmdPath = Utils.GetRandomString(10) + ".txt";
|
||||||
string fullCmdPath = FilesController.GetFullPackagePath(TaskManager.PackageId, cmdPath);
|
string fullCmdPath = FilesController.GetFullPackagePath(topTask.PackageId, cmdPath);
|
||||||
|
|
||||||
// upload batch
|
// upload batch
|
||||||
FilesController.UpdateFileBinaryContent(TaskManager.PackageId, cmdPath, Encoding.UTF8.GetBytes(cmdBatch));
|
FilesController.UpdateFileBinaryContent(topTask.PackageId, cmdPath, Encoding.UTF8.GetBytes(cmdBatch));
|
||||||
|
|
||||||
// execute system command
|
// execute system command
|
||||||
// load OS service
|
// load OS service
|
||||||
int serviceId = PackageController.GetPackageServiceId(TaskManager.PackageId, ResourceGroups.Os);
|
int serviceId = PackageController.GetPackageServiceId(topTask.PackageId, ResourceGroups.Os);
|
||||||
|
|
||||||
// load service
|
// load service
|
||||||
ServiceInfo service = ServerController.GetServiceInfo(serviceId);
|
ServiceInfo service = ServerController.GetServiceInfo(serviceId);
|
||||||
|
@ -128,7 +130,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
TaskManager.Write(winServer.ExecuteSystemCommand("ftp.exe", "-s:" + fullCmdPath));
|
TaskManager.Write(winServer.ExecuteSystemCommand("ftp.exe", "-s:" + fullCmdPath));
|
||||||
|
|
||||||
// delete batch file
|
// delete batch file
|
||||||
FilesController.DeleteFiles(TaskManager.PackageId, new string[] { cmdPath });
|
FilesController.DeleteFiles(topTask.PackageId, new string[] { cmdPath });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue