public SessionReportDao()
 {
     this.context = new DBConnection();
 }
Example #2
0
 public UpnDao()
 {
     this.context = new DBConnection();
 }
        public static List <Character> RetrieveCharactersByGameUserID(int GameUserID)
        {
            List <Character> characters = new List <Character>();

            // connection
            var conn = DBConnection.GetDBConnection();

            // cmdtext
            var cmdText = @"sp_retrieve_characters_by_gameuserid";

            // command
            var cmd = new SqlCommand(cmdText, conn);

            // command type
            cmd.CommandType = CommandType.StoredProcedure;

            // parameters
            cmd.Parameters.Add("@GameUserID", SqlDbType.Int);

            // parameter values
            cmd.Parameters["@GameUserID"].Value = GameUserID;

            // all set? need a try-catch
            try
            {
                // open a connection
                conn.Open();

                // execute the command
                var reader = cmd.ExecuteReader();

                // check for results
                if (reader.HasRows)
                {
                    // multiple rows are possible, so use a while loop
                    while (reader.Read())
                    {
                        // create a character object
                        var character = new Character()
                        {
                            PlayerCharacterID = reader.GetInt32(0),
                            PlayerName        = reader.GetString(1),
                            PlayerRace        = reader.GetString(2),
                            PlayerClass       = reader.GetString(3),
                            PlayerImage       = reader.GetString(4),
                            PlayerSlot        = reader.GetInt32(5),
                            StatID            = reader.GetInt32(6)
                        };
                        // add character to the list
                        characters.Add(character);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                conn.Close();
            }


            return(characters);
        }
 public AccountReportDao()
 {
     this.context = new DBConnection();
 }
Example #5
0
 public SourceDao()
 {
     this.context = new DBConnection();
 }
Example #6
0
        /// <summary>
        /// Edits information for the persisted match.
        /// </summary>
        /// <param name="match">The match.</param>
        public void EditMatch(Match match)
        {
            TransactionOptions to = new TransactionOptions {
                IsolationLevel = IsolationLevel.ReadCommitted
            };

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, to)) {
                using (SqlConnection connection = DBConnection.GetSqlConnection()) {
                    connection.Open();
                    using (SqlCommand command = connection.CreateCommand()) {
                        command.CommandText = "UPDATE Match SET Format=@Format, WinnerId=@WinnerId, EventId=@EventId, Held=@Held WHERE Id=@id";
                        command.Parameters.AddWithValue("Format", match.Format);
                        if (match.Winner == null)
                        {
                            command.Parameters.AddWithValue("WinnerId", -1);
                        }
                        else
                        {
                            command.Parameters.AddWithValue("WinnerId", match.Winner.Id);
                        }
                        if (match.Held)
                        {
                            command.Parameters.AddWithValue("Held", 1);
                        }
                        else
                        {
                            command.Parameters.AddWithValue("Held", 0);
                        }

                        command.Parameters.AddWithValue("EventId", match.EventId);
                        command.Parameters.AddWithValue("id", match.Id);
                        command.ExecuteNonQuery();

                        foreach (Map map in match.Maps)
                        {
                            command.CommandText = "UPDATE MapsOnMatch SET MatchId = @MatchId, MapId = @MapId WHERE MatchId = @MatchId";
                            command.Parameters.AddWithValue("MatchId", match.Id);
                            command.Parameters.AddWithValue("MapId", map.Id);
                            command.ExecuteNonQuery();
                            command.Parameters.Clear();
                        }

                        SqlDataReader reader;

                        command.CommandText = "SELECT Id FROM TeamsInMatch WHERE MatchId = @MatchId";
                        command.Parameters.AddWithValue("@MatchId", match.Id);

                        reader = command.ExecuteReader();

                        int[] ids = new int[2];

                        int count = 0;

                        while (reader.Read())
                        {
                            ids[count] = reader.GetInt32(reader.GetOrdinal("Id"));
                            count++;
                        }
                        command.Parameters.Clear();
                        reader.Close();
                        for (int i = 0; i < match.Teams.Count; i++)
                        {
                            command.CommandText = "UPDATE TeamsInMatch SET TeamId = @TeamId WHERE Id = @id";
                            command.Parameters.AddWithValue("@TeamId", match.Teams[i].Id);
                            command.Parameters.AddWithValue("@id", ids[i]);
                            command.ExecuteNonQuery();
                            command.Parameters.Clear();
                        }
                        match.GenerateName(match.Teams[0], match.Teams[1]);
                    }
                    connection.Close();
                }
                scope.Complete();
            }
        }
Example #7
0
 public DataLogDao()
 {
     this.context = new DBConnection();
 }
Example #8
0
 public UPNReportDao()
 {
     this.context = new DBConnection();
 }
 public ServerAuditTrailReportDao()
 {
     this.context = new DBConnection();
 }
Example #10
0
 public EquipmentDao()
 {
     this.context = new DBConnection();
 }
Example #11
0
 public AuditDao()
 {
     this.context = new DBConnection();
 }
Example #12
0
 public OperationDao()
 {
     this.context = new DBConnection();
 }
 public ProcessAuditTrailReportDao()
 {
     this.context = new DBConnection();
 }
Example #14
0
 public ProcessDao()
 {
     this.context = new DBConnection();
 }
Example #15
0
 public RecipeDao()
 {
     this.context = new DBConnection();
 }
Example #16
0
 public RouterDao()
 {
     this.context = new DBConnection();
 }
Example #17
0
 public ParameterDao()
 {
     this.context = new DBConnection();
 }