コード例 #1
0
        private void AddDependent_Click(object sender, EventArgs e)
        {
            Employee employee = (EmployeeList.SelectedItem as ListItem).employee;
            NameForm nameform = new NameForm("Dependent");

            if (nameform.ShowDialog(this) == DialogResult.OK)
            {
                employee.AddDependent(nameform.PersonName);
                CalculateTotalCost();
                EmployeeInfo.Text = employee.ToString();
            }
            nameform.Dispose();
        }
コード例 #2
0
        private void AddEmployee_Click(object sender, EventArgs e)
        {
            NameForm nameform = new NameForm("Employee");

            if (nameform.ShowDialog(this) == DialogResult.OK)
            {
                AddEmployee(nameform.PersonName);
                if (EmployeeList.SelectedIndex < 0)
                {
                    EmployeeList.SelectedIndex = 0;
                }
                if (button2.Enabled == false)
                {
                    button2.Enabled = true;
                }
            }
            nameform.Dispose();
        }