コード例 #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
ファイル: PartAppServices.cs プロジェクト: masuar/BRIATORES
        /// <summary>
        /// Builds a part from a design.
        /// </summary>
        /// <param name="parameters">A string containing the PartDesign Id.</param>
        public void BuildPartFromDesign(string parameters)
        {
            int partDesignId;
            if (!int.TryParse(parameters, out partDesignId))
            {
                throw new ArgumentException("Invalid function parameter. PartDesign Id expected.");
            }

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

            PartServices partSvc = new PartServices();
            partSvc.BuildPartFromDesign(theDesign);
        }
コード例 #3
0
 public BuyStandardPartDialog()
 {
     InitializeComponent();
     PartDesignServices pdCmdr = new PartDesignServices();
     this.DataContext = pdCmdr.GetAllStandardDesigns();
 }
コード例 #4
0
 public BuyDesignDialog()
 {
     InitializeComponent();
     PartDesignServices pdCmdr = new PartDesignServices();
     this.DataContext = pdCmdr.GetAllBaseDesigns();
 }