<?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/"
	>

<channel>
	<title>Sehajpal.com &#187; Development</title>
	<atom:link href="http://www.sehajpal.com/index.php/category/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sehajpal.com</link>
	<description>No path is too difficult. No destination is too far !</description>
	<lastBuildDate>Fri, 03 Sep 2010 14:34:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Web service software factory in visual studio 2010</title>
		<link>http://www.sehajpal.com/index.php/2010/09/web-service-software-factory-in-visual-studio-2010/</link>
		<comments>http://www.sehajpal.com/index.php/2010/09/web-service-software-factory-in-visual-studio-2010/#comments</comments>
		<pubDate>Fri, 03 Sep 2010 14:34:23 +0000</pubDate>
		<dc:creator>Ashish Sehajpal</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[VS 2010]]></category>

		<guid isPermaLink="false">http://www.sehajpal.com/?p=249</guid>
		<description><![CDATA[It is very cool to use WSSF modeling edition as it helps applying proper pattern for your architecture. But when you migrate from Visual Studio 2008 to Visual Studio 2010 (ultimate in my case), the very first thing you note is something like this: VS2010 failed to load the Software service Factory modeling project (.ssfproduct) <a href="http://www.sehajpal.com/index.php/2010/09/web-service-software-factory-in-visual-studio-2010/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>It is very cool to use WSSF modeling edition as it helps applying proper pattern for your architecture. But when you migrate from Visual Studio 2008 to Visual Studio 2010 (ultimate in my case), the very first thing you note is something like this:</p>
<p style="text-align: center;"><span style="color: #ff0000;"><strong> VS2010 failed to load the Software service Factory modeling project (.ssfproduct) into the solution !!</strong></span></p>
<p>This is all because we need to install new and updated version for the factory. But still there is lot to do in order to make it working, as the new VS1010 needs to have the following things:</p>
<ul>
<li> <a href="http://visualstudiogallery.msdn.microsoft.com/en-us/25e4b5e9-65e4-4950-967d-5f1e6a9dcbeb">Guidance Automation Extensions 2010</a></li>
<li> <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=47305cf4-2bea-43c0-91cd-1b853602dcc5&amp;displaylang=en">Microsoft Visual Studio 2010 SDK</a></li>
<li><a href="http://visualstudiogallery.msdn.microsoft.com/en-us/8c6ea683-acf2-4881-bb05-3c3252992bfe">Web Service Software Factory 2010</a></li>
</ul>
<p>Install in the same order and enjoy the web service software factory : modeling edition without any issues <img src='http://www.sehajpal.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<div id="attachment_250" class="wp-caption alignleft" style="width: 310px"><a href="http://www.sehajpal.com/wp-content/uploads/2010/09/extension_manager.jpg"><img class="size-medium wp-image-250" title="VS2010 Extension Manager" src="http://www.sehajpal.com/wp-content/uploads/2010/09/extension_manager-300x207.jpg" alt="" width="300" height="207" /></a><p class="wp-caption-text">VS2010 Extension Manager</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sehajpal.com/index.php/2010/09/web-service-software-factory-in-visual-studio-2010/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to pass InitParameters to Silverlight in HTML object control</title>
		<link>http://www.sehajpal.com/index.php/2010/03/how-to-pass-initparameters-to-silverlight-in-html-object-control/</link>
		<comments>http://www.sehajpal.com/index.php/2010/03/how-to-pass-initparameters-to-silverlight-in-html-object-control/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 08:21:21 +0000</pubDate>
		<dc:creator>Ashish Sehajpal</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Init Parameters]]></category>
		<category><![CDATA[SilverLight]]></category>

		<guid isPermaLink="false">http://www.sehajpal.com/?p=74</guid>
		<description><![CDATA[There are three different ways in which we can pass parameters to Silverlight from the HTML side: 1. Pass parameters using the HTML object control. This may be the case using pure HTML page to call silverlight control in it or may be the simple ASp.Net page as usual.  &#60;object width=&#8221;100%&#8221; height=&#8221;100%&#8221;&#62;    &#60;param  name=&#8221;source&#8221;  value=&#8221;ClientBin/SomethingFunny.xap&#8221; <a href="http://www.sehajpal.com/index.php/2010/03/how-to-pass-initparameters-to-silverlight-in-html-object-control/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>There are three different ways in which we can pass parameters to Silverlight from the HTML side:</p>
<p><strong>1. Pass parameters using the HTML object control.</strong></p>
<p>This may be the case using pure HTML page to call silverlight control in it or may be the simple ASp.Net page as usual.</p>
<blockquote><p> &lt;object width=&#8221;100%&#8221; height=&#8221;100%&#8221;&gt;<br />
   &lt;param  name=&#8221;source&#8221;  value=&#8221;ClientBin/SomethingFunny.xap&#8221; /&gt;<br />
   &lt;!&#8211; you can pass InitParameters to it. Pass anything like EndPointURI, EndPointName or Even StartPage &#8211;&gt;<br />
   &lt;param name=&#8221;InitParameters&#8221; value=&#8221;startPage=UnRegisteredLandingPage, EndPointURI=http://www.sehajpal.com/testservice.svc&#8221; /&gt;<br />
 &lt;/object&gt;</p></blockquote>
<p><strong>2. Using ASP.Net page to call silverlight control in it</strong>, we can easily pass parameters to it in anyway. One of the old tricks is to have an asp-literal control on the HTML side i.e. MarkUp side, and set its text to the desired HTML output fom code behind.</p>
<blockquote><p><strong>In the markup:<br />
</strong>  &lt;asp:Literal ID=&#8221;litParam&#8221; runat=&#8221;server&#8221; /&gt;</p>
<p><strong>In the code behind:</strong><br />
  this.litParam.Text = String.Format(&#8220;&lt;param name=\&#8221;ParamInitParameters\&#8221; value=\&#8221;{0}\&#8221; /&gt;&#8221;, sInitParms);</p></blockquote>
<p><strong>3. Using asp-silverlight control</strong> to host Silverlight application in an ASP.net website as usual. This is pretty neat approach in terms of playing around with parameters and properties of control hosting the Silverlight app.</p>
<blockquote><p><strong>In the markup:<br />
</strong>  &lt;asp:Silverlight ID=&#8221;SLControl&#8221; runat=&#8221;server&#8221; Width=&#8221;100%&#8221; Height=&#8221;100%&#8221; /&gt;<br />
<strong>In the code behind:</strong><br />
   SLControl.InitParameters = &#8220;EndPointURI=&#8221; + endPointURI + &#8220;,EndPointName=commonservice, UserCredentials=&#8221; + CredentialString;</p></blockquote>
<p> </p>
<p>Hope it works for you in different scenarios.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sehajpal.com/index.php/2010/03/how-to-pass-initparameters-to-silverlight-in-html-object-control/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Bind with Enum in Silverlight</title>
		<link>http://www.sehajpal.com/index.php/2010/02/bind-with-enum-in-silverlight/</link>
		<comments>http://www.sehajpal.com/index.php/2010/02/bind-with-enum-in-silverlight/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 14:54:51 +0000</pubDate>
		<dc:creator>Ashish Sehajpal</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Bind with Enum]]></category>
		<category><![CDATA[SilverLight]]></category>

		<guid isPermaLink="false">http://www.sehajpal.com/?p=62</guid>
		<description><![CDATA[Silverlight doesn&#8217;t have any kind of ObjEctDataProvider with it. So the famous example of binding the controls with an ObjectDataProvider doesn&#8217;t work with silverlight as it works with WPF &#60;UserControl.Resources&#62; &#60;ObjectDataProvider MethodName=&#8220;GetValues&#8221; ObjectType=&#8221;{x:Type sys:Enum}&#8220;  x:Key=&#8220;AlignmentValues&#8221;&#62;   &#60;ObjectDataProvider.MethodParameters&#62;           &#60;x:Type TypeName=&#8220;HorizontalAlignment&#8221; /&#62;    &#60;/ObjectDataProvider.MethodParameters&#62; &#60;/ObjectDataProvider&#62; This can be done via code behind in the Silverlight.  Just <a href="http://www.sehajpal.com/index.php/2010/02/bind-with-enum-in-silverlight/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>Silverlight doesn&#8217;t have any kind of ObjEctDataProvider with it. So the famous example of binding the controls with an ObjectDataProvider doesn&#8217;t work with silverlight as it works with WPF <img src='http://www.sehajpal.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p><span style="color: #5f5fd8;">&lt;UserControl.Resources&gt;<br />
</span><span style="color: #5f5fd8;">&lt;ObjectDataProvider</span><span style="color: #c7c7f1;"> MethodName</span><span style="color: #5f5fd8;">=</span><span style="color: #60ff60;">&#8220;GetValues&#8221; </span><span style="color: #c7c7f1;">ObjectType</span><span style="color: #5f5fd8;">=&#8221;{</span><span style="color: #a31515;">x</span><span style="color: #5f5fd8;">:</span><span style="color: #a31515;">Type</span><span style="color: #5f5fd8;"> sys:Enum}</span><span style="color: #60ff60;">&#8220;  </span><span style="color: #c7c7f1;">x</span><span style="color: #5f5fd8;">:</span><span style="color: #c7c7f1;">Key</span><span style="color: #5f5fd8;">=</span><span style="color: #60ff60;">&#8220;AlignmentValues&#8221;</span><span style="color: #5f5fd8;">&gt;</span><span style="color: #60ff60;"> </span><span style="color: #5f5fd8;">  &lt;ObjectDataProvider.MethodParameters&gt;<br />
    </span><span style="color: #60ff60;">      </span><span style="color: #5f5fd8;">&lt;x:Type</span><span style="color: #c7c7f1;"> TypeName</span><span style="color: #5f5fd8;">=</span><span style="color: #60ff60;">&#8220;HorizontalAlignment&#8221;</span><span style="color: #5f5fd8;"> /&gt;<br />
</span><span style="color: #60ff60;">   </span><span style="color: #5f5fd8;">&lt;/ObjectDataProvider.MethodParameters&gt;<br />
</span><span style="color: #5f5fd8;">&lt;/ObjectDataProvider&gt;</span></p>
<p><span style="color: #5f5fd8;"><span style="color: #000000;">This can be done via code behind in the Silverlight.  Just add a reference to the Reflection assembly.<br />
</span></span><span style="color: #8080c0;">using </span><span style="color: #3366ff;">System</span><span style="color: #e0e0e0;">.</span><span style="color: #3366ff;">Reflection</span><span style="color: #e0e0e0;">;</span></p>
<p><span style="color: #000000;">Use this simple function to get IEnumerable collection out of Enum type.</p>
<p>        public IEnumerable&lt;Enum&gt; GetEnumValues(Enum enumeration)<br />
        {<br />
            return from gField in enumeration.GetType().GetFields(BindingFlags.Static | BindingFlags.Public)<br />
                   select (Enum)gField.GetValue(enumeration);<br />
        }</span></p>
<p><span style="color: #000000;">Just bind the results of this function with your control and its done !</span></p>
<p> ComboFrom.ItemsSource = GetEnumValues(new SehajService.Currency());</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sehajpal.com/index.php/2010/02/bind-with-enum-in-silverlight/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Currency amount in words in indian format using T-SQL Stored Procedure</title>
		<link>http://www.sehajpal.com/index.php/2010/02/indian-fromat-currency-amount-using-t-sql-stored-procedure/</link>
		<comments>http://www.sehajpal.com/index.php/2010/02/indian-fromat-currency-amount-using-t-sql-stored-procedure/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 15:53:03 +0000</pubDate>
		<dc:creator>Ashish Sehajpal</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Amount in words]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.sehajpal.com/?p=59</guid>
		<description><![CDATA[I know it is not that much crucial but neither easy to get rid of financial application’s requirements as clients demand more and more facilities even they are small in size. Here is one that kinda SQL Script that every finance domain expert looks for. That is the currency writer in WORDS instead of digits. <a href="http://www.sehajpal.com/index.php/2010/02/indian-fromat-currency-amount-using-t-sql-stored-procedure/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>I know it is not that much crucial but neither easy to get rid of financial application’s requirements as clients demand more and more facilities even they are small in size.</p>
<p>Here is one that kinda SQL Script that every finance domain expert looks for. That is the currency writer in WORDS instead of digits.</p>
<p><span style="color: #0000ff;">CREATE FUNCTION</span> dbo.AMOUNT_IN_WORDS<br />
(<br />
 @Amount <span style="color: #0000ff;">INT</span>,<br />
 @PAISE <span style="color: #0000ff;">INT</span><br />
)<br />
<span style="color: #0000ff;">RETURNS int</span></p>
<p><span style="color: #0000ff;">BEGIN</span></p>
<p><span style="color: #0000ff;">DECLARE</span><br />
<span style="color: #339966;">&#8211;Step 1:<br />
&#8211;Here we define the temporary tables to hold the WORDs representation of possible digits/amounts</span></p>
<p><span style="color: #0000ff;">DECLARE</span> @INNTBL_01 <span style="color: #0000ff;">TABLE</span> (RECNO <span style="color: #0000ff;">INT IDENTITY</span>(1, 1), MTEXT <span style="color: #0000ff;">NVARCHAR</span>(50))</p>
<p><span style="color: #0000ff;">DECLARE</span> @INNTBL_02 <span style="color: #0000ff;">TABLE</span> (RECNO <span style="color: #0000ff;">INT</span> <span style="color: #0000ff;">IDENTITY</span>(1, 1), MTEXT <span style="color: #0000ff;">NVARCHAR</span>(50))</p>
<p><span style="color: #339966;">&#8211;Step 2:<br />
&#8211;Now add up the salt and pepper onto table  i.e. insert the WORDs into it</span></p>
<p><span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;ONE&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;TWO&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;THREE&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;FOUR&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;FIVE&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;SIX&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;SEVEN&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;EIGHT&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;NINE&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;TEN&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;ELEVEN&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;TWELVE&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;THIRTEEN&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;FOURTEEN&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;FIFTEEN&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;SIXTEEN&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;SEVENTEEN&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;EIGHTEEN&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;NINETEEN&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;TWENTY&#8217;<span style="color: #339966;">&#8211;Similary, insert the multiples</span></span></p>
<p><span style="color: #0000ff;">INSERT INTO</span> @INNTBL_02 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;TEN&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_02 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;TWENTY&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_02 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;THIRTY&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_02 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;FORTY&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_02 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;FIFTY&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_02 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;SIXTY&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_02 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;SEVENTY&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_02 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;EIGHTY&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_02 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;NINETY&#8217;</span></p>
<p><span style="color: #339966;">&#8211;Step 3:<br />
&#8211;Check for the limit of the amount i.e. what is the place value of digits &#8211; LACs, Thousands or Hundreds</span><br />
<span style="color: #0000ff;">DECLARE</span> @WORD <span style="color: #0000ff;">VARCHAR</span>(300)<br />
<span style="color: #0000ff;">SELECT</span> @WORD = &#8221;</p>
<p><span style="color: #0000ff;">DECLARE</span> @M_AMT01  <span style="color: #0000ff;">INT</span>, @M_AMT02 <span style="color: #0000ff;">INT</span></p>
<p><span style="color: #0000ff;">IF</span> @AMOUNT &lt; 10000000 <span style="color: #0000ff;">AND</span> @AMOUNT &gt;= 100000 <span style="color: #0000ff;">BEGIN</span><br />
<span style="color: #0000ff;">SET</span> @M_AMT01 = @AMOUNT<br />
<span style="color: #0000ff;">SELECT</span> @AMOUNT = ( @AMOUNT % 100000 )<br />
<span style="color: #0000ff;">SET</span> @M_AMT01 = ( @M_AMT01 &#8211; @AMOUNT ) / 100000<br />
<span style="color: #0000ff;">DECLARE</span> @WORD1 <span style="color: #0000ff;">VARCHAR</span>(300)<br />
<span style="color: #0000ff;">SET</span> @WORD1 = &#8221;<br />
<span style="color: #0000ff;">IF</span> @M_AMT01 &lt; 100 <span style="color: #0000ff;">AND</span> @M_AMT01 &gt; 20 <span style="color: #0000ff;">BEGIN</span><br />
<span style="color: #0000ff;">SET</span> @M_AMT02 = @M_AMT01<br />
<span style="color: #0000ff;">SET</span> @M_AMT01 = ( @M_AMT01 % 10)<br />
<span style="color: #0000ff;">SET</span> @M_AMT02 = ( @M_AMT02 &#8211; @M_AMT01 ) / 10<br />
<span style="color: #0000ff;">SET</span> @WORD1 = ( <span style="color: #0000ff;">SELECT</span> @WORD1 + MTEXT <span style="color: #0000ff;">FROM</span> @INNTBL_02 <span style="color: #0000ff;">WHERE</span> RECNO = @M_AMT02 )<br />
<span style="color: #0000ff;">END<br />
</span><br />
<span style="color: #0000ff;">IF</span> @M_AMT01 &lt;= 20 <span style="color: #0000ff;">AND</span> @M_AMT01 &lt;&gt; 0 <span style="color: #0000ff;">BEGIN</span><br />
<span style="color: #0000ff;">SET</span> @WORD1 = ( <span style="color: #0000ff;">SELECT</span> @WORD1 + MTEXT <span style="color: #0000ff;">FROM</span> @INNTBL_01 <span style="color: #0000ff;">WHERE</span> RECNO = @M_AMT01 )<br />
<span style="color: #0000ff;">END</span><br />
<span style="color: #0000ff;">SET</span> @WORD = @WORD + @WORD1 + &#8216; <span style="color: #ff0000;">LAC</span> &#8216;<br />
<span style="color: #0000ff;">END</span><br />
<span style="color: #0000ff;">IF</span> @AMOUNT &lt; 100000 <span style="color: #0000ff;">AND</span> @AMOUNT &gt;= 1000 <span style="color: #0000ff;">BEGIN</span><br />
<span style="color: #0000ff;">SET</span> @M_AMT01 = @AMOUNT<br />
<span style="color: #0000ff;">SET</span> @AMOUNT = ( @AMOUNT % 1000 )<br />
<span style="color: #0000ff;">SET</span> @M_AMT01 = ( @M_AMT01 &#8211; @AMOUNT ) / 1000<br />
<span style="color: #0000ff;">SET</span> @WORD1 = &#8221;<br />
<span style="color: #0000ff;">IF</span> @M_AMT01 &lt; 100 <span style="color: #0000ff;">AND</span> @M_AMT01 &gt; 20 <span style="color: #0000ff;">BEGIN</span><br />
<span style="color: #0000ff;">SET</span> @M_AMT02 = @M_AMT01<br />
<span style="color: #0000ff;">SET</span> @M_AMT01 = ( @M_AMT01 % 10 )<br />
<span style="color: #0000ff;">SET</span> @M_AMT02 = ( @M_AMT02 &#8211; @M_AMT01 ) / 10<br />
<span style="color: #0000ff;">SET</span> @WORD1 = ( <span style="color: #0000ff;">SELECT</span> @WORD1 + MTEXT + &#8216; &#8216; <span style="color: #0000ff;">FROM</span> @INNTBL_02 <span style="color: #0000ff;">WHERE</span> RECNO = @M_AMT02 )<br />
<span style="color: #0000ff;">END</span><br />
<span style="color: #0000ff;">IF</span> @M_AMT01 &lt;= 20 <span style="color: #0000ff;">AND</span> @M_AMT01 &lt;&gt; 0 <span style="color: #0000ff;">BEGIN</span><br />
<span style="color: #0000ff;">SET</span> @WORD1 = ( <span style="color: #0000ff;">SELECT</span> @WORD1 + MTEXT +&#8217; &#8216; <span style="color: #0000ff;">FROM</span> @INNTBL_01 <span style="color: #0000ff;">WHERE</span> RECNO = @M_AMT01 )<br />
<span style="color: #0000ff;">END</span><br />
<span style="color: #0000ff;">SET</span> @WORD = @WORD + @WORD1 + &#8216; <span style="color: #ff0000;">THOUSAND</span> &#8216;<br />
<span style="color: #0000ff;">END</span><br />
<span style="color: #0000ff;">IF</span> @AMOUNT &lt; 1000 <span style="color: #0000ff;">AND</span> @AMOUNT &gt; = 100 <span style="color: #0000ff;">BEGIN</span><br />
<span style="color: #0000ff;">SET</span> @M_AMT01 = @AMOUNT<br />
<span style="color: #0000ff;">SET</span> @AMOUNT = ( @AMOUNT % 100 )<br />
<span style="color: #0000ff;">SET</span> @M_AMT01 = ( @M_AMT01 &#8211; @AMOUNT ) / 100<br />
<span style="color: #0000ff;">SET</span> @WORD = ( <span style="color: #0000ff;">SELECT</span> @WORD + &#8216; &#8216; +MTEXT + &#8216; HUNDRED &#8216; <span style="color: #0000ff;">FROM</span> @INNTBL_01 <span style="color: #0000ff;">WHERE</span> RECNO = @M_AMT01</p>
<p>)<br />
<span style="color: #0000ff;">END</span><br />
<span style="color: #0000ff;">IF</span> @AMOUNT &lt; 100 <span style="color: #0000ff;">AND</span> @AMOUNT &gt; 20 <span style="color: #0000ff;">BEGIN</span><br />
<span style="color: #0000ff;">SET</span> @M_AMT01 = @AMOUNT<br />
<span style="color: #0000ff;">SET</span> @AMOUNT = ( @AMOUNT % 10 )<br />
<span style="color: #0000ff;">SET</span> @M_AMT01 = ( @M_AMT01 &#8211; @AMOUNT ) / 10<br />
<span style="color: #0000ff;">SET</span> @WORD = ( <span style="color: #0000ff;">SELECT</span> @WORD + MTEXT + &#8216; &#8216; <span style="color: #0000ff;">FROM</span> @INNTBL_02 <span style="color: #0000ff;">WHERE</span> RECNO = @M_AMT01 )<br />
<span style="color: #0000ff;">END</span><br />
<span style="color: #0000ff;">IF</span> @AMOUNT &lt;= 20 <span style="color: #0000ff;">AND</span> @AMOUNT &gt;= 1 BEGIN<br />
<span style="color: #0000ff;">SET</span> @WORD = ( <span style="color: #0000ff;">SELECT</span> @WORD + MTEXT +&#8217; &#8216; <span style="color: #0000ff;">FROM</span> @INNTBL_01 <span style="color: #0000ff;">WHERE</span> RECNO = @AMOUNT )<br />
<span style="color: #0000ff;">END</span></p>
<p>&#8211;STEP 4:<br />
&#8211;Calculate the paise also.<br />
<span style="color: #0000ff;">DECLARE</span> @WORDP <span style="color: #0000ff;">VARCHAR</span>(300)<br />
<span style="color: #0000ff;">SET</span> @WORDP = &#8221;<br />
<span style="color: #0000ff;">IF</span> @PAISE &lt;&gt; 0 <span style="color: #0000ff;">BEGIN</span><br />
<span style="color: #0000ff;">IF</span> @PAISE &lt; 100 <span style="color: #0000ff;">AND</span> @PAISE &gt; 20 <span style="color: #0000ff;">BEGIN</span><br />
<span style="color: #0000ff;">DECLARE</span> @PAISE_01 <span style="color: #0000ff;">VARCHAR</span>(300)<br />
<span style="color: #0000ff;">SET</span> @PAISE_01 = @PAISE<br />
<span style="color: #0000ff;">SET</span> @PAISE = ( @PAISE % 10 )<br />
<span style="color: #0000ff;">SET</span> @PAISE_01 = ( @PAISE_01 &#8211; @PAISE ) / 10<br />
<span style="color: #0000ff;">SET</span> @WORDP = ( <span style="color: #0000ff;">SELECT</span> @WORDP + MTEXT <span style="color: #0000ff;">FROM</span> @INNTBL_02 <span style="color: #0000ff;">WHERE</span> RECNO = @PAISE_01 )<br />
<span style="color: #0000ff;">END</span><br />
<span style="color: #0000ff;">IF</span> @PAISE &lt;= 20 <span style="color: #0000ff;">AND</span> @PAISE &gt;= 1 BEGIN<br />
<span style="color: #0000ff;">SET</span> @WORDP = ( <span style="color: #0000ff;">SELECT</span> @WORDP + MTEXT <span style="color: #0000ff;">FROM</span> @INNTBL_01 <span style="color: #0000ff;">WHERE</span> RECNO = @PAISE )<br />
<span style="color: #0000ff;">END</span><br />
<span style="color: #0000ff;">SET</span> @WORD = @WORD + <span style="color: #ff0000;">&#8216;AND</span> &#8216; + @WORDP + &#8216; <span style="color: #ff0000;">PAISE&#8217;</span><br />
<span style="color: #0000ff;">END</span></p>
<p><span style="color: #339966;">&#8211;STEP 5:<br />
&#8211;Time to return answer from the function.</span><br />
<span style="color: #0000ff;">RETURN</span> (<span style="color: #ff00ff;">REPLACE</span>(@WORD, &#8216;  &#8216;, &#8216; &#8216;))</p>
<p><span style="color: #339966;">&#8211;Its done dude. Try by yourself.</span><br />
<span style="color: #0000ff;">END</span></p>
<p>Now when you need to use this function, simply call it inline to any select statement.</p>
<p><strong>CALLING THE FUNCTION</strong></p>
<p><span style="color: #0000ff;">Select</span> dbo.AMOUNT_IN_WORDS(IM.GRAND_TOTAL, 0) <span style="color: #0000ff;">AS</span> words <span style="color: #0000ff;">from</span> TBL_INVOICE_MAIN IM</p>
<p>Here, it will convert <strong>GRAND_TOTAL</strong> field from the table <strong>TBL_INVOICE_MAIN</strong>.</p>
<p>or more simply,</p>
<p>Select dbo.AMOUNT_IN_WORDS(654321, 0)</p>
<p>Isn&#8217;t it simple enough !</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sehajpal.com/index.php/2010/02/indian-fromat-currency-amount-using-t-sql-stored-procedure/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Create Word Document with Hyperlinks in it with C# code</title>
		<link>http://www.sehajpal.com/index.php/2010/02/create-word-document-with-hyperlinks-in-it-with-csharp-code/</link>
		<comments>http://www.sehajpal.com/index.php/2010/02/create-word-document-with-hyperlinks-in-it-with-csharp-code/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 13:59:13 +0000</pubDate>
		<dc:creator>Ashish Sehajpal</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Create Word Document]]></category>

		<guid isPermaLink="false">http://www.sehajpal.com/?p=56</guid>
		<description><![CDATA[First of all you need to add reference to COM library in project. Add reference to Microsoft word 11.0 word library under COM reference tab Add this in the code behind “using” section using Microsoft.Office.Interop.Word; private void CreateWordDocument() { // create annonymous object to be referenced throughout object oMissingReference = System.Reflection.Missing.Value; object Visible=true; // define <a href="http://www.sehajpal.com/index.php/2010/02/create-word-document-with-hyperlinks-in-it-with-csharp-code/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>First of all you need to add reference to COM library in project.<br />
Add reference to Microsoft word 11.0 word library under COM reference tab Add this in the code behind “using” section</p>
<p>using <span style="color: #0000ff;">Microsoft.Office.Interop.Word</span>;<br />
private void CreateWordDocument()<br />
{<br />
<span style="color: #99cc00;">// create annonymous object to be referenced throughout<br />
</span>object oMissingReference = System.Reflection.Missing.Value;<br />
object Visible=true;<br />
<span style="color: #99cc00;">// define arbitrary starting point for defining range object.</span><br />
object oStartRange = 0;<br />
object oEndRange = 0;<br />
<span style="color: #99cc00;">// create instance of application class</span><br />
ApplicationClass WordApp = new ApplicationClass();<br />
<span style="color: #99cc00;">// create document instance</span><br />
Document docObject = WordApp.Documents.Add(ref oMissingReference , ref oMissingReference , ref oMissingReference , ref oMissingReference );<br />
<span style="color: #99cc00;">// select a range to add some text/image there</span><br />
Range rng=docObject.Range(ref oStartRange,ref oMissingReference );<br />
rng.Font.Name=”Arial”;<br />
rng.InsertAfter(”Ashish Sehajpal”);<br />
<span style="color: #99cc00;">// create Hyperlink object and assign address, screen tip to it</span><br />
Object address = @”http://www.sehajpal.com”;<br />
Object screenTip = “Welcome to sehajpal.com”;<br />
<span style="color: #99cc00;">// adding Hyperlink to the text “Ashish Sehajpal“<br />
</span>rng.Hyperlinks.Add(rng, ref address, ref oMissingReference , ref screenTip, ref oMissingReference , ref oMissingReference );<br />
<span style="color: #99cc00;">// give file name to it so as to save the document<br />
</span>object filename = @”C:\createdbycsharp.doc”;<br />
docObject.<span style="color: #0000ff;">SaveAs</span>(ref filename, ref oMissingReference , ref oMissingReference , ref oMissingReference , ref oMissingReference , ref oMissingReference ,ref oMissingReference , ref oMissingReference , ref oMissingReference , ref oMissingReference , ref oMissingReference , ref oMissingReference , ref oMissingReference , ref oMissingReference , ref oMissingReference , ref oMissingReference );</p>
<p>WordApp.Visible=true;<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sehajpal.com/index.php/2010/02/create-word-document-with-hyperlinks-in-it-with-csharp-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unable to debug the silverlight project</title>
		<link>http://www.sehajpal.com/index.php/2010/02/unable-to-debug-the-silverlight-project/</link>
		<comments>http://www.sehajpal.com/index.php/2010/02/unable-to-debug-the-silverlight-project/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 13:55:01 +0000</pubDate>
		<dc:creator>Ashish Sehajpal</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[SilverLight]]></category>
		<category><![CDATA[Unable to debug]]></category>

		<guid isPermaLink="false">http://www.sehajpal.com/?p=53</guid>
		<description><![CDATA[I have some strange thing happening in my application. I was able to debug anything but silverlight code !! I did so much of RnD on net and tried various tricks, but only this thing worked : - When you add a Silverlight project to a asp.net solution, you create 2 projects… A. the startup <a href="http://www.sehajpal.com/index.php/2010/02/unable-to-debug-the-silverlight-project/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>I have some strange thing happening in my application. I was able to debug anything but silverlight code !!<br />
I did so much of RnD on net and tried various tricks, but only this thing worked : -</p>
<p>When you add a Silverlight project to a asp.net solution, you create 2 projects…<br />
A. the startup project (interface starter)<br />
B. the interface itself</p>
<p>1. right click on the startup project (SilverlightWeb — the one with default.aspx in it )…<br />
2. click on ‘Property Pages’<br />
3. open ‘Start Options’ Tab<br />
4. enable Silverlight Debugger<br />
5. OK</p>
<p>This was the solution for me</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sehajpal.com/index.php/2010/02/unable-to-debug-the-silverlight-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Versioning problem in reference.cs in WCF service consumption in Silverlight 2</title>
		<link>http://www.sehajpal.com/index.php/2010/02/versioning-problem-in-reference-cs-in-wcf-service-consumption-in-silverlight-2/</link>
		<comments>http://www.sehajpal.com/index.php/2010/02/versioning-problem-in-reference-cs-in-wcf-service-consumption-in-silverlight-2/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 13:53:35 +0000</pubDate>
		<dc:creator>Ashish Sehajpal</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[SilverLight]]></category>
		<category><![CDATA[Versioning Problem]]></category>

		<guid isPermaLink="false">http://www.sehajpal.com/?p=51</guid>
		<description><![CDATA[A starnge problem occured when I was trying to add reference to one of my WCF service in my silverlight project. When deeply researched I found that some of the data contracts have been references twice in the reference.cs i.e. some classes with version 3.0.0.0 and some with 2.0.0.0 version. Strange!! A quick work around <a href="http://www.sehajpal.com/index.php/2010/02/versioning-problem-in-reference-cs-in-wcf-service-consumption-in-silverlight-2/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>A starnge problem occured when I was trying to add reference to one of my WCF service in my silverlight project. When deeply researched I found that some of the data contracts have been references twice in the reference.cs i.e. some classes with version 3.0.0.0 and some with 2.0.0.0 version. Strange!!</p>
<p>A quick work around was to generate the reference via svcutil.exe and it worked well in case where the project was justa relay service and not the silverlight application. In silverlght app, it throws the error for async and completed methods. Then I used SLSvcutil.exe i.e. svcutil for silverlight which is bundled with silverlight 3 only. I used this and generated the refences.cs for me. One problem left is FAULTCONTRACTS in the code. That i removed manually and it is working now.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sehajpal.com/index.php/2010/02/versioning-problem-in-reference-cs-in-wcf-service-consumption-in-silverlight-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to detect resolution of client in WPF?</title>
		<link>http://www.sehajpal.com/index.php/2010/02/how-to-detect-resolution-of-client-in-wpf/</link>
		<comments>http://www.sehajpal.com/index.php/2010/02/how-to-detect-resolution-of-client-in-wpf/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 13:52:00 +0000</pubDate>
		<dc:creator>Ashish Sehajpal</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Detect Resolution]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.sehajpal.com/?p=49</guid>
		<description><![CDATA[I was wondering about how to detect scrren resolution for client’s machine in wpf. I searched internet, tried googling but in vein. Here is the snippet that can help the folks looking for similar solution. // Detect screen height available. Remember it is the inner area of screen. SystemParameters.FullPrimaryScreenWidth // Detect screen width available. Remember <a href="http://www.sehajpal.com/index.php/2010/02/how-to-detect-resolution-of-client-in-wpf/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>I was wondering about how to detect scrren resolution for client’s machine in wpf. I searched internet, tried googling but in vein.</p>
<p>Here is the snippet that can help the folks looking for similar solution.</p>
<p><span style="color: #99cc00;">// Detect screen height available. Remember it is the inner area of screen.<br />
</span>SystemParameters.FullPrimaryScreenWidth</p>
<p><span style="color: #99cc00;">// Detect screen width available. Remember it is the inner area of screen.</span><br />
SystemParameters.FullPrimaryScreenHeight;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sehajpal.com/index.php/2010/02/how-to-detect-resolution-of-client-in-wpf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to open popup or redirect to web page in SilverLight</title>
		<link>http://www.sehajpal.com/index.php/2010/02/how-to-open-popup-or-redirect-to-web-page-in-silverlight/</link>
		<comments>http://www.sehajpal.com/index.php/2010/02/how-to-open-popup-or-redirect-to-web-page-in-silverlight/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 15:09:29 +0000</pubDate>
		<dc:creator>Ashish Sehajpal</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Navigation]]></category>
		<category><![CDATA[SilverLight]]></category>

		<guid isPermaLink="false">http://www.sehajpal.com/?p=46</guid>
		<description><![CDATA[This is the code to open a popup window in SilverLight. To open a website in a popup using SilverLight, we need to call Window.Navigate method. This method can be used in two different ways i.e. simply navigating to that webpage or using the window option [_blank, _self] etc. // Navigate to the webpage itself <a href="http://www.sehajpal.com/index.php/2010/02/how-to-open-popup-or-redirect-to-web-page-in-silverlight/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>This is the code to open a popup window in SilverLight.</p>
<p>To open a website in a popup using SilverLight, we need to call Window.Navigate method. This method can be used in two different ways i.e. simply navigating to that webpage or using the window option [_blank, _self] etc.</p>
<p>// Navigate to the webpage itself<br />
System.Windows.Browser.HtmlPage.Window.Navigate(new Uri(”http://www.microsoft.com”));</p>
<p>//or if you want to open a popup (in a separate window)<br />
System.Windows.Browser.HtmlPage.Window.Navigate(new Uri(”http://www.microsoft.com”), “_blank”);</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sehajpal.com/index.php/2010/02/how-to-open-popup-or-redirect-to-web-page-in-silverlight/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to open popup in wpf?</title>
		<link>http://www.sehajpal.com/index.php/2010/02/how-to-open-popup-in-wpf/</link>
		<comments>http://www.sehajpal.com/index.php/2010/02/how-to-open-popup-in-wpf/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 15:04:03 +0000</pubDate>
		<dc:creator>Ashish Sehajpal</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[How to open Popup]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.sehajpal.com/?p=41</guid>
		<description><![CDATA[This is the code to open a popup window in wpf. We need to create an empty window for popup and we’ll assign the object of the WPF Window to it. In this example we wre trying to open PopupForm.xaml as popup. private void OpenPopup() {    var oPopupForm = new ucPopupFormPopup();   // create POPUP <a href="http://www.sehajpal.com/index.php/2010/02/how-to-open-popup-in-wpf/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>This is the code to open a popup window in wpf.</p>
<p>We need to create an empty window for popup and we’ll assign the object of the WPF Window to it. In this example we wre trying to open <span style="color: #339966;">PopupForm.xaml </span>as popup.</p>
<blockquote><p>private void OpenPopup()<br />
{<br />
   var oPopupForm = new ucPopupFormPopup();</p>
<p>  // create POPUP window<br />
  var oWindow = new Window();</p>
<p>  //setting up its starting position<br />
  oWindow.WindowStartupLocation =WindowStartupLocation.CenterScreen;</p>
<p>  // we can make it available or not in taskbar<br />
  oWindow.ShowInTaskbar =false;</p>
<p>  oWindow.Width = 630;<br />
  oWindow.Height = 500;<br />
  oWindow.ResizeMode =ResizeMode.NoResize;<br />
  oWindow.Title =”Ashish Sehajpal &#8211; Trying WPF”;</p>
<p>  // Access Popup’s Controls<br />
  oPopupForm.TextBox1.Text = “Ashish Sehajpal is here.”;</p>
<p>  // Assign Form to Popup window<br />
  oWindow.Content = oPopupForm;</p>
<p>  // If you need to do some action on popup’s closing<br />
  // Assignt the event handler to it<br />
  oWindow.Closing += oWindow_Closing;<br />
  // it’s time to show POPUP<br />
  oWindow.ShowDialog();</p>
<p>}</p></blockquote>
<blockquote><p>
  // eventhandler for the popup closeing event<br />
private void oWindow_Closing(object sender, CancelEventArgs e)<br />
{<br />
  // do something nice here<br />
}</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.sehajpal.com/index.php/2010/02/how-to-open-popup-in-wpf/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
