This commit is contained in:
2018-06-29 19:47:36 +00:00
commit be7f501333
3769 changed files with 1425961 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
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("GZTW Profile")]
[assembly: AssemblyDescription("GZTW Profile library")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Ground Zero Tech-Works Inc.")]
[assembly: AssemblyProduct("AyaNova")]
[assembly: AssemblyCopyright("Copyright 2006-2018 Ground Zero Tech-Works Inc. All rights reserved.")]
[assembly: AssemblyTrademark("AyaNova® is either a registered trademark or trademark of Ground Zero Tech-Works Inc. in the United States and/or other countries.")]
[assembly: AssemblyCulture("")]
//
// 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 Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("7.5.0.0")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
////
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project output directory which is
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
//
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("..\\..\\..\\..\\..\\keys\\AyaNova.snk")]
//[assembly: AssemblyKeyName("")]
[assembly: AssemblyFileVersionAttribute("7.5.0.0")]
[assembly: ComVisibleAttribute(false)]

View File

@@ -0,0 +1,313 @@
using System;
using System.Configuration;
using System.Text;
using System.Xml;
using System.IO;
namespace GZTW.Profile
{
/// <summary>
/// Contain the connection information for
/// AyaNova to connect to the database or DataPortal
/// to be used for the session.
///
/// Note that this can be set via code by a caller
/// and used in the AyaBizUtils.Login method or
/// it will automatically retrieve and store the connection settings
/// specified in the config.txt file
/// </summary>
[Serializable]
public class AyaNovaConnectionSettings
{
#region ConnectionEnums
public enum ConnectionType
{
UnknownConnectionType,
DataPortal,
DataBase
}
public enum DataBaseType
{
UnknownDBType,
FireBird,
MSSQL,
Oracle
}
#endregion
private DataBaseType _dbType= DataBaseType.UnknownDBType;
private ConnectionType _cnType= ConnectionType.UnknownConnectionType;
private string _DataBaseConnectionString="";
private string _DataPortalConnection="";
private bool? _IsSingleUser = null;
public bool IsRemote
{
get
{
return _cnType == ConnectionType.DataPortal;
}
}
public AyaNovaConnectionSettings ()
{ }
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("\r\n\tAyaNova Connection:");
sb.Append("\r\n\t");
sb.Append(_cnType.ToString());
sb.Append(" - ");
if (_cnType == ConnectionType.DataBase)
{
sb.Append(_DataBaseConnectionString);
if (_DataBaseConnectionString != DataBaseConnectionStringUnTokenized)
{
sb.Append(" ("+DataBaseConnectionStringUnTokenized+")");
}
}
else
sb.Append(_DataPortalConnection);
sb.Append("\r\n");
return sb.ToString();
}
public DataBaseType DBType
{
get
{
return _dbType;
}
set
{
_dbType=value;
}
}
public ConnectionType CNType
{
get
{
return _cnType;
}
set
{
_cnType=value;
}
}
public bool UsingDataPortal
{
get
{
return _cnType == ConnectionType.DataPortal;
}
}
public string DataBaseConnectionString
{
get
{
return _DataBaseConnectionString;
}
set
{
_DataBaseConnectionString=value;
}
}
/// <summary>
/// If a special folder token is contained in the connection string
/// this property returns the actual path
/// </summary>
public string DataBaseConnectionStringUnTokenized
{
get
{
string token = "%AllUsersProfile%";
int x=_DataBaseConnectionString.LastIndexOf(token,StringComparison.InvariantCultureIgnoreCase);
if (x!=-1)
{
string s= _DataBaseConnectionString.Substring(0, x) +
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) +
_DataBaseConnectionString.Substring(x + 17);
return s;
}
else
return _DataBaseConnectionString;
}
}
public string DataPortalConnection
{
get
{
return _DataPortalConnection;
}
set
{
_DataPortalConnection=value;
}
}
/// <summary>
/// If stand alone firebird returns true
/// </summary>
public bool SingleUserConnection
{
get
{
if (_IsSingleUser == null)//Nullable bool
{
//Only fb will contain the servertype parameter, if it doesn't then it can't be standalone
string s = _DataBaseConnectionString.Replace(" ", "").ToLowerInvariant();
if (s.Contains("servertype=1"))
_IsSingleUser= true;
else//this was missing duh! Case 659
_IsSingleUser= false;
}
return (bool)_IsSingleUser;
}
}
/// <summary>
/// Populate the properties of this ConnectionSetting object
/// from a config.txt file in the same file system location as
/// this assembly.
/// </summary>
public void GetConnectionData()
{
XmlDocument d = new XmlDocument();
XmlNode n;
string configfile = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + Path.DirectorySeparatorChar + "config.txt";
if (!File.Exists(configfile))
{
//Added for Case 657
//Could be shadow copied (asp.net etc), try the escapedcodebase value instead
configfile = Path.GetDirectoryName(new System.Uri(System.Reflection.Assembly.GetExecutingAssembly().EscapedCodeBase).LocalPath) + Path.DirectorySeparatorChar + "config.txt";
if (!File.Exists(configfile))
throw new ApplicationException("Error config.txt file is missing. \r\nIt should be here:\r\n" + configfile);
}
d.Load(configfile);
//for error message purposes:
configfile = "(" + configfile + ")";
n = d.SelectSingleNode("/configuration/ConnectionType");
if (string.IsNullOrEmpty(n.InnerText))
throw new ApplicationException("Required setting ConnectionType is not set in configuration file\r\n" + configfile);
switch (n.InnerText)
{
case "DataBase":
_cnType = ConnectionType.DataBase;
break;
case "DataPortal":
_cnType = ConnectionType.DataPortal;
break;
default:
throw new ApplicationException("Connection type: \"" + n.InnerText + "\" not valid in configuration file\r\nValid values are: DataBase or DataPortal\r\n" + configfile);
}
if (_cnType == ConnectionType.DataBase)
{
n = d.SelectSingleNode("/configuration/DataBaseType");
if (string.IsNullOrEmpty(n.InnerText))
throw new ApplicationException("Required setting DataBaseType is not set in configuration file\r\n" + configfile);
switch (n.InnerText)
{
case "MSSQL":
_dbType = DataBaseType.MSSQL;
break;
case "FireBird":
_dbType = DataBaseType.FireBird;
break;
default:
throw new ApplicationException("Database type: \"" + n.InnerText + "\" not valid in application configuration file\r\nValid values are: MSSQL or FireBird\r\n" + configfile);
}
n = d.SelectSingleNode("/configuration/DataBaseConnectionString");
if (string.IsNullOrEmpty(n.InnerText))
throw new ApplicationException("Required setting DataBaseConnectionString is not set in configuration file\r\n" + configfile);
_DataBaseConnectionString = n.InnerText;
}
else
{
//it's a dataportal
n = d.SelectSingleNode("/configuration/PortalServer");
if (string.IsNullOrEmpty(n.InnerText))
throw new ApplicationException("Required setting PortalServer is not set in configuration file\r\n" + configfile);
_DataPortalConnection = n.InnerText;
}
}
/// <summary>
/// Flip config.txt from / to lite / full
/// </summary>
public void TrialLiteFlip()
{
string configfile = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + Path.DirectorySeparatorChar + "config.txt";
if (!File.Exists(configfile))
{
//Added for Case 657
//Could be shadow copied (asp.net etc), try the escapedcodebase value instead
configfile = Path.GetDirectoryName(new System.Uri(System.Reflection.Assembly.GetExecutingAssembly().EscapedCodeBase).LocalPath) + Path.DirectorySeparatorChar + "config.txt";
if (!File.Exists(configfile))
throw new ApplicationException("Error config.txt file is missing. \r\nIt should be here:\r\n" + configfile);
}
StreamReader reader = new StreamReader(configfile);
string content = reader.ReadToEnd();
reader.Close();
if (0 <= content.IndexOf("ayanova.fdb", StringComparison.InvariantCultureIgnoreCase))
content = System.Text.RegularExpressions.Regex.Replace(content, "ayanova.fdb", "ayanovalite.fdb", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
else
{
if (0 <= content.IndexOf("ayanovalite.fdb", StringComparison.InvariantCultureIgnoreCase))
content = System.Text.RegularExpressions.Regex.Replace(content, "ayanovalite.fdb", "ayanova.fdb", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
else
throw new ApplicationException("Error config.txt file does not contain a reference to AyaNova.fdb or AyaNovaLite.fdb");
}
StreamWriter writer = new StreamWriter(configfile);
writer.Write(content);
writer.Close();
}
//end of class
}
}

