Пример #1
0
        public void DoSomething()
        {
            int menu = 0;
            DocumentWorker worker;
            Console.WriteLine("Input key");
            menu = int.Parse(Console.ReadLine());
            switch (menu)
            {
                case 1:
                    {
                        worker = new ProDocumentWorker();
                        break;
                    }
                case 2:
                    {
                        worker = new ExpertDocumentWorker();
                        break;
                    }
                default:
                    {
                        worker = new DocumentWorker();
                        break;
                    }
            }

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

            Console.ReadKey();
        }
Пример #2
0
        static void Main(string[] args)
        {
            int            key;
            DocumentWorker documentWorker;

            Console.WriteLine("Введите ключ пользователя");
            Console.WriteLine("0 - базовый, 1 - Pro, 2 - Expert");
            key = InputUsersKey();

            if (key == (int)version.Base)
            {
                documentWorker = new DocumentWorker();
            }
            else if (key == (int)version.Pro)
            {
                documentWorker = new ProDocumentWorker();
            }
            else
            {
                documentWorker = new ExpertDocumentWorker();
            }

            documentWorker.Show();
            Console.ReadKey();
        }
Пример #3
0
        static void Main(string[] args)
        {
            if (ver == 1)
            {
                dw = dw1;
            }
            if (ver == 2)
            {
                dw = dw2;
            }

            string command = Console.ReadLine();

            if (openreg.IsMatch(command))
            {
                dw.OpenDocument();
            }
            if (editreg.IsMatch(command))
            {
                dw.EditDocument();
            }
            if (savereg.IsMatch(command))
            {
                dw.SaveDocument();
            }
            Main(null);
        }
Пример #4
0
        public void DoSomething()
        {
            int            menu = 0;
            DocumentWorker worker;

            Console.WriteLine("Input key");
            menu = int.Parse(Console.ReadLine());
            switch (menu)
            {
            case 1:
            {
                worker = new ProDocumentWorker();
                break;
            }

            case 2:
            {
                worker = new ExpertDocumentWorker();
                break;
            }

            default:
            {
                worker = new DocumentWorker();
                break;
            }
            }

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

            Console.ReadKey();
        }
Пример #5
0
        static void Main(string[] args)
        {
            DocumentWorker documentWorker = DocumentWorker.OpenWorker("exp");

            documentWorker.OpenDocument();
            documentWorker.SaveDocument();
            documentWorker.EditDocument();
            Console.ReadKey();
        }
Пример #6
0
        public void TestExpDocumentWorker3()
        {
            String keyExp = "123QWe";

            if (keyExp.Equals("123qwe"))
            {
                documentWorker = new ExpertDocumentWorker();
            }
            else
            {
                documentWorker = new DocumentWorker();
            }
            Assert.IsFalse(documentWorker.GetType().Equals(typeof(ExpertDocumentWorker)));
        }
Пример #7
0
        public void TestProDocumentWorker3()
        {
            String keyPro = "342EWQ";

            if (keyPro.Equals("342ewq"))
            {
                documentWorker = new ProDocumentWorker();
            }
            else
            {
                documentWorker = new DocumentWorker();
            }
            Assert.IsFalse(documentWorker.GetType().Equals(typeof(ProDocumentWorker)));
        }
Пример #8
0
        public void TestDocumentWorker4()
        {
            String keyExp = "123qwe";
            String keyPro = "342ewq";

            if (keyExp.Equals("123qwe"))
            {
                documentWorker = new ExpertDocumentWorker();
            }
            else if (keyPro.Equals("342ewq"))
            {
                documentWorker = new ProDocumentWorker();
            }
            else
            {
                documentWorker = new DocumentWorker();
            }
            Assert.IsTrue(documentWorker.GetType().Equals(typeof(ExpertDocumentWorker)));
        }
Пример #9
0
        public BaseApiResponse <string> Print([FromForm] DemoDocumentModel model)
        {
            var fileName = $"Заявление.docx";

            var rootDirPath = CrocoApp.Application.MapPath($"~/wwwroot");

            var filePath = $"Docs/{fileName}";

            var doccer = new DocumentWorker(AmbientContext);

            var t = doccer.RenderDoc(model, $"{rootDirPath}/{filePath}");

            if (!t.IsSucceeded)
            {
                return(new BaseApiResponse <string>(t));
            }

            return(new BaseApiResponse <string>(t, filePath));
        }
Пример #10
0
        static DocumentWorker WorkWithDocument(string version)
        {
            DocumentWorker doc;

            if (version == "pro")
            {
                doc = new ProDocumentWorker();
            }
            else if (version == "exp")
            {
                doc = new ExpertDocumentWorker();
            }
            else
            {
                doc = new DocumentWorker();
            }

            return(doc);
        }
Пример #11
0
        static void Main(string[] args)
        {
            string pro_key = "profi";
            string exp_key = "expert";
            string pro, exp;

            Console.WriteLine("Введите ключ для версии Про:");
            pro = Console.ReadLine();
            if (pro != pro_key)
            {
                DocumentWorker user1 = new DocumentWorker();
                Console.WriteLine("document status:");
                user1.OpenDocument();
                user1.EditDocument();
                user1.SaveDocument();
            }
            else
            {
                Console.WriteLine("Введите ключ для версии Эксперт:");
                exp = Console.ReadLine();
                if (exp != exp_key)
                {
                    ExpertDocumentWorker user1 = new ExpertDocumentWorker();
                    Console.WriteLine("document status:");
                    user1.OpenDocument();
                    user1.EditDocument();
                    user1.SaveDocument();
                }
                else
                {
                    ProDocumentWorker user1 = new ProDocumentWorker();
                    Console.WriteLine("document status:");
                    user1.OpenDocument();
                    user1.EditDocument();
                    user1.SaveDocument();
                }
            }
        }
Пример #12
0
        static void Main(string[] args)
        {
            DocumentWorker dw;

            Console.Write("Enter the key:");
            string key = Console.ReadLine();

            if (key == KeyForPRO_License)
            {
                dw = new ProDocumentWorker();
            }
            else if (key == KeyForEXP_License)
            {
                dw = new ExpertDocumentWorker();
            }
            else
            {
                dw = new DocumentWorker();
            }
            dw.OpenDocument();
            dw.SaveDocument();
            dw.EditDocument();
            Console.ReadKey();
        }
Пример #13
0
        static void Main(string[] args)
        {
            DocumentWorker docwor;

            Console.Write("Enter key: ");
            string key = Console.ReadLine();

            if (key == "pro")
            {
                docwor = new ProDocumentWorker();
            }
            else if (key == "exp")
            {
                docwor = new ExpertDocumentWorker();
            }
            else
            {
                docwor = new DocumentWorker();
            }

            docwor.OpenDocument();
            docwor.EditDocument();
            docwor.SaveDocument();
        }
Пример #14
0
        static void Main(string[] args)
        {
            InheritanceColor print = new InheritanceColor(ConsoleColor.Yellow);

            print.Print("Hello");

            Printer printUp = print;

            printUp.Print("Hello");

            InheritanceColor print1 = new InheritanceColor(ConsoleColor.Red);

            print1.Print("Hello");


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


            Pupil p1 = new BadPupil();
            Pupil p2 = new ExcelentPupil();

            ClassRoom group = new ClassRoom(p1, p2);

            group.Study();
            group.Read();
            group.Write();
            group.Relax();


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


            Ship ship = new Ship(20000, 120, 2000)
            {
                Passengers = 28, Port = "Odessa"
            };

            Console.WriteLine("Ship price {0}, speed {1}, year of manufacture {2}, number of passengers {3}, port of registry {4}", ship.Price, ship.Speed, ship.Year, ship.Passengers, ship.Port);


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


            Console.WriteLine("Enter Key");
            string         key = Console.ReadLine();
            DocumentWorker doc = null;

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

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

            default:
                Console.WriteLine("Key is incorrect");
                doc = new DocumentWorker();
                break;
            }

            doc.OpenDocument();
            doc.EditDocument();
            doc.SaveDocument();

            Console.ReadKey();
        }
 public void Init()
 {
     _target = new DocumentWorker();
 }
Пример #16
0
        static void Main(string[] args)
        {
            const string proKey = "pro";
            const string expKey = "exp";

            Console.WriteLine("Введите ключ");
            string         key      = Console.ReadLine();
            DocumentWorker document = new DocumentWorker();

            switch (key)
            {
            case proKey:
                document = new ProDocumentWorker();
                break;

            case expKey:
                document = new ExpertDocumentWorker();
                break;

            default:
                document = new DocumentWorker();
                break;
            }
            Console.WriteLine("Введите команды для работы с документом: \n1-Открыть документ, \n2-Редактировать документ, \n3-Сохранить, \n4-выход");
            bool A = true;

            while (A == true)
            {
                switch (Console.ReadLine())
                {
                case "1":
                    Console.ForegroundColor = ConsoleColor.DarkMagenta; document.OpenDocument(); Console.ForegroundColor = ConsoleColor.White;
                    break;

                case "2":
                    Console.ForegroundColor = ConsoleColor.DarkMagenta; document.EditDocument(); Console.ForegroundColor = ConsoleColor.White;
                    break;

                case "3":
                    Console.ForegroundColor = ConsoleColor.DarkMagenta; document.SaveDocument(); Console.ForegroundColor = ConsoleColor.White;
                    break;

                case "4":
                    A = false; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Выход"); Console.ForegroundColor = ConsoleColor.White;
                    break;

                default:
                    Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Неправильная команда!"); Console.ForegroundColor = ConsoleColor.White;
                    break;
                }
            }


            IPlayable player = new Player();

            Console.ForegroundColor = ConsoleColor.DarkCyan;
            player.Play();
            player.Pause();
            player.Stop();
            Console.WriteLine();
            IRecordable recorder = new Player();

            Console.ForegroundColor = ConsoleColor.Cyan;
            recorder.Record();
            recorder.Pause();
            recorder.Stop();
            Console.ForegroundColor = ConsoleColor.White;
            Console.ReadKey();
        }