Example #1
0
        /// <summary>
        /// 根据id获取用户角色信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static UserRole GetUserRoleInfoById(Guid id)
        {
            UserRole       info  = null;
            IDbConnection  conn  = null;
            IDbCommand     cmd   = null;
            IDbTransaction trans = null;

            try
            {
                IUserRole dp = DataProvider.DbUserRoleDP;
                conn = DbConnOperation.CreateMySqlConnection();
                cmd  = conn.CreateCommand();
                conn.Open();
                trans           = conn.BeginTransaction();
                cmd.Transaction = trans;
                info            = dp.GetUserRoleInfoById(cmd, id);
                trans.Commit();
            }
            catch (Exception ex)
            {
                if (trans != null)
                {
                    trans.Rollback();
                }
                log.Error(string.Format("GetUserRoleInfoById()出错,错误信息如下:{0}", ex.Message));
            }
            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }
            }
            return(info);
        }