|
using System;
using System.Diagnostics;
using System.Configuration;
namespace BLT
{
/// <summary>
/// Summary description for BLBasis.
/// </summary>
public class BLBasis
{
// EventLog for Buisness Logic Tier
protected static EventLog daEventLog;
// strings to connect EventLog
protected static string strLog;
protected static string strSource;
protected static string strMachine;
protected static decimal dConsumeTaxRate;
public BLBasis()
{
}
static BLBasis()
{
// strings to connect the EventLog
strLog = ConfigurationSettings.AppSettings["blLog"];
strSource = ConfigurationSettings.AppSettings["blSource"];
strMachine = ConfigurationSettings.AppSettings["blMachine"];
dConsumeTaxRate = Convert.ToDecimal(ConfigurationSettings.AppSettings["consumeTaxRate"]);
// Create an instance from EventLog
if(EventLog.SourceExists(strLog,strMachine))
{
daEventLog = new EventLog(strLog,strMachine,strSource);
}
}
/// <summary>
/// Writes error messages in to the EventLog
/// </summary>
/// <param name="strMessage"></param>
protected virtual void ErrorLog(string strMessage)
{
// write in Windows EventLog
if(daEventLog!=null)
{
daEventLog.WriteEntry(strMessage,EventLogEntryType.Error);
}
// throw an error to the buisness access tier
Exception oException= new Exception("An error occured in BLTier ");
throw oException;
}
/// <summary>
/// Writes error messages in to the EventLog
/// </summary>
/// <param name="strMessage"></param>
/// <param name="oException"></param>
protected virtual void ErrorLog(string strMessage,Exception oException)
{
// write in Windows EventLog
if(daEventLog!=null)
{
string oMessage = oException.Message + " " + strMessage;
daEventLog.WriteEntry(oMessage,EventLogEntryType.Error);
}
// throw an error to the
Exception oExcept= new Exception("An error occured in BLTier");
throw oExcept;
}
/// <summary>
/// Writes warning messages on the EventLog
/// </summary>
/// <param name="strMessage"></param>
protected void WarningLog(string strMessage)
{
// write in Windows EventLog
if(daEventLog!=null)
{
daEventLog.WriteEntry(strMessage,EventLogEntryType.Warning);
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
Paul Abraham is a software developer who designs and develops multi-shop systems.
He has received his M.Sc in Mathematics and Computer Science from the FernUniversität Hagen(
http://www.fernuni-hagen.de Germany) and his main interests are neural networks and bayesian statistics He lives in Rosenheim (South Germany http://www.rosenheim.de). You can reach him at admin@paul-abraham.com.