[expire_date] >=trunc(sysdate)-3 need to do this using llbgen filter to use in .net but how

Posts   
 
    
buckd32
User
Posts: 20
Joined: 09-Oct-2009
# Posted on: 16-Oct-2009 09:38:28   

how to i run this oracle plsql command on a llbgen datasource in asp.net it can be asp.net code or anything but i need to be able to find out the overdue date if the sabbatical dates is 3 days overdue from the system date

[expire_date] >=trunc(sysdate)-3

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 16-Oct-2009 10:15:51   

What about using the Server date (the .NET DateTime.Now) as such:

var date = DateTime.Now.AddDays(3);
prediateExpression.Add(MyEntityFields.ExpireDate >= date)
buckd32
User
Posts: 20
Joined: 09-Oct-2009
# Posted on: 16-Oct-2009 10:36:47   

how do i use the prediateExpression i am wirrting my app in c# not vb.net btw when i paste the code it gives an error am i missing a usses clause ?

using System.Web.UI.HtmlControls; using System.Data.OracleClient; using Sabbatical.DatabaseSpecific; using Sabbatical.EntityClasses; using Sabbatical.FactoryClasses; using Sabbatical.HelperClasses; using Sabbatical.RelationClasses; using Sabbatical.dataservice;

using SD.LLBLGen.Pro.ORMSupportClasses; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { // LLBLGenProDataSource2_1.FilterToUse = new RelationPredicateBucket(new PredicateExpression((WebSabbaticalFields.Extended == "NO"))); var date = DateTime.Now.AddDays(3); prediateExpression. Add(MyEntityFields.ExpireDate >= date);

// lblfaqs.FilterToUse = new RelationPredicateBucket(new PredicateExpression((FaqsFields.Faqcat == Request.QueryString["ID"] ) )); Page.Title = "Sabbatical - Non Extended records";

}
Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 16-Oct-2009 10:47:41   

Just add the semi columns and that's a C# code.

My code was jus a snippet, assuming you have a PreciateExression instance called predicateExpression.

Either use:

var date = DateTime.Now.AddDays(3);

RelationPredicateBucket bucket = new RelationPredicateBucket(new PredicateExpression(MyEntityFields.ExpireDate >= date)); 

Or if you are already consuming a bucket then:

bucket.PredicateExpression.Add(MyEntityFields.ExpireDate >= date);
buckd32
User
Posts: 20
Joined: 09-Oct-2009
# Posted on: 16-Oct-2009 10:48:33   

i might not be explaining myself well enough sorry if a person was ment to return 27 and the date is now the 30 it would filter it based on the 3 days over due in that case hence if the system date was the 30 they would be three days overdue?

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 16-Oct-2009 11:25:27   

I'm sorry I guess you need this instead:

var date = DateTime.Now.AddDays(-3); // Subtract 3 days
prediateExpression.Add(MyEntityFields.ExpireDate <= date); //expireDate should be 3 days ago or before that.

Note the -ve sign and the <= operator.