This commit is contained in:
dev_amdtel 2013-08-10 00:52:34 +04:00
commit 3b6fe9c4bb
204 changed files with 23591 additions and 9818 deletions

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Include>
<?define PROJECTPATH = "..\..\..\WebsitePanel"?>
<?define BUILDPATH = "$(var.PROJECTPATH)\Build\$(var.BUILD)\EnterpriseServer\bin"?>
<?define SERVERBUILDPATH = "$(var.PROJECTPATH)\Build\$(var.BUILD)\Server\bin"?>
</Include>

View file

@ -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>

View file

@ -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>Websitepanel-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

Binary file not shown.

After

Width:  |  Height:  |  Size: 451 KiB

View file

@ -1,7 +1,35 @@
// 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.
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <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.

View file

@ -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

View file

@ -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>

View file

@ -0,0 +1,170 @@
// 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.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;
}
}
}

View file

@ -0,0 +1,63 @@
// 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.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")]

View file

@ -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>

View file

@ -28,8 +28,12 @@
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.Text.RegularExpressions;
using System.Xml; using System.Xml;
namespace WebsitePanel.Setup.Actions namespace WebsitePanel.Setup.Actions
@ -99,6 +103,74 @@ namespace WebsitePanel.Setup.Actions
} }
} }
public class InstallSchedulerServiceAction : Action, IInstallAction, IUninstallAction
{
public const string LogStartInstallMessage = "Installing Scheduler Windows Service...";
public const string LogStartUninstallMessage = "Uninstalling Scheduler Windows Service...";
void IInstallAction.Run(SetupVariables vars)
{
try
{
Begin(LogStartInstallMessage);
Log.WriteStart(LogStartInstallMessage);
Log.WriteInfo(String.Format("Scheduler Service Name: \"{0}\"", Global.Parameters.SchedulerServiceName));
if (ServiceController.GetServices().Any(s => s.DisplayName.Equals(Global.Parameters.SchedulerServiceName, StringComparison.CurrentCultureIgnoreCase)))
{
Log.WriteEnd("Scheduler Service Already Installed.");
InstallLog.AppendLine(String.Format("- Scheduler Service \"{0}\" Already Installed.", Global.Parameters.SchedulerServiceName));
return;
}
ManagedInstallerClass.InstallHelper(new[] { "/i", Path.Combine(vars.InstallationFolder, "bin", Global.Parameters.SchedulerServiceFileName) });
Utils.StartService(Global.Parameters.SchedulerServiceName);
}
catch (Exception ex)
{
UninstallService(vars);
if (Utils.IsThreadAbortException(ex))
{
return;
}
Log.WriteError("Installing scheduler service error.", ex);
throw;
}
}
void IUninstallAction.Run(SetupVariables vars)
{
try
{
Log.WriteStart(LogStartUninstallMessage);
UninstallService(vars);
Log.WriteEnd("Scheduler Service Uninstalled.");
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
{
return;
}
Log.WriteError("Uninstalling scheduler service error.", ex);
throw;
}
}
private void UninstallService(SetupVariables vars)
{
if (ServiceController.GetServices().Any(s => s.ServiceName.Equals(Global.Parameters.SchedulerServiceName, StringComparison.CurrentCultureIgnoreCase)))
{
ManagedInstallerClass.InstallHelper(new[] { "/u", Path.Combine(vars.InstallationFolder, "bin", Global.Parameters.SchedulerServiceFileName) });
}
}
}
public class CreateDatabaseAction : Action, IInstallAction, IUninstallAction public class CreateDatabaseAction : Action, IInstallAction, IUninstallAction
{ {
public const string LogStartInstallMessage = "Creating SQL Server database..."; public const string LogStartInstallMessage = "Creating SQL Server database...";
@ -348,6 +420,91 @@ namespace WebsitePanel.Setup.Actions
} }
} }
public class SaveSchedulerServiceConnectionStringAction : Action, IInstallAction
{
void IInstallAction.Run(SetupVariables vars)
{
Log.WriteStart(string.Format("Updating {0}.config file (connection string)", Global.Parameters.SchedulerServiceFileName));
var file = Path.Combine(vars.InstallationFolder, "bin", string.Format("{0}.config", Global.Parameters.SchedulerServiceFileName));
string content;
using (var reader = new StreamReader(file))
{
content = reader.ReadToEnd();
}
vars.ConnectionString = String.Format(vars.ConnectionString, vars.DatabaseServer, vars.Database, vars.Database, vars.DatabaseUserPassword);
content = Utils.ReplaceScriptVariable(content, "installer.connectionstring", vars.ConnectionString);
using (var writer = new StreamWriter(file))
{
writer.Write(content);
}
Log.WriteEnd(string.Format("Updated {0}.config file (connection string)", Global.Parameters.SchedulerServiceFileName));
}
}
public class SaveSchedulerServiceCryptoKeyAction : Action, IInstallAction
{
void IInstallAction.Run(SetupVariables vars)
{
Log.WriteStart(string.Format("Updating {0}.config file (crypto key)", Global.Parameters.SchedulerServiceFileName));
try
{
UpdateCryptoKey(vars.InstallationFolder);
}
catch (Exception)
{
}
Log.WriteEnd(string.Format("Updated {0}.config file (connection string)", Global.Parameters.SchedulerServiceFileName));
}
private static void UpdateCryptoKey(string installFolder)
{
string path = Path.Combine(installFolder, "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 path = Path.Combine(installFolder, "bin", string.Format("{0}.config", Global.Parameters.SchedulerServiceFileName));
if (File.Exists(path))
{
string content;
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);
}
}
}
}
public class SaveEntServerConfigSettingsAction : Action, IInstallAction public class SaveEntServerConfigSettingsAction : Action, IInstallAction
{ {
void IInstallAction.Run(SetupVariables vars) void IInstallAction.Run(SetupVariables vars)
@ -390,7 +547,10 @@ namespace WebsitePanel.Setup.Actions
new UpdateServeradminPasswAction(), new UpdateServeradminPasswAction(),
new SaveAspNetDbConnectionStringAction(), new SaveAspNetDbConnectionStringAction(),
new SaveComponentConfigSettingsAction(), new SaveComponentConfigSettingsAction(),
new SaveEntServerConfigSettingsAction() new SaveEntServerConfigSettingsAction(),
new SaveSchedulerServiceConnectionStringAction(),
new SaveSchedulerServiceCryptoKeyAction(),
new InstallSchedulerServiceAction()
}; };
public EntServerActionManager(SetupVariables sessionVars) : base(sessionVars) public EntServerActionManager(SetupVariables sessionVars) : base(sessionVars)

