示例#1
0
        public IEnumerable <AdjustSalePriceDto> GetPageList(Pager page, SearchAdjustSalePrice condition)
        {
            dynamic param = new ExpandoObject();

            string where = "";
            if (!string.IsNullOrEmpty(condition.ProductCodeOrBarCode))
            {
                where += "and (t2.`Code`=@ProductCodeOrBarCode or t2.BarCode=@ProductCodeOrBarCode)";
                param.ProductCodeOrBarCode = condition.ProductCodeOrBarCode;
            }
            if (!string.IsNullOrEmpty(condition.Code))
            {
                where     += "and t0.Code=@Code ";
                param.Code = condition.Code;
            }

            if (condition.Status != 0)
            {
                where       += "and t0.Status=@Status ";
                param.Status = condition.Status;
            }
            string sql      = @"select t0.Id,t0.`Code`,t0.Status,t1.ProductId,t2.`Name` as ProductName,t2.`Code` as ProductCode,t2.BarCode,t2.Specification,
t2.Unit,t1.AdjustPrice,t1.SalePrice,t0.updatedOn,t3.NickName as UpdatedByName 
from AdjustSalePrice t0 
inner join AdjustSalePriceItem t1 on t0.Id = t1.AdjustSalePriceId
inner join product t2 on t1.productid = t2.id
left join account t3 on t0.updatedBy = t3.Id
where 1=1 {0} ORDER BY t0.Id desc LIMIT {1},{2}";
            string sqlCount = @"select count(*) from AdjustSalePrice t0 
inner join AdjustSalePriceItem t1 on t0.Id = t1.AdjustSalePriceId
inner join product t2 on t1.productid = t2.id
left join account t3 on t0.updatedBy = t3.Id
where 1=1 {0} ORDER BY t0.Id desc LIMIT {1},{2}";

            //rows = this._query.FindPage<ProductDto>(page.PageIndex, page.PageSize).Where<Product>(where, param);
            sql      = string.Format(sql, where, (page.PageIndex - 1) * page.PageSize, page.PageSize);
            sqlCount = string.Format(sqlCount, where, (page.PageIndex - 1) * page.PageSize, page.PageSize);
            var rows = this._query.FindAll <AdjustSalePriceDto>(sql, param);

            page.Total = this._query.FindScalar <int>(sqlCount, param);

            return(rows);
        }
示例#2
0
        public JsonResult LoadData(Pager page, SearchAdjustSalePrice condition)
        {
            var rows = _adjustSalePriceQuery.GetPageList(page, condition);

            return(Json(new { success = true, data = rows, total = page.Total }, JsonRequestBehavior.AllowGet));
        }