예제 #1
0
        /// <summary>
        /// 执行储存过程
        /// </summary>
        /// <param name="sProcedureName"></param>
        /// <param name="Parameters"></param>
        public int ExcuteProcedure(string sProcedureName, DbParameters Parameters)
        {
            IDbConnection conn = null;

            try
            {
                conn = GetSqlConnection();
                if (conn == null)
                {
                    throw new ApplicationException("未获取到连接对象.");
                }
                return(DoExcuteProcedure(conn, sProcedureName, Parameters.GetParameters()));
            }
            catch (Exception ex)
            {
                logger.Info(ex.Message);
                logger.Fatal(ex);
                return(-1);
            }
            finally
            {
                CloseConnect(conn);
            }
        }
예제 #2
0
        /// <summary>
        /// 分页获取数据
        /// </summary>
        /// <param name="sqlCommand"></param>
        /// <param name="pageInfo"></param>
        /// <param name="parameter"></param>
        /// <returns></returns>
        public PageResult PaginationQuery <T>(string sqlCommand, PageInfo pageInfo, DbParameters Parameters)
        {
            IDbConnection conn = null;

            try
            {
                conn = GetSqlConnection();
                if (conn == null)
                {
                    throw new ApplicationException("未获取到连接对象。");
                }
                return(DoPaginationQuery <T>(conn, sqlCommand, pageInfo, Parameters.GetParameters()));
            }
            catch (Exception ex)
            {
                logger.Info(ex.Message);
                logger.Fatal(ex);
                return(default(PageResult));
            }
            finally
            {
                CloseConnect(conn);
            }
        }