public static UserAccounts GetUsersInRole(int roleID) { UserAccounts uars = null; // get a configured DbCommand object DbCommand comm = DbAct.CreateCommand(); // set the stored procedure name comm.CommandText = "up_GetUsersInRole"; ADOExtenstion.AddParameter(comm, "roleID", roleID); // execute the stored procedure DataTable dt = DbAct.ExecuteSelectCommand(comm); // was something returned? if (dt != null && dt.Rows.Count > 0) { uars = new UserAccounts(); UserAccount art = null; foreach (DataRow dr in dt.Rows) { art = new UserAccount(dr); uars.Add(art); } } return uars; }
public UserAccount AddUserAccount(string firstName, string lastName, string username, string password = null) { var id = Guid.NewGuid(); var userAccount = new UserAccount().CreateAccount(id, firstName, lastName, username, password); UserAccounts.Add(id, userAccount); return(userAccount); }
/// <summary> /// Refreshes the UserAccounts static property with the UserAccounts that are associated with /// the simulation identified by the supplied simId. /// </summary> /// <param name="simId">A long value containing the simulation id to compare user accounts against.</param> public static void refreshUserAccountPool(long simId) { if (MySqlHelper.connect() == false) return; DBConnection dbCon = MySqlHelper.dbCon; ArrayList response = dbCon.selectQuery( "SELECT * FROM tblUserAccount AS ua WHERE ua.id = (SELECT uap.user_id FROM tblUserAccountPool AS uap WHERE uap.user_id=ua.id AND uap.sim_id=" + simId + ")"); MySqlHelper.disconnect(); UserAccounts.Clear(); foreach (ArrayList arrayList in response) UserAccounts.Add(fromArrayList(arrayList)); }
/// <summary> /// Refreshes the UserAccounts static property with the all UserAccounts that are Stations /// and not already bound to a simulation. /// </summary> public static void refreshUserAccounts() { if (MySqlHelper.connect() == false) return; DBConnection dbCon = MySqlHelper.dbCon; ArrayList response = dbCon.selectQuery( "SELECT * FROM tblUserAccount AS ua WHERE 0 = (SELECT COUNT(uap.user_id) FROM tblUserAccountPool AS uap WHERE uap.user_id=ua.id) AND ua.type=1"); MySqlHelper.disconnect(); UserAccounts.Clear(); foreach (ArrayList arrayList in response) UserAccounts.Add(fromArrayList(arrayList)); }
private void loadItemsFromDB() { // UsernameBox.Items.Clear(); foreach (string database in globalvariables.DatabaseLocations) { using (SQLiteConnection sqlite_connection = new SQLiteConnection("Data Source=" + database + ";Version=3;")) { sqlite_connection.Open(); string sql = "select V_Key,Stig_Name,System_Name,entryID,transactionID,commentText,userID from Comments;"; using (SQLiteCommand command = new SQLiteCommand(sql, sqlite_connection)) { using (SQLiteDataReader reader = command.ExecuteReader()) { while (reader.Read()) { CommentEntry ce = new CommentEntry(); ce.Comment = (string)reader["commentText"]; ce.UserID = reader["userID"] as string ?? ""; if (!UserAccounts.Contains(reader["userID"] as string)) { UserAccounts.Add(reader["userID"] as string); } ce.TransactionID = reader["transactionID"] as string ?? ""; ce.EntryID = reader["entryID"] as string ?? ""; ce.System_Name = reader["System_Name"] as string ?? ""; ce.Stig_Name = reader["Stig_Name"] as string ?? ""; ce.V_Key = reader["V_Key"] as string ?? ""; Comments.Add(ce); } reader.Close(); sqlite_connection.Close(); command.Dispose(); } } } } }
private void btnSave_Click(object sender, RoutedEventArgs e) { //add new if (SelectedUser == null) { if (cbEmployees.SelectedItem is Employee) { Employee selectedEmployee = cbEmployees.SelectedItem as Employee; UserAccounts.Add(new UserAccount() { UserName = tbUsername.Text, Password = tbPassword.Text, Role = (Role)cbRole.SelectedItem, CreatedOn = DateTime.Now, Employee = selectedEmployee }); Ctx.SaveChanges(); this.Close(); } else { MessageBox.Show("You must select or create an employee before you can create a new account."); } } //update existing else { SelectedUser.UserName = tbUsername.Text; SelectedUser.CreatedOn = DateTime.Now; SelectedUser.Password = tbPassword.Text; SelectedUser.Role = (Role)cbRole.SelectedItem; CollectionViewSource.GetDefaultView(UserAccounts).Refresh(); Ctx.SaveChanges(); this.Close(); } }
public ActionResult ContactRequest() { NameValueCollection nvc = Request.QueryString; ua = new UserAccount(nvc["username"]); uas = new UserAccounts(); uas.Add(ua); ViewBag.UserTo = uas.ToUnorderdList; ViewBag.ContactType = nvc["contacttype"]; ViewBag.UserNameTo = ua.UserName; char contype = Convert.ToChar(nvc["contacttype"]); switch (contype) { case 'R': ViewBag.HeaderRequest = string.Format("{0} : {1}", ua.UserName, BootBaronLib.Resources.Messages.HaveYouMetInRealLife); ViewBag.HeaderRequest += string.Format( @"<img src=""{0}"" />", VirtualPathUtility.ToAbsolute("~/content/images/userstatus/handprint_small.png")); break; case 'C': ViewBag.HeaderRequest = string.Format("{0} : {1}", ua.UserName, BootBaronLib.Resources.Messages.WouldYouLikeToBeCyberAssociates); ViewBag.HeaderRequest += string.Format( @"<img src=""{0}"" />", VirtualPathUtility.ToAbsolute("~/content/images/userstatus/keyboard_small.png")); break; default: break; } return View(); }
private void LoadVisitorsView(string userName) { const int maxcountusers = 100; _uad = new UserAccountDetail(); if (userName != null) _ua = new UserAccount(userName); _uad.GetUserAccountDeailForUser(_ua.UserAccountID); var uadLooker = new UserAccountDetail(); if (_mu == null) return; uadLooker.GetUserAccountDeailForUser(Convert.ToInt32(_mu.ProviderUserKey)); if (_mu == null || _ua.UserAccountID <= 0 || !_uad.EnableProfileLogging || !_uad.EnableProfileLogging) return; ArrayList al = ProfileLog.GetRecentProfileViews(_ua.UserAccountID); if (al == null || al.Count <= 0) return; var uas = new UserAccounts(); foreach (int id in al) { var viewwer = new UserAccount(id); if (viewwer.IsLockedOut || !viewwer.IsApproved) continue; _uad = new UserAccountDetail(); _uad.GetUserAccountDeailForUser(id); if (_uad.EnableProfileLogging == false) continue; if (uas.Count >= maxcountusers) break; uas.Add(viewwer); } ViewBag.TheViewers = uas.ToUnorderdList; }
private void LoadVisitorsView(string userName) { int maxcountusers = 100; mu = Membership.GetUser(); uad = new UserAccountDetail(); ua = new UserAccount(userName); uad.GetUserAccountDeailForUser(ua.UserAccountID); UserAccountDetail uadLooker = new UserAccountDetail(); uadLooker.GetUserAccountDeailForUser(Convert.ToInt32(mu.ProviderUserKey)); if (mu != null && ua.UserAccountID > 0 && uad.EnableProfileLogging && uad.EnableProfileLogging) { ArrayList al = ProfileLog.GetRecentProfileViews(ua.UserAccountID); if (al != null && al.Count > 0) { UserAccounts uas = new UserAccounts(); UserAccount viewwer = null; foreach (int ID in al) { viewwer = new UserAccount(ID); if (!viewwer.IsLockedOut && viewwer.IsApproved) { uad = new UserAccountDetail(); uad.GetUserAccountDeailForUser(ID); if (uad.EnableProfileLogging == false) continue; if (uas.Count >= maxcountusers) break; uas.Add(viewwer); } } ViewBag.TheViewers = uas.ToUnorderdList; } } }
public ActionResult BlockedUsers() { mu = Membership.GetUser(); ua = new UserAccount(mu.UserName); if (ua.UserAccountID == 0) return View(); contacts = new UserAccounts(); UserAccount ua1 = null; BlockedUsers bus = new BootBaronLib.AppSpec.DasKlub.BOL.BlockedUsers(); bus.GetBlockedUsers(Convert.ToInt32(mu.ProviderUserKey)); foreach (BlockedUser uc1 in bus) { ua1 = new UserAccount(uc1.UserAccountIDBlocked); contacts.Add(ua1); } ViewBag.BlockedUsers = contacts.ToUnorderdList; return View(); }
public ActionResult ProfileDetail(string userName) { ViewBag.VideoHeight = (Request.Browser.IsMobileDevice) ? 100 : 277; ViewBag.VideoWidth = (Request.Browser.IsMobileDevice) ? 225 : 400; _ua = new UserAccount(userName); var uad = new UserAccountDetail(); uad.GetUserAccountDeailForUser(_ua.UserAccountID); uad.BandsSeen = ContentLinker.InsertBandLinks(uad.BandsSeen, false); uad.BandsToSee = ContentLinker.InsertBandLinks(uad.BandsToSee, false); var model = new ProfileModel(); model.ProfilePhotoMainRaw = uad.RawProfilePicUrl; if (_ua.UserAccountID > 0) { model.UserAccountID = _ua.UserAccountID; model.PhotoCount = PhotoItems.GetPhotoItemCountForUser(_ua.UserAccountID); model.CreateDate = _ua.CreateDate; } if (_mu != null) { ViewBag.IsBlocked = BlockedUser.IsBlockedUser(_ua.UserAccountID, Convert.ToInt32(_mu.ProviderUserKey)); ViewBag.IsBlocking = BlockedUser.IsBlockedUser(Convert.ToInt32(_mu.ProviderUserKey), _ua.UserAccountID); if (_ua.UserAccountID == Convert.ToInt32(_mu.ProviderUserKey)) { model.IsViewingSelf = true; } else { var ucon = new UserConnection(); ucon.GetUserToUserConnection(Convert.ToInt32(_mu.ProviderUserKey), _ua.UserAccountID); model.UserConnectionID = ucon.UserConnectionID; if (BlockedUser.IsBlockedUser(Convert.ToInt32(_mu.ProviderUserKey), _ua.UserAccountID)) { return RedirectToAction("index", "home"); } } } else { if (uad.MembersOnlyProfile) { return RedirectToAction("LogOn", "Account"); } } ViewBag.ThumbIcon = uad.FullProfilePicURL; SetModelForUserAccount(model, uad); // var su = new StatusUpdate(); su.GetMostRecentUserStatus(_ua.UserAccountID); if (su.StatusUpdateID > 0) { model.LastStatusUpdate = su.CreateDate; model.MostRecentStatusUpdate = su.Message; } model.ProfileVisitorCount = ProfileLog.GetUniqueProfileVisitorCount(_ua.UserAccountID); GetUserPhotos(model); GetUserNews(model); model.MetaDescription = _ua.UserName + " " + Messages.Profile + " " + FromDate.DateToYYYY_MM_DD(_ua.LastActivityDate); GetUserPlaylist(); ForumThreads(_ua.UserAccountID, model); if (uad.UserAccountID > 0) { model.Birthday = uad.BirthDate; if (uad.ShowOnMapLegal) { // because of the foreign cultures, numbers need to stay in the English version unless a javascript encoding could be added string currentLang = Utilities.GetCurrentLanguageCode(); Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(SiteEnums.SiteLanguages.EN.ToString()); Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(SiteEnums.SiteLanguages.EN.ToString()); model.DisplayOnMap = uad.ShowOnMapLegal; var rnd = new Random(); int offset = rnd.Next(10, 100); SiteStructs.LatLong latlong = GeoData.GetLatLongForCountryPostal(uad.Country, uad.PostalCode); if (latlong.latitude != 0 && latlong.longitude != 0) { model.Latitude = Convert.ToDecimal(latlong.latitude + Convert.ToDouble("0.00" + offset)) .ToString(CultureInfo.InvariantCulture); model.Longitude = Convert.ToDecimal(latlong.longitude + Convert.ToDouble("0.00" + offset)) .ToString(CultureInfo.InvariantCulture); } else { model.DisplayOnMap = false; } Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(currentLang); Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(currentLang); } ViewBag.ThumbIcon = uad.FullProfilePicThumbURL; LoadCurrentImagesViewBag(uad.UserAccountID); } ViewBag.UserAccountDetail = uad; ViewBag.UserAccount = _ua; GetUserContacts(model); UserAccountDetail uadLooker = null; if (_mu != null) { uadLooker = new UserAccountDetail(); uadLooker.GetUserAccountDeailForUser(Convert.ToInt32(_mu.ProviderUserKey)); } if (uadLooker != null && (_mu != null && _ua.UserAccountID > 0 && uadLooker.EnableProfileLogging && uad.EnableProfileLogging)) { var pl = new ProfileLog { LookedAtUserAccountID = _ua.UserAccountID, LookingUserAccountID = Convert.ToInt32(_mu.ProviderUserKey) }; if (pl.LookingUserAccountID != pl.LookedAtUserAccountID) pl.Create(); ArrayList al = ProfileLog.GetRecentProfileViews(_ua.UserAccountID); if (al != null && al.Count > 0) { var uas = new UserAccounts(); foreach (UserAccount viewwer in al.Cast<int>().Select(id => new UserAccount(id)) .Where(viewwer => !viewwer.IsLockedOut && viewwer.IsApproved) .TakeWhile(viewwer => uas.Count < Maxcountusers)) { uas.Add(viewwer); } } } GetUserAccountVideos(); // this is either a youtube user or this is a band var art = new Artist(); art.GetArtistByAltname(userName); if (art.ArtistID > 0) { // try this way for dashers model.UserName = art.Name; } var vids = new Videos(); var sngrs = new SongRecords(); if (art.ArtistID == 0) { vids.GetAllVideosByUser(userName); var uavs = new UserAccountVideos(); uavs.GetRecentUserAccountVideos(_ua.UserAccountID, 'U'); foreach (Video f2 in uavs.Select(uav1 => new Video(uav1.VideoID)).Where(f2 => !vids.Contains(f2))) { vids.Add(f2); } vids.Sort((x, y) => (y.PublishDate.CompareTo(x.PublishDate))); model.UserName = _ua != null ? _ua.UserName : userName; } else { GetArtistProfile(art, vids); } vids.Sort((p1, p2) => p2.PublishDate.CompareTo(p1.PublishDate)); sngrs.AddRange(vids.Select(v1 => new SongRecord(v1))); if (_mu != null && _ua.UserAccountID != Convert.ToInt32(_mu.ProviderUserKey)) { var uc1 = new UserConnection(); uc1.GetUserToUserConnection(_ua.UserAccountID, Convert.ToInt32(_mu.ProviderUserKey)); if (uc1.UserConnectionID > 0) { switch (uc1.StatusType) { case 'C': if (uc1.IsConfirmed) { model.IsCyberFriend = true; } else { model.IsWatingToBeCyberFriend = true; } break; case 'R': if (uc1.IsConfirmed) { model.IsRealFriend = true; } else { model.IsWatingToBeRealFriend = true; } break; default: model.IsDeniedCyberFriend = true; model.IsDeniedRealFriend = true; break; } } } if (sngrs.Count == 0 && art.ArtistID == 0 && _ua.UserAccountID == 0) { // no longer exists Response.RedirectPermanent("/"); return new EmptyResult(); } var sngDisplay = new SongRecords(); sngDisplay.AddRange(from sr1 in sngrs let vidToShow = new Video(sr1.VideoID) where vidToShow.IsEnabled select sr1); model.SongRecords = sngDisplay.VideosList(); return View(model); }
public void GetContactsForUser(string userName, char contactType) { ua = new UserAccount(userName); // if (Membership.GetUser().UserName != ua.UserName) return View(); if (ua.UserAccountID == 0) return; contacts = new UserAccounts(); UserAccount ua1 = null; ucons = new UserConnections(); ucons.GetUserConnections(ua.UserAccountID); foreach (UserConnection uc1 in ucons) { if (!uc1.IsConfirmed || uc1.StatusType != contactType) continue; if (uc1.FromUserAccountID == ua.UserAccountID) { ua1 = new UserAccount(uc1.ToUserAccountID); } else { ua1 = new UserAccount(uc1.FromUserAccountID); } if (ua1.IsApproved && !ua1.IsLockedOut) { contacts.Add(ua1); } } ViewBag.UserName = ua.UserName; ViewBag.ContactsCount = Convert.ToString(contacts.Count); ViewBag.Contacts = contacts.ToUnorderdList; }
private void GetUserContacts(ProfileModel model) { var ucons = new UserConnections(); ucons.GetUserConnections(_ua.UserAccountID); ucons.Shuffle(); var irlContacts = new UserAccounts(); var cyberAssociates = new UserAccounts(); foreach (UserConnection uc1 in ucons.Where(uc1 => uc1.IsConfirmed)) { UserAccount userCon; switch (uc1.StatusType) { case 'C': if (cyberAssociates.Count >= Maxcountusers) continue; userCon = uc1.ToUserAccountID != _ua.UserAccountID ? new UserAccount(uc1.ToUserAccountID) : new UserAccount(uc1.FromUserAccountID); cyberAssociates.Add(userCon); break; case 'R': if (irlContacts.Count >= Maxcountusers) continue; userCon = uc1.ToUserAccountID != _ua.UserAccountID ? new UserAccount(uc1.ToUserAccountID) : new UserAccount(uc1.FromUserAccountID); irlContacts.Add(userCon); break; } } if (irlContacts.Count > 0) { model.IRLFriendCount = irlContacts.Count; } if (cyberAssociates.Count > 0) { model.CyberFriendCount = cyberAssociates.Count; } }
public void GetContactsForUser(string userName, char contactType) { _ua = new UserAccount(userName); if (_ua.UserAccountID == 0) return; _contacts = new UserAccounts(); _ucons = new UserConnections(); _ucons.GetUserConnections(_ua.UserAccountID); foreach (UserAccount ua1 in _ucons.Where(uc1 => uc1.IsConfirmed && uc1.StatusType == contactType) .Select(uc1 => uc1.FromUserAccountID == _ua.UserAccountID ? new UserAccount(uc1.ToUserAccountID) : new UserAccount(uc1.FromUserAccountID)).Where(ua1 => ua1.IsApproved && !ua1.IsLockedOut)) { _contacts.Add(ua1); } ViewBag.UserName = _ua.UserName; ViewBag.ContactsCount = Convert.ToString(_contacts.Count); ViewBag.Contacts = _contacts.ToUnorderdList; }
/// <summary> /// Add created account to database /// </summary> /// <param name="useraccount"></param> public void AddAccount(UserAccount useraccount) { UserAccounts.Add(useraccount); db.UserAccount.Add(useraccount); db.SaveChanges(); }
public ActionResult BlockedUsers() { if (_mu != null) _ua = new UserAccount(_mu.UserName); if (_ua.UserAccountID == 0) return View(); _contacts = new UserAccounts(); var bus = new BlockedUsers(); if (_mu != null) bus.GetBlockedUsers(Convert.ToInt32(_mu.ProviderUserKey)); foreach (UserAccount ua1 in bus.Select(uc1 => new UserAccount(uc1.UserAccountIDBlocked))) { _contacts.Add(ua1); } ViewBag.BlockedUsers = _contacts.ToUnorderdList; return View(); }
public ActionResult ProfileDetail(string userName) { ViewBag.VideoHeight = (Request.Browser.IsMobileDevice) ? 100 : 277; ViewBag.VideoWidth = (Request.Browser.IsMobileDevice) ? 225 : 400; ua = new UserAccount(userName); UserAccountDetail uad = new UserAccountDetail(); uad.GetUserAccountDeailForUser(ua.UserAccountID); uad.BandsSeen = ContentLinker.InsertBandLinks(uad.BandsSeen, false); uad.BandsToSee = ContentLinker.InsertBandLinks(uad.BandsToSee, false); MembershipUser mu = Membership.GetUser(); ProfileModel model = new ProfileModel(); if (ua.UserAccountID > 0) { model.UserAccountID = ua.UserAccountID; model.PhotoCount = PhotoItems.GetPhotoItemCountForUser(ua.UserAccountID); model.CreateDate = ua.CreateDate; } if (mu != null) { ViewBag.IsBlocked = BlockedUser.IsBlockedUser(ua.UserAccountID, Convert.ToInt32(mu.ProviderUserKey)); ViewBag.IsBlocking = BlockedUser.IsBlockedUser(Convert.ToInt32(mu.ProviderUserKey), ua.UserAccountID); if (ua.UserAccountID == Convert.ToInt32(mu.ProviderUserKey)) { model.IsViewingSelf = true; } else { UserConnection ucon = new UserConnection(); ucon.GetUserToUserConnection(Convert.ToInt32(mu.ProviderUserKey), ua.UserAccountID); model.UserConnectionID = ucon.UserConnectionID; if (BlockedUser.IsBlockedUser(Convert.ToInt32(mu.ProviderUserKey), ua.UserAccountID)) { return RedirectToAction("index", "home"); } } } else { if (uad.MembersOnlyProfile) { return RedirectToAction("Account", "LogOn"); } } // model.UserName = ua.UserName; model.CreateDate = ua.CreateDate; model.LastActivityDate = ua.LastActivityDate; // model.DisplayAge = uad.DisplayAge; model.Age = uad.YearsOld; model.BandsSeen = uad.BandsSeen; model.BandsToSee = uad.BandsToSee; model.HardwareAndSoftwareSkills = uad.HardwareSoftware; model.MessageToTheWorld = uad.AboutDescription; model.YouAreFull = uad.Sex; model.InterestedInFull = uad.InterestedFull; model.RelationshipStatusFull = uad.RelationshipStatusFull ; model.RelationshipStatus = uad.RelationshipStatus; model.InterestedIn = uad.InterestedIn; model.YouAre = uad.YouAre; model.Website = uad.ExternalURL; model.CountryCode = uad.Country; model.CountryName = uad.CountryName; model.IsBirthday = uad.IsBirthdayToday; model.ProfilePhotoMain = uad.FullProfilePicURL; model.ProfilePhotoMainThumb = uad.FullProfilePicThumbURL; model.DefaultLanguage = uad.DefaultLanguage; model.EnableProfileLogging = uad.EnableProfileLogging; model.Handed = uad.HandedFull; model.RoleIcon = uad.SiteBages; // StatusUpdate su = new StatusUpdate(); su.GetMostRecentUserStatus(ua.UserAccountID); if (su.StatusUpdateID > 0) { model.LastStatusUpdate = su.CreateDate; model.MostRecentStatusUpdate = su.Message; } model.ProfileVisitorCount = ProfileLog.GetUniqueProfileVisitorCount(ua.UserAccountID); PhotoItems ptiems = new PhotoItems(); ptiems.GetUserPhotos(ua.UserAccountID); if (ptiems.Count > 0) { ptiems.Sort((PhotoItem x, PhotoItem y) => (y.CreateDate.CompareTo(x.CreateDate))); PhotoItems ptiemsDisplay = new PhotoItems(); int maxPhotos = 8; foreach (PhotoItem pitm1 in ptiems) { pitm1.UseThumb = true; if (ptiemsDisplay.Count < maxPhotos) { ptiemsDisplay.Add(pitm1); } else break; } ptiemsDisplay.UseThumb = true; ptiemsDisplay.ShowTitle = false; model.HasMoreThanMaxPhotos = (ptiems.Count > maxPhotos); ptiemsDisplay.IsUserPhoto = true; model.PhotoItems = ptiemsDisplay.ToUnorderdList; } Contents conts = new Contents(); conts.GetContentForUser(ua.UserAccountID); model.NewsCount = conts.Count; if (conts.Count > 0) { conts.Sort((Content x, Content y) => (y.ReleaseDate.CompareTo(x.ReleaseDate))); Contents displayContents = new Contents(); int maxCont = 1; int currentCount = 0; foreach (Content ccn1 in conts) { currentCount++; if (maxCont >= currentCount) { displayContents.Add(ccn1); } else break; } displayContents.IncludeStartAndEndTags = false; model.NewsArticles = displayContents.ToUnorderdList; } model.MetaDescription = ua.UserName + " " + BootBaronLib.Resources.Messages.Profile + " " + FromDate.DateToYYYY_MM_DD(ua.LastActivityDate); // playlist BootBaronLib.AppSpec.DasKlub.BOL.Playlist plyst = new Playlist(); plyst.GetUserPlaylist(ua.UserAccountID); if (plyst.PlaylistID > 0 && PlaylistVideos.GetCountOfVideosInPlaylist(plyst.PlaylistID) > 0) { ViewBag.AutoPlay = plyst.AutoPlay; ViewBag.AutoPlayNumber = (plyst.AutoPlay) ? 1 : 0; ViewBag.UserPlaylistID = plyst.PlaylistID; } if (uad.UserAccountID > 0) { model.Birthday = uad.BirthDate; if (uad.ShowOnMapLegal) { byte[] myarray2 = Encoding.Unicode.GetBytes(string.Empty); // because of the foreign cultures, numbers need to stay in the English version unless a javascript encoding could be added string currentLang = Utilities.GetCurrentLanguageCode(); Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(SiteEnums.SiteLanguages.EN.ToString()); Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(SiteEnums.SiteLanguages.EN.ToString()); Encoding iso = Encoding.GetEncoding("ISO-8859-1"); Encoding utf8 = Encoding.UTF8; model.DisplayOnMap = uad.ShowOnMapLegal; Random rnd = new Random(); int offset = rnd.Next(10, 100); SiteStructs.LatLong latlong = GeoData.GetLatLongForCountryPostal(uad.Country, uad.PostalCode); if (latlong.latitude != 0 && latlong.longitude != 0) { model.Latitude = Convert.ToDecimal(latlong.latitude + Convert.ToDouble("0.00" + offset)).ToString(); model.Longitude = Convert.ToDecimal(latlong.longitude + Convert.ToDouble("0.00" + offset)).ToString(); } else { model.DisplayOnMap = false; } Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(currentLang); Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(currentLang); } ViewBag.ThumbIcon = uad.FullProfilePicThumbURL; LoadCurrentImagesViewBag(uad.UserAccountID); } ViewBag.UserAccountDetail = uad; ViewBag.UserAccount = ua; UserConnections ucons = new UserConnections(); ucons.GetUserConnections(ua.UserAccountID); ucons.Shuffle(); UserAccounts irlContacts = new UserAccounts(); UserAccounts CyberAssociates = new UserAccounts(); UserAccount userCon = null; foreach (UserConnection uc1 in ucons) { if (!uc1.IsConfirmed) continue; switch (uc1.StatusType) { case 'C': if (CyberAssociates.Count >= maxcountusers) continue; if (uc1.ToUserAccountID != ua.UserAccountID) { userCon = new UserAccount(uc1.ToUserAccountID); } else { userCon = new UserAccount(uc1.FromUserAccountID); } CyberAssociates.Add(userCon); break; case 'R': if (irlContacts.Count >= maxcountusers) continue; if (uc1.ToUserAccountID != ua.UserAccountID) { userCon = new UserAccount(uc1.ToUserAccountID); } else { userCon = new UserAccount(uc1.FromUserAccountID); } irlContacts.Add(userCon); break; default: break; } } if (irlContacts.Count > 0) { model.IRLFriendCount = irlContacts.Count; } if (CyberAssociates.Count > 0) { // ViewBag.CyberAssociatesCount = Convert.ToString( CyberAssociates.Count ); model.CyberFriendCount = CyberAssociates.Count; } mu = Membership.GetUser(); UserAccountDetail uadLooker = null; if (mu != null) { uadLooker = new UserAccountDetail(); uadLooker.GetUserAccountDeailForUser(Convert.ToInt32(mu.ProviderUserKey)); } if (mu != null && ua.UserAccountID > 0 && uadLooker.EnableProfileLogging && uad.EnableProfileLogging) { ProfileLog pl = new ProfileLog(); pl.LookedAtUserAccountID = ua.UserAccountID; pl.LookingUserAccountID = Convert.ToInt32(mu.ProviderUserKey); if (pl.LookingUserAccountID != pl.LookedAtUserAccountID) pl.Create(); ArrayList al = ProfileLog.GetRecentProfileViews(ua.UserAccountID); if (al != null && al.Count > 0) { UserAccounts uas = new UserAccounts(); UserAccount viewwer = null; foreach (int ID in al) { viewwer = new UserAccount(ID); if (!viewwer.IsLockedOut && viewwer.IsApproved) { if (uas.Count >= maxcountusers) break; uas.Add(viewwer); } } // model.ViewingUsers = uas.ToUnorderdList; } } UserAccountVideos uavs = null; if (ua.UserAccountID > 0) { uavs = new UserAccountVideos(); uavs.GetRecentUserAccountVideos(ua.UserAccountID, 'F'); if (uavs.Count > 0) { Videos favvids = new Videos(); Video f1 = new Video(); foreach (UserAccountVideo uav1 in uavs) { f1 = new Video(uav1.VideoID); if (f1.IsEnabled) favvids.Add(f1); } SongRecord sng1 = null; SongRecords sngrcds2 = new SongRecords(); foreach (Video v1 in favvids) { sng1 = new SongRecord(v1); sngrcds2.Add(sng1); } sngrcds2.IsUserSelected = true; ViewBag.UserFavorites = sngrcds2.VideosList();//.ListOfVideos(); } } // this is either a youtube user or this is a band Artist art = new Artist( ); art.GetArtistByAltname(userName); if (art.ArtistID > 0) { // try this way for dashers model.UserName = art.Name; } Videos vids = new Videos(); SongRecords sngrs = new SongRecords(); if (art.ArtistID == 0) { vids.GetAllVideosByUser(userName); uavs = new UserAccountVideos(); uavs.GetRecentUserAccountVideos(ua.UserAccountID, 'U'); Video f2 = null; foreach (UserAccountVideo uav1 in uavs) { f2 = new Video(uav1.VideoID); if (!vids.Contains(f2)) vids.Add(f2); } vids.Sort((Video x, Video y) => (y.PublishDate.CompareTo(x.PublishDate))); model.UserName = userName; } else { // photo ArtistProperty aprop = new ArtistProperty(); aprop.GetArtistPropertyForTypeArtist(art.ArtistID, SiteEnums.ArtistPropertyType.PH.ToString()); if (!string.IsNullOrEmpty(aprop.PropertyContent)) { ViewBag.ArtistPhoto = System.Web.VirtualPathUtility.ToAbsolute(aprop.PropertyContent); ViewBag.ThumbIcon = System.Web.VirtualPathUtility.ToAbsolute(aprop.PropertyContent); } // meta descriptione aprop = new ArtistProperty(); aprop.GetArtistPropertyForTypeArtist(art.ArtistID, SiteEnums.ArtistPropertyType.MD.ToString()); if (!string.IsNullOrEmpty(aprop.PropertyContent)) ViewBag.MetaDescription = aprop.PropertyContent; // description aprop = new ArtistProperty(); aprop.GetArtistPropertyForTypeArtist(art.ArtistID, SiteEnums.ArtistPropertyType.LD.ToString()); if (!string.IsNullOrEmpty(aprop.PropertyContent)) ViewBag.ArtistDescription = ContentLinker.InsertBandLinks(aprop.PropertyContent, false); #region rss ///// rss //RssResources rssrs = new RssResources(); //rssrs.GetArtistRssResource(art.ArtistID); //if (rssrs.Count > 0) //{ // RssItems ritems = new RssItems(); // RssItems ritemsOUT = new RssItems(); // foreach (RssResource rssre in rssrs) // { // ritems.GetTopRssItemsForResource(rssre.RssResourceID); // //ritm = new RssItem(rssre..ArtistID); // } // ritems.Sort((RssItem x, RssItem y) => (y.PubDate.CompareTo(x.PubDate))); // foreach (RssItem ritm in ritems) // { // if (ritemsOUT.Count < 10) // { // ritemsOUT.Add(ritm); // } // } // ViewBag.ArtistNews = ritemsOUT.ToUnorderdList; //} //else //{ // ViewBag.ArtistNews = null; //} //ViewBag.DisplayName = art.DisplayName; #endregion Songs sngss = new Songs(); sngss.GetSongsForArtist(art.ArtistID); SongRecord snrcd = new SongRecord(); foreach (Song sn1 in sngss) { vids.GetVideosForSong(sn1.SongID); } } vids.Sort(delegate(Video p1, Video p2) { return p2.PublishDate.CompareTo(p1.PublishDate); }); foreach (BootBaronLib.AppSpec.DasKlub.BOL.Video v1 in vids) { sngrs.Add(new SongRecord(v1)); } if (mu != null && ua.UserAccountID != Convert.ToInt32(mu.ProviderUserKey)) { UserConnection uc1 = new UserConnection(); uc1.GetUserToUserConnection(ua.UserAccountID, Convert.ToInt32(mu.ProviderUserKey)); if (uc1.UserConnectionID > 0) { switch (uc1.StatusType) { case 'C': if (uc1.IsConfirmed) { model.IsCyberFriend = true; } else { model.IsWatingToBeCyberFriend = true; } break; case 'R': if (uc1.IsConfirmed) { model.IsRealFriend = true; } else { model.IsWatingToBeRealFriend = true; } break; default: model.IsDeniedCyberFriend = true; model.IsDeniedRealFriend = true; break; } } } if (sngrs == null || sngrs.Count == 0 && art.ArtistID == 0 && ua.UserAccountID == 0) { // no longer exists Response.RedirectPermanent("/"); return new EmptyResult(); } //sngrs.Sort((SongRecord x, SongRecord y) => (y.cre.CompareTo(x.CreateDate))); SongRecords sngDisplay = new SongRecords(); Video vidToShow = null; foreach (SongRecord sr1 in sngrs) { vidToShow = new Video(sr1.VideoID); if (vidToShow.IsEnabled) { sngDisplay.Add(sr1); } } model.SongRecords = sngDisplay.VideosList(); return View(model); }