private DataLayer.SeatViewModel GetTempOrder(DataContracts.TempOrderViewModel tempOrder) { DataLayer.SeatViewModel tempOrderModel = new DataLayer.SeatViewModel(); tempOrderModel.ScreenId = tempOrder.ScreenId; tempOrderModel.ScreenClassId = tempOrder.ScreenClassId; tempOrderModel.MovieTimingId = tempOrder.MovieTimingId; tempOrderModel.VendorId = tempOrder.VendorId; tempOrderModel.TicketCount = tempOrder.TicketCount; tempOrderModel.IPAddress = tempOrder.IPAddress; tempOrderModel.TotalAmount = tempOrder.TotalPrice; tempOrderModel.TicketPrice = tempOrder.TicketPrice; tempOrderModel.WebOrderId = tempOrder.WebOrderId; tempOrderModel.SeatIds = string.Join(",", tempOrder.Seats.Select(seat => seat.ID)); return(tempOrderModel); }
private DataLayer.SeatViewModel GetOrder(DataContracts.OrderViewModel order) { DataLayer.SeatViewModel orderModel = new DataLayer.SeatViewModel(); orderModel.ScreenId = order.ScreenId; orderModel.ScreenClassId = order.ScreenClassId; orderModel.MovieTimingId = order.MovieTimingId; orderModel.VendorId = order.VendorId; orderModel.TicketCount = order.TicketCount; orderModel.IPAddress = order.IPAddress; orderModel.TotalAmount = order.TotalPrice; orderModel.TicketPrice = order.TicketPrice; orderModel.WebOrderId = order.WebOrderId; orderModel.SeatIds = string.Join(",", order.Seats.Select(seat => seat.ID)); orderModel.TempOrderId = order.TempOrderId; orderModel.MobileNumber = order.MobileNumber; orderModel.ShowDate = order.ShowDate; orderModel.ShowTime = order.ShowTime; orderModel.TransactionId = order.TransactionId; orderModel.PaymentType = order.PaymentType; orderModel.PaymentConfirmationNumber = order.PaymentConfirmationNumber; return(orderModel); }
public BookSeatsResponse CreateTempOrder(DataContracts.TempOrderViewModel tempOrder) { BookSeatsResponse response = new BookSeatsResponse(); try { DataLayer.SeatViewModel tempOrderModel = GetTempOrder(tempOrder); var result = _seatBookingRepository.CreateTempOrder(tempOrderModel); if (result < 0) { if (result == -1) { response.ErrorMessage = "There are no seats available in booking"; response.ErrorCode = 1; return(response); } if (result == -2) { response.ErrorMessage = "Requested seats are more than allowed seats per booking."; response.ErrorCode = 2; return(response); } if (result == -3) { response.ErrorMessage = "Requested seats are not allocated to your vendor Id."; response.ErrorCode = 3; return(response); } if (result == -4) { response.ErrorMessage = "Some of the seats or all seats already booked."; response.ErrorCode = 4; return(response); } if (result == -101) { response.ErrorMessage = "Internal Server Error occured."; response.ErrorCode = -101; return(response); } } response.ErrorCode = 0; response.tempOrderId = result; response.ErrorMessage = "Seats are booked successfully."; return(response); } catch (Exception ex) { Log.ErrorFormat("Error occured while creating temp order for ScreenId {0}: {1}", tempOrder.ScreenId, ex); response.ErrorMessage = "Internal Server Error occured."; response.ErrorCode = -101; return(response); } }
public BuySeatsResponse CreateOrder(DataContracts.OrderViewModel order) { BuySeatsResponse response = new BuySeatsResponse(); try { DataLayer.SeatViewModel orderModel = GetOrder(order); var result = _seatBookingRepository.CreateOrder(orderModel); if (result < 0) { if (result == -1) { response.ErrorMessage = "Blocked seats with this booking has been expired. Please try to book again."; response.ErrorCode = 1; return(response); } if (result == -2) { response.ErrorMessage = "Requested seats are more than allowed seats per booking."; response.ErrorCode = 2; return(response); } if (result == -3) { response.ErrorMessage = "Requested seats are not allocated to your vendor Id."; response.ErrorCode = 3; return(response); } if (result == -4) { response.ErrorMessage = "Some of the seats or all seats already booked."; response.ErrorCode = 4; return(response); } if (result == -101) { response.ErrorMessage = "Internal Server Error occured."; response.ErrorCode = -101; return(response); } } response.ErrorCode = 0; response.OrderId = result; response.ErrorMessage = "Order created successfully."; return(response); } catch (Exception ex) { Log.ErrorFormat("Error occured while creating order for ScreenId {0}, tempOrder: {1}, exception Details: {2}", order.ScreenId, order.TempOrderId, ex); response.ErrorMessage = "Internal Server Error occured."; response.ErrorCode = -101; return(response); } }