Exemple #1
0
        public bool Read()
        {
            bool result = false;

            if (buffer != null)
            {
                if (!IsLastRecordReaded || !dbReader.IsClosed)
                {
                    if (!isFirstRecordReaded)
                    {
                        if (!dbReader.Read())
                        {
                            if (!isFirstRecordReaded)
                            {
                                dbReader.Close();
                                Connection.Close();
                            }
                            IsLastRecordReaded = true;
                            buffer             = null;
                            return(false);
                        }
                        isFirstRecordReaded = true;
                    }
                    buffer.RemoveAll();
                    for (int i = 0; i < dbReader.FieldCount; i++)
                    {
                        object value = null;

                        // dont forget to truncate oracle decimal to normal .net decimal

                        var oraReader = (Oracle.ManagedDataAccess.Client.OracleDataReader)dbReader;
                        if (!dbReader.IsDBNull(i) && oraReader.GetProviderSpecificFieldType(i) == typeof(Oracle.ManagedDataAccess.Types.OracleDecimal))
                        {
                            value = (decimal)Oracle.ManagedDataAccess.Types.OracleDecimal.SetPrecision(oraReader.GetOracleDecimal(i), 28);
                        }
                        else
                        {
                            value = dbReader[i];
                        }


                        buffer.SetArrayItem(i, value);
                        buffer.SetArrayItem(dbReader.GetName(i), value);
                    }
                    if (!dbReader.IsClosed && !dbReader.Read())
                    {
                        IsLastRecordReaded = true;
                        dbReader.Close();
                        Connection.Close();
                    }
                    result = true;
                }
                else
                {
                    buffer = null;
                }
            }
            return(result);
        }
Exemple #2
0
        public bool Read()
        {
            bool result = false;
            if (buffer != null)
            {
                if (!IsLastRecordReaded || !dbReader.IsClosed)
                {
                    if (!isFirstRecordReaded)
                    {
                        if (!dbReader.Read())
                        {
                            if (!isFirstRecordReaded)
                            {
                                dbReader.Close();
                                Connection.Close();
                            }
                            IsLastRecordReaded = true;
                            buffer = null;
                            return false;
                        }
                        isFirstRecordReaded = true;
                    }
                    buffer.RemoveAll();
                    for (int i = 0; i < dbReader.FieldCount; i++)
                    {
						object value = null;
						if(ConnectionType == Constants.nDATABASE_Oracle)
						{
						}
						else
						{
							value = dbReader[i];
							//if(value is DBNull)
							//	value = null;
						}

                        buffer.SetArrayItem(i, value);
                        buffer.SetArrayItem(dbReader.GetName(i), value);
                    }
                    if (!dbReader.IsClosed && !dbReader.Read())
                    {
                        IsLastRecordReaded = true;
                        dbReader.Close();
                        Connection.Close();
                    }
                    result = true;
                }
                else
                {
                    buffer = null;
                }
            }
            return result;
        }
Exemple #3
0
        private XVar buildPfImportRecordPrimaryKeyClause(dynamic record)
        {
            XVar recordWhereClause = new XVar();
            XVar value;

            if (record.TryGetValue("IMPORT_ID", out value))
            {
                if (value != null && value.IsString() && (value.ToString().Length > 0))
                {
                    recordWhereClause.SetArrayItem("IMPORT_ID", value);
                }
                else
                {
                    throw new NullReferenceException("IMPORT_ID was null in a data retreived from non null column");
                }
            }
            else
            {
                throw new Exception("Unable to retrieve IMPORT_ID from table xxcok.xxcok_rm_import_pf");
            }
            if (record.TryGetValue("IMPORT_DATE", out value))
            {
                if (value != null && value.Value is DateTime)
                {
                    DateTime import_datetime = (DateTime)value.Value;
                    recordWhereClause.SetArrayItem("IMPORT_DATE", import_datetime.ToString("yyyyMMdd"));
                }
                else
                {
                    throw new NullReferenceException("IMPORT_DATE was null in a data retreived from non null column");
                }
            }
            else
            {
                throw new Exception("Unable to retrieve IMPORT_DATE from table xxcok.xxcok_rm_import_pf");
            }
            if (record.TryGetValue("PAYMENT_ID", out value))
            {
                if (value != null && value.IsNumeric())
                {
                    recordWhereClause.SetArrayItem("PAYMENT_ID", value.ToString());
                }
                else
                {
                    throw new NullReferenceException("PAYMENT_ID was null in a data retreived from non null column");
                }
            }
            else
            {
                throw new Exception("Unable to retrieve PAYMENT_ID from table xxcok.xxcok_rm_import_pf");
            }
            return(recordWhereClause);
        }
