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

<channel>
	<title>IWebBiz Dot Net Development</title>
	<atom:link href="http://dotnet.iwebbiz.com.au/feed/" rel="self" type="application/rss+xml" />
	<link>http://dotnet.iwebbiz.com.au</link>
	<description>C# / ASP.Net and Windows Forms Ramblings</description>
	<pubDate>Sun, 14 Sep 2008 04:42:28 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
	<language>en</language>
			<item>
		<title>How to select a range of dates in SQL where all or none of the dates are retrieved</title>
		<link>http://dotnet.iwebbiz.com.au/2008/09/13/how-to-select-a-range-of-dates-in-sql-where-all-or-none-of-the-dates-are-retrieved/</link>
		<comments>http://dotnet.iwebbiz.com.au/2008/09/13/how-to-select-a-range-of-dates-in-sql-where-all-or-none-of-the-dates-are-retrieved/#comments</comments>
		<pubDate>Sun, 14 Sep 2008 04:37:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[SQL]]></category>

		<category><![CDATA[Accommodation]]></category>

		<guid isPermaLink="false">http://dotnet.iwebbiz.com.au/?p=9</guid>
		<description><![CDATA[I am designing a booking engine for hotel rooms and to check for availabilities you have to select a range of dates to check if they are available and if not dont return a result for that room. This seems like a simple SQL statement but it is not as easy as it seems. I [...]]]></description>
			<content:encoded><![CDATA[<p>I am designing a booking engine for hotel rooms and to check for availabilities you have to select a range of dates to check if they are available and if not dont return a result for that room. This seems like a simple SQL statement but it is not as easy as it seems. I got around the problem by selecting a range of dates e.g.</p>
<p><code>SELECT Rooms.id,Rooms.Name,Rooms.Description,Allotments.NumberAvailable,ADate,Rates.RoomsRate FROM Rooms,Allotments,Rates,Seasons WHERE Seasons.RoomsID=Rooms.id AND Seasons.SDate=ADate AND Seasons.id=Rates.SeasonsID AND Rooms.id=Allotments.RoomsID AND (ADate='2008-09-12' OR ADate='2008-10-13') AND COUNT(ADate)=2 GROUP BY Rooms.id ORDER BY Rooms.id,ADate</code></p>
<p>Then grouping by the room id and counting the number of results. This way the OR becomes an AND except it returns a result for each date and it only returns a result if all the dates are found. This can be used in seperate groups of dates e.g. 1st->3rd and 5th->6th as long as each individual variable is counted. You could even make sure that the &#8220;NumberAvailable&#8221; is equal to the number of rooms required. To even simplify an allotments query for hotels you just take out the returning date field and SUM the room rate and extra guests rate (ExtraPAX) and you have a complete result.</p>
<p><code>SELECT Rooms.id,Rooms.Name,Rooms.Description,SUM(Rates.RoomsRate)+SUM(Rates.ExtraPAX*(?NumberOfGuests-Rates.IncludedGuests)) AS TotalCost<br />
FROM Rooms,Allotments,Rates,Seasons<br />
WHERE Seasons.RoomsID=Rooms.id AND Seasons.SDate=ADate<br />
AND Seasons.id=Rates.SeasonsID AND Rates.RoomsID=Rooms.id<br />
AND Rooms.id=Allotments.RoomsID AND (ADate='2008-09-12' OR ADate='2008-10-13')<br />
AND COUNT(ADate)=2 AND Allotments.NumberAvailable>=?RoomsRequired<br />
AND Rooms.MaximumGuests>=?NumberOfGuests<br />
GROUP BY Rooms.id<br />
ORDER BY TotalCost</code></p>
<p>If you want to make it a multi-property booking engine just add the property table to the SQL query as follows:-</p>
<p><code>SELECT Properties.id,Properties.Name,Rooms.id,Rooms.Name,Rooms.Description,SUM(Rates.RoomsRate)+SUM(Rates.ExtraPAX*(?NumberOfGuests-Rates.IncludedGuests)) AS TotalCost<br />
FROM Properties,Rooms,Allotments,Rates,Seasons<br />
WHERE Properties.id=Rooms.PropertiesID<br />
AND Seasons.RoomsID=Rooms.id AND Seasons.SDate=Allotments.ADate<br />
AND Seasons.id=Rates.SeasonsID AND Rates.RoomsID=Rooms.id<br />
AND Rooms.id=Allotments.RoomsID<br />
AND (ADate='2008-09-12' OR ADate='2008-10-13') AND COUNT(ADate)=2<br />
AND Allotments.NumberAvailable>=?RoomsRequired<br />
AND Rooms.MaximumGuests>=?NumberOfGuests<br />
GROUP BY Rooms.id<br />
ORDER BY Properties.id,TotalCost</code></p>
<p>This technique could be used in any sort of situation where a variable in a number of rows needs to be in a set of predefined values and to return a result row for every one of the values required or return none of them. Also as shown above the rows can be grouped by a common factor and functions can be run on columns within the rows selected and totals for the sets of rows can be returned as a single row.</p>
<p>Hope this helps.<br />
Dan.</p>
]]></content:encoded>
			<wfw:commentRss>http://dotnet.iwebbiz.com.au/2008/09/13/how-to-select-a-range-of-dates-in-sql-where-all-or-none-of-the-dates-are-retrieved/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Search engine friendly urls</title>
		<link>http://dotnet.iwebbiz.com.au/2008/04/25/search-engine-friendly-urls/</link>
		<comments>http://dotnet.iwebbiz.com.au/2008/04/25/search-engine-friendly-urls/#comments</comments>
		<pubDate>Fri, 25 Apr 2008 11:34:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[ASP.Net]]></category>

		<category><![CDATA[C#]]></category>

		<category><![CDATA[DotNet]]></category>

		<category><![CDATA[SEO]]></category>

		<category><![CDATA[ASP]]></category>

		<guid isPermaLink="false">http://dotnet.iwebbiz.com.au/?p=4</guid>
		<description><![CDATA[Hello there,
If you were wondering how to do search engine friendly urls in asp.net go no further. The key is the Global.asax file in your root. Put this code in for this example to get the number after /search/dist/ and run the file specified. :-

1
2
3
4
5
6
7
8
9
10
11
 protected void Application_BeginRequest&#40;Object sender, EventArgs e&#41;
&#123;
HttpContext incoming = HttpContext.Current;
string oldpath [...]]]></description>
			<content:encoded><![CDATA[<p>Hello there,</p>
<p>If you were wondering how to do search engine friendly urls in asp.net go no further. The key is the Global.asax file in your root. Put this code in for this example to get the number after /search/dist/ and run the file specified. :-</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="csharp"> <span style="color: #0600FF;">protected</span> <span style="color: #0600FF;">void</span> Application_BeginRequest<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">Object</span> sender, EventArgs e<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
HttpContext incoming <span style="color: #008000;">=</span> HttpContext.<span style="color: #0000FF;">Current</span><span style="color: #008000;">;</span>
<span style="color: #FF0000;">string</span> oldpath <span style="color: #008000;">=</span> incoming.<span style="color: #0000FF;">Request</span>.<span style="color: #0000FF;">Path</span>.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">if</span><span style="color: #000000;">&#40;</span>oldpath.<span style="color: #0000FF;">Contains</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;/search/dist/&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
<span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> sstring <span style="color: #008000;">=</span><span style="color: #008000;">new</span> <span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #FF0000;">6</span><span style="color: #000000;">&#93;</span><span style="color: #008000;">;</span>
sstring<span style="color: #008000;">=</span>oldpath.<span style="color: #0000FF;">Split</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">'/'</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #008080; font-style: italic;">//Web_Security.SearchDistributions=Convert.ToInt32();</span>
incoming.<span style="color: #0000FF;">RewritePath</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;~<span style="color: #008080; font-weight: bold;">\\</span>search<span style="color: #008080; font-weight: bold;">\\</span>Default.aspx?dist=&quot;</span> <span style="color: #008000;">+</span> sstring<span style="color: #000000;">&#91;</span><span style="color: #FF0000;">4</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://dotnet.iwebbiz.com.au/2008/04/25/search-engine-friendly-urls/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Enterprise Library</title>
		<link>http://dotnet.iwebbiz.com.au/2007/10/26/enterprise-library/</link>
		<comments>http://dotnet.iwebbiz.com.au/2007/10/26/enterprise-library/#comments</comments>
		<pubDate>Fri, 26 Oct 2007 12:09:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[DotNet]]></category>

		<category><![CDATA[dotnet .net Enterprise Library Factory Code]]></category>

		<guid isPermaLink="false">http://dotnet.iwebbiz.com.au/?p=3</guid>
		<description><![CDATA[I was looking for some code to do with logging errors and came across the Microsoft Enterprise Library. This seems to be a framework for different  areas  of design  and one  of them was Logs. It also has some cool stuff on database factory classes so you can create database independant [...]]]></description>
			<content:encoded><![CDATA[<p>I was looking for some code to do with logging errors and came across the <a href="http://msdn2.microsoft.com/en-us/library/aa480453.aspx" title="Enterprise Library">Microsoft Enterprise Library</a>. This seems to be a framework for different  areas  of design  and one  of them was Logs. It also has some cool stuff on database factory classes so you can create database independant code. Also i found <a href="http://www.codeplex.com/entlibcontrib" class="NoUnderline">Enterprise Library Contrib<br />
</a>which is an open source extension to the Microsoft Enterprise Library, it has some cool stuff like <span id="ctl00_ctl00_Content_TabContentPanel_Content_wikiSourceLabel">MySql, SqLite and SqlEx providers.</span></p>
]]></content:encoded>
			<wfw:commentRss>http://dotnet.iwebbiz.com.au/2007/10/26/enterprise-library/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