View file

@ -77,6 +77,8 @@ namespace WebsitePanel.Setup
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 const string SchedulerServiceFileName = "WebsitePanel.SchedulerService.exe";
public const string SchedulerServiceName = "WebsitePanel Scheduler";
} }
public abstract class Messages public abstract class Messages

View file

@ -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" />

View file

@ -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,18 +211,20 @@ 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});
}
catch(Exception)
{
Log.WriteError(string.Format("Unable to remove \"{0}\" Windows service.", serviceName), null);
InstallLog.AppendLine(string.Format("- Failed to remove \"{0}\" Windows service", serviceName));
throw;
}
Log.WriteEnd("Removed Windows service"); Log.WriteEnd("Removed Windows service");
InstallLog.AppendLine(string.Format("- Removed \"{0}\" Windows service", serviceName)); InstallLog.AppendLine(string.Format("- Removed \"{0}\" Windows service", serviceName));
} }
else
{
Log.WriteError(string.Format("Unable to remove \"{0}\" Windows service. Error code: {1}", serviceName, exitCode), null);
InstallLog.AppendLine(string.Format("- Failed to remove \"{0}\" Windows service", serviceName));
}
}
catch (Exception ex) catch (Exception ex)
{ {
if (Utils.IsThreadAbortException(ex)) if (Utils.IsThreadAbortException(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
@ -285,6 +290,12 @@ namespace WebsitePanel.Setup
list.Add(action); list.Add(action);
} }
if (ServiceController.GetServices().Any(s => s.DisplayName.Equals(Global.Parameters.SchedulerServiceName, StringComparison.CurrentCultureIgnoreCase)))
{
action = new InstallAction(ActionTypes.UnregisterWindowsService) { Path = Path.Combine(installFolder, "bin", Global.Parameters.SchedulerServiceFileName), Name = Global.Parameters.SchedulerServiceName, Description = "Removing Windows service..." };
action.Log = string.Format("- Remove {0} Windows service", action.Name);
list.Add(action);
}
//database //database
bool deleteDatabase = AppConfig.GetComponentSettingBooleanValue(componentId, "NewDatabase"); bool deleteDatabase = AppConfig.GetComponentSettingBooleanValue(componentId, "NewDatabase");

View file

@ -418,7 +418,7 @@ class WebsitePanel
$esUrl = (($this->_esUseSsl ? "https" : "http") . "://{$this->_esServerUrl}:{$this->_esServerPort}/{$serviceFile}?WSDL"); $esUrl = (($this->_esUseSsl ? "https" : "http") . "://{$this->_esServerUrl}:{$this->_esServerPort}/{$serviceFile}?WSDL");
$soapParams = array('login' => $this->_esUsername, $soapParams = array('login' => $this->_esUsername,
'password' => $this->_esPassword, 'password' => $this->_esPassword,
'cache_wsdl' => WSDL_CACHE_NONE, // WSDL caching is an annoying nightmare - we will disable it 'cache_wsdl' => WSDL_CACHE_NONE // WSDL caching is an annoying nightmare - we will disable it
); );
try try
{ {
@ -432,7 +432,7 @@ class WebsitePanel
} }
catch (Exception $e) catch (Exception $e)
{ {
throw; throw new Exception($e->getMessage());
} }
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -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>

View file

@ -1,7 +1,35 @@
// 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.
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <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.

View file

@ -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.

View file

@ -117,6 +117,7 @@ order by rg.groupOrder
public const string EXCHANGE2007_ENABLEDPLANSEDITING = "Exchange2007.EnablePlansEditing"; // Enabled plans editing public const string EXCHANGE2007_ENABLEDPLANSEDITING = "Exchange2007.EnablePlansEditing"; // Enabled plans editing
public const string EXCHANGE2007_ALLOWLITIGATIONHOLD = "Exchange2007.AllowLitigationHold"; public const string EXCHANGE2007_ALLOWLITIGATIONHOLD = "Exchange2007.AllowLitigationHold";
public const string EXCHANGE2007_RECOVERABLEITEMSSPACE = "Exchange2007.RecoverableItemsSpace"; public const string EXCHANGE2007_RECOVERABLEITEMSSPACE = "Exchange2007.RecoverableItemsSpace";
public const string EXCHANGE2007_DISCLAIMERSALLOWED = "Exchange2007.DisclaimersAllowed";
public const string MSSQL2000_DATABASES = "MsSQL2000.Databases"; // Databases public const string MSSQL2000_DATABASES = "MsSQL2000.Databases"; // Databases
public const string MSSQL2000_USERS = "MsSQL2000.Users"; // Users public const string MSSQL2000_USERS = "MsSQL2000.Users"; // Users
public const string MSSQL2000_MAXDATABASESIZE = "MsSQL2000.MaxDatabaseSize"; // Max Database Size public const string MSSQL2000_MAXDATABASESIZE = "MsSQL2000.MaxDatabaseSize"; // Max Database Size

View file

@ -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;
} }
public int ItemId return null;
{
get { return this.itemId; }
set { this.itemId = value; }
} }
public int PackageId public void UpdateParamValue(String name, object value)
{ {
get { return this.packageId; } foreach (BackgroundTaskParameter param in Params)
set { this.packageId = value; } {
if (param.Name == name)
{
param.Value = value;
return;
}
} }
public int Severity Params.Add(new BackgroundTaskParameter(name, value));
{
get { return this.severity; }
set { this.severity = value; }
} }
[XmlIgnore] public bool ContainsParam(String name)
public List<BackgroundTaskLogRecord> LogRecords
{ {
get { return this.logRecords; } foreach (BackgroundTaskParameter param in Params)
set { this.logRecords = value; } {
if (param.Name == name)
return true;
} }
public List<BackgroundTaskLogRecord> LastLogRecords return false;
{
get { return this.lastLogRecords; }
} }
public string ItemName #endregion
{
get { return this.itemName; }
set { this.itemName = value; }
} }
public BackgroundTaskLogRecord LastLogRecord public class BackgroundTaskParameter
{ {
get { return this.lastLogRecord; } #region Properties
set { this.lastLogRecord = value; }
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)
{
Name = name;
Value = value;
} }
public string TaskId #endregion
{
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; }
}
} }
} }

