using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Serialization;
namespace Sleis.EIS4Sleis
{
public enum DatabaseType
{
[Description("System.Data.SqlClient")]
SqlServer,
[Description("System.Data.OracleClient")]
Oracle
}
[Serializable]
public class DatabaseParameters
{
public DatabaseParameters()
{
}
public DatabaseParameters(DatabaseType type, string connectionString)
{
Type = type;
ConnectionString = connectionString;
}
///
/// The type of database
///
public DatabaseType Type
{
get;
set;
}
///
/// The full connection string to the database
///
public string ConnectionString
{
get;
set;
}
}
public enum NodeType
{
Default,
[Description("EN11")]
v11,
[Description("EN20")]
v20
}
[Serializable]
public class NodeEndpointParameters
{
public NodeEndpointParameters()
{
}
public NodeEndpointParameters(NodeType type, string url, string username, string password)
{
Type = type;
Url = url;
Username = username;
Password = password;
}
///
/// The type of node (v1.1 or v2.0).
///
public NodeType Type
{
get;
set;
}
///
/// The url to node endpoint.
///
public string Url
{
get;
set;
}
///
/// The NAAS username to use for the submission.
///
public string Username
{
get;
set;
}
///
/// The NAAS password to use for the submission.
///
public string Password
{
get;
set;
}
}
public enum EISCategory
{
[Description("FacilityInventory")]
FacilityInventory,
[Description("Point")]
Point,
}
[Serializable]
public class SubmissionParameters
{
public SubmissionParameters()
{
}
public SubmissionParameters(string authorName, string organizationName, string senderContactInfo,
bool isProductionSubmission, int emissionsYear, EISCategory category)
{
AuthorName = authorName;
OrganizationName = organizationName;
SenderContactInfo = senderContactInfo;
IsProductionSubmission = isProductionSubmission;
EmissionsYear = emissionsYear;
Category = category;
}
///
/// The Author for the EIS submission.
///
public string AuthorName
{
get;
set;
}
///
/// The Organization for the EIS submission.
///
public string OrganizationName
{
get;
set;
}
///
/// The Contact Information (email, phone number) for the EIS submission.
///
public string SenderContactInfo
{
get;
set;
}
///
/// A folder path to attachment documents that will be included with the submission.
///
public string AttachmentFolderPath
{
get;
set;
}
///
/// Is this Production or QA (Test) data.
///
public bool IsProductionSubmission
{
get;
set;
}
///
/// The emissions year for the submission.
///
public int EmissionsYear
{
get;
set;
}
///
/// The data catagory for the EIS submission.
///
public EISCategory Category
{
get;
set;
}
}
[Serializable]
public class SubmissionResults
{
///
/// The endpoint transaction id of the successful submission.
///
public string TransactionId
{
get;
set;
}
///
/// The path to the temporary, zipped file that contains the submission data. This file can be deleted if it is not needed.
///
public string FilePath
{
get;
set;
}
}
public enum TransactionStatusCode
{
[Description("Received")]
Received,
[Description("Processing")]
Processing,
[Description("Pending")]
Pending,
[Description("Failed")]
Failed,
[Description("Cancelled")]
Cancelled,
[Description("Approved")]
Approved,
[Description("Processed")]
Processed,
[Description("Completed")]
Completed,
}
[Serializable]
public class CheckStatusResults
{
///
/// The status of the endpoint transaction.
///
public TransactionStatusCode Status
{
get;
set;
}
}
[Serializable]
public class DownloadResults
{
///
/// The path to the temporary, zipped file that contains the downloaded documents associated with the
/// transaction. This file can be deleted if it is not needed. This parameter will be null if no
/// documents are associated with the transaction.
///
public string FilePath
{
get;
set;
}
}
public enum ExceptionType
{
[Description("An uncategorized exception occurred.")]
Uncategorized,
[Description("An error occurred attempting to load EIS data from the database.")]
DatabaseException,
[Description("An error occurred attempting serialize EIS data to an xml file.")]
SerializationException,
[Description("An error occurred attempting to validate the EIS xml against the EIS schema.")]
ValidationException,
[Description("An error occurred attempting to communicate with the EIS node endpoint.")]
NodeEndpointException,
}
[Serializable]
public class EIS4SleisException : ApplicationException
{
public EIS4SleisException(ExceptionType exceptionType, string format, params object[] args) :
base((args == null) ? format : string.Format(format, args))
{
ExceptionType = exceptionType;
}
public EIS4SleisException(ExceptionType exceptionType, Exception innerException, string format, params object[] args) :
base((args == null) ? format : string.Format(format, args), innerException)
{
ExceptionType = exceptionType;
}
protected EIS4SleisException(SerializationInfo info, StreamingContext context) :
base(info, context)
{
}
public ExceptionType ExceptionType
{
get;
set;
}
///
/// If ExceptionType == ValidationException, then this parameter will be set to the file path that contains a summary of the xml validation errors
/// It is the resposibility of the caller to delete this file when finished using it.
///
public string ValidationErrorsFilePath
{
get;
set;
}
///
/// If ExceptionType == ValidationException, then this parameter will be set to the file path that contains the zipped xml file that was generated.
/// It is the resposibility of the caller to delete this file when finished using it.
///
public string GeneratedZippedXmlFilePath
{
get;
set;
}
}
}