コード例 #1
0
        static void UserInput()
        {
            Console.WriteLine("Input Key");
            int    key;
            string keystring = Console.ReadLine();
            bool   chek      = int.TryParse(keystring, out key);

            if (chek)
            {
                if (keystring.Length < 8)
                {
                    var prodocument = new ProDocument();
                    prodocument.ShowInfo1();
                }
                else
                {
                    var expertdocument = new ExpertDocumentWorker();
                    expertdocument.ShowInfo2();
                }
            }
            else
            {
                var simpledocument = new DocumentWorker();
                simpledocument.ShowDelegate();
            }
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Console.Write("Enter key (PRO - 1, EXP - 2, Default - 0) : ");
            int key = Int32.Parse(Console.ReadLine());

            switch (key)
            {
            case 1:
                ProDocumentWorker proDocumentWorker = new ProDocumentWorker();
                proDocumentWorker.OpenDocument();
                proDocumentWorker.EditDocument();
                proDocumentWorker.SaveDocument();
                break;

            case 2:
                ExpertDocumentWorker expertDocumentWorker = new ExpertDocumentWorker();
                expertDocumentWorker.OpenDocument();
                expertDocumentWorker.EditDocument();
                expertDocumentWorker.SaveDocument();
                break;

            default:
                DocumentWorker documentWorker = new DocumentWorker();
                documentWorker.OpenDocument();
                documentWorker.EditDocument();
                documentWorker.SaveDocument();
                break;
            }
        }
コード例 #3
0
        static void Main(string[] args)
        {
            var account = new DocumentWorker();

            List <string> passwordPRO = new List <string>()
            {
                "1146732aA",
                "AndyAndy",
                "JohanPohan"
            };

            List <string> passwordEXP = new List <string>()
            {
                "325427sS186",
                "1111"
            };

            Console.Write("Enter you liesence: ");
            var result = Console.ReadLine();

            if (passwordPRO.Contains(result))
            {
                account = new ProDocumentWorker();
            }

            if (passwordEXP.Contains(result))
            {
                account = new ExpertDocumentWorker();
            }

            if (!passwordEXP.Contains(result) && !passwordPRO.Contains(result))
            {
                account = new DocumentWorker();
            }

            account.OpenDocument();
            account.EditDocument();
            account.SaveDocument();
        }