Posts filed under 'Own design custom Framework'
Multipurpose of Exception Handling Class Part 3
Hi..see you again.. this section is the continue part of my trilogy Multipurpose of Exception Handling class, okay let’s make it this quickly, the last class that we need is EmailGenerator class :
- This class using 3 core of .Net library; System IO for accessing the XML email template,System XML and then System.Web.Email.
- The main idea for this class is service another class that want to generate the email notification so we need to produce the public method for sending the emai, here are the method
public void AutomaticSendEmailLogging(string ErrorMessage)
{
MailMessage mailMsg = new MailMessage(); // Create instance of EmailMessage Object
string templateName = FrameworkLayer.ConfigurationUtility.WebApplicationConfiguration.ProgrammerEmailName;
mailMsg.From = FrameworkLayer.ConfigurationUtility.WebApplicationConfiguration.EmailSender;
mailMsg.To = FrameworkLayer.ConfigurationUtility.WebApplicationConfiguration.ProgrammerEmail;
//mailMsg.Cc = EmailUser;
Add comment July 5, 2007
Multipurpose of Exception Handling Class Part 2
Okay in this section part i will talk more detail about those kind of class ,
- Logging Class
Prerequisite for this class :
- You need provide the xml file for become the email template, the simple form like this :<EMAIL>
<TITLE>Error Notification</TITLE>
<MESSAGE>
<SUBJECT>Global Coding System Notification
</SUBJECT>
<BODY>ERROR MESSAGE ALERT {0}
================================================\n\nPlease be advised that somthing error happen in your application :
{1} \N
</BODY>
</MESSAGE>
</EMAIL>
Add comment July 5, 2007
Multipurpose of Exception Handling Class Part 1
In this Part, i will share of my code project which is i have made the multipurpose exception handling class. What is the trully meaning of multipurpose ? in this class i have create the exception handling class which covered the function for throwing the exception message and also giving the email alert notification to the programmer or event for system administrator.
for instance is like this :
in DAL i am using the exception handling class –> if there is something error in my DAL class –> the error handler will capture the Exception stack trace –> the Exception class will talk to the Logging class and also either the email class.
and then my class like this Logging class and Email class :
Add comment July 2, 2007
Multipurpose Data Access Layer part 2
In this 2nd part i’ll try to describe more detail in coding which i mentioned it in part 1,
a. ConnectionString Class
- First Of all you need to save your connection string variable in your web config, in my case i put all of the setting in particular configuration setting class which being taken from webconfig setting.
- I must inherit from the WebPageBase class for become the master of base page class, this WebPageBase class inherit the System.web.UI.Page , this class will become the property provider to every page in Web UI such as retrive the current user,current password and of course the applicationID that we need.
- And the last thing i made two public static method which return the string of connectionstring and providername, both of those method will filter the appropriate connection string and provider name which inputed from each outside ( define input parameter ).
let see the complete module :
Add comment July 2, 2007
Multipurpose Data Access Layer part 1
In my current project i have made some DAL ( Data Access Layer ) class in my framework which has some purpose for handling many project needs such as :
1. Able to provide multiple connection string in my project
2. Able to provide the multiple datastore string with many provider
3. Should be able to handling many application parameter response redirect
see the picture below of my class design :
I put the all of my engine application in Framework layer project including the Data Access utility, wheter contain :
a. ConnectionString Class :
- This Class has purpose and duty to serving the connection string and provider name which will be consumed by the Query Builder class. In this class i set the Connection to database namespace and also i made inherit the web base class for accessing the web base class page property and method in the future utilization.
- Why i must inherit from the page base class, in this project framework i need to access the ApplicationID property which catered by the page base class wheter all of web page should inherit from this base class.
- After the initialially web page loaded in this case the default.aspx, there is an automatically fill the ApplicationID property in base class which consumed from the url parameter. Actually there is still need the decrypt class which serving for securing the parameter from URL but later i will create for this purpose.
- This class has 2 methods which will cater the connection string and provider name the mthods are GetCN which return on string and either for GetPV.
b. Query Builder Class ( Interface Class )
- This is sound of interesting part from the whole stories, this class has a duty for catering the automatically object parameter, object connection and the type of the sql command.
- Therefore this class has an may important part method that execution in any output parameter method such as execute the dataset return,data reader return,execute scalar return in integer and also add parameter method for processing the parameter input to this class.
- This Class has three kind overload method which catering the text string query, the stored procedure type of query which will be implemented in DAL project later.
Add comment June 30, 2007