>************************************************** >*-- Class: allfct_busytier (d:\playvfp\arbwork.vcx) >*-- ParentClass: custom >*-- BaseClass: custom >*-- Time Stamp: 06/14/01 01:49:10 PM >* >DEFINE CLASS allfct_busytier AS custom > > *** properties that express the table and important indexes > pctable = "AllFunctions" > pctag = "Fun_Key" > *-- Index tag for the primekey. > pc_pkeytag = "AllF_PKey" > > *** buffer properties for the field values > *-- Old value of AllFunctions.FunName > pcfunname_old = "" > *-- New value of Allfunctions.FunName > pcfunname_new = "" > *-- Old value of some numeric field in AllFunctions > pnallfun_1_old = 0 > *-- New value of some numeric field in AllFunctions > pnallfun_1_new = 0 > *-- Old value of some date field in AllFunctions > pdallfun_1_old = "" > *-- New value of some date field in AllFunctions > pdallfun_1_new = "" > *-- Value of the AllFunctions primary key. > pn_allf_pkey = 0 > > Name = "allfct_busytier" > > > *-- Find a given AllFunctions record and load THIS's properties. > PROCEDURE load_funct > LPARAMETER tnKeyVal > WITH THIS > IF NOT USED(.pcTable) > USE (.pcTable) IN 0 > ENDIF > > IF INDEXSEEK((m.tnKeyVal), .F., (.pcTable), (.pc_PKeyTag)) > .pnAllF_PKey = AllFunctions.PrimeKey > .pcFunName_Old = AllFunctions.FunName > .pc_pnAllFun_1_Old = AllFunctions.NumbField > .pd_pnAllFun_1_Old = AllFunctions.DateField > ENDIF > ENDWITH > ENDPROC > > > *-- Test for possible duplication of the primary key. > PROCEDURE fun_uniq > LPARAMETER tcKeyVal > > WITH THIS > IF NOT USED(.pcTable) > USE (.pcTable) IN 0 > ENDIF > > m.lRetVal = INDEXSEEK(m.tcKey, .F., (.pcTable), (.pcTag)) > ENDWITH > > RETURN(m.lRetVal) > ENDPROC > > > *-- Add a new function > PROCEDURE add_newfunct > LOCAL ARRAY laInsVals[4] > > WITH THIS > IF NOT USED(.pcTable) > USE (.pcTable) IN 0 > ENDIF > > IF .Fun_Uniq(.pcFunName_New) > laInsVals[2] = .pcFunName_New > laInsVals[3] = IIF(EMPTY(.pnAllFun_1_New), .pc_pnAllFun_1_Old, .pcAllFun_1_New) > laInsVals[4] = IIF(EMPTY(.pdAllFun_1_New), .pd_pnAllFun_1_Old, .pdAllFun_1_New) > laInsVals[1] = .New_PKey() > > INSERT INTO AllFunctions ; > FROM ARRAY laInsVals > ENDIF > ENDWITH > ENDPROC > > > *-- Apply changes to a record in AllFunctions > PROCEDURE upd_funct > LOCAL ARRAY laUpdVals[4] > > WITH THIS > IF NOT USED(.pcTable) > USE (.pcTable) IN 0 > ENDIF > > IF INDEXSEEK((.pnAllF_PKey), .T., (.pcTable), (.pc_PKeyTag)) > laUpdVals[1] = .pnAllF_PKey > laUpdVals[2] = IIF(EMPTY(.pcFunName_New), .pcFunName_Old, .pcFunName_New) > laUpdVals[3] = IIF(EMPTY(.pnAllFun_1_New), .pn_pnAllFun_1_Old, .pnAllFun_1_New) > laUpdVals[4] = IIF(EMPTY(.pdAllFun_1_New), .pd_AllFun_1_Old, .pdAllFun_1_New) > > SELECT (.pcTable) > GATHER FROM laUpdVals > ENDIF > ENDWITH > ENDPROC > > > *-- Delete a function. > PROCEDURE del_funct > WITH THIS > IF NOT USED(.pcTable) > USE (.pcTable) IN 0 > ENDIF > > IF INDEXSEEK(.pn_AllF_PKey, .T., (.pcTable), (.pc_Pkeytag)) > DELETE IN (.pcTable) > ENDIF > ENDWITH > ENDPROC > > > *-- Validate the date field value. > PROCEDURE valid_pdfunct > LPARAMETER tdValue > > [Code to verify the validity of m.tdValue] > > IF m.tdValue = Valid > THIS.pd_AllFun_1_New = m.tdValue > ENDIF > ENDPROC > > > *-- Validate the numeric field value. > PROCEDURE valid_pnfunct > LPARAMETER tnValue > > [Code to verify the validity of m.tnValue] > > IF m.tnValue = Valid > THIS.pn_AllFun_1_New = m.tnValue > ENDIF > ENDPROC > > > *-- Test for a unique prime key. > PROCEDURE uniq_pkey > LOCAL lRetVal > WITH THIS > m.lRetVal = INDEXSEEK((.pnAllF_PKey), .F., (.pcTable), (.pc_PKeyTag)) > ENDWITH > RETURN(m.lRetVal) > ENDPROC > > > *-- Get the next primekey. > PROCEDURE new_pkey > LOCAL lnRetVal > > WITH THIS > IF NOT USED(.pcTable) > USE (.pcTable) IN 0 > ENDIF > SELECT (.pcTable) > SET ORDER TO (.pc_PKeyTag) > > GO BOTT > > m.lnRetVal = AllFunctions.Primekey + 1 > ENDWITH > > RETURN(m.lnRetVal) > ENDPROC > > >ENDDEFINE >* >*-- EndDefine: allfct_busytier >************************************************** >Ok, I think, I got the basis, but have to work on it more.