Esempio n. 1
0
        public void InsertUpdateLatestCompetitiveCombatStat(Guid ProfileGuid, Common.Data.General.OverallCombat combatStat)
        {
            try
            {
                using (SqlConnection conn = new SqlConnection(_connectionString))
                {
                    conn.Open();
                    SqlCommand command = new SqlCommand("Competitive.InsertUpdateCombatStat", conn);
                    command.CommandType = System.Data.CommandType.StoredProcedure;

                    command.Parameters.AddRange(new SqlParameter[] {
                        new SqlParameter("@profileGuid", ProfileGuid),
                        new SqlParameter("@meleeFinalBlows", combatStat.MeleeFinalBlows),
                        new SqlParameter("@objectiveKills", combatStat.ObjectiveKills),
                        new SqlParameter("@soloKills", combatStat.SoloKills),
                        new SqlParameter("@finalBlows", combatStat.FinalBlows),
                        new SqlParameter("@damageDone", combatStat.DamageDone),
                        new SqlParameter("@eliminations", combatStat.Eliminations),
                        new SqlParameter("@multiKills", combatStat.MultiKills),
                        new SqlParameter("@environmentalKills", combatStat.EnvironmentalKills),
                        new SqlParameter("@sr", combatStat.SR)
                    });
                    command.ExecuteNonQuery();
                }
            }
            catch (SqlException Sqle)
            { }
        }
Esempio n. 2
0
        public Common.Data.General.OverallCombat ConstructCombatStats(Dictionary <string, long> _overallCombataStatDictionary)
        {
            Common.Data.General.OverallCombat overallCombatStats = new Common.Data.General.OverallCombat();

            foreach (KeyValuePair <string, long> CombatStat in _overallCombataStatDictionary)
            {
                switch (CombatStat.Key)
                {
                case CombatStrings.DamageDone:
                    overallCombatStats.DamageDone = CombatStat.Value;
                    break;

                case CombatStrings.Eliminations:
                case CombatStrings.Elimination:
                    overallCombatStats.Eliminations = (int)CombatStat.Value;
                    break;

                case CombatStrings.EnvironmentalKills:
                case CombatStrings.EnvironmentalKill:
                    overallCombatStats.EnvironmentalKills = (int)CombatStat.Value;
                    break;

                case CombatStrings.FinalBlows:
                case CombatStrings.FinalBlow:
                    overallCombatStats.FinalBlows = (int)CombatStat.Value;
                    break;

                case CombatStrings.MeleeFinalBlows:
                case CombatStrings.MeleeFinalBlow:
                    overallCombatStats.MeleeFinalBlows = (int)CombatStat.Value;
                    break;

                case CombatStrings.MultKills:
                case CombatStrings.MultKill:
                    overallCombatStats.MultiKills = (int)CombatStat.Value;
                    break;

                case CombatStrings.ObjectiveKills:
                case CombatStrings.ObjectiveKill:
                    overallCombatStats.ObjectiveKills = (int)CombatStat.Value;
                    break;

                case CombatStrings.SoloKills:
                case CombatStrings.SoloKill:
                    overallCombatStats.SoloKills = (int)CombatStat.Value;
                    break;

                case CombatStrings.SR:
                    overallCombatStats.SR = (int)CombatStat.Value;
                    break;

                default:
                    //TODO LOGGING STAT EXTRACTED THATS NOT YET ACCOUNTED FOR
                    break;
                }
            }

            return(overallCombatStats);
        }
Esempio n. 3
0
        public Common.Data.General.OverallCombat GetLatestCompetitiveCombatStats(Guid profileGuid)
        {
            var combatStat = new Common.Data.General.OverallCombat();

            combatStat = new CombatStoreAccess(_connectionString).GetLatestCompetitiveCombatStats(profileGuid);

            return(combatStat);
        }
