예제 #1
0
        public static List <StockModel> GetStockModelPartialList(List <Stock> s)
        {
            List <StockModel> sml = new List <StockModel>();

            using (SatisEntities se = new SatisEntities())
            {
                var ff = s;
                foreach (var item in ff)
                {
                    Product    p  = HelperProduct.GetByID(item.productID);
                    StockModel sm = new StockModel();
                    sm.stockID             = item.stockID;
                    sm.product.productID   = item.productID;
                    sm.product.productName = p.productName;
                    sm.count       = item.count;
                    sm.dateOfAdded = item.dateOfAdded;
                    sml.Add(sm);
                }
                return(sml);
            }
        }
예제 #2
0
        public static List <OrderModel> GetOrderModelList()
        {
            List <OrderModel> oml = new List <OrderModel>();

            using (SatisEntities se = new SatisEntities())
            {
                var ff = se.OrderDetail.ToList();
                foreach (var item in ff)
                {
                    OrderModel om = new OrderModel();
                    om.orderDetail.orderID = item.orderID;
                    om.product.productID   = item.productID;
                    Product pml = HelperProduct.GetByID(item.productID);
                    om.product.productName   = pml.productName;
                    om.orderDetail.count     = item.count;
                    om.orderDetail.unitPrice = item.unitPrice;
                    om.product.discount      = pml.discount;
                    om.totalPrice            = (item.unitPrice - (item.unitPrice * (pml.discount / 100.0))) * item.count;
                    om.order.orderDate       = item.Order.orderDate;
                    oml.Add(om);
                }
                return(oml);
            }
        }