Exemplo n.º 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;
        }
Exemplo n.º 2
0
        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));
            }
        }
Exemplo n.º 3
0
 public static Order ToEntity(this OrderModel model, Order destination)
 {
     return Mapper.Map(model, destination);
 }
Exemplo n.º 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);
 }
Exemplo n.º 5
0
 public virtual void CreateInQueue(Order order)
 {
     this.orderQueuedService.EnQueue(order);
 }
Exemplo n.º 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);
        }