private void IndentificationNumbersListControl_OnAdd()
{
var form = new IdentificationNumberForm();
form.IdentificationNumber = new IdentificationNumber();
if (DialogResult.OK == form.ShowDialog())
{
IdentificationNumber id = form.IdentificationNumber;
String idType = "";
if (id is ManufacturerIdentificationNumber)
idType = "MFR";
else if (id is UserDefinedIdentificationNumber)
idType = "USR";
var lvi = new ListViewItem(idType);
lvi.SubItems.Add(id.number);
lvi.SubItems.Add(id.type.ToString());
lvi.SubItems.Add(id is UserDefinedIdentificationNumber
? ((UserDefinedIdentificationNumber) id).qualifier
: "");
if (id is ManufacturerIdentificationNumber)
lvi.SubItems.Add(((ManufacturerIdentificationNumber)id).manufacturerName);
else
lvi.SubItems.Add("");
lvi.Tag = id;
Items.Add(lvi);
if (_identificationNumbers == null)
_identificationNumbers = new List<IdentificationNumber>();
_identificationNumbers.Add(id);
lvi.BackColor = lvi.Index % 2 == 0 ? ATMLContext.COLOR_LIST_EVEN : ATMLContext.COLOR_LIST_ODD;
}
}