示例#1
0
        /// <summary>
        /// 根据id删除角色信息
        /// </summary>
        /// <param name="id">编号</param>
        /// <returns></returns>
        public bool DeleteRoleInfo(Guid id)
        {
            bool           ret   = false;
            IDbConnection  conn  = null;
            IDbCommand     cmd   = null;
            IDbTransaction trans = null;

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