public void Start()
        {
            Console.Title = "BlueMoon - View Appointments";

            Console.Clear();
            AsciiClass ac = new AsciiClass();

            ac.BlueMoon(3);


            Console.SetCursorPosition(37, 13);
            Console.WriteLine("==========PERSONAL ASSISTANT APPLICATION==========");


            Console.SetCursorPosition(37, 15);
            Console.WriteLine("Press any Key to View Appointments....");
            Console.ReadKey(true);



            Console.SetCursorPosition(39, 17);
            Console.WriteLine("       ======Appointment Details======");



            string curPath = Directory.GetCurrentDirectory();

            string path = curPath + "\\Schedule.ebase";


            string[] EbRows = File.ReadAllLines(path);

            string[] fieldName = { "Name of appointment", "Year", "Month", "Day", "Hour", "Minute", "Location" };

            int topDisplay   = 20;
            int leftDisplay  = 0;
            int countingLeft = 1;
            //int countingtop = 0;
            int displaySet = 0;

            // Move logged in to upper left
            Console.MoveBufferArea(0, 38, 40, 2, 1, 2);

            Station.StopTimeThread();

            int initial = EbRows.Length - 1;

            for (int q = initial; q >= 0; q--)
            {
                string[] EbCol = EbRows[q].Split('~');


                countingLeft++;

                if (countingLeft % 2 == 0)
                {
                    leftDisplay = 5;
                }
                else
                {
                    leftDisplay = 62;
                    topDisplay  = displaySet;
                }

                displaySet = topDisplay;

                for (int i = 0; i < EbCol.Length; i++)
                {
                    Console.SetCursorPosition(leftDisplay, topDisplay);
                    Console.WriteLine("{0,-20} : {1}", fieldName[i], EbCol[i]);
                    topDisplay++;
                }



                topDisplay += 2;
            }

            int count = displaySet;

            Station.BorderThread(2, 18, 115, count, 10);
            Console.CursorVisible = false;

            int leftB = 60;
            int topB  = 18;

            for (int i = 0; i < count; i++)
            {
                Console.SetCursorPosition(leftB, topB);
                Console.Write("|");
                topB++;
            }

            Console.SetCursorPosition(37, 15);
            Console.WriteLine("Press any Key to Return to previous Menu....");
            Console.ReadKey(true);


            MeetingAppointment ma = new MeetingAppointment();

            ma.Start();
        }
        public void Start()
        {
            Console.Title = "BlueMoon - View Contacts";


            Console.Clear();
            AsciiClass ac = new AsciiClass();

            ac.BlueMoon(3);


            Console.SetCursorPosition(37, 13);
            Console.WriteLine("==========PERSONAL ASSISTANT APPLICATION==========");


            Console.SetCursorPosition(37, 15);
            Console.WriteLine("Press any Key to View Contacts....");
            Console.ReadKey(true);



            Console.SetCursorPosition(39, 17);
            Console.WriteLine("       ======Contact Details======");



            string curPath = Directory.GetCurrentDirectory();

            string path = curPath + "\\Contacts.ebase";


            string[] EbRows = File.ReadAllLines(path);

            string[] fieldName = { "Name", "Phone Number", "Email", "State", "City", "Address" };

            int topDisplay   = 20;
            int leftDisplay  = 0;
            int countingLeft = 1;
            int displaySet   = 0;


            Console.MoveBufferArea(0, 38, 40, 2, 1, 2);

            // Go over each row
            int initial = EbRows.Length - 1;

            for (int q = initial; q >= 0; q--)
            {
                // split rows into column
                string[] EbCol = EbRows[q].Split('~');

                //determine left or right based on even or odd
                countingLeft++;

                // set left to right or left
                if (countingLeft % 2 == 0)
                {
                    leftDisplay = 5;
                }
                else
                {
                    leftDisplay = 62;
                    topDisplay  = displaySet;
                }

                // set display set to top display to determine height
                displaySet = topDisplay;

                for (int i = 0; i < EbCol.Length; i++)
                {
                    Console.SetCursorPosition(leftDisplay, topDisplay);
                    Console.WriteLine("{0,-12} : {1}", fieldName[i], EbCol[i]);
                    topDisplay++;
                }



                topDisplay += 2;
            }


            // draw main border
            int count = displaySet;

            Station.BorderThread(2, 18, 115, count, 10);
            Console.CursorVisible = false;

            // draw book border
            int leftB = 60;
            int topB  = 18;

            for (int i = 0; i < count; i++)
            {
                Console.SetCursorPosition(leftB, topB);
                Console.Write("|");
                topB++;
            }

            // readkey to exit
            Console.SetCursorPosition(37, 15);
            Console.WriteLine("Press any Key to Return to previous Menu....");
            Console.ReadKey(true);

            // Goto Contact details Menu
            ContactDetails cd = new ContactDetails();

            cd.Start();
        }