Esempio n. 4
0
        public List <Common.Data.General.OverallCombat> GetAllCompetitiveCombatStats(Guid profileGuid)
        {
            List <Common.Data.General.OverallCombat> combatStats = new List <Common.Data.General.OverallCombat>();

            try
            {
                using (SqlConnection conn = new SqlConnection(_connectionString))
                {
                    conn.Open();

                    SqlCommand command = new SqlCommand("Competitive.GetAllCombatStatsForProfileGuid", conn);
                    command.CommandType = System.Data.CommandType.StoredProcedure;

                    command.Parameters.Add(
                        new SqlParameter(
                            "@profileGuid", profileGuid
                            ));

                    SqlDataReader rdr = command.ExecuteReader();

                    int profileGuidOrdinal     = rdr.GetOrdinal("ProfileGuid");
                    int meleeFinalBlowsOrdinal = rdr.GetOrdinal("MeleeFinalBlows");
                    int objectiveKillsOrdinal  = rdr.GetOrdinal("ObjectiveKills");
                    int soloKillsOrdinal       = rdr.GetOrdinal("SoloKills");
                    int finalBlowsOrdinal      = rdr.GetOrdinal("FinalBlows");
                    int damageDoneOrdinal      = rdr.GetOrdinal("DamageDone");
                    int eliminationsOrdinal    = rdr.GetOrdinal("Eliminations");
                    int multiKillsOrdinal      = rdr.GetOrdinal("MultiKills");
                    int recordDateOrdinal      = rdr.GetOrdinal("RecordDate");
                    int environmentalOrdinal   = rdr.GetOrdinal("EnvironmentalKills");
                    int srOrdinal = rdr.GetOrdinal("SR");

                    while (rdr.Read())
                    {
                        var combatStat = new Common.Data.General.OverallCombat();
                        combatStat.MeleeFinalBlows    = rdr.GetInt32(meleeFinalBlowsOrdinal);
                        combatStat.ObjectiveKills     = rdr.GetInt32(objectiveKillsOrdinal);
                        combatStat.SoloKills          = rdr.GetInt32(soloKillsOrdinal);
                        combatStat.FinalBlows         = rdr.GetInt32(finalBlowsOrdinal);
                        combatStat.DamageDone         = rdr.GetInt64(damageDoneOrdinal);
                        combatStat.Eliminations       = rdr.GetInt32(eliminationsOrdinal);
                        combatStat.MultiKills         = rdr.GetInt32(multiKillsOrdinal);
                        combatStat.RecordDate         = rdr.GetDateTime(recordDateOrdinal);
                        combatStat.EnvironmentalKills = rdr.GetInt32(environmentalOrdinal);
                        combatStat.SR = rdr.GetInt32(srOrdinal);

                        combatStats.Add(combatStat);
                    }
                }
            }
            catch (SqlException Sqle)
            { }

            return(combatStats);
        }
Esempio n. 5
0
 public void InsertUpdateLatestCompetitiveCombatStat(Guid profileGuid, Common.Data.General.OverallCombat combatStat)
 {
     try
     {
         new Store.Service.Combat
         .CombatStore(_connectionString)
         .InsertUpdateLatestCompetitiveCombatStat(
             profileGuid,
             combatStat);
     }
     catch (Exception e)
     { }
 }
Esempio n. 6
0
        public Common.Data.General.OverallCombat GetLatestCompetitiveCombatStats(Guid profileGuid)
        {
            var combatStat = new Common.Data.General.OverallCombat();

            try
            {
                combatStat = new Store.Service.Combat.CombatStore(_connectionString).GetLatestCompetitiveCombatStats(profileGuid);
            }
            catch (Exception e)
            { }

            return(combatStat);
        }
Esempio n. 7
0
        public OverwatchStats.Common.Data.General.OverallCombat ExtractCombatStatsFromSite()
        {
            Common.Data.General.OverallCombat combat = new Common.Data.General.OverallCombat();
            try
            {
                var stats = new StatRetrievers.OverallCombatStatRetriever(_doc).ExtractCombatStat();
                if (stats.Count > 0)
                {
                    combat = new ObjectCreator.OverallCombatStats().ConstructCombatStats(stats);
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }

            return(combat);
        }
        public void CreatePartialCombatStatClassIgnoringAllIncorrectInfo()
        {
            var expectedCombatStats = new Common.Data.General.OverallCombat
            {
                DamageDone         = 1000,
                Eliminations       = 10,
                EnvironmentalKills = 4
            };

            var actualCombatStats = new OverallCombatStats().ConstructCombatStats(CreateTestData(1000, 10, 4));

            Assert.AreEqual(expectedCombatStats.DamageDone, actualCombatStats.DamageDone, "Damage Done");
            Assert.AreEqual(expectedCombatStats.Eliminations, actualCombatStats.Eliminations, "Eliminations");
            Assert.AreEqual(expectedCombatStats.SoloKills, actualCombatStats.SoloKills, "SoloKills");
            Assert.AreEqual(expectedCombatStats.ObjectiveKills, actualCombatStats.ObjectiveKills, "ObjectiveKills");
            Assert.AreEqual(expectedCombatStats.FinalBlows, actualCombatStats.FinalBlows, "FinalBlows");
            Assert.AreEqual(expectedCombatStats.MultiKills, actualCombatStats.MultiKills, "MultiKills");
            Assert.AreEqual(expectedCombatStats.MeleeFinalBlows, actualCombatStats.MeleeFinalBlows, "MeleeFinalBlows");
            Assert.AreEqual(expectedCombatStats.SR, actualCombatStats.SR, "SR");
        }
Esempio n. 9
0
 public void InsertUpdateLatestCompetitiveCombatStat(Guid profileGuid, Common.Data.General.OverallCombat combatStat)
 {
     new CombatStoreAccess(_connectionString).InsertUpdateLatestCompetitiveCombatStat(profileGuid, combatStat);
 }
Esempio n. 10
0
        public Common.Data.General.OverallCombat CheckandUpdateLatestCompetitiveCombatStats(Guid profileGuid, Common.Data.General.OverallCombat combatStat)
        {
            if (combatStat.RecordDate != null && combatStat.RecordDate == DateTime.Now)
            {
                return(combatStat);
            }
            else
            {
                InsertUpdateLatestCompetitiveCombatStat(profileGuid, combatStat);
                combatStat = GetLatestCompetitiveCombatStats(profileGuid);
            }

            return(combatStat);
        }