Beispiel #1
0
        public string readCellFromDb(OracleDataReader reader, int i)
        {
            string type = reader.GetFieldType(i).ToString();

            switch (type)
            {
            case "System.String":
                return(reader.GetOracleString(i).IsNull ? "" : reader.GetString(i));

            case "System.DateTime":
            {
                return(reader.GetOracleDate(i).IsNull ? "" : reader.GetDateTime(i).ToString());
            }

            case "System.Character":
            {
                return(reader.GetChar(i).ToString());
            }

            case "System.Decimal":
            {
                return(reader.GetOracleDecimal(i).IsNull ? "" : System.Convert.ToString(reader.GetDecimal(i)));
            }

            case "System.Int64":
            {
                return(System.Convert.ToString(reader.GetInt64(i)));
            }
            }
            return("");
        }
Beispiel #2
0
        public override char GetChar(int ordinal)
        {
            var value = source.GetValue(ordinal);

            if (value is string)
            {
                return(((string)value)[0]);
            }
            if (value is ValueType)
            {
                return(Convert.ToChar(value));
            }

            return(source.GetChar(ordinal));
        }
        public void Retrieve_theBlocked_Users_Data()
        {
            numofBlockedUsers = Num_of_Blocked_Users();
            if (numofBlockedUsers == -1)
            {
                return;
            }

            userName = new string[numofBlockedUsers];
            Email    = new string[numofBlockedUsers];
            Blocked  = new char[numofBlockedUsers];
            con      = new OracleConnection(_connectionString);
            cmd      = new OracleCommand();

            cmd.Connection = con;

            cmd.CommandText = "Retrieve_theBlocked_Users_Data";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("cursor", OracleDbType.RefCursor, DBNull.Value, ParameterDirection.Output);

            try
            {
                con.Open();

                dr = cmd.ExecuteReader();
                int count = 0;
                while (dr.Read())
                {
                    userName[count]  = dr["userName"].ToString();
                    Email[count]     = dr.GetString(1).ToString();
                    Blocked[count++] = dr.GetChar(2);
                }
                dr.Close();
            }
            catch (Exception e)
            { }
            finally
            {
                if (con.State == System.Data.ConnectionState.Open)
                {
                    con.Close();
                }
            }
        }
Beispiel #4
0
        private IEnumerable <IntegrityHash> GetDataIntegrityHash()
        {
            List <IntegrityHash> listIntegrityHash = new List <IntegrityHash>();
            string sqlQuery = "SELECT * FROM CMP_VERIFIC_INTEGRIDADE_HASH";

            try
            {
                using (OracleConnection oracleConnection = new OracleConnection(ConnectionString))
                {
                    using (var command = new OracleCommand(sqlQuery, oracleConnection))
                    {
                        oracleConnection.Open();
                        command.CommandType = CommandType.Text;
                        OracleDataReader dataReader = command.ExecuteReader();

                        while (dataReader.Read())
                        {
                            listIntegrityHash.Add(new IntegrityHash()
                            {
                                ObjectSystemId       = dataReader.GetDecimal("N_COD_SISTEMA_OBJETO"),
                                ObjectName           = dataReader.GetString("S_NOME_OBJETO"),
                                ObjectType           = dataReader.GetString("S_TIPO_OBJETO"),
                                VersionAlteredObject = dataReader.IsDBNull("S_VERSAO_ALTEROU_OBJETO") ? null : dataReader.GetString("S_VERSAO_ALTEROU_OBJETO"),
                                CreationDate         = dataReader.GetDateTime("D_DATA_CRIACAO"),
                                ObjectHash           = dataReader.GetString("S_HASH_OBJETO"),
                                Flag = dataReader.IsDBNull("S_FLAG") ? null : dataReader.GetChar("S_FLAG").ToString()
                            });
                        }
                        return(listIntegrityHash);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 public char GetChar(int i)
 {
     return(reader.GetChar(i));
 }