Exemple #4
0
        private void buildRiskMasterPaymentErrorList(dynamic record, string errorMessage)
        {
            XVar insertErrorRow = buildPfImportRecordPrimaryKeyClause(record);

            insertErrorRow.SetArrayItem("ERROR_DESCR", errorMessage);
            insertErrorList.Add(insertErrorRow);
        }
Exemple #5
0
        private void updateCokRiskmasterPfImportRecord(XVar recordWhereClause, string isValid)
        {
            XVar setIsValidColumn = new XVar();

            setIsValidColumn.SetArrayItem("IS_VALID", isValid);
            oracleDBFacade.Update("xxcok.xxcok_rm_import_pf", setIsValidColumn, recordWhereClause);
        }
Exemple #6
0
 public RunnerDBReader(DbDataReader reader)
 {
     this.dbReader      = reader;
     IsLastRecordReaded = false;
     for (int i = 0; i < this.dbReader.FieldCount; i++)
     {
         fieldsNames.SetArrayItem(i, this.dbReader.GetName(i));
         fieldsTypes[i] = this.dbReader.GetFieldType(i);
     }
 }
Exemple #7
0
        private XVar parsePdCsvRowListToDictionary(IList <string> csvRowList)
        {
            XVar pdCsvRowDictionary = new XVar();

            pdCsvRowDictionary.SetArrayItem("IMPORT_ID", RiskMasterCsvParser._pd_import_id);
            pdCsvRowDictionary.SetArrayItem("IMPORT_DATE", RiskMasterCsvParser._import_date);
            pdCsvRowDictionary.SetArrayItem("IS_VALID", "0");
            pdCsvRowDictionary.SetArrayItem("IS_PROCESSED", "0");
            // row delimiter passed in?
            if (csvRowList.Count != 11)
            {
                throw new Exception("Pd CSV file should have 11 columns. Unable to discover 11 columns");
            }

            for (int rowNum = 0; rowNum < 11; ++rowNum)
            {
                pdCsvRowDictionary.SetArrayItem(_pdCsvColumnNames[rowNum], csvRowList[rowNum]);
            }

            //pfCsvRowDictionary.Add
            return(pdCsvRowDictionary);
        }
Exemple #8
0
        public RunnerDBReader(DbDataReader reader)
        {
            this.dbReader = reader;
            IsLastRecordReaded = false;
            for (int i = 0; i < this.dbReader.FieldCount; i++)
            {
                fieldsNames.SetArrayItem(i, this.dbReader.GetName(i));
                fieldsTypes[i] = this.dbReader.GetFieldType(i);
            }
			
			if(dbReader is System.Data.SqlClient.SqlDataReader)
				ConnectionType = Constants.nDATABASE_MSSQLServer;
			if(dbReader is System.Data.OleDb.OleDbDataReader)
				ConnectionType = Constants.nDATABASE_Access;
        }
Exemple #9
0
        /**
         * An interface stub
         * Fetch a result row as a numeric array
         * @param Mixed qHanle		The query handle
         * @return Array
         */
        public XVar fetch_numarray(dynamic qHanle)
        {
            //db_fetch_numarray
            if (qHanle != null)
            {
                RunnerDBReader reader = (RunnerDBReader)qHanle;
                if (reader.Read())
                {
                    XVar result = new XVar();
                    for (int i = 0; i < reader.FieldCount; i++)
                    {
                        result.SetArrayItem(i, reader[i]);
                    }
                    return(result);
                }
            }

            return(XVar.Array());
        }