Exemplo n.º 1
0
 public IResult Execute(PartyModel repo, IRegisteredCommand comm)
 {
     if (comm.BaseCommandText == CommandText)
     {
         if (comm.Parameters == null || comm.Parameters.Count == 0)
         {
             return(new Result("Group was not made, there was no parameters that matched what was required."));
         }
         if (comm.Parameters.Count > 1)
         {
             repo.AddGroup(comm.Parameters[0], comm.Parameters[1]);
             return(new Result(string.Format("The group {0} was made with the parent {1}",
                                             comm.Parameters[0],
                                             comm.Parameters[1])
                               ));
         }
         else
         {
             repo.AddGroup(comm.Parameters[0]);
             return(new Result(string.Format("The group {0} was made",
                                             comm.Parameters[0])
                               ));
         }
     }
     else
     {
         return(_NextCommand.Execute(repo, comm));
     }
 }
Exemplo n.º 2
0
 public IResult Execute(PartyModel repo, IRegisteredCommand comm)
 {
     if (comm.BaseCommandText == CommandText)
     {
         return(new Result());
     }
     else
     {
         return(_NextCommand.Execute(repo, comm));
     }
 }
 public IResult Execute(PartyModel repo, IRegisteredCommand comm)
 {
     if (comm.BaseCommandText == CommandText)
     {
         string printString = repo.PrettyPrint();
         return(new Result(printString));
     }
     else
     {
         return(_NextCommand.Execute(repo, comm));
     }
 }
 public IResult Execute(PartyModel repo, IRegisteredCommand comm)
 {
     if (comm.BaseCommandText == CommandText)
     {
         int experienceToAdd = Int32.Parse(comm.Parameters[0]);
         repo.AddExperience(experienceToAdd);
         return(new Result(String.Format("The amount of {0} was added the the root party and divided among the children", experienceToAdd)));
     }
     else
     {
         return(_NextCommand.Execute(repo, comm));
     }
 }
Exemplo n.º 5
0
        public IResult Execute(PartyModel repo, IRegisteredCommand comm)
        {
            string mes = "Command of " + comm.BaseCommandText;

            if (comm.Parameters != null)
            {
                mes += " with the parameters of ";
                foreach (var i in comm.Parameters)
                {
                    mes += i + ", ";
                }
            }

            mes += " was not found please try again";
            return(new Result(mes));
        }
 public IResult Execute(PartyModel repo, IRegisteredCommand comm)
 {
     if (comm.BaseCommandText == CommandText)
     {
         string memberName  = comm.Parameters[0];
         string parentGroup = "";
         if (comm.Parameters.Count == 2)
         {
             parentGroup = comm.Parameters[1];
         }
         else
         {
             parentGroup = "root";
         }
         repo.AddPartyMember(memberName, parentGroup);
         return(new Result("member " + comm.Parameters[0] + " was made successfully"));
     }
     else
     {
         return(_NextCommand.Execute(repo, comm));
     }
 }
Exemplo n.º 7
0
 public LoginController(IUserLoginCommand userLogin, IRegisteredCommand registered, IMediator mediator)
 {
     _iUserLogin = userLogin;
     _registered = registered;
     _mediator   = mediator;
 }