Пример #1
0
        static Person GetPersonFromFile(string path)
        {
            var fileManager = new FileManager(path);
            var parserType  = ArgumentsConverter.GetFileParserType(path);
            var parser      = new FileParserFactory(fileManager, parserType);

            return(parser.GetPerson());
        }
Пример #2
0
        static string GetCommandOutput(Person person, string command)
        {
            var processType = ArgumentsConverter.GetPersonProcessType(command);

            switch (processType)
            {
            case PersonProcessType.Console:
                return(new PersonProcessConsole(person).GetOutput());

            case PersonProcessType.Database:
                return(new PersonProcessDatabase(person).GetInputSql("PersonTable") + "\n");    // add newline for output

            case PersonProcessType.Email:
                return(new PersonProcessEmail(person).GetBody());

            default:
                throw new NotImplementedException();
            }
        }