示例#1
0
        public long GetSecLog()
        {
            long rtn = -1;

            OracleCommand cmd = CrearCommand();

            cmd.CommandText = "SecLog";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("rtn", OracleDbType.Single, rtn, ParameterDirection.ReturnValue);
            try
            {
                object        o   = cmd.ExecuteScalar();
                OracleDecimal oee = (OracleDecimal)cmd.Parameters[0].Value;
                rtn = (long)oee.ToDouble();
            }
            catch (Exception exception)
            {
                PistaMgr.Instance.Error("DALSisFalla", exception);
            }
            finally
            {
                DisposeCommand(cmd);
            }
            return(rtn);
        }
示例#2
0
 public override object ConvertDbValue(object value, Type expectedType)
 {
     if (value == null || value == DBNull.Value)
     {
         return(null);
     }
     if (expectedType.IsGenericType && expectedType.GetGenericTypeDefinition() == typeof(Nullable <>))
     {
         Type innerType = Nullable.GetUnderlyingType(expectedType);
         return(ConvertDbValue(value, innerType));
     }
     if (expectedType.IsEnum)
     {
         Type innerType = Enum.GetUnderlyingType(expectedType);
         return(Enum.ToObject(expectedType, ConvertDbValue(value, innerType)));
     }
     if (value is OracleDecimal)
     {
         OracleDecimal newValue = (OracleDecimal)value;
         if (expectedType == typeof(byte))
         {
             return(newValue.ToByte());
         }
         if (expectedType == typeof(Int16))
         {
             return(newValue.ToInt16());
         }
         if (expectedType == typeof(Int32))
         {
             return(newValue.ToInt32());
         }
         if (expectedType == typeof(Int64))
         {
             return(newValue.ToInt64());
         }
         if (expectedType == typeof(Single))
         {
             return(newValue.ToSingle());
         }
         if (expectedType == typeof(Double))
         {
             return(newValue.ToDouble());
         }
         if (expectedType == typeof(bool))
         {
             return(Convert.ToBoolean(newValue.ToInt32()));
         }
         throw new Exception("未实现Oracle.ManagedDataAccess.Types.OracleDecimal转化" + expectedType);
     }
     return(Convert.ChangeType(value, expectedType));
 }