public static void writeCustomer2File(MyQueue fQueue, MyQueue mQueue)
 {
     File.WriteAllText("customerFile.txt", string.Empty);
     for (int i = 0; i < fQueue.Lenght; i++)
     {
         Person temp = (Person)fQueue[i];
         temp.write2File();
     }
     for (int i = 0; i < mQueue.Lenght; i++)
     {
         Person temp = (Person)mQueue[i];
         temp.write2File();
     }
 }
        public static void readCustomerFromFile(MyQueue femaleQ, MyQueue maleQ)
        {
            MyQueue      tempQueue = new MyQueue();
            StreamReader sr        = new StreamReader("customerFile.txt");

            for (int i = 0; !sr.EndOfStream; i++)
            {
                Person temp = new Person();
                temp.First_Name = sr.ReadLine();
                temp.Last_Name  = sr.ReadLine();
                temp.Gender     = Convert.ToBoolean(sr.ReadLine());
                int n = Convert.ToInt32(sr.ReadLine());
                for (int j = 0; j < n; j++)
                {
                    Book tempBook = new Book();
                    tempBook.BookName        = sr.ReadLine();
                    tempBook.WriterName      = sr.ReadLine();
                    tempBook.PublicationYear = Convert.ToInt32(sr.ReadLine());
                    tempBook.Price           = Convert.ToInt32(sr.ReadLine());
                    temp.ShoppingBag.pushBack(tempBook);
                }
                sr.ReadLine();
                tempQueue.Enqueue(temp);
            }
            for (int i = 0; i < tempQueue.Lenght; i++)
            {
                Person temp = (Person)tempQueue[i];
                if (temp.Gender)
                {
                    femaleQ.Enqueue(temp);
                }
                else
                {
                    maleQ.Enqueue(temp);
                }
            }
        }
예제 #3
0
 public ReserveWaiting(MyQueue female, MyQueue male)
 {
     femaleQueue = female;
     maleQueue   = male;
     InitializeComponent();
 }
 public Accounting(MyQueue fQueue, MyQueue mQueue)
 {
     femaleQ = fQueue;
     maleQ   = mQueue;
     InitializeComponent();
 }
예제 #5
0
 public ShowQueue(MyQueue female, MyQueue male)
 {
     femaleQ = female;
     maleQ   = male;
     InitializeComponent();
 }