/* *******************************************************
         *
         */
        public void AddLeague(DLeague league)
        {
            using (var cmd = new SqlCmdExt(_connectionString))
            {
                cmd.CreateCmd(@"
                    INSERT INTO League (Name)
                    VALUES (@Name)
                ");
                cmd.SetInArg("@Name", league.Name);

                cmd.ExecuteInsertUpdateDelete();
            }
        }
        /* *******************************************************
         *
         */
        public void AddProspect(DProspect prospect)
        {
            using (var cmd = new SqlCmdExt(_connectionString))
            {
                cmd.CreateCmd(@"
                    INSERT INTO Prospect
                    (
                        Name,
                        TeamId,
                        Height,
                        Weight,
                        PositionId,
                        HandednessId,
                        BirthDay,
                        DraftYear,
                        BirthCity,
                        BirthCountry,
                        Notes
                    )
                    VALUES
                    (
                        @Name,
                        @TeamId,
                        @Height,
                        @Weight,
                        @PositionId,
                        @HandednessId,
                        @BirthDay,
                        @DraftYear,
                        @BirthCity,
                        @BirthCountry,
                        @Notes
                    )");
                cmd.SetInArg("@Name", prospect.Name);
                cmd.SetInArg("@TeamId", prospect.Team.Id);
                cmd.SetInArg("@Height", prospect.Height);
                cmd.SetInArg("@Weight", prospect.Weight);
                cmd.SetInArg("@PositionId", GetPositionId(prospect.Position));
                cmd.SetInArg("@HandednessId", GetHandednessId(prospect.Handedness));
                cmd.SetInArg("@BirthDay", prospect.BirthDay);
                cmd.SetInArg("@DraftYear", prospect.DraftYear);
                cmd.SetInArg("@BirthCity", prospect.BirthCity);
                cmd.SetInArg("@BirthCountry", prospect.BirthCountry);
                cmd.SetInArg("@Notes", prospect.Notes);

                cmd.ExecuteInsertUpdateDelete();
            }
        }
        private SqlCmdExt Select(string command)
        {
            var cmd = new SqlCmdExt(_connectionString);

            cmd.CreateCmd(command);

            cmd.ExecuteSelect();

            return cmd;
        }
        /* *******************************************************
         *
         */
        public void AddTeam(DTeam team)
        {
            using (var cmd = new SqlCmdExt(_connectionString))
            {
                cmd.CreateCmd(@"
                    INSERT INTO Team (Name, LeagueId)
                    VALUES (@Name, @LeagueId)
                ");
                cmd.SetInArg("@Name", team.Name);
                cmd.SetInArg("@LeagueId", team.League.Id);

                cmd.ExecuteInsertUpdateDelete();
            }
        }
Ejemplo n.º 5
0
        private void LoadHandednessPairs()
        {
            var idToHandedness = new Dictionary<int, string>();
            var handednessToId = new Dictionary<string, int>();

            using (var cmd = new SqlCmdExt(_connectionString))
            {
                cmd.CreateCmd(@"
                SELECT
                    Id, Hand
                FROM
                    Handedness
                ");

                cmd.ExecuteSelect();

                while (cmd.Read())
                {
                    var id = cmd.GetInt("Id");
                    var hand = cmd.GetString("Hand");

                    idToHandedness.Add(id, hand);
                    handednessToId.Add(hand, id);
                }
            }

            _idToHandedness = idToHandedness;
            _handednessToId = handednessToId;
        }
Ejemplo n.º 6
0
        /* *******************************************************
         *
         */
        private void LoadPositionPairs()
        {
            var idToPosition = new Dictionary<int, string>();
            var positionToId = new Dictionary<string, int>();

            using (var cmd = new SqlCmdExt(_connectionString))
            {
                cmd.CreateCmd(@"
                SELECT
                    Id, Position
                FROM
                    Position
                ");

                cmd.ExecuteSelect();

                while (cmd.Read())
                {
                    var id = cmd.GetInt("Id");
                    var position = cmd.GetString("Position");

                    idToPosition.Add(id, position);
                    positionToId.Add(position, id);
                }
            }

            _idToPosition = idToPosition;
            _positionToId = positionToId;
        }