コード例 #1
0
        public Page <PriceEx> List(BaseParm parm)
        {
            var page   = new Page <PriceEx>(parm);
            var strSql = new StringBuilder();

            strSql.Append(@"SELECT p.*,p1.ID ProductID ,p1.`Name` ,p1.TypeID,p1.TypeName ,s.Amount
                  FROM product p1  
                  LEFT JOIN  productprice p on p.ProductID =p1.ID
                  LEFT JOIN store s ON s.ProductID=p1.ID AND p.UnitID=s.UnitID ");
            strSql.Append(" WHERE p1.IsActive=1");
            if (!string.IsNullOrEmpty(parm.Id))
            {
                strSql.Append(" AND p1.ID = @Id");
            }
            if (!string.IsNullOrEmpty(parm.Name))
            {
                parm.Name = "%" + parm.Name + "%";
                strSql.Append(" AND p1.Name like @Name");
            }
            if (!string.IsNullOrEmpty(parm.Type))
            {
                strSql.Append(" AND p1.TypeName like @Type");
            }
            var list = _db.Page <PriceEx>(parm.page, parm.rows, strSql.ToString(), parm);

            page.rows  = list.Items;
            page.total = (int)list.TotalItems;
            return(page);
        }
コード例 #2
0
        public Page <FavoriteEx> List(BaseParm parm)
        {
            var page   = new Page <FavoriteEx>(parm);
            var strSql = new StringBuilder();

            strSql.Append(@"SELECT f.*,p.Price,p.MemberPrice MPrice 
                    FROM FAVORITE f 
                    LEFT JOIN price p ON p.ProductID=f.ProductID AND p.UnitName=f.UserName");
            strSql.Append(" Where f.UserID=@Id");
            var list = _db.Page <FavoriteEx>(parm.page, parm.rows, strSql.ToString(), parm);

            page.rows  = list.Items;
            page.total = (int)list.TotalItems;
            return(page);
        }
コード例 #3
0
ファイル: OrderDAL.cs プロジェクト: niuhongkui/Portal
        public Page<order> ListByPage(BaseParm parm)
        {
            var page = new Page<order>(parm);
            var strSql = new StringBuilder();
            strSql.Append(" where 1=1");
            if (!string.IsNullOrEmpty(parm.Name))
            {
                parm.Name = "%" + parm.Name + "%";
                strSql.Append(" AND UserName like @Name");
            }
            if (!string.IsNullOrEmpty(parm.Type))
            {
                strSql.Append(" AND State = @Type");
            }
            if (!string.IsNullOrEmpty(parm.Code))
            {
                strSql.Append(" AND OrderNo = @Code");
            }
            if (parm.Query == "1")
            {
                parm.Query = "配送中";
                strSql.Append(" AND SendState = @Query");
            }
            if (parm.End!=null) {
                parm.End = parm.End.Value.AddDays(1);
                strSql.Append(" AND CreateDate <@End");
            }
            if (parm.Start != null)
            {
                strSql.Append(" AND CreateDate >@Start");
            }
            var list = _db.Page<order>(parm.page, parm.rows, strSql.ToString(), parm);

            page.rows = list.Items;
            page.total = (int)list.TotalItems;
            return page;
        }