static void Main(string[] args)
        {
            Console.WriteLine("Hello!! Its your Document Worker!!");
            Console.WriteLine();
            Console.Write("Enter the Pro or Expert version code: ? ");
            DocumentWorker dw = new DocumentWorker();

            if (int.TryParse(Console.ReadLine(), out int userCode))
            {
                VersionType version = KeyLicenseValidator.Validate(userCode);
                Console.WriteLine("Your version is {0}", version);
                switch (version)
                {
                case VersionType.Standart:
                    break;

                case VersionType.Pro:
                    dw = new ProDocumentWorker();
                    break;

                case VersionType.Expert:
                    dw = new ExpertDocumentWorker();
                    break;

                default:
                    break;
                }
            }

            dw.OpenDocument();
            dw.EditDocument();
            dw.SaveDocument();

            Console.ReadKey();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            DocumentWorker       documentWorker       = new DocumentWorker();
            ProDocumentWorker    proDocumentWorker    = new ProDocumentWorker();
            ExpertDocumentWorker expertDocumentWorker = new ExpertDocumentWorker();

            string key = Console.ReadLine();

            switch (key)
            {
            case "1":
                proDocumentWorker = new ProDocumentWorker();
                break;

            case "2":
                expertDocumentWorker = new ExpertDocumentWorker();
                break;

            default:
                documentWorker = new DocumentWorker();;
                break;
            }

            Console.ReadKey();
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            while (true)
            {
                Console.Write("Введите ключ доступа: ");
                string key = Console.ReadLine();

                if (key == "1")
                {
                    ProDocumentWorker proDocumentWorker = new ProDocumentWorker();
                    proDocumentWorker.OpenDocument();
                    proDocumentWorker.EditDocument();
                    proDocumentWorker.SaveDocument();
                    Console.WriteLine("_______________________");
                }
                else if (key == "2")
                {
                    ExpertDocumentWorker expertDocumentWorker = new ExpertDocumentWorker();
                    expertDocumentWorker.OpenDocument();
                    expertDocumentWorker.EditDocument();
                    expertDocumentWorker.SaveDocument();
                    Console.WriteLine("_______________________");
                }
                else
                {
                    DocumentWorker documentWorker = new DocumentWorker();
                    documentWorker.OpenDocument();
                    documentWorker.EditDocument();
                    documentWorker.SaveDocument();
                    Console.WriteLine("_______________________");
                }
            }
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            const int pro = 2468;
            const int exp = 1357;
            int       key = 0;

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

            if (!String.IsNullOrEmpty(keyStr))
            {
                key = Convert.ToInt32(keyStr);
            }

            DocumentWorker documentWorker = null;

            switch (key)
            {
            case pro:
                documentWorker = new ProDocumentWorker();
                break;

            case exp:
                documentWorker = new ExpertDocumentWorker();
                break;

            default:
                documentWorker = new DocumentWorker();
                break;
            }

            documentWorker.OpenDocument();
            documentWorker.EditDocument();
            documentWorker.SaveDocument();
        }
Esempio n. 5
0
        static void Main(string[] args)
        {
            while (true)
            {
                Console.WriteLine("Введите ключ");
                string         key = Console.ReadLine();
                DocumentWorker doc = null;
                switch (key)
                {
                case "123":
                    doc = new ProDocumentWorker();
                    break;

                case "321":
                    doc = new ExpertDocumentWorker();
                    break;

                default:
                    Console.WriteLine("Ключ неверен");
                    doc = new DocumentWorker();
                    break;
                }

                doc.OpenDocument();
                doc.EditDocument();
                doc.SaveDocument();
            }
        }
