Пример #1
0
        /// <summary>
        /// select list of orderdetails by orderid for gridview datasource
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns></returns>
        public List <OrderDetailsBE> GetOrderDetailsByOrderId(int orderId)
        {
            TTAEntityContainer  dbEntity = new TTAEntityContainer();
            List <OrderDetails> list     = (from OrderDetails orderdetails in dbEntity.OrderDetails
                                            where orderdetails.OrderId == orderId && orderdetails.IsDeleted == false
                                            select orderdetails).ToList <OrderDetails>();
            List <OrderDetailsBE> listBE = new List <OrderDetailsBE>();

            foreach (OrderDetails orderdetails in list)
            {
                OrderDetailsBE orderdetailsBE = new OrderDetailsTranslator().Translate(orderdetails);
                listBE.Add(orderdetailsBE);
            }
            return(listBE);
        }
Пример #2
0
        /// <summary>
        /// insert a piece of orderdetails record by new inserted orderid linked by its corresponding createdtime
        /// </summary>
        /// <param name="orderdetails"></param>
        public bool Insert(OrderDetailsBE orderdetailsBE)
        {
            TTAEntityContainer dbEntity     = new TTAEntityContainer();
            OrderDetails       orderdetails = new OrderDetailsTranslator().Translate(orderdetailsBE);

            dbEntity.AddToOrderDetails(orderdetails);
            int result = dbEntity.SaveChanges();

            if (result == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }