Beispiel #1
0
        public virtual int PlaceOrder(Order order)
        {
            int result = 0;

            //using (this.syncLockService.AcquireLock())
            //{
            //    //查询余票
            //    int availableTicketsCount = this.ticketService.GetAvailableTicketsCount(new Ticket { From = order.From.GetValueOrDefault(0), To = order.To.GetValueOrDefault(0) });

            //    if (availableTicketsCount < 1)
            //    {
            //        throw new Exception("创建订单失败,没有足够的余票");
            //    }

            //    var obj = this.repository.Insert(order);

            //    result = Convert.ToInt32(obj);

            //    return result;
            //}

            order.OrderStatus = OrderStatus.Pendding.ToString();

            var obj = this.repository.Insert(order);

            result = Convert.ToInt32(obj);

            return result;
        }
        public virtual void EnQueue(Order order)
        {
            //Insert into order queue table

            //Insert into redis queue
            //Queue.Add("TRAINTICKETSBOOKING_ORDERQUEUE", order)

            using (var client = this.clientsManager.GetClient())
            {
                client.AddItemToList(ORDERQUEUENAME, string.Format("{0}", order.Id));
            }
        }
 public static Order ToEntity(this OrderModel model, Order destination)
 {
     return Mapper.Map(model, destination);
 }
Beispiel #4
0
 public virtual int ProcessingOrder(Order order, OrderStatus status = OrderStatus.Success)
 {
     return this.repository.Update("SET OrderStatus = @0 WHERE Id = @1", OrderStatus.Success.ToString(), order.Id);
 }
Beispiel #5
0
 public virtual void CreateInQueue(Order order)
 {
     this.orderQueuedService.EnQueue(order);
 }
Beispiel #6
0
        public ActionResult OrderStatus(int? id)
        {
            var order = this.orderService.RetrieveOrder(id.GetValueOrDefault(0));

            if (order == null)
            {
                order = new Order { OrderStatus = "Unkown" };
            }

            var model = FillOrderModel(order.ToModel());

            return View(model);
        }