コード例 #1
0
        private void btnAddStaff_Click(object sender, EventArgs e)
        {
            StaffEditForm staffEditForm = new StaffEditForm();

            if (staffEditForm.ShowDialog() == DialogResult.OK)
            {
                dgvStaff.DataSource = staffManager.GetAll();
                staffEditForm.Dispose();
            }
        }
コード例 #2
0
        private void btnEditStaff_Click(object sender, EventArgs e)
        {
            string name  = dgvStaff.CurrentRow.Cells["name"].Value.ToString();
            Staff  staff = staffManager.GetByName(name);

            //if update success
            if (staff != null)
            {
                StaffEditForm staffEditForm = new StaffEditForm(staff, diningArea);
                if (staffEditForm.ShowDialog() == DialogResult.OK)
                {
                    dgvStaff.DataSource = staffManager.GetAll();
                    staffEditForm.Dispose();
                }
            }
        }