<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title></title>
	<atom:link href="http://doddychsaputra.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://doddychsaputra.wordpress.com</link>
	<description>System analyst and Application Development blogs</description>
	<lastBuildDate>Sat, 01 Dec 2007 14:31:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='doddychsaputra.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title></title>
		<link>http://doddychsaputra.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://doddychsaputra.wordpress.com/osd.xml" title="" />
	<atom:link rel='hub' href='http://doddychsaputra.wordpress.com/?pushpress=hub'/>
		<item>
		<title>WCF Domain Model for SOA Part &#8211; 1</title>
		<link>http://doddychsaputra.wordpress.com/2007/12/01/wcf-domain-architecture-for-soa-implementation-1/</link>
		<comments>http://doddychsaputra.wordpress.com/2007/12/01/wcf-domain-architecture-for-soa-implementation-1/#comments</comments>
		<pubDate>Sat, 01 Dec 2007 13:29:27 +0000</pubDate>
		<dc:creator>Doddy Christiana saputra</dc:creator>
				<category><![CDATA[Design Pattern Code]]></category>
		<category><![CDATA[Development in C# 3.0]]></category>
		<category><![CDATA[Dotnet Framework 2.0]]></category>
		<category><![CDATA[Dotnet Framework 3.0]]></category>
		<category><![CDATA[Pattern and Practise]]></category>

		<guid isPermaLink="false">http://doddychsaputra.wordpress.com/2007/12/01/wcf-domain-architecture-for-soa-implementation-1/</guid>
		<description><![CDATA[Hallo folks &#8230; see you again in my sharing knowledge moment in my development journal blogs, i would like to share to all of you about the knowledge of creating the domain architecture, in this case i would like to create the WCF ( Windows Communication Foundation ) especially for further purpose is implement the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=doddychsaputra.wordpress.com&amp;blog=1305638&amp;post=26&amp;subd=doddychsaputra&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Hallo folks &#8230; see you again in my sharing knowledge moment in my<br />
development journal blogs,<br />
i would like to share to all of you about the knowledge of creating the<br />
domain architecture,<br />
in this case i would like to create the WCF ( Windows Communication<br />
Foundation ) especially for further purpose is<br />
implement the SOA ( Software Oriented Architecture ).</p>
<p>I will separate the part of the knowledge become the trilogy knowledge<br />
which are :</p>
<ol>
<li>Introduction the Domain WCF or Web service</li>
<li>Introduction the Service Factory from The Pattern and Practise team to implement the WCF or Web service as a Domain Artifact model.</li>
<li>Sample implementation the WCF or Web service.</li>
</ol>
<p>so..let&#8217;s try to rock&#8217;n roll &#8230;</p>
<p>Overview :<br />
the application development in this era has already come to service<br />
oriented architecture which is known by SOA, by using SOA<br />
we implement the interoperability application architecture which avoid<br />
the system operation platform or even the language<br />
of application development and domain application as well. we using the<br />
independence file format transferring or independence format that<br />
allow every domain<br />
application could leverage every programming functionality such as<br />
procedure or method for IPO ( Input-Process-Output) processing<br />
Because the original purpose of SOA is become a bridge of many platform<br />
which cater the functionality of the application then the ser-<br />
vice need the endpoint or even the contract which is tighten from one<br />
service point to another service point or from one domain<br />
application to another domain application but of course loosely<br />
coupling architecture.</p>
<p>For further detail explanation i put some figure about the domain WCF :</p>
<p><a href="http://doddychsaputra.files.wordpress.com/2007/12/mywebservicedomainarticle.jpg" title="mywebservicedomainarticle.jpg"></a></p>
<p style="text-align:center;"><a href="http://doddychsaputra.files.wordpress.com/2007/12/mywebservicedomainarticle.jpg" title="mywebservicedomainarticle.jpg"><img src="http://doddychsaputra.files.wordpress.com/2007/12/mywebservicedomainarticle.thumbnail.jpg?w=455" alt="mywebservicedomainarticle.jpg" /></a></p>
<p><span id="more-26"></span><br />
Domain model provide the abstraction and also the entity relationship<br />
between the environment<br />
application that we can assume like the glosary between a word. let&#8217;s<br />
take a look the main things of this<br />
model :</p>
<ul>
<li>Service contract is the abstract things in the web CLR or interface. service implementation is looks like the concrete class that implements the interface.</li>
<li>service host is somekind a the host the service or like an actor that catering the service.</li>
<li>the service host invoke the service implementation and then the service implementation invoke based on the service contract which is showed by the dash arrow connector.</li>
</ul>
<p>Next we will talk about the contract element area here there are :</p>
<ul>
<li>The Service contract is the nomenclature of way that we think about service application which is ,</li>
<li>The service contract has a method operation which has purpose to pass the request and respond the message in two way direction or one way direction in thedomain, not only the message that will be delivered but also the data type such as customer datatype and so on.</li>
<li>and then finaly the fault contract is the exception handling services in the application which has a service to throw the exception and handling the failure message.</li>
</ul>
<p>For the functionality area, it&#8217;s figure the implementation<br />
functionality and it&#8217;s looks<br />
like the abstraction and not the concrete technology implementation<br />
inside, i will explain<br />
the mechanism like the following step :</p>
<ul>
<li>The service implementation has a service adapter that become a bridge between outside world domain and the inside, this service adapter has a funtion such as business facade interface controller from the service domain.</li>
<li>The business facade controller contain or using the business  component application and business entity which is different than the datacontract, the business component has the funtion as well for being the translator from the datacontract inside the business application and also the data from the outside world, the translator is somekind like the serialization or deserialization mechanism.</li>
</ul>
<p>as i told to you at the beginning overview that the service will talk<br />
to another service or even<br />
another application domain,that&#8217;s why the service has the connectivity<br />
channel in this case<br />
binding is talking about the media that service want to talk and the<br />
endpoint is the point that<br />
become the initial talking point or become the destination point. The<br />
binding way platform<br />
could use the Http way, channel IP adress remoting way ,the COM+<br />
interface or by using the SOAP messaging<br />
protocol. that&#8217;s why<br />
the WCF leverage manykind of transport method and enhance the previous<br />
platform SOA which was<br />
catered by the web service and also the COM+ technology.</p>
<p>The lasthing that, due to the service will process in the independent<br />
format but still need to keep maintain the<br />
quality of the service in each platform, which is suppose tobe separate<br />
from the it&#8217;s service and the operating system<br />
service such as respond time service , attaching the format through the<br />
binding and also availability supporting format<br />
that the application didn&#8217;t care about that because it&#8217;s become the OS<br />
job.</p>
<p>i guess my explanation is quite enough to understand the model of WCF<br />
domain and next we will meet in the tools that we could<br />
applied those bunch theory above.</p>
<p>See you in my next article&#8230;</p>
<p>Regards,<br />
Doddy Ch saputra</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/doddychsaputra.wordpress.com/26/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/doddychsaputra.wordpress.com/26/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/doddychsaputra.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/doddychsaputra.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/doddychsaputra.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/doddychsaputra.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/doddychsaputra.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/doddychsaputra.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/doddychsaputra.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/doddychsaputra.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/doddychsaputra.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/doddychsaputra.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/doddychsaputra.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/doddychsaputra.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/doddychsaputra.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/doddychsaputra.wordpress.com/26/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=doddychsaputra.wordpress.com&amp;blog=1305638&amp;post=26&amp;subd=doddychsaputra&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://doddychsaputra.wordpress.com/2007/12/01/wcf-domain-architecture-for-soa-implementation-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b91382498b0b016e1364e483ec1bf7ec?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Doddy Christiana saputra</media:title>
		</media:content>

		<media:content url="http://doddychsaputra.files.wordpress.com/2007/12/mywebservicedomainarticle.thumbnail.jpg" medium="image">
			<media:title type="html">mywebservicedomainarticle.jpg</media:title>
		</media:content>
	</item>
		<item>
		<title>Multipurpose of Exception Handling Class Part 3</title>
		<link>http://doddychsaputra.wordpress.com/2007/07/05/multipurpose-of-exception-handling-class-part-3/</link>
		<comments>http://doddychsaputra.wordpress.com/2007/07/05/multipurpose-of-exception-handling-class-part-3/#comments</comments>
		<pubDate>Thu, 05 Jul 2007 11:34:25 +0000</pubDate>
		<dc:creator>Doddy Christiana saputra</dc:creator>
				<category><![CDATA[Design Pattern Code]]></category>
		<category><![CDATA[Development in  C# 2.0]]></category>
		<category><![CDATA[Own design custom Framework]]></category>

		<guid isPermaLink="false">http://doddychsaputra.wordpress.com/2007/07/05/multipurpose-of-exception-handling-class-part-3/</guid>
		<description><![CDATA[Hi..see you again.. this section is the continue part of my trilogy Multipurpose of Exception Handling class, okay let&#8217;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 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=doddychsaputra.wordpress.com&amp;blog=1305638&amp;post=23&amp;subd=doddychsaputra&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Hi..see you again.. this section is the continue part of my trilogy Multipurpose of Exception Handling class, okay let&#8217;s make it this quickly, the last class that we need is EmailGenerator class :</p>
<ul>
<li>This class using 3 core of .Net library; System IO for accessing the XML email template,System XML and then System.Web.Email.</li>
<li>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</li>
</ul>
<p>public void AutomaticSendEmailLogging(string ErrorMessage)<br />
        {<br />
          <br />
            MailMessage mailMsg = new MailMessage(); // Create instance of EmailMessage Object</p>
<p>            string templateName = FrameworkLayer.ConfigurationUtility.WebApplicationConfiguration.ProgrammerEmailName;<br />
            mailMsg.From = FrameworkLayer.ConfigurationUtility.WebApplicationConfiguration.EmailSender;<br />
            mailMsg.To = FrameworkLayer.ConfigurationUtility.WebApplicationConfiguration.ProgrammerEmail;<br />
            //mailMsg.Cc = EmailUser;</p>
<p><span id="more-23"></span></p>
<p>            string[] arrParamEmail = new string[2];</p>
<p>            //parametere yang akan dikirim ke email template<br />
            arrParamEmail[0] = System.DateTime.Now.ToString();//tgl<br />
            arrParamEmail[1] = ErrorMessage.ToString(); <br />
          </p>
<p>            this.SendEmail(mailMsg, templateName, arrParamEmail);<br />
        }</p>
<p><!--more--></p>
<ul>
<li>I Guess i will rock&#8217;n roll of all entire code <img src='http://s2.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  .. okay let see below &#8230;</li>
</ul>
<p>using System;<br />
using System.Collections.Generic;<br />
using System.Collections.Specialized;<br />
using System.Text;<br />
using System.IO;<br />
using System.Xml;<br />
using System.Web.Mail;<br />
using FrameworkLayer.ConfigurationUtility;<br />
namespace FrameworkLayer.EmailUtility<br />
{<br />
    public class EmailGenerator<br />
    {<br />
        private string xml_file_name;<br />
        //private Logger lg;</p>
<p>        public EmailGenerator()<br />
  {<br />
   //<br />
   // TODO: Add constructor logic here<br />
   //<br />
  }</p>
<p>  public bool IsEmail(string mail)<br />
  {<br />
   System.Text.RegularExpressions.Regex mailPattern = new System.Text.RegularExpressions.Regex(@&#8221;\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*&#8221;);<br />
   return mailPattern.IsMatch(mail);<br />
  }</p>
<p>        //public bool SendEmail (MailMessage mailMessage)<br />
        //{<br />
        //    bool retEmail=false;<br />
        //    string enableEmailTrigger=&#8221;";</p>
<p>        //    enableEmailTrigger = FrameworkLayer.ConfigurationUtility.WebApplicationConfiguration.IsEmailTrigger;<br />
        //    try<br />
        //    {<br />
        //        if(enableEmailTrigger.ToUpper().Trim()!=&#8221;NO&#8221;)<br />
        //        {<br />
        //            SmtpMail.SmtpServer = FrameworkLayer.ConfigurationUtility.WebApplicationConfiguration.SmtpServer;<br />
        //            mailMessage.From= FrameworkLayer.ConfigurationUtility.WebApplicationConfiguration.EmailSender;<br />
        //            SmtpMail.Send(mailMessage);<br />
        //            retEmail=true;<br />
        //        }<br />
        //    }<br />
        //    catch (Exception exp)<br />
        //    { <br />
        //        //lg=new Logger();<br />
        //        //lg.WriteTextLog(&#8220;Email&#8221;,exp,((string)System.Configuration.ConfigurationSettings.AppSettings.Get(&#8220;ERROR_LOG_PATH&#8221;)));</p>
<p>        //        //string err= exp.Message;<br />
        //        //retEmail=false;   <br />
        //    }<br />
        //    return retEmail;<br />
        //}</p>
<p>        private bool SendEmail(MailMessage mailMessage, string xmlfilename, string[] arrParam)<br />
        {<br />
            bool retEmail = false;<br />
            string m_subject = &#8220;&#8221;;<br />
            string m_title = &#8220;&#8221;;<br />
            string m_body = &#8220;&#8221;;<br />
            string smtpUsr = &#8220;&#8221;;<br />
            string smtpPsw = &#8220;&#8221;;<br />
            string enableEmailTrigger = &#8220;&#8221;;<br />
            string enableEmailAuth = &#8220;&#8221;;</p>
<p>            enableEmailTrigger = FrameworkLayer.ConfigurationUtility.WebApplicationConfiguration.IsEmailTrigger;<br />
            enableEmailAuth = FrameworkLayer.ConfigurationUtility.WebApplicationConfiguration.IsEmailEnableAuthorization;<br />
            try<br />
            {<br />
                if (enableEmailTrigger.ToUpper().Trim() != &#8220;NO&#8221;)<br />
                {<br />
                    xml_file_name = FrameworkLayer.ConfigurationUtility.WebApplicationConfiguration.EmailTemplateLocation + xmlfilename;</p>
<p>                    m_title = readFromXMLEmailTemplate(&#8220;TITLE&#8221;);</p>
<p>                    m_subject = readFromXMLEmailTemplate(&#8220;SUBJECT&#8221;);<br />
                    //m_subject += &#8221; &#8211; &#8221; + m_title;</p>
<p>                    mailMessage.Subject = m_subject;</p>
<p>                    m_body = readFromXMLEmailTemplate(&#8220;BODY&#8221;);<br />
                    m_body = replaceParameter(m_body, arrParam);<br />
                    //m_body.Replace (&#8220;\\N&#8221;,&#8221;\r\n&#8221;);<br />
                    mailMessage.Body = m_body;<br />
                    mailMessage.From = FrameworkLayer.ConfigurationUtility.WebApplicationConfiguration.EmailSender;</p>
<p>                    if (enableEmailAuth.Trim().ToUpper().Equals(&#8220;YES&#8221;))<br />
                    {</p>
<p>                        smtpUsr = FrameworkLayer.ConfigurationUtility.WebApplicationConfiguration.SmtpUserName;<br />
                        smtpPsw = FrameworkLayer.ConfigurationUtility.WebApplicationConfiguration.SmtpPassword;</p>
<p>                        mailMessage.Fields.Add(&#8220;<a href="http://schemas.microsoft.com/cdo/configuration/smtpauthenticate">http://schemas.microsoft.com/cdo/configuration/smtpauthenticate</a>&#8220;, &#8220;1&#8243;); //basic authentication<br />
                        mailMessage.Fields.Add(&#8220;<a href="http://schemas.microsoft.com/cdo/configuration/sendusername">http://schemas.microsoft.com/cdo/configuration/sendusername</a>&#8220;, smtpUsr); //set your username here<br />
                        mailMessage.Fields.Add(&#8220;<a href="http://schemas.microsoft.com/cdo/configuration/sendpassword">http://schemas.microsoft.com/cdo/configuration/sendpassword</a>&#8220;, smtpPsw); //set your password here<br />
                    }<br />
                    SmtpMail.SmtpServer.Insert(0, FrameworkLayer.ConfigurationUtility.WebApplicationConfiguration.SmtpServer);<br />
                    //SmtpMail.SmtpServer =MPConfiguration.SMTPServer ;</p>
<p>                    SmtpMail.Send(mailMessage);<br />
                    retEmail = true;<br />
                }<br />
            }<br />
            catch (Exception exp)<br />
            {<br />
                //string err= exp.Message;<br />
                //lg=new Logger();<br />
                //lg.WriteTextLog(&#8220;Email Template: &#8220;+xmlfilename,exp,((string)System.Configuration.ConfigurationSettings.AppSettings.Get(&#8220;ERROR_LOG_PATH&#8221;)));</p>
<p>                //retEmail=false;   <br />
            }<br />
            return retEmail;<br />
        }</p>
<p>        public void AutomaticSendEmailLogging(string ErrorMessage)<br />
        {<br />
          <br />
            MailMessage mailMsg = new MailMessage(); // Create instance of EmailMessage Object</p>
<p>            string templateName = FrameworkLayer.ConfigurationUtility.WebApplicationConfiguration.ProgrammerEmailName;<br />
            mailMsg.From = FrameworkLayer.ConfigurationUtility.WebApplicationConfiguration.EmailSender;<br />
            mailMsg.To = FrameworkLayer.ConfigurationUtility.WebApplicationConfiguration.ProgrammerEmail;<br />
            //mailMsg.Cc = EmailUser;</p>
<p>            string[] arrParamEmail = new string[2];</p>
<p>            //parametere yang akan dikirim ke email template<br />
            arrParamEmail[0] = System.DateTime.Now.ToString();//tgl<br />
            arrParamEmail[1] = ErrorMessage.ToString(); <br />
          </p>
<p>            this.SendEmail(mailMsg, templateName, arrParamEmail);<br />
        }</p>
<p>  public string replaceParameter(string input,string[] arrParam)<br />
  {<br />
   StringBuilder tmpInput= new  StringBuilder (input);<br />
   int idx=0;<br />
   for(int i=0 ; i &lt; arrParam.Length;i++)<br />
   {<br />
    idx = i+1;<br />
    tmpInput.Replace (&#8220;{&#8221; + i + &#8220;}&#8221;,arrParam[i].Trim());<br />
   }<br />
   tmpInput.Replace (&#8220;\\N&#8221;,&#8221;\r\n&#8221;);tmpInput.Replace (&#8220;\\n&#8221;,&#8221;\r\n&#8221;);<br />
   return tmpInput.ToString ();<br />
  }</p>
<p>  public string readFromXMLEmailTemplate(string tagName)<br />
  {<br />
   bool bStop=false;<br />
   string m_RetVal=&#8221;";<br />
   XmlTextReader reader = new  XmlTextReader (xml_file_name);<br />
   <br />
   while(reader.Read ())<br />
   {<br />
    //    bStop=false;<br />
    //    m_RetVal=&#8221;";<br />
    switch(reader.NodeType )<br />
    {<br />
     case XmlNodeType.Element :<br />
      if(reader.Name.Equals (tagName))<br />
      {<br />
       m_RetVal=&#8221;";<br />
       bStop=true;<br />
      }<br />
      break;<br />
     case XmlNodeType.Text:<br />
      m_RetVal=reader.Value ; <br />
      break;<br />
    }<br />
    if (bStop &amp;&amp; m_RetVal!=&#8221;")<br />
     break;<br />
   <br />
   }<br />
   return m_RetVal;<br />
  }<br />
    }<br />
}</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/doddychsaputra.wordpress.com/23/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/doddychsaputra.wordpress.com/23/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/doddychsaputra.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/doddychsaputra.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/doddychsaputra.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/doddychsaputra.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/doddychsaputra.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/doddychsaputra.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/doddychsaputra.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/doddychsaputra.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/doddychsaputra.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/doddychsaputra.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/doddychsaputra.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/doddychsaputra.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/doddychsaputra.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/doddychsaputra.wordpress.com/23/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=doddychsaputra.wordpress.com&amp;blog=1305638&amp;post=23&amp;subd=doddychsaputra&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://doddychsaputra.wordpress.com/2007/07/05/multipurpose-of-exception-handling-class-part-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b91382498b0b016e1364e483ec1bf7ec?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Doddy Christiana saputra</media:title>
		</media:content>
	</item>
		<item>
		<title>Multipurpose of Exception Handling Class Part 2</title>
		<link>http://doddychsaputra.wordpress.com/2007/07/05/multipurpose-of-exception-handling-class-part-2/</link>
		<comments>http://doddychsaputra.wordpress.com/2007/07/05/multipurpose-of-exception-handling-class-part-2/#comments</comments>
		<pubDate>Thu, 05 Jul 2007 11:18:10 +0000</pubDate>
		<dc:creator>Doddy Christiana saputra</dc:creator>
				<category><![CDATA[Design Pattern Code]]></category>
		<category><![CDATA[Development in  C# 2.0]]></category>
		<category><![CDATA[Own design custom Framework]]></category>

		<guid isPermaLink="false">http://doddychsaputra.wordpress.com/2007/07/05/multipurpose-of-exception-handling-class-part-2/</guid>
		<description><![CDATA[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 :&#60;EMAIL&#62; &#60;TITLE&#62;Error Notification&#60;/TITLE&#62; &#60;MESSAGE&#62; &#60;SUBJECT&#62;Global Coding System Notification &#60;/SUBJECT&#62; &#60;BODY&#62;ERROR MESSAGE ALERT {0} ================================================\n\nPlease be advised [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=doddychsaputra.wordpress.com&amp;blog=1305638&amp;post=22&amp;subd=doddychsaputra&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Okay in this section part i will talk more detail about those kind of class ,</p>
<ol>
<li>Logging Class</li>
</ol>
<p>Prerequisite for this class :</p>
<ul>
<li>You need provide the xml file for become the email template, the simple form like this :&lt;EMAIL&gt;<br />
&lt;TITLE&gt;Error Notification&lt;/TITLE&gt;<br />
&lt;MESSAGE&gt;<br />
&lt;SUBJECT&gt;Global Coding System Notification<br />
&lt;/SUBJECT&gt;<br />
&lt;BODY&gt;ERROR MESSAGE ALERT {0}<br />
================================================\n\nPlease be advised that somthing error happen in your application :<br />
{1} \N<br />
&lt;/BODY&gt;<br />
&lt;/MESSAGE&gt;<br />
&lt;/EMAIL&gt;</li>
</ul>
<p><span id="more-22"></span></p>
<ul>
<li>Those XML email file using two parameters, {0} this parameter will display the date error generate and the second things {1} this parameter will display or capture your exeception handling stack trace.</li>
<li>Those parameter will be taken from the emailGenerator class, wheter triggered from logging class.</li>
<li>In Logging class, there are two important method , first method is Handledexception Method hich has a duty to coordinate to another private method which has a function for logging writing to text file and also the trigerring to email alertGenerator class, and this class will become the second important method in this class.</li>
</ul>
<p>  So Let&#8217;s take a look the concrete code in this sample below :</p>
<p>//***********************************************************************************************************<br />
//  SUBJECT             : LOGGING UTILITY ENGINE<br />
//  CREATED BY          : Doddy Christiana Saputra , MCAD.NET<br />
//  LAST MODIFIED DATE  : JUNE 22,2007<br />
//***********************************************************************************************************</p>
<p>using System;<br />
using System.Collections.Generic;<br />
using System.Text;<br />
using System.Data;<br />
using System.Configuration;<br />
using FrameworkLayer.ConfigurationUtility;<br />
using FrameworkLayer.EmailUtility;<br />
using System.IO;</p>
<p>namespace FrameworkLayer.LoggingUtility<br />
{<br />
    public class Logging<br />
    {<br />
        private bool boolHandleErrors;<br />
        private string strLastError;<br />
        private bool boolLogError;<br />
        private string strLogFile;</p>
<p>        EmailGenerator Email = new EmailGenerator(); //Create instance of email generator<br />
  </p>
<p>        public bool HandleErrors<br />
        {<br />
            get<br />
            {<br />
                return boolHandleErrors;<br />
            }<br />
            set<br />
            {<br />
                boolHandleErrors = value;<br />
            }<br />
        }</p>
<p>        public string LastError<br />
        {<br />
            get<br />
            {<br />
                return strLastError;<br />
            }<br />
        }</p>
<p>        public bool LogErrors<br />
        {<br />
            get<br />
            {<br />
                return boolLogError;<br />
            }<br />
            set<br />
            {<br />
                boolLogError = value;<br />
            }<br />
        }</p>
<p>        public string LogFile<br />
        {<br />
            get<br />
            {<br />
                return strLogFile;<br />
            }<br />
            set<br />
            {<br />
                strLogFile = value;<br />
            }<br />
        }<br />
        public void HandleExceptions(Exception ex)<br />
        {<br />
            this.LogErrors = true;<br />
            this.LogFile = FrameworkLayer.ConfigurationUtility.WebApplicationConfiguration.ErrorLogFile;  <br />
                  <br />
            if (LogErrors)<br />
            {<br />
                WriteToLog(ex.Message+ex.StackTrace);<br />
            }<br />
            if (HandleErrors)<br />
            {<br />
                strLastError = ex.Message;<br />
            }<br />
            else<br />
            {<br />
                throw ex;<br />
            }<br />
        }</p>
<p>        private void WriteToLog(string msg)<br />
        {<br />
            StreamWriter writer = File.AppendText(LogFile);<br />
            writer.WriteLine(DateTime.Now.ToString() + &#8221; &#8211; &#8221; + msg);<br />
            writer.Close();</p>
<p>            //This is the part of automatically sending email to programmer<br />
            string[] test = new string[1]; //harus didefine nanti<br />
            Email.AutomaticSendEmailLogging (msg); //hanyautk inisialisasi sementara</p>
<p>           <br />
        }<br />
    }<br />
   <br />
}</p>
<p>okay..after yo see all of those description then you will rather clear enough or getting more itchi <img src='http://s2.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  &#8230;</p>
<p>i will continue the emailgenerator class in the third part. see you..</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/doddychsaputra.wordpress.com/22/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/doddychsaputra.wordpress.com/22/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/doddychsaputra.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/doddychsaputra.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/doddychsaputra.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/doddychsaputra.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/doddychsaputra.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/doddychsaputra.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/doddychsaputra.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/doddychsaputra.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/doddychsaputra.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/doddychsaputra.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/doddychsaputra.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/doddychsaputra.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/doddychsaputra.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/doddychsaputra.wordpress.com/22/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=doddychsaputra.wordpress.com&amp;blog=1305638&amp;post=22&amp;subd=doddychsaputra&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://doddychsaputra.wordpress.com/2007/07/05/multipurpose-of-exception-handling-class-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b91382498b0b016e1364e483ec1bf7ec?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Doddy Christiana saputra</media:title>
		</media:content>
	</item>
		<item>
		<title>Multipurpose of Exception Handling Class Part 1</title>
		<link>http://doddychsaputra.wordpress.com/2007/07/02/multipurpose-of-exception-handling-class/</link>
		<comments>http://doddychsaputra.wordpress.com/2007/07/02/multipurpose-of-exception-handling-class/#comments</comments>
		<pubDate>Mon, 02 Jul 2007 09:47:42 +0000</pubDate>
		<dc:creator>Doddy Christiana saputra</dc:creator>
				<category><![CDATA[Design Pattern Code]]></category>
		<category><![CDATA[Development in  C# 2.0]]></category>
		<category><![CDATA[Own design custom Framework]]></category>

		<guid isPermaLink="false">http://doddychsaputra.wordpress.com/2007/07/02/multipurpose-of-exception-handling-class/</guid>
		<description><![CDATA[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 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=doddychsaputra.wordpress.com&amp;blog=1305638&amp;post=19&amp;subd=doddychsaputra&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>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.</p>
<p>for instance is like this :</p>
<p>in DAL i am using the exception handling class &#8211;&gt; if there is something error in my DAL class &#8211;&gt; the error handler will capture the Exception stack trace &#8211;&gt; the Exception class will talk to the Logging class and also either the email class.</p>
<p>and then my class like this Logging class and Email class :</p>
<p><a href="http://doddychsaputra.files.wordpress.com/2007/07/emaillogging.jpg" title="log"><img width="323" src="http://doddychsaputra.files.wordpress.com/2007/07/emaillogging.thumbnail.jpg?w=323&#038;h=77" alt="log" height="77" style="width:210px;height:118px;" /></a></p>
<p><span id="more-19"></span></p>
<p>the logging class has a duty to write the log in text file for every single stck error trace and then the email class will send those error stack trace automatically to the proper progammers email and also carbon copy to the system administrator.</p>
<p>let&#8217;s take a look for technically details ( continue to part 2 )</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/doddychsaputra.wordpress.com/19/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/doddychsaputra.wordpress.com/19/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/doddychsaputra.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/doddychsaputra.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/doddychsaputra.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/doddychsaputra.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/doddychsaputra.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/doddychsaputra.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/doddychsaputra.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/doddychsaputra.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/doddychsaputra.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/doddychsaputra.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/doddychsaputra.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/doddychsaputra.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/doddychsaputra.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/doddychsaputra.wordpress.com/19/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=doddychsaputra.wordpress.com&amp;blog=1305638&amp;post=19&amp;subd=doddychsaputra&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://doddychsaputra.wordpress.com/2007/07/02/multipurpose-of-exception-handling-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b91382498b0b016e1364e483ec1bf7ec?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Doddy Christiana saputra</media:title>
		</media:content>

		<media:content url="http://doddychsaputra.files.wordpress.com/2007/07/emaillogging.thumbnail.jpg" medium="image">
			<media:title type="html">log</media:title>
		</media:content>
	</item>
		<item>
		<title>Multipurpose Data Access Layer part 2</title>
		<link>http://doddychsaputra.wordpress.com/2007/07/02/multipurpose-data-access-layer-part-2/</link>
		<comments>http://doddychsaputra.wordpress.com/2007/07/02/multipurpose-data-access-layer-part-2/#comments</comments>
		<pubDate>Mon, 02 Jul 2007 02:31:01 +0000</pubDate>
		<dc:creator>Doddy Christiana saputra</dc:creator>
				<category><![CDATA[Design Pattern Code]]></category>
		<category><![CDATA[Development in  C# 2.0]]></category>
		<category><![CDATA[Own design custom Framework]]></category>

		<guid isPermaLink="false">http://doddychsaputra.wordpress.com/2007/07/02/multipurpose-data-access-layer-part-2/</guid>
		<description><![CDATA[In this 2nd part i&#8217;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 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=doddychsaputra.wordpress.com&amp;blog=1305638&amp;post=18&amp;subd=doddychsaputra&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In this 2nd part i&#8217;ll try to describe more detail in coding which i mentioned it in part 1,</p>
<p>a. ConnectionString Class</p>
<ul>
<li>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.</li>
<li>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.</li>
<li>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 ).</li>
</ul>
<p>     let see the complete module :</p>
<p>     <span id="more-18"></span>//********************************************************************************************************<br />
// SUBJECT      : MULTIPLE CONNECTION STRING AND PROVIDER CLASS<br />
// CREATED BY   : DODDY CH SAPUTRA , MCAD.NET <br />
// CREATED DATE : JUNE 26,2007<br />
//********************************************************************************************************</p>
<p>using System;<br />
using System.Collections.Generic;<br />
using System.Configuration;<br />
using System.Data.Common;<br />
using FrameworkLayer.WebUtility;<br />
using FrameworkLayer.ConfigurationUtility;<br />
namespace FrameworkLayer.DataUtility<br />
{<br />
    public class ConnectionToDatabase : FrameworkLayer.WebUtility.WebPageBase<br />
    {</p>
<p>   <br />
        //******* Code yang udAH OKAY MONCOR *****************<br />
        //public string Key<br />
        //{<br />
        //    get { return base.IdApplication; }<br />
        //}<br />
        //****************************************************</p>
<p>        //******** Tester Key ********************************<br />
        public string _Key = &#8220;GCS&#8221;;</p>
<p>        public string Key<br />
        {<br />
            get { return _Key; }<br />
            set { _Key = &#8220;GCS&#8221;; }<br />
        }<br />
        //******************************************************<br />
        public static string GetCN()<br />
        {<br />
            string Cn = string.Empty;<br />
            ConnectionToDatabase oKey = new ConnectionToDatabase();<br />
            string Key = oKey.Key.ToString();</p>
<p>            if (Key == FrameworkLayer.ConfigurationUtility.WebApplicationConfiguration.GcsAppKey)<br />
            {<br />
                Cn = ConfigurationManager.ConnectionStrings["CN_GCS"].ConnectionString;<br />
            }<br />
            else<br />
            if (Key == FrameworkLayer.ConfigurationUtility.WebApplicationConfiguration.ElearningAppKey)<br />
            {<br />
                Cn = ConfigurationManager.ConnectionStrings["CN_ELN"].ConnectionString;<br />
            }<br />
            if (Key == FrameworkLayer.ConfigurationUtility.WebApplicationConfiguration.MMwebAppkey)<br />
            {<br />
                Cn = ConfigurationManager.ConnectionStrings["CN_MMW"].ConnectionString;</p>
<p>            }<br />
            else<br />
            if (Key == FrameworkLayer.ConfigurationUtility.WebApplicationConfiguration.BidAppKey)<br />
            {<br />
                Cn = ConfigurationManager.ConnectionStrings["CN_BID"].ConnectionString;</p>
<p>            }<br />
            else<br />
            if (Key == FrameworkLayer.ConfigurationUtility.WebApplicationConfiguration.OtherAppKey)<br />
            {<br />
                Cn = ConfigurationManager.ConnectionStrings["CN_OTHERS"].ConnectionString;<br />
            }</p>
<p>            return Cn;<br />
        }</p>
<p>        public static string GetPV()<br />
        {</p>
<p>            string Pv = string.Empty;<br />
            ConnectionToDatabase oKey = new ConnectionToDatabase();<br />
            string Key = oKey.Key.ToString();</p>
<p>            if (Key == FrameworkLayer.ConfigurationUtility.WebApplicationConfiguration.GcsAppKey)<br />
            {<br />
                Pv = ConfigurationManager.ConnectionStrings["CN_GCS"].ProviderName ;<br />
            }<br />
            else<br />
            if (Key == FrameworkLayer.ConfigurationUtility.WebApplicationConfiguration.ElearningAppKey)<br />
            {</p>
<p>                Pv = ConfigurationManager.ConnectionStrings["CN_ELN"].ProviderName;<br />
            }<br />
            else<br />
            if (Key == FrameworkLayer.ConfigurationUtility.WebApplicationConfiguration.MMwebAppkey)<br />
            {<br />
                Pv = ConfigurationManager.ConnectionStrings["CN_MMW"].ProviderName;<br />
            }<br />
            else<br />
            if (Key == FrameworkLayer.ConfigurationUtility.WebApplicationConfiguration.BidAppKey)<br />
            {<br />
                Pv = ConfigurationManager.ConnectionStrings["CN_BID"].ProviderName;<br />
            }<br />
            else<br />
            if (Key == FrameworkLayer.ConfigurationUtility.WebApplicationConfiguration.OtherAppKey)<br />
            {<br />
                Pv = ConfigurationManager.ConnectionStrings["CN_OTHERS"].ProviderName;<br />
            }</p>
<p>            return Pv;<br />
        }<br />
     }<br />
}<br />
  </p>
<p>b. Query Builder Class</p>
<ul>
<li>I made theree public overloading method ( polimorphism method ) which could receive the SQL server provider and the config define. This all method has function the define and select the proper provider name for which consumed from the connectionstring class.</li>
<li>All Of Query syntax was embed either in this class wheter has a function to service all of query type and command type such as text query or stored procedure command type.</li>
</ul>
<p>Let&#8217;s get rock&#8217;n roll of the code :</p>
<p> <!--more--></p>
<p>//***********************************************************************************************************<br />
//  SUBJECT             : DATA ACCESS ENGINE PROVIDER AND QUERY HELPER<br />
//  CREATED BY          : Doddy Christiana Saputra , MCAD.NET<br />
//  LAST MODIFIED DATE  : JUNE 22,2007<br />
//***********************************************************************************************************</p>
<p>using System;<br />
using System.Collections.Generic;<br />
using System.Text;<br />
using System.Data;<br />
using System.Configuration;<br />
using System.Data.Common;<br />
using System.Data.SqlClient;<br />
using System.Data.OleDb;<br />
using System.Data.Odbc;<br />
using System.Data.OracleClient;<br />
using System.IO;<br />
using FrameworkLayer.LoggingUtility;<br />
using FrameworkLayer.DataUtility;<br />
using FrameworkLayer.ConfigurationUtility;</p>
<p>namespace FrameworkLayer.DataUtility<br />
{<br />
    public class QueryBuilder : IDisposable<br />
    {<br />
        private string strConnectionString;<br />
        private DbConnection objConnection;<br />
        private DbCommand objCommand;<br />
        private DbProviderFactory objFactory = null;<br />
        Logging msg = new Logging();<br />
      </p>
<p>        //private string strCN = FrameworkLayer.DataUtility.ConnectionToDatabase.GetCN();<br />
        //private string strPV  = FrameworkLayer.DataUtility.ConnectionToDatabase.GetPV();<br />
        public string _CN = string.Empty;<br />
        public string strCN<br />
        {<br />
            get { return _CN; }<br />
            set { _CN = FrameworkLayer.DataUtility.ConnectionToDatabase.GetCN(); }<br />
        }</p>
<p>        public string _PV = string.Empty;<br />
        public string strPV<br />
        {<br />
            get { return _PV; }<br />
            set { _PV = FrameworkLayer.DataUtility.ConnectionToDatabase.GetPV(); }<br />
        }<br />
 <br />
        //Overloading Provider<br />
        public QueryBuilder(Providers provider): this(FrameworkLayer.DataUtility.ConnectionToDatabase.GetCN(), provider)<br />
        {</p>
<p>        }</p>
<p>        //Overloading Connection String<br />
        public QueryBuilder(string connectionstring): this(connectionstring, Providers.SqlServer)<br />
        {<br />
        }</p>
<p>        //Overloading get Connection String and Provider<br />
        public QueryBuilder(): this(FrameworkLayer.DataUtility.ConnectionToDatabase.GetCN(), Providers.ConfigDefined)<br />
        {<br />
        }</p>
<p>        public QueryBuilder(string connectionstring,Providers provider)<br />
        {  <br />
            //Pemilihan Provider Database<br />
            strConnectionString = connectionstring;<br />
            switch (provider)<br />
            {<br />
                case Providers.SqlServer:<br />
                    objFactory = SqlClientFactory.Instance;<br />
                    break;<br />
                case Providers.OleDb:<br />
                    objFactory = OleDbFactory.Instance;<br />
                    break;<br />
                case Providers.Oracle:<br />
                    objFactory = OracleClientFactory.Instance;<br />
                    break;<br />
                case Providers.ODBC:<br />
                    objFactory = OdbcFactory.Instance;<br />
                    break;<br />
                case Providers.ConfigDefined:<br />
                    string providername = FrameworkLayer.DataUtility.ConnectionToDatabase.GetPV();<br />
                    switch (providername)<br />
                    {<br />
                        case &#8220;System.Data.SqlClient&#8221;:<br />
                            objFactory = SqlClientFactory.Instance;<br />
                            break;<br />
                        case &#8220;System.Data.OleDb&#8221;:<br />
                            objFactory = OleDbFactory.Instance;<br />
                            break;<br />
                        case &#8220;System.Data.OracleClient&#8221;:<br />
                            objFactory = OracleClientFactory.Instance;<br />
                            break;<br />
                        case &#8220;System.Data.Odbc&#8221;:<br />
                            objFactory = OdbcFactory.Instance;<br />
                            break;<br />
                    }<br />
                    break;</p>
<p>            }<br />
            objConnection = objFactory.CreateConnection();<br />
            objCommand = objFactory.CreateCommand();</p>
<p>            objConnection.ConnectionString = strConnectionString;<br />
            objCommand.Connection = objConnection;<br />
        }</p>
<p>       </p>
<p>      <br />
        public int AddParameter(string name,object value)<br />
        {<br />
            DbParameter p = objFactory.CreateParameter();<br />
            p.ParameterName = name;<br />
            p.Value=value;<br />
            return objCommand.Parameters.Add(p);<br />
        }</p>
<p>        public int AddParameter(DbParameter parameter)<br />
        {<br />
            return objCommand.Parameters.Add(parameter);<br />
        }</p>
<p>        public DbCommand Command<br />
        {<br />
            get<br />
            {<br />
                return objCommand;<br />
            }<br />
        }</p>
<p>        public void BeginTransaction()<br />
        {<br />
            if (objConnection.State == System.Data.ConnectionState.Closed)<br />
            {<br />
                objConnection.Open();<br />
            }<br />
            objCommand.Transaction = objConnection.BeginTransaction();<br />
        }</p>
<p>        public void CommitTransaction()<br />
        {<br />
            objCommand.Transaction.Commit();<br />
            objConnection.Close();<br />
        }</p>
<p>        public void RollbackTransaction()<br />
        {<br />
            objCommand.Transaction.Rollback();<br />
            objConnection.Close();<br />
        }</p>
<p>        public int ExecuteNonQuery(string query)<br />
        {<br />
            return ExecuteNonQuery(query, CommandType.Text, ConnectionState.CloseOnExit);<br />
        }</p>
<p>        public int ExecuteNonQuery(string query,CommandType commandtype)<br />
        {<br />
            return ExecuteNonQuery(query, commandtype, ConnectionState.CloseOnExit);<br />
        }</p>
<p>        public int ExecuteNonQuery(string query,ConnectionState connectionstate)<br />
        {<br />
            return ExecuteNonQuery(query,CommandType.Text,connectionstate);<br />
        }</p>
<p>        public int ExecuteNonQuery(string query,CommandType commandtype, ConnectionState connectionstate)<br />
        {<br />
            objCommand.CommandText = query;<br />
            objCommand.CommandType = commandtype;<br />
            int i=-1;<br />
            try<br />
            {<br />
                if (objConnection.State == System.Data.ConnectionState.Closed)<br />
                {<br />
                    objConnection.Open();<br />
                }<br />
                i = objCommand.ExecuteNonQuery();<br />
            }<br />
            catch (Exception ex)<br />
            {<br />
                msg.HandleExceptions(ex);<br />
            }<br />
            finally<br />
            {<br />
                objCommand.Parameters.Clear();<br />
                if (connectionstate == ConnectionState.CloseOnExit)<br />
                {<br />
                    objConnection.Close();<br />
                }<br />
            }</p>
<p>            return i;<br />
        }</p>
<p>        public object ExecuteScalar(string query)<br />
        {<br />
            return ExecuteScalar(query, CommandType.Text, ConnectionState.CloseOnExit);<br />
        }</p>
<p>        public object ExecuteScalar(string query,CommandType commandtype)<br />
        {<br />
            return ExecuteScalar(query, commandtype, ConnectionState.CloseOnExit);<br />
        }</p>
<p>        public object ExecuteScalar(string query, ConnectionState connectionstate)<br />
        {<br />
            return ExecuteScalar(query, CommandType.Text, connectionstate);<br />
        }</p>
<p>        public object ExecuteScalar(string query,CommandType commandtype, ConnectionState connectionstate)<br />
        {<br />
            objCommand.CommandText = query;<br />
            objCommand.CommandType = commandtype;<br />
            object o = null;<br />
            try<br />
            {<br />
                if (objConnection.State == System.Data.ConnectionState.Closed)<br />
                {<br />
                    objConnection.Open();<br />
                }<br />
                o = objCommand.ExecuteScalar();<br />
            }<br />
            catch (Exception ex)<br />
            {<br />
                msg.HandleExceptions(ex);<br />
            }<br />
            finally<br />
            {<br />
                objCommand.Parameters.Clear();<br />
                if (connectionstate == ConnectionState.CloseOnExit)<br />
                {<br />
                    objConnection.Close();<br />
                }<br />
            }</p>
<p>            return o;<br />
        }</p>
<p>        public DbDataReader ExecuteReader(string query)<br />
        {<br />
            return ExecuteReader(query, CommandType.Text, ConnectionState.CloseOnExit);<br />
        }</p>
<p>        public DbDataReader ExecuteReader(string query,CommandType commandtype)<br />
        {<br />
            return ExecuteReader(query, commandtype, ConnectionState.CloseOnExit);<br />
        }</p>
<p>        public DbDataReader ExecuteReader(string query, ConnectionState connectionstate)<br />
        {<br />
            return ExecuteReader(query, CommandType.Text, connectionstate);<br />
        }</p>
<p>        public DbDataReader ExecuteReader(string query,CommandType commandtype, ConnectionState connectionstate)<br />
        {<br />
            objCommand.CommandText = query;<br />
            objCommand.CommandType = commandtype;<br />
            DbDataReader reader=null;<br />
            try<br />
            {<br />
                if (objConnection.State == System.Data.ConnectionState.Closed)<br />
                {<br />
                    objConnection.Open();<br />
                }<br />
                if (connectionstate == ConnectionState.CloseOnExit)<br />
                {<br />
                    reader = objCommand.ExecuteReader(CommandBehavior.CloseConnection);<br />
                }<br />
                else<br />
                {<br />
                    reader = objCommand.ExecuteReader();<br />
                }</p>
<p>            }<br />
            catch (Exception ex)<br />
            {<br />
                msg.HandleExceptions(ex);<br />
            }<br />
            finally<br />
            {<br />
                objCommand.Parameters.Clear();<br />
            }</p>
<p>            return reader;<br />
        }</p>
<p>        public DataSet ExecuteDataSet(string query)<br />
        {<br />
            return ExecuteDataSet(query, CommandType.Text, ConnectionState.CloseOnExit);<br />
        }</p>
<p>        public DataSet ExecuteDataSet(string query,CommandType commandtype)<br />
        {<br />
            return ExecuteDataSet(query, commandtype, ConnectionState.CloseOnExit);<br />
        }</p>
<p>        public DataSet ExecuteDataSet(string query,ConnectionState connectionstate)<br />
        {<br />
            return ExecuteDataSet(query, CommandType.Text, connectionstate);<br />
        }</p>
<p>        public DataSet ExecuteDataSet(string query,CommandType commandtype, ConnectionState connectionstate)<br />
        {<br />
            DbDataAdapter adapter = objFactory.CreateDataAdapter();<br />
            objCommand.CommandText = query;<br />
            objCommand.CommandType = commandtype;<br />
            adapter.SelectCommand = objCommand;<br />
            DataSet ds = new DataSet();<br />
            try<br />
            {<br />
                adapter.Fill(ds);<br />
            }<br />
            catch (Exception ex)<br />
            {<br />
                msg.HandleExceptions(ex);<br />
            }<br />
            finally<br />
            {<br />
                objCommand.Parameters.Clear();<br />
                if (connectionstate == ConnectionState.CloseOnExit)<br />
                {<br />
                    if (objConnection.State == System.Data.ConnectionState.Open)<br />
                    {<br />
                        objConnection.Close();<br />
                    }<br />
                }<br />
            }<br />
            return ds;<br />
        }<br />
       <br />
        public void Dispose()<br />
        {<br />
            objConnection.Close();<br />
            objConnection.Dispose();<br />
            objCommand.Dispose();<br />
        }</p>
<p>    }</p>
<p>    public enum Providers<br />
    {<br />
        SqlServer,OleDb,Oracle,ODBC,ConfigDefined<br />
    }</p>
<p>    public enum ConnectionState<br />
    {<br />
        KeepOpen,CloseOnExit<br />
    }<br />
   <br />
}</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/doddychsaputra.wordpress.com/18/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/doddychsaputra.wordpress.com/18/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/doddychsaputra.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/doddychsaputra.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/doddychsaputra.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/doddychsaputra.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/doddychsaputra.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/doddychsaputra.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/doddychsaputra.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/doddychsaputra.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/doddychsaputra.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/doddychsaputra.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/doddychsaputra.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/doddychsaputra.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/doddychsaputra.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/doddychsaputra.wordpress.com/18/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=doddychsaputra.wordpress.com&amp;blog=1305638&amp;post=18&amp;subd=doddychsaputra&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://doddychsaputra.wordpress.com/2007/07/02/multipurpose-data-access-layer-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b91382498b0b016e1364e483ec1bf7ec?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Doddy Christiana saputra</media:title>
		</media:content>
	</item>
		<item>
		<title>How handling Upload file module in Asp.Net</title>
		<link>http://doddychsaputra.wordpress.com/2007/06/30/how-you-handling-upload-file-module-in-aspnet/</link>
		<comments>http://doddychsaputra.wordpress.com/2007/06/30/how-you-handling-upload-file-module-in-aspnet/#comments</comments>
		<pubDate>Sat, 30 Jun 2007 08:05:02 +0000</pubDate>
		<dc:creator>Doddy Christiana saputra</dc:creator>
				<category><![CDATA[Development in  C# 2.0]]></category>
		<category><![CDATA[Dotnet Framework 2.0]]></category>

		<guid isPermaLink="false">http://doddychsaputra.wordpress.com/2007/06/30/how-you-handling-upload-file-module-in-aspnet/</guid>
		<description><![CDATA[I would like to share about how to handling the upload file or creating something in your project which is need for file uploading, in this part there are some purpose that we want to achieve : 1. Browsing the file in local client into the list of file uploading 2. Move the all file list [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=doddychsaputra.wordpress.com&amp;blog=1305638&amp;post=11&amp;subd=doddychsaputra&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://doddychsaputra.files.wordpress.com/2007/06/upload-files-ui.jpg" title="UI Design"></a><a href="http://doddychsaputra.files.wordpress.com/2007/06/grid-view-file.jpg" title="grid-view-file.jpg"></a>I would like to share about how to handling the upload file or creating something in your project which is need for file uploading, in this part there are some purpose that we want to achieve :</p>
<p>1. Browsing the file in local client into the list of file uploading</p>
<p>2. Move the all file list into the table which already to sent to web server  </p>
<ul>
<li>The UI design                          * User Control for Editing and viewing Files</li>
</ul>
<p>           <a href="http://doddychsaputra.files.wordpress.com/2007/06/upload-files-ui.jpg" title="UI Design"><img width="128" src="http://doddychsaputra.files.wordpress.com/2007/06/upload-files-ui.thumbnail.jpg?w=128&#038;h=71" alt="UI Design" height="71" /></a>                   <a href="http://doddychsaputra.files.wordpress.com/2007/06/grid-view-file.jpg" title="grid-view-file.jpg"><img width="128" src="http://doddychsaputra.files.wordpress.com/2007/06/grid-view-file.thumbnail.jpg?w=128&#038;h=61" alt="grid-view-file.jpg" height="61" style="width:140px;height:69px;" /></a></p>
<ul>
<li>From the UI design I made the MediaFileUpload.Aspx , and then in the code behind of this control you need to made a declaration for web file repository like this : </li>
</ul>
<p><span id="more-11"></span>string webRepository=((stringSystem.Configuration.ConfigurationSettings.AppSettings.Get(&#8220;WebDataRequestRepository&#8221;));     </p>
<ul>
<li>Next you need to create the method which has purpose to handling file uploading in this case we call it public void Upload_ServerClick(), but before that you must using the System.IO for IO accesing into the web file repository.</li>
<li>Beside those method above, i have made another method for define the file type validation for the user which is the bussiness process required only certain file type that should be updated into the system which return the string for file name type, in this case we call the TypeFile().</li>
<li>And the last of method for saving the file we put the mediaview.saveFile() method which refer to mediaView.ascx user control.</li>
<li>In this sample case, i am using the Typed dataset for binding into GridView which are when user pick the file which wanna upload then all of those URL image will be saved into the view state and then after that, when you want to save into your database or calling the CRUD , you need to move all from the viewstate into the dataset again ( you will find the complete sample MediaView.ascx in this code below )</li>
</ul>
<p>      this is the listing complete code of MediaFileUpload.Aspx :</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>      /*==================================================================================<br />
 * Created By           : Doddy Ch Saputra, MCAD.NET<br />
 * Created Date           : 03 May 2007<br />
 * Last Modified By    : Doddy Ch Saputra<br />
 * Last Modified date     : 03 May 2007<br />
 * Architecture Template  : C# MyGeneration Doodads<br />
 * Functionality          : Upload user control for Media<br />
 * =================================================================================<br />
 */<br />
namespace ProcLearning.WebAdmin<br />
{<br />
 using System;<br />
 using System.Data;<br />
 using System.Drawing;<br />
 using System.Web;<br />
 using System.Web.UI.WebControls;<br />
 using System.Web.UI.HtmlControls;<br />
 using MyGeneration.dOOdads ;<br />
 using System.Data.SqlClient;<br />
 using System.Collections;<br />
 using System.Collections.Specialized;<br />
 using ProcLearning.FacadeLayer; <br />
 using ProcLearning.BindingLayer;<br />
 using System.IO;</p>
<p> /// &lt;summary&gt;<br />
 ///  Summary description for MediaFileUpload.<br />
 /// &lt;/summary&gt;<br />
 public class MediaFileUpload : ProcLearning.WebForm.FrontEnd.UserControl.UserControlBase<br />
 {<br />
  protected System.Web.UI.WebControls.Button RemvFile;<br />
  string baseLocation=((string)System.Configuration.ConfigurationSettings.AppSettings.Get(&#8220;DataRequestRepository&#8221;));<br />
  string webRepository=((string)System.Configuration.ConfigurationSettings.AppSettings.Get(&#8220;WebDataRequestRepository&#8221;));<br />
  protected BunnyBear.msgBox Msgbox2;<br />
  protected System.Web.UI.WebControls.Button Button2;<br />
  protected System.Web.UI.WebControls.Label Label5;<br />
  protected System.Web.UI.WebControls.Label Label6;<br />
  protected ProcLearning.BindingLayer.Media media1;<br />
  protected System.Web.UI.WebControls.TextBox txtMediaFileName;<br />
  protected System.Web.UI.WebControls.TextBox txtDesc;<br />
  protected System.Web.UI.HtmlControls.HtmlInputFile FindFile;<br />
  protected System.Web.UI.WebControls.Button btnAdd;<br />
  protected System.Web.UI.WebControls.Button btnSave;<br />
  protected BunnyBear.msgBox MsgBox3;<br />
  protected System.Web.UI.WebControls.Label Label1;<br />
  protected System.Web.UI.WebControls.Label Label3;<br />
  protected System.Web.UI.WebControls.DropDownList ddlType;<br />
  protected System.Web.UI.WebControls.Label Label2;<br />
  protected System.Web.UI.WebControls.Button AddFile;<br />
  protected System.Web.UI.WebControls.Button btnSimpan;<br />
  protected ProcLearning.WebAdmin.MediaView MediaView1;</p>
<p>  private void Page_Load(object sender, System.EventArgs e)<br />
  {<br />
  <br />
  }<br />
  public void Upload_ServerClick()<br />
  {<br />
   <br />
   string status = &#8220;&#8221;;<br />
   string fn =&#8221;";<br />
   string URL=&#8221;";<br />
   string ImageURL=&#8221;";<br />
   int docID=0;<br />
   DataRow dr;<br />
   FileInfo fi;<br />
   <br />
   string idType=&#8221;";<br />
   string TypeName=&#8221;";<br />
   string URLName=&#8221;";<br />
   </p>
<p>   fn = System.IO.Path.GetFileName(FindFile.PostedFile.FileName);<br />
   string Ext = System.IO.Path.GetExtension(FindFile.PostedFile.FileName);</p>
<p>   string []Attribute=TypeFile(Ext).ToString().Split(&#8216;|&#8217;);</p>
<p>   if (Ext.ToUpper() != &#8220;.DOC&#8221; &amp;&amp; Ext.ToUpper() != &#8220;.WMV&#8221; &amp;&amp; Ext.ToUpper() != &#8220;.MP3&#8243; &amp;&amp; Ext.ToUpper() != &#8220;.JPG&#8221; &amp;&amp; Ext.ToUpper() != &#8220;.JPEG&#8221; &amp;&amp; Ext.ToUpper() != &#8220;.PDF&#8221; &amp;&amp; Ext.ToUpper() != &#8220;.VSD&#8221; &amp;&amp; Ext.ToUpper() != &#8220;.XLS&#8221; &amp;&amp; Ext.ToUpper() != &#8220;.PPT&#8221;)<br />
   {<br />
    this.MsgBox3.alert(&#8220;Please be advised that your file is in DOC,JPG,JPEG,XLS,PPT,VSD,PDF,WMV,MP3 format&#8221;);<br />
   }<br />
   else<br />
   {<br />
    idType=Attribute[0];<br />
    TypeName=Attribute[1];<br />
    URLName=Attribute[2];<br />
   }<br />
   if (this.txtMediaFileName.Text  == &#8220;&#8221;)<br />
   {<br />
               this.MsgBox3.alert(&#8220;Please be advised that your must fill the subject name of Media File &#8220;);<br />
   }<br />
   else<br />
   if (this.txtDesc.Text == &#8220;&#8221;  )<br />
   {<br />
               this.MsgBox3.alert(&#8220;Please be advised that your must fill the description name of Media File &#8220;);<br />
   }<br />
   else<br />
   if(FindFile.PostedFile.ContentLength&gt;5000000)<br />
   {<br />
    this.MsgBox3.alert(&#8220;File Size should be smaller than 5 MB&#8221;);<br />
   }<br />
   else<br />
   {<br />
    try<br />
    {<br />
     FindFile.PostedFile.SaveAs(baseLocation + fn);</p>
<p>     // Bagian utk mengisi ke dataset sementara &#8212;&#8212;-is&#8212;&#8212;&#8212;&#8212;&#8212;<br />
       this.media1 = new Media();<br />
       dr = this.media1.VW_Media.NewRow();<br />
       dr["Media_Name"]= this.txtMediaFileName.ToString() ;<br />
       dr["Type_Name"] = TypeName ;<br />
       dr["Description"]=this.txtDesc.Text;<br />
       dr["User_Name"]=base.CurrentUser.ToString();<br />
       dr["Last_Updated"]= DateTime.Now;<br />
       dr["URL"] = &#8220;/ProcLearning/DataRequestFileRepository/&#8221; + fn ;<br />
       dr["Type_ID"] = idType;<br />
       dr["Image_URL"] = URLName;<br />
//       // &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
     this.media1.VW_Media.Rows.Add(dr);<br />
       <br />
     status += fn + &#8220;&lt;br&gt;&#8221;;<br />
     MediaView1.PrepareDocDS(this.txtMediaFileName.Text,TypeName,this.txtDesc.Text,base.CurrentUser.ToString(),&#8221;/ProcLearning/DataRequestFileRepository/&#8221; + fn,decimal.Parse(idType),URLName);</p>
<p>     this.txtMediaFileName.Text=&#8221;";<br />
     this.txtDesc.Text=&#8221;";<br />
                               <br />
    }<br />
    catch(Exception err)<br />
    {<br />
    }<br />
   }<br />
      <br />
  }</p>
<p>  private string TypeFile(string Ekstension)<br />
  {<br />
            string Temp=&#8221;";          <br />
           <br />
    switch(Ekstension.ToUpper())<br />
    {<br />
     case &#8220;.DOC&#8221; :<br />
      Temp = &#8220;2&#8243; + &#8220;|&#8221; + &#8220;Word Document&#8221; + &#8220;|&#8221; + &#8220;/ProcLearning/WebFileRepository/Others/WORD.gif&#8221;;<br />
      break;<br />
     case &#8220;.WMV&#8221; :<br />
      Temp = &#8220;3&#8243; + &#8220;|&#8221; + &#8220;Video File&#8221; + &#8220;|&#8221; + &#8220;/ProcLearning/WebFileRepository/Others/Video.gif&#8221;;<br />
      break;<br />
     case &#8220;.MP3&#8243; :<br />
      Temp = &#8220;4&#8243; + &#8220;|&#8221; + &#8220;Audio File&#8221; + &#8220;|&#8221; + &#8220;/ProcLearning/WebFileRepository/Others/WAV.gif&#8221;;<br />
      break;<br />
     case &#8220;.JPG&#8221; :<br />
      Temp = &#8220;5&#8243; + &#8220;|&#8221; + &#8220;Picture File&#8221; + &#8220;|&#8221; + &#8220;/ProcLearning/WebFileRepository/Others/Gambar.gif&#8221;;<br />
      break;<br />
     case &#8220;.JPEG&#8221; :<br />
      Temp = &#8220;5&#8243; + &#8220;|&#8221; + &#8220;Picture File&#8221; + &#8220;|&#8221; + &#8220;/ProcLearning/WebFileRepository/Others/Gambar.gif&#8221;;<br />
      break;<br />
     case &#8220;.PPT&#8221; :<br />
      Temp = &#8220;6&#8243; + &#8220;|&#8221; + &#8220;Presentation File&#8221; + &#8220;|&#8221; + &#8220;/ProcLearning/WebFileRepository/Others/Presentation.gif&#8221;;<br />
      break;<br />
     case &#8220;.XLS&#8221; :<br />
      Temp = &#8220;7&#8243; + &#8220;|&#8221; + &#8220;Spreadsheet File&#8221; + &#8220;|&#8221; + &#8220;/ProcLearning/WebFileRepository/Others/EXCEL.gif&#8221;;<br />
      break;<br />
     case &#8220;.VSD&#8221; :<br />
      Temp = &#8220;8&#8243; + &#8220;|&#8221; + &#8220;Visio File&#8221; + &#8220;|&#8221; + &#8220;/ProcLearning/WebFileRepository/Others/VISIO.gif&#8221;;<br />
      break;<br />
     case &#8220;.PDF&#8221; :<br />
      Temp = &#8220;10&#8243; + &#8220;|&#8221; + &#8220;Acrobat File&#8221; + &#8220;|&#8221; + &#8220;/ProcLearning/WebFileRepository/Others/PDF.gif&#8221;;<br />
     break;<br />
      <br />
    }<br />
    return Temp;<br />
  }</p>
<p>  void getMediaType()<br />
  {<br />
   ProcLearning.Concrete.Master_Media_Type mediaType = new ProcLearning.Concrete.Master_Media_Type(); // Create Instance Object for Media Type</p>
<p>   mediaType.Where.Type_ID.Operator = WhereParameter.Operand.NotEqual;<br />
   mediaType.Where.Type_ID.Value= 1;<br />
                <br />
   mediaType.Query.AddResultColumn(ProcLearning.Concrete.Master_Media_Type.ColumnNames.Type_ID);<br />
   mediaType.Query.AddResultColumn(ProcLearning.Concrete.Master_Media_Type.ColumnNames.Type_Name );<br />
   mediaType.Query.AddOrderBy(ProcLearning.Concrete.Master_Media_Type.ColumnNames.Type_Name ,WhereParameter.Dir.DESC );<br />
     <br />
   mediaType.Query.Load();</p>
<p>  }<br />
  #region Web Form Designer generated code<br />
  override protected void OnInit(EventArgs e)<br />
  {<br />
   //<br />
   // CODEGEN: This call is required by the ASP.NET Web Form Designer.<br />
   //<br />
   InitializeComponent();<br />
   base.OnInit(e);<br />
  }<br />
  <br />
  /// &lt;summary&gt;<br />
  ///  Required method for Designer support &#8211; do not modify<br />
  ///  the contents of this method with the code editor.<br />
  /// &lt;/summary&gt;<br />
  private void InitializeComponent()<br />
  {<br />
   this.media1 = new ProcLearning.BindingLayer.Media();<br />
   ((System.ComponentModel.ISupportInitialize)(this.media1)).BeginInit();<br />
   this.AddFile.Click += new System.EventHandler(this.AddFile_Click);<br />
   this.btnSimpan.Click += new System.EventHandler(this.btnSimpan_Click);<br />
   //<br />
   // media1<br />
   //<br />
   this.media1.DataSetName = &#8220;Media&#8221;;<br />
   this.media1.Locale = new System.Globalization.CultureInfo(&#8220;en-US&#8221;);<br />
   this.Load += new System.EventHandler(this.Page_Load);<br />
   ((System.ComponentModel.ISupportInitialize)(this.media1)).EndInit();</p>
<p>  }<br />
  #endregion</p>
<p>  private void btnAdd_Click(object sender, System.EventArgs e)<br />
  {<br />
        <br />
  }</p>
<p>  private void btnSave_Click(object sender, System.EventArgs e)<br />
  {<br />
   <br />
  }</p>
<p>  private void btnSimpan_Click(object sender, System.EventArgs e)<br />
  {<br />
      MediaView1.Save();<br />
  }</p>
<p>  private void AddFile_Click(object sender, System.EventArgs e)<br />
  {<br />
     Upload_ServerClick();</p>
<p>   if (Page.IsPostBack )<br />
   {<br />
    this.btnSimpan.Visible=true;<br />
   }</p>
<p>  }</p>
<p>  <br />
  <br />
  <br />
 }<br />
}<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>The code in MediaView.Ascx is :</p>
<p>/*==================================================================================<br />
 * Created By           : Doddy Ch Saputra, MCAD.NET<br />
 * Created Date           : 23 May 2007<br />
 * Last Modified By    : Doddy Ch Saputra<br />
 * Last Modified date     : 23 May 2007<br />
 * Architecture Template  : C# MyGeneration Doodads<br />
 * Functionality          : User Control for Media data uploading <br />
 * =================================================================================<br />
 */<br />
namespace ProcLearning.WebAdmin<br />
{<br />
 using System;<br />
 using System.Data;<br />
 using System.Drawing;<br />
 using System.Web;<br />
 using System.Web.UI.WebControls;<br />
 using System.Web.UI.HtmlControls;<br />
 using ProcLearning.BindingLayer;<br />
 using ProcLearning.Configuration;</p>
<p> /// &lt;summary&gt;<br />
 ///  Summary description for MediaView.<br />
 /// &lt;/summary&gt;<br />
 public class MediaView : ProcLearning.WebForm.FrontEnd.UserControl.UserControlBase<br />
 {<br />
  protected ProcLearning.BindingLayer.Media  Media1;<br />
  protected System.Web.UI.WebControls.DataGrid dtgDoc;<br />
  string webRepository=((string)System.Configuration.ConfigurationSettings.AppSettings.Get(&#8220;WebDataRequestRepository&#8221;));</p>
<p>  private void Page_Load(object sender, System.EventArgs e)<br />
  {<br />
   // Put user code to initialize the page here</p>
<p>   <br />
  }<br />
  public void DtgDocDataBind()<br />
  {<br />
   this.dtgDoc.DataBind();<br />
  }<br />
  <br />
  public void Page_Change(object sender,  DataGridPageChangedEventArgs e)<br />
  {<br />
   int start = this.dtgDoc.CurrentPageIndex * this.dtgDoc.PageSize;<br />
   this.dtgDoc .CurrentPageIndex= e.NewPageIndex;</p>
<p>   getMediaAllFiles();<br />
  <br />
  }<br />
  protected void getMediaAllFiles()<br />
  {<br />
   ProcLearning.Concrete .VW_Media  media = new ProcLearning.Concrete.VW_Media (); // Create Instance Object for Media Type<br />
   media.LoadAll();</p>
<p>   this.Media1 =this.DocDS;<br />
   this.dtgDoc.DataBind();<br />
  <br />
  }</p>
<p>  public void PrepareDocDS(string MediaFileName,string TypeName,string Desc,string UserName,string URL,decimal TypeID,string ImageURL) // Updated By Doddy Chs 16 oktober 2006<br />
  {<br />
   this.Media1 =this.DocDS;<br />
   DataRow dr = this.Media1.VW_Media.NewRow();<br />
    dr["Media_Name"]= MediaFileName ;<br />
    dr["Type_Name"] = TypeName ;<br />
    dr["Description"]=Desc;<br />
    dr["User_Name"]=UserName;<br />
    dr["Last_Updated"]= DateTime.Now;<br />
    dr["URL"] = URL ;<br />
    dr["Type_ID"] = TypeID ;<br />
    dr["Image_URL"] =ImageURL;<br />
   // &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
   this.Media1.VW_Media.Rows.Add(dr);<br />
   this.DocDS=this.Media1;<br />
   this.dtgDoc.DataBind();</p>
<p>   return;<br />
  <br />
  }<br />
  <br />
  public Media DocDS<br />
  {<br />
   get<br />
   {<br />
    Media ds=new Media();<br />
    if(ViewState["MediaData"]!=null)<br />
     ds=(Media)ViewState["MediaData"];<br />
   <br />
    return ds;<br />
   }<br />
   set<br />
   {<br />
    ViewState["MediaData"]=value;<br />
    this.Media1 =value;<br />
    this.dtgDoc.DataBind();</p>
<p>   }</p>
<p>  }</p>
<p>  public bool IsReadOnly<br />
  {<br />
   set<br />
   {<br />
    bool isVisible=true;<br />
    if(value)isVisible=false;<br />
    foreach (DataGridColumn col in this.dtgDoc.Columns)<br />
    {<br />
     if(col.HeaderText.Equals(&#8220;Delete&#8221;))<br />
      col.Visible=isVisible;    </p>
<p>    }<br />
   }<br />
  }</p>
<p>  private void dtgDoc_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)<br />
  {<br />
   <br />
   int i=0;<br />
   int rowNum=0;<br />
   this.Media1  =this.DocDS;</p>
<p>   foreach(DataRow dr in this.Media1.VW_Media.Rows )<br />
   {<br />
    if(!dr.RowState.Equals(DataRowState.Deleted))<br />
    {<br />
      rowNum=i;<br />
    }<br />
    i++;<br />
   }</p>
<p>   DataRowCollection rc=this.Media1.VW_Media.Rows ;<br />
   rc[rowNum].Delete();<br />
   <br />
   if((this.dtgDoc.Items.Count % this.dtgDoc.PageSize == 1) &amp;&amp; (this.dtgDoc.CurrentPageIndex == this.dtgDoc.PageCount &#8211; 1) &amp;&amp; (this.dtgDoc.CurrentPageIndex != 0))<br />
   {<br />
    this.dtgDoc.CurrentPageIndex = this.dtgDoc.CurrentPageIndex -1;<br />
   }<br />
   <br />
 <br />
   this.DocDS=this.Media1;<br />
     <br />
  }</p>
<p>  public void Save ()<br />
  {<br />
   decimal userID = decimal.Parse(Session["User_ID"].ToString());<br />
           <br />
   this.Media1  =this.DocDS;</p>
<p>   foreach(DataRow dr in this.Media1.VW_Media.Rows )<br />
   {</p>
<p>    ProcLearning.Concrete.Portal_Media_Collection Trans = new ProcLearning.Concrete.Portal_Media_Collection();</p>
<p>    Trans.AddNew();<br />
     Trans.Media_Name=dr["Media_Name"].ToString() ;<br />
     Trans.Media_Type=decimal.Parse(dr["Type_ID"].ToString()) ;<br />
     Trans.Description =dr["Description"].ToString();<br />
     Trans.Updated_By = userID;<br />
     Trans.Last_Updated = System.DateTime.Now ;<br />
     Trans.Active=&#8221;Y&#8221;;<br />
     Trans.URL = dr["URL"].ToString();<br />
    Trans.Save();<br />
    Response.Redirect(&#8220;/ProcLearning/WebForm/LessonModule/frmMultimediaLearning.aspx&#8221;,true);<br />
   }<br />
  }</p>
<p>  private void dtgDoc_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)<br />
  {<br />
   Label lblDocID;<br />
   string url=&#8221;";<br />
   string docName=&#8221;";<br />
   HyperLink hl=new HyperLink();<br />
   if(e.Item.ItemType == ListItemType.Item || (e.Item.ItemType == ListItemType.AlternatingItem))<br />
   {<br />
    <br />
    lblDocID = (Label) e.Item.FindControl(&#8220;lblDocID&#8221;);<br />
    hl=(HyperLink)e.Item.Cells[2].Controls[0];<br />
    docName=lblDocID.Text;<br />
    url=this.webRepository+docName;<br />
    hl.NavigateUrl =url;<br />
   }<br />
  }</p>
<p>  #region Web Form Designer generated code<br />
  override protected void OnInit(EventArgs e)<br />
  {<br />
   //<br />
   // CODEGEN: This call is required by the ASP.NET Web Form Designer.<br />
   //<br />
   InitializeComponent();<br />
   base.OnInit(e);<br />
  }<br />
  <br />
  /// &lt;summary&gt;<br />
  ///  Required method for Designer support &#8211; do not modify<br />
  ///  the contents of this method with the code editor.<br />
  /// &lt;/summary&gt;<br />
  private void InitializeComponent()<br />
  {<br />
   this.Media1 = new ProcLearning.BindingLayer.Media();<br />
   ((System.ComponentModel.ISupportInitialize)(this.Media1)).BeginInit();<br />
   this.dtgDoc.DeleteCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.dtgDoc_DeleteCommand);<br />
   //<br />
   // Media1<br />
   //<br />
   this.Media1.DataSetName = &#8220;Media1&#8243;;<br />
   this.Media1.Locale = new System.Globalization.CultureInfo(&#8220;en-US&#8221;);<br />
   this.Load += new System.EventHandler(this.Page_Load);<br />
   ((System.ComponentModel.ISupportInitialize)(this.Media1)).EndInit();</p>
<p>  }<br />
  #endregion<br />
 }<br />
}</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/doddychsaputra.wordpress.com/11/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/doddychsaputra.wordpress.com/11/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/doddychsaputra.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/doddychsaputra.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/doddychsaputra.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/doddychsaputra.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/doddychsaputra.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/doddychsaputra.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/doddychsaputra.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/doddychsaputra.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/doddychsaputra.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/doddychsaputra.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/doddychsaputra.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/doddychsaputra.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/doddychsaputra.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/doddychsaputra.wordpress.com/11/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=doddychsaputra.wordpress.com&amp;blog=1305638&amp;post=11&amp;subd=doddychsaputra&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://doddychsaputra.wordpress.com/2007/06/30/how-you-handling-upload-file-module-in-aspnet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b91382498b0b016e1364e483ec1bf7ec?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Doddy Christiana saputra</media:title>
		</media:content>

		<media:content url="http://doddychsaputra.files.wordpress.com/2007/06/upload-files-ui.thumbnail.jpg" medium="image">
			<media:title type="html">UI Design</media:title>
		</media:content>

		<media:content url="http://doddychsaputra.files.wordpress.com/2007/06/grid-view-file.thumbnail.jpg" medium="image">
			<media:title type="html">grid-view-file.jpg</media:title>
		</media:content>
	</item>
		<item>
		<title>Multipurpose Data Access Layer part 1</title>
		<link>http://doddychsaputra.wordpress.com/2007/06/30/automatic-database-provider-in-data-access-layer/</link>
		<comments>http://doddychsaputra.wordpress.com/2007/06/30/automatic-database-provider-in-data-access-layer/#comments</comments>
		<pubDate>Sat, 30 Jun 2007 03:18:20 +0000</pubDate>
		<dc:creator>Doddy Christiana saputra</dc:creator>
				<category><![CDATA[Design Pattern Code]]></category>
		<category><![CDATA[Development in  C# 2.0]]></category>
		<category><![CDATA[Own design custom Framework]]></category>

		<guid isPermaLink="false">http://doddychsaputra.wordpress.com/2007/06/30/automatic-database-provider-in-data-access-layer/</guid>
		<description><![CDATA[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 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=doddychsaputra.wordpress.com&amp;blog=1305638&amp;post=5&amp;subd=doddychsaputra&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://doddychsaputra.files.wordpress.com/2007/06/class-design.jpg" title="class-design.jpg"></a>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 :</p>
<p>1.  Able to provide multiple connection string in my project</p>
<p>2. Able to provide the multiple datastore string with many provider</p>
<p>3. Should be able to handling many application parameter response redirect</p>
<p>see the picture below of my class design :</p>
<p><a href="http://doddychsaputra.files.wordpress.com/2007/06/class-design.jpg" title="class-design.jpg"></a><a href="http://doddychsaputra.files.wordpress.com/2007/06/class-design.jpg" title="class-design.jpg"><img src="http://doddychsaputra.files.wordpress.com/2007/06/class-design.thumbnail.jpg?w=455" alt="class-design.jpg" /></a></p>
<p>I put the all of my engine application in Framework layer project including the Data Access utility, wheter contain :</p>
<p>a. ConnectionString Class :</p>
<ul>
<li>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.</li>
<li>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.</li>
<li>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.</li>
<li>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.</li>
</ul>
<p>b. Query Builder Class ( Interface Class )</p>
<ul>
<li>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.</li>
<li>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.</li>
<li>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. </li>
</ul>
<p><a href="http://doddychsaputra.files.wordpress.com/2007/06/class-design.jpg" title="class-design.jpg"></a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/doddychsaputra.wordpress.com/5/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/doddychsaputra.wordpress.com/5/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/doddychsaputra.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/doddychsaputra.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/doddychsaputra.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/doddychsaputra.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/doddychsaputra.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/doddychsaputra.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/doddychsaputra.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/doddychsaputra.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/doddychsaputra.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/doddychsaputra.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/doddychsaputra.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/doddychsaputra.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/doddychsaputra.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/doddychsaputra.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=doddychsaputra.wordpress.com&amp;blog=1305638&amp;post=5&amp;subd=doddychsaputra&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://doddychsaputra.wordpress.com/2007/06/30/automatic-database-provider-in-data-access-layer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b91382498b0b016e1364e483ec1bf7ec?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Doddy Christiana saputra</media:title>
		</media:content>

		<media:content url="http://doddychsaputra.files.wordpress.com/2007/06/class-design.thumbnail.jpg" medium="image">
			<media:title type="html">class-design.jpg</media:title>
		</media:content>
	</item>
	</channel>
</rss>
