Ejemplo n.º 1
0
        }//ENd getHeaderColumnNo method

        // =====================================================================================
        /// <summary>
        /// this method updates a table cell value form the query result set.
        /// Note:  the cell indexes are zero based.
        /// </summary>
        /// <param name="Row">The DataRow containing the field</param>
        /// <param name="Col">Int: The column index in the able.</param>
        /// <param name="RecordField"> Evado.Model.Forms.EvFormField object, containg the field data.</param>
        // -------------------------------------------------------------------------------------
        private String getTableColumnValue(DataRow Row, int Col, Evado.Digital.Model.EdRecordField RecordField)
        {
            LogMethod("getTableColumnValue");
            //
            // Select the column to retieve the value from
            //
            switch (RecordField.Table.Header [Col].TypeId)
            {
            case EvDataTypes.Numeric:
            {
                float fltValue = EvSqlMethods.getFloat(Row, EdRecordValues.DB_VALUES_NUMERIC);
                return(fltValue.ToString( ));
            }

            case EvDataTypes.Yes_No:
            {
                bool   bYesNo = EvSqlMethods.getBool(Row, EdRecordValues.DB_VALUES_NUMERIC);
                string value  = "No";
                if (bYesNo == true)
                {
                    value = "Yes";
                }
                return(value);
            }

            case EvDataTypes.Date:
            {
                DateTime dtValue = EvSqlMethods.getDateTime(Row, EdRecordValues.DB_VALUES_DATE);

                if (dtValue == Evado.Model.EvStatics.CONST_DATE_NULL)
                {
                    return(String.Empty);
                }

                //
                // Return the value.
                //
                return(dtValue.ToString("dd MMM yyyy"));
            }

            default:
            {
                return(EvSqlMethods.getString(Row, EdRecordValues.DB_VALUES_STRING));
            }
            } //END table column type switch.
        }     //END getTableColumnValue method
Ejemplo n.º 2
0
        // =====================================================================================
        /// <summary>
        /// This class reads the content of the data reader object into ChecklistItem business object.
        /// </summary>
        /// <param name="Row">DataRow: an Sql DataReader object</param>
        /// <returns>EvFormField: a formfield object</returns>
        /// <remarks>
        /// This method consists of the following steps:
        ///
        /// 1. Extract the compatible row data to the formfield object.
        ///
        /// 2. Deserialize the xmlData to the formfield design object if it exists.
        ///
        /// 3. Deserialize the xmlvalidationRules to the formfield validationRules object if they exist.
        ///
        /// 4. Reset the horizontal radion button list enumertion
        ///
        /// 5. Ensure that the formfield state is not null.
        ///
        /// 6. if skip retrieving comments is selected, fill the comment list and format it
        ///
        /// 7. Get the table object and the external selection list object.
        ///
        /// 8. Process the NA values in selectionlists.
        ///
        /// 9. Update the current formfield state and type object.
        ///
        /// 10. Return the formfield object.
        /// </remarks>
        // -------------------------------------------------------------------------------------
        private EdRecordField getRowData(
            DataRow Row)
        {
            this.LogMethod("getRowData method");
            //
            // Initialise method template table string, a return formfield object and an annotation string.
            //
            string        stTemplateTable = String.Empty;
            EdRecordField recordField     = new EdRecordField( );

            //
            // Fill the evForm object.l
            //
            recordField.Guid       = EvSqlMethods.getGuid(Row, EdRecordValues.DB_VALUES_GUID);
            recordField.RecordGuid = EvSqlMethods.getGuid(Row, EdRecords.DB_RECORD_GUID);
            recordField.LayoutGuid = EvSqlMethods.getGuid(Row, EdRecordLayouts.DB_LAYOUT_GUID);
            recordField.FieldGuid  = EvSqlMethods.getGuid(Row, EdRecordValues.DB_FIELD_GUID);


            recordField.FieldId = EvSqlMethods.getString(Row, EdRecordFields.DB_FIELD_ID);
            String value = EvSqlMethods.getString(Row, EdRecordFields.DB_TYPE_ID);

            recordField.Design.TypeId = Evado.Model.EvStatics.parseEnumValue <Evado.Model.EvDataTypes> (value);

            recordField.Design.Title                   = EvSqlMethods.getString(Row, EdRecordFields.DB_TITLE);
            recordField.Design.Instructions            = EvSqlMethods.getString(Row, EdRecordFields.DB_INSTRUCTIONS);
            recordField.Design.HttpReference           = EvSqlMethods.getString(Row, EdRecordFields.DB_HTTP_REFERENCE);
            recordField.Design.SectionNo               = EvSqlMethods.getInteger(Row, EdRecordFields.DB_SECTION_ID);
            recordField.Design.Options                 = EvSqlMethods.getString(Row, EdRecordFields.DB_OPTIONS);
            recordField.Design.IsSummaryField          = EvSqlMethods.getBool(Row, EdRecordFields.DB_SUMMARY_FIELD);
            recordField.Design.Mandatory               = EvSqlMethods.getBool(Row, EdRecordFields.DB_MANDATORY);
            recordField.Design.AiDataPoint             = EvSqlMethods.getBool(Row, EdRecordFields.DB_AI_DATA_POINT);
            recordField.Design.HideField               = EvSqlMethods.getBool(Row, EdRecordFields.DB_HIDDEN);
            recordField.Design.ExSelectionListId       = EvSqlMethods.getString(Row, EdRecordFields.DB_EX_SELECTION_LIST_ID);
            recordField.Design.ExSelectionListCategory = EvSqlMethods.getString(Row, EdRecordFields.DB_EX_SELECTION_LIST_CATEGORY);
            recordField.Design.DefaultValue            = EvSqlMethods.getString(Row, EdRecordFields.DB_DEFAULT_VALUE);
            recordField.Design.Unit        = EvSqlMethods.getString(Row, EdRecordFields.DB_UNIT);
            recordField.Design.UnitScaling = EvSqlMethods.getString(Row, EdRecordFields.DB_UNIT_SCALING);

            recordField.Design.ValidationLowerLimit  = EvSqlMethods.getFloat(Row, EdRecordFields.DB_VALIDATION_LOWER_LIMIT);
            recordField.Design.ValidationUpperLimit  = EvSqlMethods.getFloat(Row, EdRecordFields.DB_VALIDATION_UPPER_LIMIT);
            recordField.Design.AlertLowerLimit       = EvSqlMethods.getFloat(Row, EdRecordFields.DB_ALERT_LOWER_LIMIT);
            recordField.Design.AlertUpperLimit       = EvSqlMethods.getFloat(Row, EdRecordFields.DB_ALERT_UPPER_LIMIT);
            recordField.Design.NormalRangeLowerLimit = EvSqlMethods.getFloat(Row, EdRecordFields.DB_NORMAL_LOWER_LIMITD);
            recordField.Design.NormalRangeUpperLimit = EvSqlMethods.getFloat(Row, EdRecordFields.DB_NORMAL_UPPER_LIMIT);

            recordField.Design.FieldCategory        = EvSqlMethods.getString(Row, EdRecordFields.DB_FIELD_CATEGORY);
            recordField.Design.AnalogueLegendStart  = EvSqlMethods.getString(Row, EdRecordFields.DB_ANALOGUE_LEGEND_START);
            recordField.Design.AnalogueLegendFinish = EvSqlMethods.getString(Row, EdRecordFields.DB_ANALOGUE_LEGEND_FINISH);
            recordField.Design.JavaScript           = EvSqlMethods.getString(Row, EdRecordFields.DB_JAVA_SCRIPT);
            recordField.Design.InitialOptionList    = EvSqlMethods.getString(Row, EdRecordFields.DB_INITIAL_OPTION_LIST);
            recordField.Design.InitialVersion       = EvSqlMethods.getInteger(Row, EdRecordFields.DB_INITIAL_VERSION);
            //
            // if the field is a signature then decrypt the field.
            //
            if (recordField.TypeId == EvDataTypes.Signature)
            {
                this.LogDebug("Encrypted Signature string");
                EvEncrypt encrypt = new EvEncrypt(this.ClassParameters.AdapterGuid, recordField.Guid);
                encrypt.ClassParameters = this.ClassParameters;

                value = encrypt.decryptString(recordField.ItemText);
                this.LogDebug("clear string: " + value);
                recordField.ItemText = value;

                this.LogClass(encrypt.Log);
            }

            //
            // Get the table or matric object.
            //
            this.processTableRowObject(Row, recordField);

            //
            // Return the formfield object.
            //
            this.LogMethodEnd("getRowData");
            return(recordField);
        }//END getRowData method.
