there r two fields in my database"LowSeason"&"HighSeason"
according to bellow code if we pick dates within month 11 we pick rent from "LowSeason"
and if we pick dates within month 12 we pick rent from "HighSeason"
but i want that when i pick startdate from month 11 end end date from month 12 rent should be pick acording to the seasons
i.e startdate=31/11/2008 & enddate =3/12/2008
for month 11 that is "LowSeason" rent is 20$ per day
and for month 12 that is "HighSeason" rent is 35$ per day
toal rent should be 55.
if ((totdays >= 2) && (totdays <= 6) && (start.Month == 11) || (end.Month == 11) )
{
rent = Convert.ToInt32(rd["LowSeason"].ToString());
}
else if (totdays >= 2 && totdays <= 6 && (start.Month == 12) || (end.Month == 12) )
{
rent =
Convert.ToInt32(rd["HighSeason"].ToString());}
total rent=totdays*rent;
ChongoPosted Nov 13, 2008, 3:08 PM
I like this format MM/DD/YYYY. so from 11/25/2008 to 12/05/2008 there are 10 days. You can figure out how many days are in a month using the DateTime class. I would start from 11/25/2008 and check to see if it is LOW or HIGH add the value. the using the DateTime you can add a Day, check again and add to the total. Do this until you hit the end date. Sudo Code:
while(startdate <= enddate)
{
if(datetime.month == 11)
{
rent +=20;
}
elseif(datetime.month ==12)
{
rent +=25;
}
datetime.addday(1);
}
Hope this helps.