////// <summary>
        ////// 分页查询
        ////// </summary>
        ////// <param name="pageIndex"></param>
        ////// <param name="pageSize"></param>
        ////// <param name="whLamdba"></param>
        ////// <param name="recordCount"></param>
        ////// <param name="pageCount"></param>
        ////// <returns></returns>
        ///public List<SYS_ROLE_MENU_BUTTON> PageQuery<TKey>(int pageIndex, int pageSize, Expression<Func<SYS_ROLE_MENU_BUTTON, bool>> whLamdba,Expression<Func<SYS_ROLE_MENU_BUTTON, TKey>> orderByLamdba, out int recordCount, out int pageCount)
        ///{
        ///    List<SYS_ROLE_MENU_BUTTON> list = null;
        ///    try
        ///    {
        ///        if (pageIndex == 0)
        ///        {
        ///            pageIndex = 1;
        ///        }
        ///        list = idal.PageQuery(pageIndex, pageSize, out recordCount, out pageCount, whLamdba, orderByLamdba);
        ///    }
        ///    catch (Exception ex)
        ///    {
        ///        recordCount = 0;
        ///        pageCount = 0;
        ///        Logger.Error(string.Format("SYS_ROLE_MENU_BUTTON_BLL 分页查询异常,异常信息:{0}", ex.ToString()));
        ///    }
        ///    return list;
        ///}

        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="modle"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="recordCount"></param>
        /// <param name="pageCount"></param>
        /// <returns></returns>
        public DataTable PageQuery(SYS_ROLE_MENU_BUTTON modle, int pageIndex, int pageSize, out int recordCount, out int pageCount)
        {
            DataTable dt = new DataTable();

            using (var dbcontext = DbFactory.Create())
            {
                try
                {
                    SearchCondition condition = new SearchCondition();
                    if (modle != null)
                    {
                        #region 组装查询条件

                        //if (!string.IsNullOrWhiteSpace(modle.PlayerNickname))
                        //{
                        //    condition.AddCondition("a.PlayerNickname", modle.PlayerNickname, SqlOperator.Like, true);
                        //}

                        #endregion
                    }
                    PagerInfo pager = new PagerInfo();
                    #region 组装存储过程调用参数


                    //pager.curPage = pageIndex;
                    //pager.pageSize = pageSize;
                    //pager.isDescending = true;
                    //pager.fields = "a.*,c.GameName";
                    //pager.sortField = "a.UploadTime";
                    //pager.indexField = "a.ID";
                    //pager.where = null;
                    //pager.condition = condition;
                    //pager.tableName = "[ZhpGame].[dbo].[Zhp_GameRecord] a left join  [Zhp_OnlineGame] b on a.Gameid=b.Gameid left join [Zhp_GameConfig] c on b.GameCode= c.GameCode ";

                    #endregion
                    dt = dbcontext.PageQuery(pager, out recordCount, out pageCount);
                }
                catch (Exception ex)
                {
                    recordCount = 0;
                    pageCount   = 0;
                    Logger.Error(string.Format("SYS_ROLE_MENU_BUTTON_BLL 分页查询异常,异常信息:{0}", ex.ToString()));
                }
            }
            return(dt);
        }
        /// <summary>
        /// 根据主键获取实体
        /// </summary>
        /// <param name="pkId">主键</param>
        /// <returns></returns>
        public SYS_ROLE_MENU_BUTTON GetById(string pkId)
        {
            SYS_ROLE_MENU_BUTTON model = null;

            using (var dbcontext = DbFactory.Create())
            {
                try
                {
                    int id = Convert.ToInt32(pkId);
                    Expression <Func <SYS_ROLE_MENU_BUTTON, bool> > exp = a => a.ID == id;
                    model = dbcontext.Get(exp);
                }
                catch (Exception ex)
                {
                    Logger.Error(string.Format("SYS_ROLE_MENU_BUTTON_BLL 根据主键获取实体异常,异常信息:{0}", ex.ToString()));
                }
            }
            return(model);
        }
        /// <summary>
        /// 编辑
        /// </summary>
        /// <param name="model">新实体</param>
        /// <returns></returns>
        public bool Edit(SYS_ROLE_MENU_BUTTON model)
        {
            bool success = false;

            using (var dbcontext = DbFactory.Create())
            {
                try
                {
                    dbcontext.Update(model);
                    dbcontext.Save();
                    success = true;
                }
                catch (Exception ex)
                {
                    success = false;
                    Logger.Error(string.Format("SYS_ROLE_MENU_BUTTON_BLL 编辑记录异常,异常信息:{0}", ex.ToString()));
                }
            }
            return(success);
        }
        /// <summary>
        /// 根据条件获取列表
        /// </summary>
        /// <param name="querymodel">条件</param>
        /// <returns></returns>
        public List <SYS_ROLE_MENU_BUTTON> GetList(SYS_ROLE_MENU_BUTTON querymodel)
        {
            List <SYS_ROLE_MENU_BUTTON> list = null;

            using (var dbcontext = DbFactory.Create())
            {
                try
                {
                    int id = Convert.ToInt32(querymodel.ID);
                    Expression <Func <SYS_ROLE_MENU_BUTTON, bool> > exp  = a => a.ID == id;
                    Expression <Func <SYS_ROLE_MENU_BUTTON, bool> > temp = a => 1 == 1;
                    exp  = CompileLinqSearch.AndAlso(exp, temp);
                    list = dbcontext.Find(exp);
                }
                catch (Exception ex)
                {
                    Logger.Error(string.Format("SYS_ROLE_MENU_BUTTON_BLL 根据条件获取列表异常,异常信息:{0}", ex.ToString()));
                }
            }
            return(list);
        }