Exemplo n.º 1
0
        public static DynamicEntityList ExcuteSelectMultiDynamicObject(string packname, string procname, Object parameter)
        {
            List <USER_ARGUMENTS> lstUserArg = DalUtility.SelectUserArgs(packname, procname);

            OracleConnection conn = DBConnection.Instance.GetConnection();

            if (conn.State != ConnectionState.Open)
            {
                return(new DynamicEntityList());
            }

            OracleCommand command = conn.CreateCommand();

            if (!string.IsNullOrEmpty(packname))
            {
                command.CommandText = packname + "." + procname;
            }
            else
            {
                command.CommandText = procname;
            }

            command.CommandType = CommandType.StoredProcedure;
            command.BindByName  = true;

            DalUtility.LoadParametersFromObject(command, parameter, lstUserArg);

            return(Dal4DynamicObject.LoadObjectListFromDatabase(command));
        }
Exemplo n.º 2
0
        public static T ExcuteSelectObject <T>(string packname, string procname, Object parameter) where T : new()
        {
            try
            {
                List <USER_ARGUMENTS> lstUserArg = DalUtility.SelectUserArgs(packname, procname);

                OracleConnection conn    = DBConnection.Instance.GetConnection();
                OracleCommand    command = conn.CreateCommand();

                if (!string.IsNullOrEmpty(packname))
                {
                    command.CommandText = packname + "." + procname;
                }
                else
                {
                    command.CommandText = procname;
                }

                command.CommandType = CommandType.StoredProcedure;
                command.BindByName  = true;

                DalUtility.LoadParametersFromObject(command, parameter, lstUserArg);

                return(DalUtility.LoadObjectFromDatabase <T>(command));
            }
            catch (Exception ex)
            {
                DBConnection.Instance.Close();
                Util.Log.Instance.WriteExceptionLog(ex, "ExcuteSelectObject");
                return(new T());
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Just for report
        /// </summary>
        /// <param name="packname"></param>
        /// <param name="procname"></param>
        /// <param name="parameter"></param>
        /// <returns></returns>
        public static DataSet ExcuteSelectDataSet(string packname, string procname, Object parameter)
        {
            try
            {
                List <USER_ARGUMENTS> lstUserArg = DalUtility.SelectUserArgs(packname, procname);

                OracleConnection conn = DBConnection.Instance.GetConnection();
                if (conn.State != ConnectionState.Open)
                {
                    return(new DataSet());
                }

                OracleCommand command = conn.CreateCommand();

                if (!string.IsNullOrEmpty(packname))
                {
                    command.CommandText = packname + "." + procname;
                }
                else
                {
                    command.CommandText = procname;
                }

                command.CommandType = CommandType.StoredProcedure;
                command.BindByName  = true;

                DalUtility.LoadParametersFromObject(command, parameter, lstUserArg);

                DataSet           dsReturn = new DataSet();
                OracleDataAdapter adap     = new OracleDataAdapter(command);
                adap.Fill(dsReturn);

                List <USER_ARGUMENTS> lstRefCur = lstUserArg.FindAll(obj => obj.DATA_TYPE == DalUtility.ORACLE_CURSOR_TYPE);

                for (int idx = 0; idx < lstRefCur.Count; idx++)
                {
                    dsReturn.Tables[idx].TableName = lstRefCur[idx].ARGUMENT_NAME;
                }

                return(dsReturn);
            }
            catch (Exception ex)
            { throw ex; }
        }
Exemplo n.º 4
0
        public static bool ExcuteNonQuery(string packname, string procname, Object parameter)
        {
            try
            {
                int resutl;

                List <USER_ARGUMENTS> lstUserArg = DalUtility.SelectUserArgs(packname, procname);

                OracleConnection conn    = DBConnection.Instance.GetConnection();
                OracleCommand    command = conn.CreateCommand();

                if (!string.IsNullOrEmpty(packname))
                {
                    command.CommandText = packname + "." + procname;
                }
                else
                {
                    command.CommandText = procname;
                }

                command.CommandType = CommandType.StoredProcedure;
                command.BindByName  = true;

                DalUtility.LoadParametersFromObject(command, parameter, lstUserArg);

                resutl = command.ExecuteNonQuery();

                DalUtility.SetOutputValueToObject(command, parameter);

                return(true);
            }
            catch (Exception ex)
            {
                DBConnection.Instance.Close();
                Util.Log.Instance.WriteExceptionLog(ex, "ExcuteNonQuery");
                return(false);
            }
        }