コード例 #1
0
        public int CreatePerson(PersonDto person)
        {
            PersonData personData = new PersonData();
            int        insertedId = personData.InsertPerson(person);

            return(insertedId);
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="facultyDto"></param>
        /// <returns></returns>
        public int InsertFaculty(FacultyDto facultyDto)
        {
            int returnedValue = 0;

            try
            {
                PersonData personData = new PersonData();
                returnedValue = personData.InsertPerson(facultyDto.Person);
                if (returnedValue > -1)
                {
                    query         = InsertFacultyQuery(facultyDto);
                    returnedValue = dbConnect.ExecuteQueries(query, false);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return(-1);
            }
            finally
            {
                dbConnect.CloseConnection();
            }

            return(returnedValue);
        }
コード例 #3
0
        public void InsertPersonDl()
        {
            Person lPerson = new Person()
            {
                PersonID        = 0,
                FullName        = "James",
                ProductName     = "Bond",
                Address         = "10 Avenue A",
                Purpose         = "New York",
                ProductCategory = "NY",
                ProductPrice    = "12345"
            };
            PersonData lPersonData = new PersonData();

            lPersonData.InsertPerson(lPerson);
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: plaberge/NHLStatsData
        public static void doIt(string sched)
        {
            Schedule schedule = new Schedule(sched);

            // ***********PAUL CHANGE SQL STRING TO PARAMETERIZED COMMAND!!!*******
            // https://docs.microsoft.com/en-us/dotnet/api/system.data.sqlclient.sqlcommand.parameters?redirectedfrom=MSDN&view=netframework-4.7.2#System_Data_SqlClient_SqlCommand_Parameters


            //---------------------------------------------------
            // Insert the SCHEDULE into the DB

            int scheduleID = ScheduleData.InsertSchedule(schedule);
            int i          = 0;

            //---------------------------------------------------

            //---------------------------------------------------
            // Insert the list of GAMEs into the DB
            //  INCLUDES:  Insert the TEAMs (insert the CONFERENCE, DIVISION, VENUE), VENUE, list of PERIODs, BOXSCOREs(insert the TEAMGAMESTATS(insert the PERSON/coach, list of PLAYERGAMESTATS), list of PERSON/officials), list of PLAYERs, list of GAMEEVENTs(insert TEAMs, list of PLAYERs), GAMECONTENT)
            if (Convert.ToInt16(schedule.totalGames) > 0)
            {
                foreach (Game g in schedule.games)
                {
                    i = GameData.InsertGame(g, scheduleID);
                    //---------------------------------------------------
                    // Insert the Home and Away TEAMs into the DB
                    //  INCLUDES:  Insert the VENUE, list of PERIODs, BOXSCOREs(insert the TEAMGAMESTATS(insert the PERSON/coach, list of PLAYERGAMESTATS), list of PERSON/officials), list of PLAYERs, list of GAMEEVENTs(insert TEAMs, list of PLAYERs), GAMECONTENT)

                    // Insert the Coach (PERSON) for each team
                    if (!(g.gameBoxScore.homeTeamStats.coach is null))
                    {
                        i = PersonData.InsertPerson(g.gameBoxScore.homeTeamStats.coach);
                    }

                    if (!(g.gameBoxScore.awayTeamStats.coach is null))
                    {
                        i = PersonData.InsertPerson(g.gameBoxScore.awayTeamStats.coach);
                    }


                    // Insert the game VENUE
                    if (!(g.gameVenue is null))
                    {
                        i = VenueData.InsertVenue(g.gameVenue);
                    }


                    // Insert the game Officials (PERSON)
                    if (!(g.gameBoxScore.officials is null))
                    {
                        foreach (Person p in g.gameBoxScore.officials)
                        {
                            i = PersonData.InsertPerson(p);

                            // Insert officials list to the cross reference table (tblGameOfficials)
                            i = PersonData.InsertGameOfficials(g.gameID, p.personId);
                        }
                    }

                    // Insert the Home Team:
                    i = TeamData.InsertTeam(g.homeTeam);
                    i = TeamData.InsertTeam(g.awayTeam);

                    // Insert the CONFERENCE of each team:
                    i = ConferenceData.InsertConference(g.homeTeam.teamConference);
                    i = ConferenceData.InsertConference(g.awayTeam.teamConference);

                    //Insert the DIVISION of each team:
                    if (!(g.homeTeam.teamDivision is null))
                    {
                        i = DivisionData.InsertDivision(g.homeTeam.teamDivision);
                    }
                    if (!(g.awayTeam.teamDivision is null))
                    {
                        i = DivisionData.InsertDivision(g.awayTeam.teamDivision);
                    }

                    //Insert the PERIODs of the Game
                    if (!(g.periodData is null))
                    {
                        foreach (Period p in g.periodData)
                        {
                            i = PeriodData.InsertPeriod(p);
                        }
                    }

                    // Insert the details and stats for each home PLAYER
                    if (!(g.gameBoxScore.homeTeamStats.teamPlayers is null))
                    {
                        foreach (PlayerGameStats homepgs in g.gameBoxScore.homeTeamStats.teamPlayers)
                        {
                            i = PlayerData.InsertPlayer(homepgs);
                            i = PlayerGameStatsData.InsertPlayerGameStats(homepgs, g.gameID);
                        }
                    }

                    // Insert the details and stats for each away PLAYER
                    if (!(g.gameBoxScore.awayTeamStats.teamPlayers is null))
                    {
                        foreach (PlayerGameStats awaypgs in g.gameBoxScore.awayTeamStats.teamPlayers)
                        {
                            i = PlayerData.InsertPlayer(awaypgs);
                            i = PlayerGameStatsData.InsertPlayerGameStats(awaypgs, g.gameID);
                        }
                    }

                    // Insert the GAMEEVENTS for the game
                    if (!(g.gameEvents is null))
                    {
                        foreach (GameEvent ge in g.gameEvents)
                        {
                            i = GameEventData.InsertGameEvent(ge, g.gameID);
                        }
                    }



                    //---------------------------------------------------
                }
            }
        }
コード例 #5
0
        public void ProcessInsertPerson(Person pPerson)
        {
            PersonData lPersonData = new PersonData();

            lPersonData.InsertPerson(pPerson);
        }