Пример #1
0
        /// <summary>
        /// 获取用户登录列表
        /// </summary>
        /// <param name="fields"></param>
        /// <param name="whereCondition"></param>
        /// <param name="startIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public List <UserLogin> GetUserLoginInfoPageList(string fields, string whereCondition, int startIndex, int pageSize)
        {
            List <UserLogin> list  = new List <UserLogin>();
            IDbConnection    conn  = null;
            IDbCommand       cmd   = null;
            IDbTransaction   trans = null;

            try
            {
                IUserLogin dp = DataProvider.DbUserLoginDP;
                conn = DbConnOperation.CreateMySqlConnection();
                cmd  = conn.CreateCommand();
                conn.Open();
                trans           = conn.BeginTransaction();
                cmd.Transaction = trans;
                list            = dp.GetUserLoginInfoPageList(cmd, fields, whereCondition, startIndex, pageSize);
                trans.Commit();
            }
            catch (Exception ex)
            {
                if (trans != null)
                {
                    trans.Rollback();
                }
                log.Error(string.Format("GetUserLoginInfoPageList()出错,错误信息如下:{0}", ex.Message));
            }
            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }
            }
            return(list);
        }