public List <MyMenu> getMyMenuListData(string MemberCardNo, string OrderId, string Type = null) { List <MyMenu> list = null; try { IParameterMapper ipmapper = new getMyMenuListDataParameterMapper(); DataAccessor <MyMenu> tableAccessor; string strSql = @"select od.UnitPrice,od.ProductCount,o.status,p.MemberPrice, p.ProductName,p.Id , o.DiningDate ,od.UseState, os.OrderStatus, (select sum(os.ProductCount) from OrderDetails os where os.OrderId=o.Id) totalcount from Orders o left join OrderStatus os on os.OrderId = o.Id,OrderDetails od,Product p,Restaurant r where o.Id=od.OrderId and od.ProductId=p.Id and r.RstType='02' and r.Id=o.RstId and o.MemberCardNo=@MemberCardNo and o.id=@OrderId and os.OrderStatus='New' and dateAdd(hh,5,o.DiningDate)>=getdate() order by p.Code asc"; if (!string.IsNullOrEmpty(Type) && Type == "FastFood") { strSql = @"select od.UnitPrice,od.ProductCount,o.status,p.MemberPrice, p.ProductName,p.Id , o.DiningDate ,od.UseState, os.OrderStatus, (select sum(os.ProductCount) from OrderDetails os where os.OrderId=o.Id) totalcount from Orders o left join OrderStatus os on os.OrderId = o.Id,OrderDetails od,Product p ,Restaurant r where o.Id=od.OrderId and od.ProductId=p.Id and o.MemberCardNo=@MemberCardNo and o.id=@OrderId and os.OrderStatus='New' and r.RstType='01' and r.Id=o.RstId order by p.Code asc"; } tableAccessor = db.CreateSqlStringAccessor(strSql, ipmapper, MapBuilder <MyMenu> .MapAllProperties() .Map(t => t.ProductName).ToColumn("ProductName") .Map(t => t.UnitPrice).ToColumn("UnitPrice") .Map(t => t.ProductCount).ToColumn("ProductCount") .Map(t => t.ProductId).ToColumn("Id") .Map(t => t.DiningDate).ToColumn("DiningDate") .Map(t => t.status).ToColumn("OrderStatus") .Map(t => t.totalcount).ToColumn("totalcount") .Map(t => t.MemberPrice).ToColumn("MemberPrice") .Map(t => t.UseState).ToColumn("UseState") .Build()); list = tableAccessor.Execute(new object[] { MemberCardNo, Guid.Parse(OrderId) }).ToList(); return(list); } catch (Exception ex) { Logger.Log(ex); return(null); } }
public List<MyMenu> getMyMenuListData(string MemberCardNo, string OrderId, string Type = null) { List<MyMenu> list = null; try { IParameterMapper ipmapper = new getMyMenuListDataParameterMapper(); DataAccessor<MyMenu> tableAccessor; string strSql = @"select od.UnitPrice,od.ProductCount,o.status,p.MemberPrice, p.ProductName,p.Id , o.DiningDate ,od.UseState, os.OrderStatus, (select sum(os.ProductCount) from OrderDetails os where os.OrderId=o.Id) totalcount from Orders o left join OrderStatus os on os.OrderId = o.Id,OrderDetails od,Product p,Restaurant r where o.Id=od.OrderId and od.ProductId=p.Id and r.RstType='02' and r.Id=o.RstId and o.MemberCardNo=@MemberCardNo and o.id=@OrderId and os.OrderStatus='New' and dateAdd(hh,5,o.DiningDate)>=getdate() order by p.Code asc"; if (!string.IsNullOrEmpty(Type) && Type == "FastFood") { strSql = @"select od.UnitPrice,od.ProductCount,o.status,p.MemberPrice, p.ProductName,p.Id , o.DiningDate ,od.UseState, os.OrderStatus, (select sum(os.ProductCount) from OrderDetails os where os.OrderId=o.Id) totalcount from Orders o left join OrderStatus os on os.OrderId = o.Id,OrderDetails od,Product p ,Restaurant r where o.Id=od.OrderId and od.ProductId=p.Id and o.MemberCardNo=@MemberCardNo and o.id=@OrderId and os.OrderStatus='New' and r.RstType='01' and r.Id=o.RstId order by p.Code asc"; } tableAccessor = db.CreateSqlStringAccessor(strSql, ipmapper, MapBuilder<MyMenu>.MapAllProperties() .Map(t => t.ProductName).ToColumn("ProductName") .Map(t => t.UnitPrice).ToColumn("UnitPrice") .Map(t => t.ProductCount).ToColumn("ProductCount") .Map(t => t.ProductId).ToColumn("Id") .Map(t => t.DiningDate).ToColumn("DiningDate") .Map(t => t.status).ToColumn("OrderStatus") .Map(t => t.totalcount).ToColumn("totalcount") .Map(t => t.MemberPrice).ToColumn("MemberPrice") .Map(t => t.UseState).ToColumn("UseState") .Build()); list = tableAccessor.Execute(new object[] { MemberCardNo, Guid.Parse(OrderId) }).ToList(); return list; } catch (Exception ex) { Logger.Log(ex); return null; } }