Exemplo n.º 1
0
        internal static void StroagetoRam()//Hocam Biligyorum madem dosyadan okuyorsun kontrol icin niye ihtiyac var ben classlari doldurmak icin yapiyorum hocam
        {
            bool boolean = false;

            Error.TryCatchFile(() =>
            {
                FileStream fileStream = new FileStream(@"cinema.txt", FileMode.Open, FileAccess.Read);
                Error.TryCatchArg(() =>
                {
                    StreamReader streams = new StreamReader(fileStream);
                    string line          = streams.ReadLine();
                    Show show;
                    Chair chair;
                    while (line != null)
                    {
                        string[] lineSplit = line.Split(",");
                        try
                        {
                            (chair, show) = BookingProcess.FindShow(Convert.ToInt32(lineSplit[0]), Convert.ToInt32(lineSplit[1]), Convert.ToInt32(lineSplit[2]), Convert.ToInt32(lineSplit[3]));
                            if (String.Compare(lineSplit[4], "Full") == 0)
                            {
                                chair.MakeFull();
                            }
                        }catch (IndexOutOfRangeException exception)
                        {
                            Console.WriteLine(exception.Message);
                            boolean = true;
                            break;
                        }catch (NullReferenceException exception)
                        {
                            boolean = true;
                            Console.WriteLine(exception.Message);
                            break;
                        }catch (Exception exception)
                        {
                            boolean = true;
                            Console.WriteLine(exception.Message);
                            break;
                        }
                        line = streams.ReadLine();
                    }

                    streams.Close();
                });
                fileStream.Close();
            });
            if (boolean == true)
            {
                Console.WriteLine("System is Crashed.");
                Console.WriteLine("Please Try Again");
                GenerateNewCinema();
            }
        }
Exemplo n.º 2
0
 static void Main(string[] args)
 {
     BookingProcess.DefaultShowInfo();
     Console.WriteLine("Please Choose!");
     Console.WriteLine("1 - Booking Ticket Now!");
     Console.WriteLine("Other Button - Exit!");
     if (Console.ReadLine() == "1")
     {
         Console.WriteLine("Do you have got a Discounted Code[Y/(other button)]?");
         if (String.Compare(Console.ReadLine().ToUpper(), "Y") == 0)
         {
             BookingProcess.GetDTicket();
         }
         else
         {
             BookingProcess.GetTicket();
         }
     }
 }