📄 cdataenv.prg
字号:
* Returns: LOGICAL
* .T. if the database is valid
* .F. if it is not
*------------------ Maintenance Section --------------------
*@ Inputs:
*@ 1. cDataEnvironment.cDefaultDatabase
*@ 2. cDataEnvironment.cDefaultDatabaseName
* Outputs:
* Pre-condition Invariants:
* 1. The method GetDefaultDatabase() must have executed
* and derived the fully qualified drive, path and
* name of the default database and placed this information
* into the cDefaultDatabase property.
* Post-condition Invariants:
* 1. The fully qualified name of the default database was
* provided AND the file exists in the specified location.
*? Notes: None
* Collaborating Methods:
* 1. ErrorMsg() in UTILS.PRG
*-- Process:
*-- 1. IF the default database (fully qualified drive, path and
*-- name) has not been provided OR the specified file
*-- does not exist
*-- 2. Message the user that the default database cannot be found
*-- 3. Condition the return value to return a failed condition
*-- ENDIF
* Change Log:
* MODIFIED
*--------- (c) Flash Creative Management, Inc. -------------
*---------------- Commenting Provided By -------------------
* Software Assets of Virginia, Inc. (SAVI)
* Charles T. Blankenship, President
* Compuserve: 76132,2575
* Internet: www.savvysolutions.com
* eMail 1: ctb@savvysolutions.com
* eMail 2: 76132.2575@compuserve.com
* Voice: (757)853-4465
************************************************************
LOCAL llRetVal
llRetVal = .T.
IF EMPTY(This.cDefaultDatabase) OR !FILE(This.cDefaultDatabase)
=ErrorMsg(CANNOTFINDDATABASE_LOC + " " + This.cDefaultDatabase)
llRetVal = .F.
ENDIF
RETURN llRetVal
ENDFUNC
FUNCTION SetInitiallySelectedAlias()
*-------------------- Location Section ---------------------
* Library: cDataEnv.PRG
* Class: cDataEnvironment
* Method: SetInitiallySelectedAlias
*--------------------- Usage Section -----------------------
*) Description:
*) Places the name of the cursor that was designated to
*) be the intially selected alias (by the developer) into the
*) .InitialSelectedAlias property.
* Scope: PUBLIC
* Parameters: None
*$ Usage:
*$ cDataEnvironment::SetInitiallySelectedAlias()
*% Example:
*% This.SetInitiallySelectedAlias()
* Returns: LOGICAL .T. by default
*------------------ Maintenance Section --------------------
*@ Inputs:
*@ 1. cDataEnvironment.nInitialSelectedAlias
*@ 2. cDataEnvironment.aCursors[]
* Outputs:
* 1. cDataEnvironment.InitialSelectedAlias
* Pre-condition Invariants:
* 1. The developer must have specified which
* cursor is desired to be the initially selected
* alias by appropriately populating the
* nInitialSelectedAlias property
* 2. The aCursor array must have a valid cursor
* name in the element that corresponds to
* the value in the nInitialSelectedalias property
* Post-condition Invariants:
* 1. The name of the cursor desired to be the initially
* selected alias is present in the InitialSelectedAlias
* property.
*? Notes: None
* Collaborating Methods: None
*-- Process:
*-- 1. If a valid cursor name exists in the specified
*-- element of the aCursors array for the initially selected
*-- alias
*-- 2. Populate the InitialSelectedAlias property with the
*-- name of the cursor that is desired to be initially
*-- selected when this data environment instantiates.
*-- ENDIF
* Change Log:
* MODIFIED
*--------- (c) Flash Creative Management, Inc. -------------
*---------------- Commenting Provided By -------------------
* Software Assets of Virginia, Inc. (SAVI)
* Charles T. Blankenship, President
* Compuserve: 76132,2575
* Internet: www.savvysolutions.com
* eMail 1: ctb@savvysolutions.com
* eMail 2: 76132.2575@compuserve.com
* Voice: (757)853-4465
************************************************************
IF TYPE("This.aCursors[This.nInitialSelectedAlias]") == "C"
This.InitialSelectedAlias = This.aCursors[This.nInitialSelectedAlias]
ENDIF
ENDFUNC
FUNCTION CreateCursors()
*-------------------- Location Section ---------------------
* Library: cDataEnv.PRG
* Class: cDataEnvironment
* Method: CreateCursors()
*--------------------- Usage Section -----------------------
*) Description:
*) Loops through the aCursors array, element by element
*) and adds the specified cursor objects to the data
*) environment.
* Scope: Public
* Parameters: None
*$ Usage:
*$ cDataEnvironmant::CreateCursors()
*% Example:
*% This.CreateCursors()
* Returns: LOGICAL .T. by default
*------------------ Maintenance Section --------------------
*@ Inputs:
*@ 1. cDataEnvironment.aCursors[] - name of the class
*@ definition from which to create the cursor.
*@ Usually defined in ADATAENV.PRG and populated into
*@ the array from the LoadCursors() method.
* Outputs:
* 1. Child cursor objects are added to the cDataEnvironment
* Pre-condition Invariants:
* 1. The developer must have populated the class definition
* in ADATAENV.PRG with the names of the cursors that
* are to participate in the data environment.
* Post-condition Invariants:
* 1. All of the specified cursors exist as child objects
* of the data environment. The names of these objects
* are the names of the class definitions of the cursors
* with a "o" pre-pended, e.g. "ov_UserView" if the
* class definition was "v_UserView".
*? Notes: None
* Collaborating Methods:
* 1. DataEnvironment.AddObject()
*-- Process:
*-- 1. IF a name of the cursor's class definition is
*-- present in the first element of the aCursor array
*-- 2. FOR every cursor whose class definition was defined
*-- 3. Add the cursor object to the data environment
*-- objects as a child of the DE. The name of the
*-- object is derived by prepending a "o" to the
*-- name of the cursor's class definition.
*-- ENDFOR
*-- ENDIF
* Change Log:
* MODIFIED
*--------- (c) Flash Creative Management, Inc. -------------
*---------------- Commenting Provided By -------------------
* Software Assets of Virginia, Inc. (SAVI)
* Charles T. Blankenship, President
* Compuserve: 76132,2575
* Internet: www.savvysolutions.com
* eMail 1: ctb@savvysolutions.com
* eMail 2: 76132.2575@compuserve.com
* Voice: (757)853-4465
************************************************************
LOCAL lnCursor
IF TYPE("This.aCursors[1]") == "C"
FOR lnCursor = 1 TO ALEN(This.aCursors, 1)
This.AddObject("o" + This.aCursors[lnCursor], This.aCursors[lnCursor])
ENDFOR
ENDIF
ENDFUNC
FUNCTION Unload()
*-------------------- Location Section ---------------------
* Library: cDataEnv.PRG
* Class: cDataEnvironment
* Method: Unload()
*--------------------- Usage Section -----------------------
*) Description:
* Scope:
* Parameters:
*$ Usage:
*% Example:
* Returns: LOGICAL .T. by default
*------------------ Maintenance Section --------------------
*@ Inputs:
* Outputs:
* Pre-condition Invariants:
* Post-condition Invariants:
*? Notes:
* Collaborating Methods:
*-- Process:
* Change Log:
*--------- (c) Flash Creative Management, Inc. -------------
*---------------- Commenting Provided By -------------------
* Software Assets of Virginia, Inc. (SAVI)
* Charles T. Blankenship, President
* Compuserve: 76132,2575
* Internet: www.savvysolutions.com
* eMail 1: ctb@savvysolutions.com
* eMail 2: 76132.2575@compuserve.com
* Voice: (757)853-4465
************************************************************
This.CloseTables()
This.UnloadCursors()
This.UnloadRelations()
ENDFUNC
FUNCTION UnloadCursors()
*-------------------- Location Section ---------------------
* Library: cDataEnv.PRG
* Class: cDataEnvironment
* Method: UnloadCursors()
*--------------------- Usage Section -----------------------
*) Description:
* Scope:
* Parameters:
*$ Usage:
*% Example:
* Returns: LOGICAL .T. by default
*------------------ Maintenance Section --------------------
*@ Inputs:
* Outputs:
* Pre-condition Invariants:
* Post-condition Invariants:
*? Notes:
* Collaborating Methods:
*-- Process:
* Change Log:
*--------- (c) Flash Creative Management, Inc. -------------
*---------------- Commenting Provided By -------------------
* Software Assets of Virginia, Inc. (SAVI)
* Charles T. Blankenship, President
* Compuserve: 76132,2575
* Internet: www.savvysolutions.com
* eMail 1: ctb@savvysolutions.com
* eMail 2: 76132.2575@compuserve.com
* Voice: (757)853-4465
************************************************************
LOCAL lnCursor
IF TYPE("This.aCursors[1]") == "C"
FOR lnCursor = 1 TO ALEN(This.aCursors, 1)
This.RemoveObject("o" + This.aCursors[lnCursor])
ENDFOR
ENDIF
ENDFUNC
FUNCTION UnloadRelations()
*-------------------- Location Section ---------------------
* Library: cDataEnv.PRG
* Class: cDataEnvironment
* Method: UnloadRelations()
*--------------------- Usage Section -----------------------
*) Description:
* Scope:
* Parameters:
*$ Usage:
*% Example:
* Returns: LOGICAL .T. by default
*------------------ Maintenance Section --------------------
*@ Inputs:
* Outputs:
* Pre-condition Invariants:
* Post-condition Invariants:
*? Notes:
* Collaborating Methods:
*-- Process:
* Change Log:
*--------- (c) Flash Creative Management, Inc. -------------
*---------------- Commenting Provided By -------------------
* Software Assets of Virginia, Inc. (SAVI)
* Charles T. Blankenship, President
* Compuserve: 76132,2575
* Internet: www.savvysolutions.com
* eMail 1: ctb@savvysolutions.com
* eMail 2: 76132.2575@compuserve.com
* Voice: (757)853-4465
************************************************************
LOCAL lnRelation
IF TYPE("This.aRelations[1]") == "C"
FOR lnRelation = 1 TO ALEN(This.aRelations, 1)
This.RemoveObject("o" + This.aRelations[lnRelation])
ENDFOR
ENDIF
ENDFUNC
FUNCTION CreateRelations()
*-------------------- Location Section ---------------------
* Library: cDataEnv.PRG
* Class: cDataEnvironment
* Method: CreateRelations()
*--------------------- Usage Section -----------------------
*) Description:
*) Loops through the aRelations array, element by element
*) and adds the specified relation objects to the data
*) environment.
* Scope: Public
* Parameters: None
*$ Usage:
*$ cDataEnvironmant::CreateRelations()
*% Example:
*% This.CreateRelations()
* Returns: LOGICAL .T. by default
*------------------ Maintenance Section --------------------
*@ Inputs:
*@ 1. cDataEnvironment.aRelations[] - each element contains
*@ the name of the class definition from which to create
*@ the relation object. Usually defined in ADATAENV.PRG
*@ and populated into the array from the LoadRelations()
*@ method.
* Outputs:
* 1. Child relation objects are added to the DataEnvironment
* Pre-condition Invariants:
* 1. The developer must have populated the class definition
* in ADATAENV.PRG with the names of the relations that
* are to participate in the data environment.
* Post-condition Invariants:
* 1. All of the specified relations exist as child objects
* of the data environment. The names of these objects
* are the names of the class definitions of the relations
* with a "o" pre-pended, e.g. "oRelationClassDefinition"
* if the class definition's name was "RelationClassDefinition".
*? Notes: None
* Collaborating Methods:
* 1. DataEnvironment.AddObject()
*-- Process:
*-- 1. IF a name of the relation's class definition is
*-- present in the first element of the aRelation array
*-- 2. FOR every relation whose class definition was defined
*-- 3. Add the relation object to the data environment
*-- object as a child of the DE. The name of the
*-- object is derived by prepending a "o" to the
*-- name of the relation's class definition.
*-- ENDFOR
*-- ENDIF
* Change Log:
* MODIFIED
*--------- (c) Flash Creative Management, Inc. -------------
*---------------- Commenting Provided By -------------------
* Software Assets of Virginia, Inc. (SAVI)
* Charles T. Blankenship, President
* Compuserve: 76132,2575
* Internet: www.savvysolutions.com
* eMail 1: ctb@savvysolutions.com
* eMail 2: 76132.2575@compuserve.com
* Voice: (757)853-4465
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -