コード例 #1
0
        public MainSiteAccessPoint(Common.Data.General.Profile profile)
        {
            _userProfile = profile;
            string urlUserNameString = profile.UserName.Replace('#', '-');

            _mainProfileURL = String.Format(WebsiteStringURL.MainWebsiteURL, PlatformEnumToString(profile.Platform), RegionEnumToString(profile.Region), urlUserNameString);
            HtmlAgilityPack.HtmlWeb web = new HtmlAgilityPack.HtmlWeb();
            _doc = web.Load(_mainProfileURL);
        }
コード例 #2
0
ファイル: UpdateManager.cs プロジェクト: Gkeane12/WCFOwStats
 public UpdateManager(string userName, int regionId, int platformId)
 {
     profile = new Common.Data.General.Profile
     {
         Platform = (Common.Data.General.Enums.Platform)platformId,
         Region   = (Common.Data.General.Enums.Region)regionId,
         UserName = userName
     };
 }
コード例 #3
0
ファイル: UpdateManager.cs プロジェクト: Gkeane12/WCFOwStats
 private void GetOrCreateUserProfile(ProfileManager profileManager)
 {
     _profileManager = profileManager;
     profile         = _profileManager
                       .GetOrCreateProfile(
         userName: profile.UserName,
         platformId: (int)profile.Platform,
         regionId: (int)profile.Region
         );
 }
コード例 #4
0
ファイル: ProfileManager.cs プロジェクト: Gkeane12/WCFOwStats
        private Common.Data.General.Profile TryRetriveProfile(string userName, int regionId, int platformId, ProfileStoreAccess storeAccess)
        {
            var profile = new Common.Data.General.Profile();

            profile = storeAccess.GetProfile(
                userName: userName,
                regionId: regionId,
                platformId: platformId);

            return(profile);
        }
コード例 #5
0
        public Common.Data.General.Profile GetProfile(string userName, int regionId, int platformId)
        {
            var profile = new Common.Data.General.Profile();

            try
            {
                profile = new Store.Service.Profile.ProfileStore(_connectionString).GetProfileByUsername(userName, regionId, platformId);
            }
            catch (Exception e)
            {
            }

            return(profile);
        }
コード例 #6
0
        public Common.Data.General.Profile GetProfileByUsername(string userName, int regionId, int platformId)
        {
            var profile = new Common.Data.General.Profile();

            try
            {
                using (SqlConnection conn = new SqlConnection(_connectionString))
                {
                    conn.Open();
                    SqlCommand command = new SqlCommand("General.GetProfileInfoByName", conn);
                    command.CommandType = System.Data.CommandType.StoredProcedure;
                    command.Parameters.AddRange(new SqlParameter[] {
                        new SqlParameter("@profileName", userName),
                        new SqlParameter("@platformId", platformId),
                        new SqlParameter("@regionId", regionId)
                    });

                    SqlDataReader rdr = command.ExecuteReader();

                    int profileGuidOrdinal = rdr.GetOrdinal("ProfileGuid");
                    int userNameOrdinal    = rdr.GetOrdinal("UserName");
                    int regionIdOrdinal    = rdr.GetOrdinal("RegionId");
                    int platformIdOrdinal  = rdr.GetOrdinal("PlatformId");

                    while (rdr.Read())
                    {
                        var _profileGuid = rdr.GetGuid(profileGuidOrdinal);
                        var _platformId  = rdr.GetInt32(platformIdOrdinal);
                        var _regionId    = rdr.GetInt32(regionIdOrdinal);
                        var _name        = rdr.GetString(userNameOrdinal);

                        profile = new Common.Data.General.Profile
                        {
                            ProfileGuid = _profileGuid,
                            Platform    = (Common.Data.General.Enums.Platform)_platformId,
                            UserName    = _name,
                            Region      = (Common.Data.General.Enums.Region)_regionId
                        };
                    }
                }
            }
            catch (SqlException Sqle)
            {
            }
            catch (System.Exception e)
            { }
            return(profile);
        }
コード例 #7
0
        public List <Common.Data.General.Profile> GetAllProfiles()
        {
            var profileList = new List <Common.Data.General.Profile>();

            try
            {
                using (SqlConnection conn = new SqlConnection(_connectionString))
                {
                    conn.Open();
                    SqlCommand command = new SqlCommand("General.GetAllProfiles", conn);
                    command.CommandType = System.Data.CommandType.StoredProcedure;

                    SqlDataReader rdr = command.ExecuteReader();

                    int profileGuidOrdinal = rdr.GetOrdinal("ProfileGuid");
                    int userNameOrdinal    = rdr.GetOrdinal("UserName");
                    int regionIdOrdinal    = rdr.GetOrdinal("RegionId");
                    int platformIdOrdinal  = rdr.GetOrdinal("PlatformId");

                    while (rdr.Read())
                    {
                        var _profileGuid = rdr.GetGuid(profileGuidOrdinal);
                        var _platformId  = rdr.GetInt32(platformIdOrdinal);
                        var _regionId    = rdr.GetInt32(regionIdOrdinal);
                        var _name        = rdr.GetString(userNameOrdinal);
                        var profile      = new Common.Data.General.Profile
                        {
                            ProfileGuid = _profileGuid,
                            Platform    = (Common.Data.General.Enums.Platform)_platformId,
                            UserName    = _name,
                            Region      = (Common.Data.General.Enums.Region)_regionId
                        };

                        profileList.Add(profile);
                    }
                }
            }
            catch (SqlException SQLe)
            { }

            return(profileList);
        }
コード例 #8
0
ファイル: ProfileManager.cs プロジェクト: Gkeane12/WCFOwStats
        public Common.Data.General.Profile GetOrCreateProfile(string userName, int regionId, int platformId)
        {
            var profile = new Common.Data.General.Profile();

            ProfileStoreAccess storeAccess = new ProfileStoreAccess(_connectionString);

            profile = TryRetriveProfile(userName, regionId, platformId, storeAccess);

            if (profile.ProfileGuid == null || profile.ProfileGuid == Guid.Empty)
            {
                storeAccess.InsertProfile(
                    userName: userName,
                    regionId: regionId,
                    platformId: platformId);

                profile = TryRetriveProfile(userName, regionId, platformId, storeAccess);
            }

            return(profile);
        }