View File

@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<ProjectType>Local</ProjectType>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{EDE897E2-E2E6-441D-9F83-0B973AE09670}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon>
</ApplicationIcon>
<AssemblyKeyContainerName>
</AssemblyKeyContainerName>
<AssemblyName>GZTW.Profile</AssemblyName>
<AssemblyOriginatorKeyFile>..\..\..\keys\AyaNova.snk</AssemblyOriginatorKeyFile>
<DefaultClientScript>JScript</DefaultClientScript>
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
<OutputType>Library</OutputType>
<RootNamespace>GZTW.Profile</RootNamespace>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
<StartupObject>
</StartupObject>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<SignAssembly>true</SignAssembly>
<OldToolsVersion>3.5</OldToolsVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>bin\Debug\</OutputPath>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>true</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<NoStdLib>false</NoStdLib>
<NoWarn>
</NoWarn>
<Optimize>false</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<DebugType>full</DebugType>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>bin\Release\</OutputPath>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>false</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<NoStdLib>false</NoStdLib>
<NoWarn>
</NoWarn>
<Optimize>true</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<DebugType>none</DebugType>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'RELEASE AND DEPLOY BUILD|AnyCPU' ">
<OutputPath>bin\RELEASE AND DEPLOY BUILD\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<BaseAddress>285212672</BaseAddress>
<Optimize>true</Optimize>
<DebugType>
</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="System">
<Name>System</Name>
</Reference>
<Reference Include="System.configuration" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data">
<Name>System.Data</Name>
</Reference>
<Reference Include="System.Xml">
<Name>System.XML</Name>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="ConnectionSettings.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\keys\AyaNova.snk">
<Link>AyaNova.snk</Link>
</None>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<LastOpenVersion>7.10.3077</LastOpenVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ReferencePath>
</ReferencePath>
<CopyProjectDestinationFolder>
</CopyProjectDestinationFolder>
<CopyProjectUncPath>
</CopyProjectUncPath>
<CopyProjectOption>0</CopyProjectOption>
<ProjectView>ProjectFiles</ProjectView>
<ProjectTrust>0</ProjectTrust>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<EnableASPDebugging>false</EnableASPDebugging>
<EnableASPXDebugging>false</EnableASPXDebugging>
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
<EnableSQLServerDebugging>false</EnableSQLServerDebugging>
<RemoteDebugEnabled>false</RemoteDebugEnabled>
<RemoteDebugMachine>
</RemoteDebugMachine>
<StartAction>Project</StartAction>
<StartArguments>
</StartArguments>
<StartPage>
</StartPage>
<StartProgram>
</StartProgram>
<StartURL>
</StartURL>
<StartWorkingDirectory>
</StartWorkingDirectory>
<StartWithIE>false</StartWithIE>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<EnableASPDebugging>false</EnableASPDebugging>
<EnableASPXDebugging>false</EnableASPXDebugging>
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
<EnableSQLServerDebugging>false</EnableSQLServerDebugging>
<RemoteDebugEnabled>false</RemoteDebugEnabled>
<RemoteDebugMachine>
</RemoteDebugMachine>
<StartAction>Project</StartAction>
<StartArguments>
</StartArguments>
<StartPage>
</StartPage>
<StartProgram>
</StartProgram>
<StartURL>
</StartURL>
<StartWorkingDirectory>
</StartWorkingDirectory>
<StartWithIE>false</StartWithIE>
</PropertyGroup>
</Project>