Example #1
0
        //***
        public List <OrderParentModel> GetOrders(int Id, string type)
        {
            List <OrderModel> ordersAll = PurchaseOrderList(Id, type);

            List <OrderParentModel> result = new List <OrderParentModel>();

            var orders = ordersAll.GroupBy(t => new { t.CART_ID });

            foreach (var order in orders)
            {
                OrderParentModel parentorder = new OrderParentModel()
                {
                    CART_ID    = order.FirstOrDefault().CART_ID,
                    SHPNG_ADRS = order.FirstOrDefault().SHPNG_ADRS,
                    Total      = order.Sum(t => t.ItemAmount)
                };
                parentorder.orderdetail = new List <OrderChildModel>();

                foreach (var item in order)
                {
                    OrderChildModel child = new OrderChildModel()
                    {
                        ProdName    = item.Product,
                        Quantity    = item.Quantity,
                        Unit_Price  = item.UnitPrice,
                        TotalAmount = item.UnitPrice * item.Quantity,
                        ID          = item.PurchaseOrderId,
                        VendorName  = item.VendorName,
                        VendorPhone = item.VendorPhone,
                        STATUS      = item.STATUS,
                        VendorEmail = item.VendorEmail
                    };
                    parentorder.orderdetail.Add(child);
                }
                result.Add(parentorder);
            }
            return(result);
        }
Example #2
0
 public ResultModel <PayStatusModel> GetChildPayStatus(OrderChildModel model)
 {
     return(iOrderChildProvider.GetPayStatus(model.orderId, model.childId));
 }