Qaiser Mehmood

Qaiser Mehmood

  • NA
  • 105
  • 0

which month select

Nov 7 2008 5:27 AM

my data base  have two season fields "2_6DaysLowSeason" and "2_6DaysHigh Season"

i want thatwhen user select from calendar

January = 1,

February = 2,

March = 3,

November = 11,

December = 12

 

value should go to 2_6DaysLowSeason

 

and if

April = 4,

May = 5,

June = 6,

July = 7,

August = 8,

September = 9,

October = 10,

 

 

value should go to 2_6DaysHigh Season

 

but every time whether i select

January = 1,

February = 2,

March = 3,

April = 4,

May = 5,

June = 6,

July = 7,

August = 8,

 

values go to current month i.e November and 2_6DaysHigh Season

 

 

Please help in this code

 

 

 

 

 

 

 

public partial class carwithtotal : System.Web.UI.Page

{

private int totdays = 0;

public int id = 0;

DateTime p;

public enum Month


{

January = 1,

February = 2,

March = 3,

April = 4,

May = 5,

June = 6,

July = 7,

August = 8,

September = 9,

October = 10,

November = 11,

December = 12

}

 

protected void Page_Load(object sender, EventArgs e)

{

if (!IsPostBack)

{

 

 

int rent = 0, tot = 0;


DateTime start = DateTime.Parse(lbstartDate.Text);

DateTime end = DateTime.Parse(lbendDate.Text);


int totdays = (end - start).Days + 1;

if (totdays <= 1)

{

lbDayHire.Text = "Sorry start date can't be greater then end date for same month";

}

else

{

lbDayHire.Text = Convert.ToString(totdays);

 

 

if ((totdays >= 2) &&( totdays <= 6 )&& (DateTime.Now.Month==11)|| (DateTime.Now.Month==12) || (DateTime.Now.Month==1) ||(DateTime.Now.Month==2) ||(DateTime.Now.Month==3))

{


rent = Convert.ToInt32(rd["2_6DaysLowSeason"].ToString());


}

else if (totdays >= 7 && totdays <= 13 && (DateTime.Now.Month == 11 || DateTime.Now.Month == 12 || DateTime.Now.Month == 1 || DateTime.Now.Month == 2 || DateTime.Now.Month == 3))

{

else if (totdays >= 2 && totdays <= 6 && (DateTime.Now.Month == 4 || DateTime.Now.Month == 5 || DateTime.Now.Month == 6 || DateTime.Now.Month == 7 || DateTime.Now.Month == 8 || DateTime.Now.Month == 9 || DateTime.Now.Month == 10))

{

rent = Convert.ToInt32(rd["2_6DaysHighSeason"].ToString());

 

 

}

 

tot = rent * totdays;

lbTotalrent.Text = tot.ToString();

// Label8.Text=rd["VAT%"].ToString();

 

 

 

}

 

 

 


Answers (1)