Exemple #3
0
        public void Start()
        {
            Console.Title = "BlueMoon - Add Contacts";

            Station.BlueMoonHeader();

            AddContactsHeader();

            // open file and a stream writer to write
            FileStream   fs = new FileStream("Contacts.ebase", FileMode.Append, FileAccess.Write);
            StreamWriter w  = new StreamWriter(fs);

            // Input Name
            Station.BorderThread(2, 20, 20, 6, 20);
            Station.writer(3, 21, "Enter Name : ");
            Station.writer(3, 22, "max letters(16)");
            string name = Station.MeteredInput(16, 3, 23);


            // Input Phone Number
            Station.BorderThread(24, 20, 20, 6, 20);
            Station.writer(25, 21, "Enter Phone Number");
            Station.writer(25, 22, "max letters(11)");
            string phoneNumber = Station.MeteredInputNum(11, 25, 23);


            // Input Email
            Station.BorderThread(46, 20, 28, 6, 20);
            Station.writer(47, 21, "Enter Email");
            Station.writer(47, 22, "max letters(25)");
            string email = Station.MeteredInput(25, 47, 23);


            // Input State
            Station.BorderThread(76, 20, 19, 6, 20);
            Station.writer(77, 21, "Enter State");
            Station.writer(77, 22, "max letters(10)");
            string state = Station.MeteredInput(10, 77, 23);

            // Input City
            Station.BorderThread(97, 20, 19, 6, 20);
            Station.writer(98, 21, "Enter City");
            Station.writer(98, 22, "max letters(12)");
            string city = Station.MeteredInput(12, 98, 23);



            //Input Address
            Station.BorderThread(2, 27, 30, 6, 20);
            Station.writer(3, 28, "Enter street address : ");
            Station.writer(3, 29, "max letters(28)");
            string address = Station.MeteredInput(28, 3, 30);


            // Ask user if sure to save data
            ToSaveData();



            while (true)
            {
                Console.CursorVisible = false;
                ConsoleKeyInfo key;
                key = Console.ReadKey(true);

                if (key.Key == ConsoleKey.Y)
                {
                    Console.SetCursorPosition(35, 28);
                    Console.WriteLine("                                            ");

                    Console.SetCursorPosition(35, 30);
                    Console.WriteLine("                                            ");

                    Console.SetCursorPosition(35, 32);
                    Console.WriteLine("                                            ");


                    Station.Blink("Saving Data.........", 3000, 35, 28);

                    string cont = name + "~" + phoneNumber + "~" + email + "~" + state + "~" + city + "~" + address;

                    w.WriteLine(cont);
                    w.Flush();
                    w.Close();
                    fs.Close();
                    fs.Dispose();
                    w.Dispose();

                    Console.SetCursorPosition(35, 28);
                    Console.Write("Data Saved.          ");
                    Console.SetCursorPosition(35, 30);
                    Console.Write("press any key to return to previous Menu");
                    Console.ReadKey(true);
                    ContactDetails cd = new ContactDetails();
                    cd.Start();

                    break;
                }
                else if (key.Key == ConsoleKey.N)
                {
                    w.Flush();
                    w.Close();
                    fs.Close();
                    Start();
                    return;
                }
                else if (key.Key == ConsoleKey.Backspace)
                {
                    w.Flush();
                    w.Close();
                    fs.Close();
                    ContactDetails cd = new ContactDetails();
                    cd.Start();
                    return;
                }
                else
                {
                    Console.SetCursorPosition(63, 29);
                    Console.WriteLine("Invalid Key.");
                    Thread.Sleep(200);
                    Console.SetCursorPosition(63, 29);
                    Console.WriteLine("            ");
                }
            }
        }