/// <Summary>
/// Verification end date is greater than or equal to the start date
/// </Summary>
/// <Param name = "startdate"> Start date </Param>
/// <Param name = "enddate"> End Date </Param>
/// <Param name = "curdbfield"> Database field corresponding to the verification date </Param>
/// <Param name = "filterexpression"> Condition </Param>
/// <Returns> True/false </Returns>
Private Bool Validoraclestartenddate ( String Startdate, String Enddate, String Curdbfield, Out String Filterexpression)
{
Filterexpression = String . Empty;
String Startdatefilter = " And {1 }>= to_date ('{0}', 'yyyy-MM-DD hh24: MI: ss ') " ;
String Enddatefilter = " And {1} <to_date ('{0}', 'yyyy-MM-DD hh24: MI: ss ') " ;
// The start and end dates are empty.
If (Startdate = Null | Startdate. Length = 0 ) && (Enddate = Null | Enddate. Length = 0 ))
{
Return True ;
}
Datetime sdate=Webcommon. tostartdatetime (startdate );
Datetime edate=Webcommon. toenddatetime (enddate );
// The start date is later than the end date.
If (Sdate > Edate)
{
Return False ;
}
Else // Start date is less than or equal to end date (correct)
{
Edate = Edate = Datetime. maxvalue ?
Datetime. maxvalue: edate. adddays ( 1 );
Filterexpression = String . Format (startdatefilter, sdate, curdbfield );
Filterexpression + = String . Format (enddatefilter, edate, curdbfield );
Return True ;
}
}
/// <Summary>
/// Verification end date is greater than or equal to the start date
/// </Summary>
/// <Param name = "startdate"> Start date </Param>
/// <Param name = "enddate"> End Date </Param>
/// <Param name = "curdbfield"> Database field corresponding to the verification date </Param>
/// <Param name = "filterexpression"> Condition </Param>
/// <Returns> True/false </Returns>
Public Static Bool Validsqlserverstartenddate ( String Startdate, String Enddate, String Curdbfield, Out String Filterexpression)
{
Filterexpression = String . Empty;
String Startdatefilter = " And convert (varchar (10), {1}, 120)> = '{0 }' " ;
String Enddatefilter = " And convert (varchar (10), {1}, 120) <'{0 }' " ;
// The start and end dates are empty.
If (Startdate = Null | Startdate. Length = 0 ) && (Enddate = Null | Enddate. Length = 0 ))
{
Return True ;
}
Datetime sdate=Object2startdate (startdate );
Datetime edate=Object2enddate (enddate );
// The start date is later than the end date.
If (Sdate > Edate)
{
Return False ;
}
Else // Start date is less than or equal to end date (correct)
{
Edate = Edate = Datetime. maxvalue ?
Datetime. maxvalue: edate. adddays ( 1 );
Filterexpression = String . Format (startdatefilter, sdate. tostring ( " Yyyy-mm-dd " ), Curdbfield );
Filterexpression + = String . Format (enddatefilter, edate. tostring ( " Yyyy-mm-dd " ), Curdbfield );
Return True ;
}
}