public override bool OnCommandFind() { this.Cursor = Cursors.WaitCursor; try { m_dlgFindUser = new FindUserDialog(new FindDialogSqlDAO(AppEnvironment.Database), false, false); if (m_dlgFindUser.ShowDialog(this) == DialogResult.OK) { string strUserID = m_dlgFindUser.SelectedRecords[0][FindUserDialog.eColumn.Username.ToString()].ToString(); this.LoadingParam = strUserID; this.DataLoading(strUserID); } return(true); } catch (Exception ex) { ExceptionManager.ManageException(this, ex); return(false); } finally { this.Cursor = Cursors.Default; } }
private void btnAdd_Click(object sender, System.EventArgs e) { this.Cursor = Cursors.WaitCursor; try { if (m_dlgFindUser.ShowDialog(this) == DialogResult.OK) { SelectedRecordCollection records = m_dlgFindUser.SelectedRecords; foreach (SelectedRecord line in records) { string strUsername = Convert.ToString(line[FindUserDialog.eColumn.Username.ToString()]); bool bFoundItem = false; foreach (ListViewItem item in lstvMember.Items) { if (item.Text == strUsername) { bFoundItem = true; break; } } if (!bFoundItem) { string firstName = Convert.ToString(line[FindUserDialog.eColumn.FirstName.ToString()]); string lastName = Convert.ToString(line[FindUserDialog.eColumn.LastName.ToString()]); ListViewItem lv = new ListViewItem(strUsername); lv.SubItems.AddRange(new[] { firstName, lastName }); lstvMember.Items.Add(lv); } } } } catch (Exception ex) { ExceptionManager.ManageException(this, ex); } this.Cursor = Cursors.Default; }