Ejemplo n.º 1
0
 public static S3TicketsDao GetInstance()
 {
     if (_instance == null)
     {
         _instance = new S3TicketsDao();
     }
     return(_instance);
 }
        public string PlaceOrder(string showName, string desiredDateStr, int numberOfTickets)
        {
            var desiredDate = DateTime.Parse(desiredDateStr);
            var currentDate = DateTime.Now;

            ValidateDates(desiredDate, currentDate);
            DateTime lastCancellationDate = DateTime.MinValue;

            if (isMoreThanAWeek(desiredDate, currentDate))
            {
                lastCancellationDate = setCancellationDate(currentDate);
            }
            string reportString = GenerateReportString(showName, desiredDateStr, numberOfTickets, lastCancellationDate);

            _windowsFileWriter.Write(reportString);
            S3TicketsDao.GetInstance().UploadObject(reportString);
            OrdersCounter++;
            return(reportString);
        }