Author: dst101 | Posted on: 9/13/2010 11:46:47 AM | Views : 320

Scenario
I have records that have an initial value of 'blue' and stay 'blue' until after 2 days then they turn to 'green', Turn 'orange' after 15 days and then after 20 days turn 'red'.
The results will be pulled into a gridview.
What I'm having difficulty is; what's the best way of calculating the days, in sql server or in c#?
Trying to get construct date examples is proving to be a bit of a pain:


DateTime TodaysDate = DateTime.Now; DateTime SelectedDate = Calendar1.SelectedDate; TimeSpan result = SelectedDate - TodaysDate; int days = result.Days; lblCalculateDays.Text = days.ToString(); TextBox1.Text = TodaysDate.ToString("d"); TextBox2.Text = SelectedDate.ToString("d"); protected void Calendar1_SelectionChange ...

Go to the complete details ...