Beispiel #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Please, enter the key (XXX-XXX-XXX or XXX-XXX-XXX-XXX )");
            string       key    = Console.ReadLine();
            const string proKey = "123-456-789";
            const string expKey = "ABC-DEF-GHI-jKL";

            switch (key)
            {
            case proKey:
            {
                ProDocumentWorker proDoc = new ProDocumentWorker();
                DocumentWorker    doc    = proDoc;
                doc.Output();
            }
            break;

            case expKey:
            {
                ExpertDocumentWorker expDoc = new ExpertDocumentWorker();
                DocumentWorker       doc    = expDoc;
                doc.Output();
            }
            break;

            default:
            {
                DocumentWorker doc = new DocumentWorker();
                doc.Output();
            }
            break;
            }
            Console.ReadKey();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            List <string> ProKeys = new List <string>()
            {
                "hd7", "s6d", "s7u"
            };
            List <string> ExpKeys = new List <string>()
            {
                "8jd", "s8j", "pso"
            };

            Console.WriteLine("Введите ключ");
            string         o;
            DocumentWorker DW;

            o = Console.ReadLine();
            if (ProKeys.Contains(o))
            {
                DW = new ProDocumentWorker();
                Console.WriteLine("Вы ввели ключ Pro");
            }
            else if (ExpKeys.Contains(o))
            {
                DW = new ExpertDocumentWorker();
                Console.WriteLine("Вы ввели ключ Exp");
            }
            else
            {
                DW = new DocumentWorker();
                Console.WriteLine("Ключ не правильный");
            }
            DW.OpenDocument();
            DW.EditDocument();
            DW.SaveDocument();
            Console.ReadKey();
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Введите ключ");
            string key    = Console.ReadLine();
            string ProKey = "Pro";
            string ExpKey = "Exp";

            DocumentWorker access = new DocumentWorker();

            if (String.Compare(key, ProKey, StringComparison.OrdinalIgnoreCase) == 0)
            {
                access = new ProDocumentWorker();
            }
            else if (String.Compare(key, ExpKey, StringComparison.OrdinalIgnoreCase) == 0)
            {
                access = new ExpertDocumentWorker();
            }

            access.OpenDocumet();
            access.EditDocument();
            access.SaveDocument();

            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            const string KeyExpert = "exp";
            const string KeyPro    = "pro";

            Console.OutputEncoding = Encoding.UTF8;
            string key;

            Console.WriteLine("Введите ключ доступа:");
            key = Console.ReadLine();

            DocumentWorker documentWorker;

            if (key == KeyExpert)
            {
                documentWorker = new ExpertDocumentWorker();
            }
            else if (key == KeyPro)
            {
                documentWorker = new ProDocumentWorker();
            }
            else
            {
                documentWorker = new DocumentWorker();
            }

            ShowMenu();

            int action = 0;

            do
            {
                Console.WriteLine("Что вы хотите сделать?");

                action = int.TryParse(Console.ReadLine(), out action) ? action : 0;

                switch (action)
                {
                case 1:
                    documentWorker.OpenDocument();
                    break;

                case 2:
                    documentWorker.EditDocument();
                    break;

                case 3:
                    documentWorker.SaveDocument();
                    break;

                case 4:
                    ShowMenu();
                    break;

                case 5:
                    break;

                default:
                    Console.WriteLine("Такой команды нет");
                    break;
                }
            }while (action != 5);
        }