public string InsertTicket(TTicket ticket, string userId)
        {
            try
            {
                //------------------------------------------------------------//
                // check a valid of Ticket
                //------------------------------------------------------------//
                TicketSaleDateBusiness saleDatebusines = new TicketSaleDateBusiness();
                Ticket newTicket = ThriftUtil.ConvertToEntityObject(ticket) as Ticket;

                string errorMessage = CheckTicketInfo(newTicket);
                errorMessage += saleDatebusines.ValidateDateTime(newTicket.departure_time);

                if (string.IsNullOrEmpty(errorMessage) == false)
                {
                    return(errorMessage);
                }

                TicketBusiness business  = new TicketBusiness();
                string         resultMsg = business.Insert(newTicket);

                ////notify to the others client station
                //ticket.TicketId = ticketId;
                //BroadcastToClient(ClientAction.SellTicket,ticket);

                return(resultMsg);
            }
            catch (Exception exc)
            {
                ServerLogger.logError("[InsertTicket]", exc);
                return(exc.Message);
            }
        }
        private string ValidateBeforeSearch()
        {
            string   errorMessage = string.Empty;
            DateTime departTime   = _ticketBusiness.GetDepartureDateTime(dtDepartureTime.Value.Date);

            if (departTime < DateTime.Now)
            {
                errorMessage = Constants.Messages.MSG_TICKET_DATETIME_SMALLER_CURRENTDATE;
            }
            else
            {
                errorMessage = _ticketSaleDateBusiness.ValidateDateTime(dtDepartureTime.Value);
            }
            return(errorMessage);
        }