Esempio n. 6
0
        static void Main(string[] args)
        {
            Dictionary <string, string> key = new Dictionary <string, string>()
            {
                ["Pro"]        = "1234567890",
                ["Exp"]        = "0987654321",
                ["UsuallUser"] = ""
            };
            string inputKey = Helper.Query("Hello, put the key, please");

            if (inputKey == key["Pro"])
            {
                workWithDocument = new ProDocumentWorker();
                Use(workWithDocument);
            }
            else if (inputKey == key["Exp"])
            {
                workWithDocument = new ExpertDocumentWorker();
                Use(workWithDocument);
            }
            else if (inputKey == key["UsuallUser"])
            {
                workWithDocument = new DocumentWorker();
                Use(workWithDocument);
            }
            else
            {
                Console.WriteLine("Error");
            }
            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Input key (pro/exp)");
            string         key    = Console.ReadLine();
            DocumentWorker worker = CreatDocument(key);

            worker.OpenDocument();
            worker.EditDocument();
            worker.SaveDocument();

            Console.ReadKey();
        }
        static void Main(string[] args)
        {
Again:
            Console.Write("Введите пожалуйста номер ключа доступа к версии PRO: ");
            string pro = Console.ReadLine();

            Console.Write("Введите пожалуйста номер ключа доступа к версии EXP: ");
            string exp = Console.ReadLine();
            ExpertDocumentWorker expertDocumentWorker = new ExpertDocumentWorker();

            Console.WriteLine(new string('-', 60));

            if (exp == expertDocumentWorker.ExpNumber)
            {
                Console.WriteLine("Вы можете пользоваться EXP версией программы!");
                Console.WriteLine("Вам будут доступны все функции программы:");
                expertDocumentWorker.OpenDocument();
                expertDocumentWorker.EditDocument();
                expertDocumentWorker.SaveDocument();
            }
            if (pro == expertDocumentWorker.ProNumber)
            {
                ProDocumentWorker proDocumentWorker = expertDocumentWorker;
                Console.WriteLine("Вы можете пользоваться PRO версией программы!");
                Console.WriteLine("Вам будут доступны неполные функции программы:");
                proDocumentWorker.OpenDocument();
                proDocumentWorker.EditDocument();
                proDocumentWorker.SaveDocument();
            }

            if (pro != expertDocumentWorker.ProNumber && exp != expertDocumentWorker.ExpNumber)
            {
                Console.WriteLine("Вы можете пользоваться только бесплатной версией программы!");
                Console.WriteLine("Вам будут доступны сильно ограниченные функции программы:");
                DocumentWorker documentWorker = expertDocumentWorker;
                documentWorker.OpenDocument();
                documentWorker.EditDocument();
                documentWorker.SaveDocument();
            }
            for (int i = 0; i < 3; i++)
            {
                Console.WriteLine(new string('-', 60));
            }
            goto Again;
        }
Esempio n. 9
0
        static void Main(string[] args)
        {
            DocumentWorker document = null;
            string key = "pro";

            if (key == "pro")
            {
                document = new ProDocumentWorker();
            }
            else if (key == "exp")
            {
                document = new ExpertDocumentWorker();
            }
            else
            {
                document = new DocumentWorker();
            }
            document.OpenDocument();
            document.EditDocument();
            document.SaveDocument();
            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            Console.Write("Введите ключ продукта: ");

            string regKey = Console.ReadLine();

            if (regKey == "Pro")
            {
                DocumentWorker document1 = new ProDocumentWorker();
                GetFunctionalityBeVersion(document1);
            }
            else if (regKey == "Expert")
            {
                DocumentWorker document2 = new ExpertDocumentWorker();
                GetFunctionalityBeVersion(document2);
            }
            else
            {
                DocumentWorker document3 = new DocumentWorker();
                GetFunctionalityBeVersion(document3);
            }
        }
Esempio n. 11
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            string key;

            Console.Write("Введите ключь для доступап к версии Pro или Expert: ");
            key = Console.ReadLine();
            if (key.Equals(new ProDocumentWorker().Key))
            {
                Console.WriteLine("Вы используете версию Pro!");
                _ = new ProDocumentWorker();
            }
            else if (key.Equals(new ExpertDocumentWorker().Key))
            {
                Console.WriteLine("Вы используете версию Expert!");
                _ = new ExpertDocumentWorker();
            }
            else
            {
                Console.WriteLine("Вы используете версию Free!");
                _ = new DocumentWorker();
            }
            Console.ReadKey();
        }
Esempio n. 12
0
        static void Main(string[] args)
        {
            Console.Write("Ввдите номер ключа доступа(pro or exp)");
            string value = Console.ReadLine();

            if (value == "" || value == "pro")
            {
                ProDocumentWorker proDocument    = new  ProDocumentWorker();
                DocumentWorker    documentWorker = proDocument;
                documentWorker.OpenDocument();
                documentWorker.EditDocument();
                documentWorker.SaveDocument();
            }
            else if (value == "exp")
            {
                ExpertDocumentWorker expert         = new ExpertDocumentWorker();
                DocumentWorker       documentWorker = expert;
                documentWorker.SaveDocument();
            }
            else
            {
                Console.WriteLine("Некорректные данные!");
            }
        }
 public static void GetFunctionalityBeVersion(DocumentWorker document)
 {
     document.OpenDocument();
     document.EditDocument();
     document.SaveDocument();
 }
Esempio n. 14
0
 static void Use(DocumentWorker document)
 {
     document.OpenDocument();
     document.EditDocument();
     document.SaveDocument();
 }