コード例 #1
0
        public IExecutable InterpretateCommand(string[] data)
        {
            IExecutable command = null;

            string commandName = data[0];

            string[] commandParams = data.Skip(1).ToArray();

            switch (commandName)
            {
            case "RegisterCleansingCenter":
                command = new RegisterCleansingCenter(commandParams, this.Databse);
                break;

            case "RegisterAdoptionCenter":
                command = new RegisterAdoptionCenter(commandParams, this.Databse);
                break;

            case "RegisterCastrationCenter":
                command = new RegisterCastratingCenter(commandParams, this.Databse);
                break;

            case "RegisterDog":
                command = new RegisterDog(commandParams, this.Databse, this.AnimalFactory);
                break;

            case "RegisterCat":
                command = new RegisterCat(commandParams, this.Databse, this.AnimalFactory);
                break;

            case "SendForCleansing":
                command = new SendForCleansing(commandParams, this.Databse);
                break;

            case "SendForCastration":
                command = new SendForCastrating(commandParams, this.Databse);
                break;

            case "Cleanse":
                command = new Cleanse(commandParams, this.Databse);
                break;

            case "Castrate":
                command = new Castrate(commandParams, this.Databse);
                break;

            case "Adopt":
                command = new Adopt(commandParams, this.Databse);
                break;

            case "CastrationStatistics":
                command = new CastrationStatistics(commandParams, this.Databse, this.writer);
                break;

            case "Paw Paw Pawah":
                command = new PawPawPawah(commandParams, this.Databse, this.Writer);
                break;
            }
            return(command);
        }
コード例 #2
0
ファイル: Dog.cs プロジェクト: AndyHitchman/BlastTrack
        public Dog(RegisterDog cmd)
        {
            //TODO Check no other dog exists with this earbrand

            this.Raise(new DogRegistered(cmd.Earbrand, cmd.VaccinationCertificateNumber));
        }