private void AuthorsListBox_ItemCheck(object sender, ItemCheckEventArgs e) { for (var ix = 0; ix < AuthorsListBox.Items.Count; ++ix) { if (ix != e.Index) { AuthorsListBox.SetItemChecked(ix, false); } } RefreshAuthorInfoListBox(); }
private void AuthorsListBox_ItemCheck(object sender, ItemCheckEventArgs e) { if (e.NewValue == CheckState.Checked) { for (var index = 0; index < AuthorsListBox.Items.Count; ++index) { if (e.Index != index) { AuthorsListBox.SetItemChecked(index, false); } } } }
private void Refresh() { IList <Contact> authors = null; string range = string.Empty; AuthorsListBox.Items.Clear(); //Find selected bucket if (AtoELink.Font.Bold) { range = Constants.A_EAuthors; } else if (FtoJLink.Font.Bold) { range = Constants.F_JAuthors; } else if (KtoOLink.Font.Bold) { range = Constants.K_OAuthors; } else if (PtoTLink.Font.Bold) { range = Constants.P_TAuthors; } else if (UtoZLink.Font.Bold) { range = Constants.U_ZAuthors; } else if (OtherLink.Font.Bold) { range = Constants.OtherAuthors; } int fetchRecordCount = 0; int totalRecords = 0; //Calculate fetched record count if (PageIndex > 0) { fetchRecordCount = PageSize * this.PageIndex; } //Fetch authors using (ResourceDataAccess dataAccess = new ResourceDataAccess(this.CreateContext())) { if (IsSecurityAwareControl) { if (AuthenticatedToken != null) { authors = (IList <Contact>)dataAccess.GetAuthors(this.AuthenticatedToken, range, FilterTextBox.Text.Trim(), PageSize, fetchRecordCount, out totalRecords); } } else { authors = (IList <Contact>)dataAccess.GetAuthors(null, range, FilterTextBox.Text.Trim(), PageSize, fetchRecordCount, out totalRecords); } } //Set Page count. if (totalRecords > 0 && totalRecords > PageSize) { PageCount = Convert.ToInt32(Math.Ceiling((double)totalRecords / PageSize)); } else { PageCount = 0; } //Set status of Next and Previous navigation buttons NextButton.Enabled = PrevButton.Enabled = false; NextButton.Enabled = PageCount == 1 | PageCount <= (PageIndex + 1) ? false : true; PrevButton.Enabled = PageIndex == 0 ? false : true; if (authors != null) { foreach (Contact contact in authors) { string title = contact.Title; contact.Title = HttpUtility.HtmlEncode(CoreHelper.FitString(CoreHelper.GetTitleByResourceType(contact), 30)); Person person = contact as Person; if (person != null) { if (!string.IsNullOrEmpty(person.FirstName) || !string.IsNullOrEmpty(person.LastName)) { contact.Title += "(" + title + ")"; } } } } AuthorsListBox.DataSource = authors; AuthorsListBox.DataBind(); }