Пример #1
0
        public IList <ProductOrderViewModel> GetOrderList(SearchParameter search)
        {
            var description = "前台获取订购/续费动态列表";

            try
            {
                var tbName = "ProductOrder(nolock) po left join ProductUser(nolock) pu on po.ProductUserId=pu.Id";
                var filter = "po.*,pu.ResourceOwner as ProductUserName";
                var where = "";
                var orderBy      = " po.BuyDateTime desc";
                var searchPara   = search as ProductOrderSearchParameter;
                var sqlParameter = new List <SqlParameter>();
                var pageCount    = DataBaseManager.GetCountString(tbName, where);
                RPoney.Log.LoggerManager.Debug(GetType().Name, $"{description}pageCount:{pageCount},参数:{search.SerializeToJSON()}");
                search.Count = DataBaseManager.MainDb().ExecuteScalar(pageCount, sqlParameter.ToArray()).CInt(0, false);
                if (search.Count > 0)
                {
                    var pageSql = DataBaseManager.GetPageString(tbName, filter, orderBy, where, search.Page, search.PageSize);
                    RPoney.Log.LoggerManager.Debug(GetType().Name, $"{description}pageSql:{pageSql},参数:{search.SerializeToJSON()}");
                    return(RPoney.Data.ModelConvertHelper <ProductOrderViewModel> .ToModels(DataBaseManager.MainDb().ExecuteFillDataTable(pageSql, sqlParameter.ToArray())));
                }
                return(Enumerable.Empty <ProductOrderViewModel>().ToList());
            }
            catch (Exception ex)
            {
                RPoney.Log.LoggerManager.Error(GetType().Name, $"{description}异常", ex);
                return(Enumerable.Empty <ProductOrderViewModel>().ToList());
            }
        }
        public IList <ShareArticleEntity> GetRecommendShareArticle(SearchParameter search)
        {
            var description = "获取推荐分享文章";

            try
            {
                var tbName = "ShareArticle(nolock) sa";
                var filter = "sa.*";
                var where = "";
                var orderBy      = " UpdatedTime desc";
                var searchPara   = search as ShareArticleSearchParameter;
                var sqlParameter = new List <SqlParameter>();
                if (searchPara.ArticleType.HasValue)
                {
                    sqlParameter.Add(new SqlParameter("@ArticleType", SqlDbType.Int)
                    {
                        Value = (int)searchPara.ArticleType
                    });
                }
                var pageCount = DataBaseManager.GetCountString(tbName, where);
                RPoney.Log.LoggerManager.Debug(GetType().Name, $"{description}pageCount:{pageCount},参数:{search.SerializeToJSON()}");
                search.Count = DataBaseManager.MainDb().ExecuteScalar(pageCount, sqlParameter.ToArray()).CInt(0, false);
                if (search.Count > 0)
                {
                    var pageSql = DataBaseManager.GetPageString(tbName, filter, orderBy, where, search.Page, search.PageSize);
                    RPoney.Log.LoggerManager.Debug(GetType().Name, $"{description}pageSql:{pageSql},参数:{search.SerializeToJSON()}");
                    return(RPoney.Data.ModelConvertHelper <ShareArticleEntity> .ToModels(DataBaseManager.MainDb().ExecuteFillDataTable(pageSql, sqlParameter.ToArray())));
                }
                return(Enumerable.Empty <ShareArticleEntity>().ToList());
            }
            catch (Exception ex)
            {
                RPoney.Log.LoggerManager.Error(GetType().Name, $"{description}异常", ex);
                return(Enumerable.Empty <ShareArticleEntity>().ToList());
            }
        }
Пример #3
0
        public IList <SystemDicEntity> GetList(SearchParameter search)
        {
            var description = "获取全局配置列表";

            try
            {
                var tbName  = "[SystemDic](nolock)";
                var filter  = "*";
                var orderBy = "[key] asc";
                var where = "";
                var searchParameter = search as SystemDicSearchParameter;
                var sqlParameter    = new List <SqlParameter>();
                if (null != searchParameter)
                {
                    if (!string.IsNullOrWhiteSpace(searchParameter.Key))
                    {
                        where += " and [key]=@key";
                        sqlParameter.Add(new SqlParameter("@key", SqlDbType.VarChar)
                        {
                            Value = searchParameter.Key
                        });
                    }
                }
                var pageCount = DataBaseManager.GetCountString(tbName, where);
                RPoney.Log.LoggerManager.Debug(GetType().Name, $"{description}pageCount:{pageCount},参数:{search.SerializeToJSON()}");
                search.Count = DataBaseManager.MainDb().ExecuteScalar(pageCount, sqlParameter.ToArray()).CInt(0, false);
                if (search.Count > 0)
                {
                    var pageSql = DataBaseManager.GetPageString(tbName, filter, orderBy, where, search.Page, search.PageSize, search.IsAll);
                    RPoney.Log.LoggerManager.Debug(GetType().Name, $"{description}pageSql:{pageSql},参数:{search.SerializeToJSON()}");
                    return(RPoney.Data.ModelConvertHelper <SystemDicEntity> .ToModels(DataBaseManager.MainDb().ExecuteFillDataTable(pageSql, sqlParameter.ToArray())));
                }
                return(Enumerable.Empty <SystemDicEntity>().ToList());
            }
            catch (Exception ex)
            {
                RPoney.Log.LoggerManager.Error(GetType().Name, $"{description}异常", ex);
                return(Enumerable.Empty <SystemDicEntity>().ToList());
            }
        }
        public IList <ShareArticleEntity> GetList(SearchParameter search)
        {
            var description = "获取分享文章列表";

            try
            {
                var tbName = "ShareArticle(nolock) sa";
                var filter = "sa.*";
                var where = "";
                var orderBy      = " UpdatedTime desc";
                var searchPara   = search as ShareArticleSearchParameter;
                var sqlParameter = new List <SqlParameter>();
                if (!string.IsNullOrWhiteSpace(searchPara.Title))
                {
                    where += " and Title like @Title";
                    sqlParameter.Add(new SqlParameter("@Title", SqlDbType.NVarChar)
                    {
                        Value = $"%{searchPara.Title}%"
                    });
                }
                var pageCount = DataBaseManager.GetCountString(tbName, where);
                RPoney.Log.LoggerManager.Debug(GetType().Name, $"{description}pageCount:{pageCount},参数:{search.SerializeToJSON()}");
                search.Count = DataBaseManager.MainDb().ExecuteScalar(pageCount, sqlParameter.ToArray()).CInt(0, false);
                if (search.Count > 0)
                {
                    var pageSql = DataBaseManager.GetPageString(tbName, filter, orderBy, where, search.Page, search.PageSize, search.IsAll);
                    RPoney.Log.LoggerManager.Debug(GetType().Name, $"{description}pageSql:{pageSql},参数:{search.SerializeToJSON()}");
                    return(RPoney.Data.ModelConvertHelper <ShareArticleEntity> .ToModels(DataBaseManager.MainDb().ExecuteFillDataTable(pageSql, sqlParameter.ToArray())));
                }
                return(Enumerable.Empty <ShareArticleEntity>().ToList());
            }
            catch (Exception ex)
            {
                RPoney.Log.LoggerManager.Error(GetType().Name, $"{description}异常", ex);
                return(Enumerable.Empty <ShareArticleEntity>().ToList());
            }
        }