private void FillManagedRelationsTable() { StringBuilder sb = new StringBuilder(); ManagedRelations.Clear(); using (Database db = new MySqlDatabase()) { UserInfo[] uis = db.GetManagedUsers(Util.UserId, 0); foreach (UserInfo ui in uis) { ClientInfo ci = db.GetClientInfo(ui.UserId); int relType = db.DetermineRelationType(Util.UserId, ui.UserId); AddManagedRelationRow(sb, ManagedRelations, ci.GetFullName(), ui.UserId, relType); } ManagedRelations.DefaultView.Sort = "name ASC"; ArtistsTable.DataSource = ManagedRelations; ArtistsTable.DataBind(); dlMyRelations.DataSource = ManagedRelations; dlMyRelations.DataBind(); } }
private void FillManagedArtistDropDown() { ddlManagedArtist.Items.Clear(); ddlManagedArtist.Items.Add(new ListItem("---", "0")); using (Database db = new MySqlDatabase()) { UserInfo[] uis = db.GetManagedUsers(Util.UserId, 1); foreach (UserInfo ui in uis) { ClientInfo ci = db.GetClientInfo(ui.UserId); ddlManagedArtist.Items.Add(new ListItem(ci.GetFullName(), ui.UserId.ToString())); } if (!string.IsNullOrEmpty(Request["id"])) { Session["managed.userid"] = Convert.ToInt64(Request["id"]); IsrcHandle.Text = GetIsrcCode(Convert.ToInt64(Session["managed.userid"])); ddlManagedArtist.SelectedValue = Request.QueryString["id"].ToString(); ClientInfo _ManagedUserInfo = db.GetClientInfo(Convert.ToInt64(Request.QueryString["id"])); string accessToken = db.GetSocialCredential(_ManagedUserInfo.ClientId, SocialConnector.Facebook, "accesstoken"); string expiresRaw = db.GetSocialCredential(_ManagedUserInfo.ClientId, SocialConnector.Facebook, "accesstokenexpires"); bool isNotExpired = true; Facebook.AuthenticationService authService = new Facebook.AuthenticationService(); if (authService.TryAuthenticateAdminFBCred(expiresRaw, accessToken)) { isNotExpired = true; } else { db.RemoveSocialCredential(_ManagedUserInfo.ClientId, SocialConnector.Facebook); db.UpdateFacebookID(_ManagedUserInfo.ClientId); isNotExpired = false; } } } }
private void FillCoArtistsDropDown() { CoArtistDropDown.Items.Clear(); CoArtistDropDown.Items.Add(new ListItem("---", "0")); using (Database db = new MySqlDatabase()) { UserInfo[] uis = db.GetManagedUsers(Util.UserId, 0); foreach (UserInfo ui in uis) { ClientInfo ci = db.GetClientInfo(ui.UserId); CoArtistDropDown.Items.Add(new ListItem(ci.GetFullName(), ui.UserId.ToString())); } } }
private void FillManagedUsersTable() { int vcl = 0, ecl = 0; Util.GetUserClearanceLevels(Util.UserId, out vcl, out ecl); if (vcl < 100 && ecl < 100) { divManagedArtists.Visible = false; //divManaccChk.Visible = false; } else { divManagedArtists.Visible = true; // divManaccChk.Visible = true; ManagedArtists.Clear(); using (Database db = new MySqlDatabase()) { UserInfo[] uis = db.GetManagedUsers(Util.UserId, 1); if (uis.Length > 0) { foreach (UserInfo ui in uis) { ClientInfo ci = db.GetClientInfo(ui.UserId); AddManagedArtistRow(ManagedArtists, ci.GetFullName(), ui.UserId); dlMyManagedRelations.DataSource = ManagedArtists; dlMyManagedRelations.DataBind(); if (ManagedArtists.Rows.Count > 0) lblMSgMANACC.Visible = false; else lblMSgMANACC.Visible = true; } } else { dlMyManagedRelations.DataSource = ManagedArtists; dlMyManagedRelations.DataBind(); lblMSgMANACC.Visible = true; } } } }