Пример #1
0
        private void addBtn_Click(object sender, EventArgs e)
        {
            var modifyAppt = new ModifyAppointment(_context, null, _customer);

            modifyAppt.Show();
            // refreshes the appointment data after the modify form is closed
            modifyAppt.FormClosed += async(object s, FormClosedEventArgs ec) =>
            {
                await GetAppointments();
            };
        }
Пример #2
0
        private void editBtn_Click(object sender, EventArgs e)
        {
            var index = appointmentTable.CurrentRow.Index;
            // find is used to get the appointment by id from the appointments list. If its not found it returns null
            var appointment = _appointments[index];

            if (appointment == null)
            {
                MessageBox.Show(_translator.Translate("appointment.noneSelected"));
                return;
            }
            var modifyAppt = new ModifyAppointment(_context, appointment, new Customer
            {
                Id   = appointment.CustomerId,
                Name = appointment.CustomerName
            });

            modifyAppt.Show();
            // refresh the appointment data
            modifyAppt.FormClosed += async(object s, FormClosedEventArgs ec) =>
            {
                await GetAppointments();
            };
        }