import SK_PUZZLE_PKG:Model:*; class PuzzleModel /******************************************************* P R O P E R T I E S *******************************************************/ property string PuzzleId get set; property string Description get set; property number ElapsedTime get set; property array of any PuzzleCells; /********************************************************* C O N S T R U C T O R D E C L A R A T I O N *********************************************************/ method PuzzleModel(); /******************************************************* P U B L I C M E T H O D D E C L A I R A T I O N *******************************************************/ method getPuzzle(&p_strPuzzleId As string); private /******************************************************* P R I V A T E M E T H O D D E C L A I R A T I O N *******************************************************/ method getCells(&p_strPuzzleId As string); /******************************************************* P R I V A T E I N S T A N C E V A R I A B L E S *******************************************************/ instance string &i_strSkPuzzleId; instance string &i_strSkDescr; instance number &i_nbrSkElapsedTime; end-class; /* PuzzleModel */ /********************************************************* C O N S T R U C T O R M E T H O D *********************************************************/ method PuzzleModel end-method; /* PuzzleModel */ /******************************************************* G E T T E R M E T H O D S *******************************************************/ /******************************* Getter Method PuzzleId ******************************/ get PuzzleId /+ Returns String +/ Return &i_strSkPuzzleId; end-get; /* PuzzleId */ /******************************* Getter Method Description ******************************/ get Description /+ Returns String +/ Return &i_strSkDescr; end-get; /* Description */ /******************************* Getter Method ElapsedTime ******************************/ get ElapsedTime /+ Returns Number +/ Return &i_nbrSkElapsedTime; end-get; /* ElapsedTime */ /******************************************************* S E T T E R M E T H O D S *******************************************************/ /******************************* Setter Method PuzzleId ******************************/ set PuzzleId /+ &NewValue as String +/ &i_strSkPuzzleId = &NewValue; end-set; /* PuzzleId */ /******************************* Setter Method Description ******************************/ set Description /+ &NewValue as String +/ &i_strSkDescr = &NewValue; end-set; /* Description */ /******************************* Setter Method ElapsedTime ******************************/ set ElapsedTime /+ &NewValue as Number +/ &i_nbrSkElapsedTime = &NewValue; end-set; /* ElapsedTime */ /******************************************************* P U B L I C M E T H O D S *******************************************************/ /******************************* Method getPuzzle ******************************/ method getPuzzle /+ &p_strPuzzleId as String +/ Local number &i; Local Record &recSkPuzzleTbl; &recSkPuzzleTbl = CreateRecord(Record.SK_PUZZLE_TBL); &recSkPuzzleTbl.SK_PUZZLE_ID.Value = &p_strPuzzleId; If &recSkPuzzleTbl.SelectByKey() Then %this.PuzzleId = &recSkPuzzleTbl.SK_PUZZLE_ID.Value; %This.Description = &recSkPuzzleTbl.SK_DESCR.Value; %This.ElapsedTime = &recSkPuzzleTbl.SK_ELAPSED_TIME.Value; %This.PuzzleCells = CreateArray(); For &i = 1 To 81 %This.PuzzleCells [&i] = create SK_PUZZLE_PKG:Model:CellModel(&i, 0, False); End-For; %This.getCells(&p_strPuzzleId); End-If; end-method; /* getPuzzle */ /******************************************************* P R I V A T E M E T H O D S *******************************************************/ /******************************* Method getCells ******************************/ method getCells /+ &p_strPuzzleId as String +/ Local number &nbrSkCellNbr; Local number &nbrSkCellValue; Local string &strSkGivenValue; Local SQL &SQL; &SQL = GetSQL(SQL.SK_CELL_SQL, &p_strPuzzleId); While &SQL.Fetch(&nbrSkCellNbr, &nbrSkCellValue, &strSkGivenValue); %This.PuzzleCells [&nbrSkCellNbr].CellNumber = &nbrSkCellNbr; %This.PuzzleCells [&nbrSkCellNbr].CellValue = &nbrSkCellValue; If &strSkGivenValue = "Y" Then %This.PuzzleCells [&nbrSkCellNbr].GivenValue = True Else %This.PuzzleCells [&nbrSkCellNbr].GivenValue = False End-If; End-While; end-method; /* getCells */