Beispiel #1
0
        /// <summary>
        /// add a new order to database
        /// </summary>
        /// <param name="customerId"></param>
        /// <param name="deliveryId"></param>
        /// <param name="shopId"></param>
        /// <param name="arriveTime"></param>
        /// <param name="readyTime"></param>
        /// <param name="status"></param>
        /// <param name="lat"></param>
        /// <param name="lng"></param>
        /// <param name="numOfFloor"></param>
        public BlOrder(string customerId, string deliveryId, int shopId, DateTime arriveTime, DateTime readyTime, int status, double lat, double lng, int numOfFloor, List <BLOrderDetailsDB> orderDetails)
        {
            int id;

            try
            {
                id = FlyPack.DalOrder.AddOrder(customerId, deliveryId, shopId, arriveTime, status, numOfFloor, readyTime, lat, lng);
            }
            catch
            {
                throw new Exception("fail");
            }
            bool isUpdateDetails = BLOrderDetailsDB.UpdateOrderDetails(orderDetails, id);

            if (id == -1 && isUpdateDetails)
            {
                return;
            }
            OrderId           = id;
            CustomerId        = customerId;
            DeliveryId        = deliveryId;
            ShopId            = shopId;
            ArriveTime        = arriveTime;
            Time              = DateTime.Now;
            ReadyTime         = readyTime;
            Status            = status;
            Location          = new Point(lat, lng);
            NumOfFloor        = numOfFloor;
            this.OrderDetails = orderDetails;
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="products"></param>
        /// <param name="amounts"></param>
        /// <returns> string that describe the list</returns>
        public static string GetProductString(List <BLOrderDetailsDB> orderDetails)
        {
            string ProductString = "";

            for (int i = 0; i < orderDetails.Count; i++)
            {
                BLOrderDetailsDB orderDetail = orderDetails[i];
                BLProduct        product     = BLProduct.GetProductById(orderDetail.productId);
                ProductString += "<br/>" + product.ToString() + " amount-" + orderDetail.amount;
            }
            return(ProductString);
        }
Beispiel #3
0
 /// <summary>
 /// constructor by BLOrderDetail
 /// </summary>
 /// <param name="orderDetailsDb"></param>
 public BLOrderDetail(BLOrderDetailsDB orderDetailsDb)
 {
     Product = BLProduct.GetProductById(orderDetailsDb.productId);
     Amount  = orderDetailsDb.amount;
 }