Case " Within this week " :
Datetime retstartday = datetime. Now. Date. adddays (-( Int ) (Datetime. Now. dayofweek) + 1 );
Datetime retendday = datetime. Now. Date. adddays ( 7 -( Int ) (Datetime. Now. dayofweek). adddays ( 1 );
Sbsqldate. append ( " Joindate> =' " + Retstartday + " 'And joindate <=' " + Retendday + " ' " );
Break ;
Case " Within this month " :
Datetime monthstart =New Datetime (datetime. Now. Year, datetime. Now. Month, 1 );
Datetime monthend = New Datetime (datetime. Now. Year, datetime. Now. Month + 1 , 1 ). Adddays (- 1 );
Sbsqldate. append ( " Joindate> =' " + Monthstart + " 'And joindate <=' " + Monthend + " ' " );
Break ;
Case " Within this year " :
Datetime yearstart = New Datetime (datetime. Now. Date. Year, 1 , 1 );
Datetime yearend =New Datetime (datetime. Now. Date. Year + 1 , 1 , 1 ). Adddays (- 1 );
Sbsqldate. append ( " Joindate> =' " + Yearstart + " 'And joindate <=' " + Yearend + " ' " );
Break ;
List <radio> radlist = radgrop. checkeditems;
Foreach (Radio item In Radlist)
{
Switch (Item. boxlabel)
{
Case " Do not remember " :
Break ;
Case " Yesterday " : Sbsqldate. append ( " Createdate> =' " + New Datetime (datetime. Now. Year, datetime. Now. Month, datetime. Now. Day). adddays (- 1 ) + " And createdate <' " + New Datetime (datetime. Now. Year, datetime. Now. Month, datetime. Now. Day) +" ' " );
Break ;
Case " Today " : Sbsqldate. append ( " Createdate =' " + Datetime. Now. Date + " ' " );
Break ;
Case " Past 7 days " : Sbsqldate. append ( " Createdate> =' " + Datetime. Now. adddays (- 7 ) + " And createdate <=' " + Datetime. now + " ' " );
Break ;
Case " Past 30 days " : Sbsqldate. append ( " Createdate> =' " + Datetime. Now. adddays (- 30 ) + " And createdate <=' " + Datetime. now + " ' " );
Break ;
Case " Within this week " :
Datetime retstartday = datetime. Now. Date. adddays (-( Int ) (Datetime. Now. dayofweek) + 1 );
Datetime retendday = datetime. Now. Date. adddays ( 7 -( Int ) (Datetime. Now. dayofweek). adddays ( 1 );
Sbsqldate. append ( " Createdate> =' " + Retstartday + " And createdate <=' " + Retendday + " ' " );
Break ;
Case " Within this month " :
Datetime monthstart = New Datetime (datetime. Now. Year, datetime. Now. Month, 1 );
Datetime monthend = New Datetime (datetime. Now. Year, datetime. Now. Month + 1 , 1 ). Adddays (- 1 );
Sbsqldate. append ( " Createdate> =' " + Monthstart + " And createdate <=' " + Monthend + " ' " );
Break ;
Case " Within this year " :
Datetime yearstart = New Datetime (datetime. Now. Date. Year, 1 , 1 );
Datetime yearend = New Datetime (datetime. Now. Date. Year + 1 , 1 , 1 ). Adddays (- 1 );
Sbsqldate. append ( " Createdate> =' " + Yearstart + " And createdate <=' " + Yearend + " ' " );
Break ;
Case " Specified Date " : Sbsqldate. append ( " Createdate> =' " + Dfstatedate. Text. Trim () + " And createdate <=' " + (Dfenddate. Text. Trim () = " 0001-1-1 0:00:00 " ? Datetime. Now. tostring (): dfenddate. Text. Trim () + " ' " );
Break ;
}
}