Ejemplo n.º 3
0
        // =====================================================================================
        /// <summary>
        /// This class reads the content of the SqlDataReader into the Report data object.
        /// </summary>
        /// <param name="Row">DataRow: a data row object.</param>
        /// <param name="Columns">List of EvReportColumn: a list of report columns</param>
        /// <returns>EvReportRow: a report row object</returns>
        /// <remarks>
        /// This method consists of the following steps:
        ///
        /// 1. Loop through the Report's columns list
        ///
        /// 2. Switch data type to update the Report object's column values.
        ///
        /// 3. Return the Report object.
        /// </remarks>
        // -------------------------------------------------------------------------------------
        private EdReportRow readRow(DataRow Row, List <EdReportColumn> Columns)
        {
            //
            // Initialize the return report row object.
            //
            EdReportRow reportRow = new EdReportRow(Columns.Count);

            //
            // Loop through the report columns list.
            //
            for (int columnCount = 0; columnCount < Columns.Count; columnCount++)
            {
                //
                // Switch column's datatype for updating the column values.
                //
                switch (Columns [columnCount].DataType)
                {
                case EdReport.DataTypes.Bool:
                {
                    reportRow.ColumnValues [columnCount] = EvSqlMethods.getBool(Row, Columns [columnCount].SourceField).ToString( );
                    break;
                }

                case EdReport.DataTypes.Date:
                {
                    DateTime dateVal = EvSqlMethods.getDateTime(Row, Columns [columnCount].SourceField);
                    if (dateVal != Evado.Model.EvStatics.CONST_DATE_NULL)
                    {
                        reportRow.ColumnValues [columnCount] = dateVal.ToString("dd MMM yyyy HH:mm:ss");
                    }
                    else
                    {
                        reportRow.ColumnValues [columnCount] = "";
                    }

                    break;
                }

                case EdReport.DataTypes.Integer:
                {
                    reportRow.ColumnValues [columnCount] = EvSqlMethods.getInteger(Row, Columns [columnCount].SourceField).ToString( );
                    break;
                }

                case EdReport.DataTypes.Float:
                case EdReport.DataTypes.Currency:
                {
                    reportRow.ColumnValues [columnCount] = EvSqlMethods.getFloat(Row, Columns [columnCount].SourceField).ToString( );
                    break;
                }

                default:
                {
                    String val = EvSqlMethods.getString(Row, Columns [columnCount].SourceField);
                    if (val == "Null")
                    {
                        val = String.Empty;
                    }
                    reportRow.ColumnValues [columnCount] = val;
                    break;
                }
                } //END Type switch
            }     //END column interation loop.

            //
            // Return the Report object
            //
            return(reportRow);
        }// End readRow method.