Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Simple business object utility or class?
Message
From
24/09/2008 14:05:21
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Title:
Simple business object utility or class?
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01350261
Message ID:
01350261
Views:
57
Is there a builder for a simple Business Object in VFP?

For instance, I want to pass a lookup value, and then I would have an object that has a property for every field in the matching record.

(pseudo code):

oJob=CreateObject('JobObject')
oJob.GetInfo('4033')


Now, I should be able to look at the oJob object and see a property for each field in the table:

oJob.CustNo=
oJob.Po_No=
oJob.ShipDate=
oJob.QuotedBy=
etc.

I want it to figure out the fields from the table structure and create a property for each field.

I am not worried about the full compliment of the usual Business Object features at this point, mostly just a lookup object.

I have hacked out this code, but it it very rough and very hard-coded:
LPARAMETERS cJob_num

 cAlias=alias()

 if not used('Job_Info')
  Do Open_Job_Info
 else
  select Job_Info
 endif

 *-- Seek the entered text as a job number ---------------
 seek alltrim(cJob_Num)


 if found()
  this.ipkey=ipkey
  this.job_num=alltrim(job_num)
  this.status=status
  this.job_start=job_start
  this.invoiced=invoiced
  this.po_num=Alltrim(p_o_num)
  this.ship_date=ship_date
  this.quote_no=quote_no
  this.cust_num=alltrim(cust_num)
  this.company=alltrim(Customer.Company)
  this.phone=Alltrim(Customer.phone)
  this.found=1
  this.value=alltrim(job_num)
  select (cAlias)
  return .t.
 else
   this.ClearProperties()
   if this.complain=.t.
    =MessageBox("Job Number " + alltrim(cJob_Num)+ " not found!", 0, 'Notice')
   endif
   If !Empty(cAlias)
    select (cAlias)
   endif
   return .F.
 endif
Anyoneone ever built something like this?
Next
Reply
Map
View

Click here to load this message in the networking platform