/// <summary> /// 订单详情 /// </summary> /// <param name="uid"></param> /// <param name="orderNum"></param> /// <returns></returns> public OrderDetail OrderDetail(string uid, string orderNum) { OrderDetail order = new model.OrderDetail(); string orderSql = " select * from [Order] where Uid={0} and OrderId={1}"; DAO.Order o = db.Database.SqlQuery <DAO.Order>(string.Format(orderSql, uid, orderNum)).FirstOrDefault(); string opSql = " SELECT * FROM [OrderProList] where [OrderId] ={0}"; List <DAO.OrderProList> opList = db.Database.SqlQuery <DAO.OrderProList>(string.Format(opSql, orderNum)).ToList(); string imgSql = "select * from imgstock where partID in (select ProductID from orderProList where orderID={0})"; List <DAO.ImgStock> imgList = db.Database.SqlQuery <DAO.ImgStock>(string.Format(imgSql, orderNum)).ToList(); string expSql = "select * from ExpRecord where orderNum ='{0}'"; DAO.ExpRecord ex = db.Database.SqlQuery <DAO.ExpRecord>(string.Format(expSql, orderNum)).FirstOrDefault(); int? exp = 0; if (ex != null) { exp = ex.Exp; } order.order = o; order.opList = opList; order.pimgList = imgList; order.exp = exp == null ? 0 : exp; return(order); }
public OrderDetail OrderDetail(string orderNum) { OrderDetail order = new model.OrderDetail(); string orderSql = " select * from [Order] where OrderId={0}"; DAO.Order o = db.Database.SqlQuery <DAO.Order>(string.Format(orderSql, orderNum)).FirstOrDefault(); string opSql = " SELECT * FROM [OrderProList] where [OrderId] ={0}"; List <DAO.OrderProList> opList = db.Database.SqlQuery <DAO.OrderProList>(string.Format(opSql, orderNum)).ToList(); order.order = o; order.opList = opList; return(order); }