View file

@ -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; }
}
} }
} }

View file

@ -0,0 +1,10 @@
namespace WebsitePanel.EnterpriseServer
{
public enum BackgroundTaskStatus
{
Run = 1,
Abort = 2,
Starting = 3,
Stopping = 4
}
}

View file

@ -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" />

View file

@ -1,4 +1,32 @@
using System; // 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.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Web; using System.Web;

View file

@ -1,4 +1,32 @@
/* // 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.
/*
* Int128.c: Represents a 128-bit signed integer. * Int128.c: Represents a 128-bit signed integer.
* *
* Authors: * Authors:

View file

@ -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

View file

@ -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
{ {

View file

@ -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);

View file

@ -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;
} }

View file

@ -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);
// //

View file

@ -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))

View file

@ -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);
} }
} }

View file

@ -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;
} }

View file

@ -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);

View file

@ -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;

View file

@ -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)

View file

@ -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
{ {

View file

@ -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
{ {

View file

@ -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;
@ -1715,10 +1709,7 @@ namespace WebsitePanel.EnterpriseServer
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;

View file

@ -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)

View file

@ -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
{ {
@ -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,6 +1065,7 @@ 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,9 +1213,8 @@ 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
{ {

View file

@ -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
{ {

View file

@ -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
{ {

View file

@ -0,0 +1,64 @@
// 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.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")]

View file

@ -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,8 +117,7 @@ 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");
@ -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;
} }
} }

View file

@ -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;

View file

@ -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)

View file

@ -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);

View file

@ -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)
{ {

View file

@ -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)

View file

@ -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)

Some files were not shown because too many files have changed in this diff Show more