Пример #1
0
        private void btn_add_Click(object sender, EventArgs e)
        {
            if (tb_companyName.Text.Length == 0)
            {
                DialogResult dialogResult = MessageBox.Show(invalidNameMessage, "Error", MessageBoxButtons.OK);
                if (dialogResult == DialogResult.OK)
                {
                    return;
                }
            }

            if (cb_accessPackage.SelectedIndex < 0)
            {
                DialogResult dialogResult = MessageBox.Show(invalidPackageMessage, "Error", MessageBoxButtons.OK);
                if (dialogResult == DialogResult.OK)
                {
                    return;
                }
            }

            registrations.Add(new RegistrationContainer(tb_companyName.Text, (int)nm_numberOfPasses.Value, packages[cb_accessPackage.SelectedIndex].Id));

            tb_companyName.Text = "";

            listViewRegistrationUtility.Refresh();
            tb_companyName.Focus();
            this.Owner.Refresh();
        }
Пример #2
0
        private void lv_deleteRegistrations_Click(object sender, EventArgs e)
        {
            if (lv_registrations.SelectedItems.Count == 0)
            {
                return;
            }

            String index  = lv_registrations.SelectedItems[0].SubItems[0].Text;
            var    result = registrationUtility.RemoveId(registrations, index);

            if (result)
            {
                listViewRegistrationUtility.Refresh();
            }
        }