Пример #1
0
        /// <summary>
        /// Buys a part design to a team.
        /// </summary>
        /// <param name="parameters">A string containing the team id which buying, plus the design id, separated with a pipe.</param>
        public void BuyDesign(string parameters)
        {
            string[] p = parameters.Split('|');
            if (p.Length < 2)
            {
                throw new ArgumentException("Invalid function parameter. Team id and PartDesign Id expected.");
            }

            int teamId;
            if (!int.TryParse(p[0], out teamId))
            {
                throw new ArgumentException("Invalid function parameter. Team Id expected.");
            }

            int partDesignId;
            if (!int.TryParse(p[1], out partDesignId))
            {
                throw new ArgumentException("Invalid function parameter. PartDesign Id expected.");
            }

            TeamServices teamSvc = new TeamServices();
            var theTeam = teamSvc.GetById(teamId);

            PartDesignServices partDesignSvc = new PartDesignServices();
            var theDesign = partDesignSvc.GetById(partDesignId);

            partDesignSvc.BuyPartDesign(theTeam, theDesign);
        }
Пример #2
0
 private void LoadTeams()
 {
     this.DataContext = null;
     TeamServices tMgr = new TeamServices();
     teams = tMgr.GetAllTeams();
     this.DataContext = teams;
 }
Пример #3
0
 /// <summary>
 /// Removes a team from the system.
 /// </summary>
 /// <param name="team">The team to remove.</param>
 public void DropTeam(Team team)
 {
     // This order is inmediate!!
     TeamServices teamSvc = new TeamServices();
     teamSvc.DropTeam(team);
 }
Пример #4
0
 /// <summary>
 /// Creates a new empty team.
 /// </summary>
 /// <param name="managerName">Name of the manager.</param>
 /// <param name="countryName">Name of the country.</param>
 /// <param name="teamName">Name of the team.</param>
 /// <param name="teamShortName">Short name of the team.</param>
 public void CreateEmptyTeam(string managerName, string countryName, string teamName, string teamShortName)
 {
     // This order is inmediate!!
     TeamServices teamSvc = new TeamServices();
     teamSvc.CreateEmptyTeam(managerName, countryName, teamName, teamShortName);
 }