private void Schedule_AppointmentEditorClosed(object sender, AppointmentEditorClosedEventArgs e) { MeetingsDBDataContext scheduleMeetings = new MeetingsDBDataContext(); Meeting_Table meeting; if (e.Action == EditorClosedAction.Save) { var editedAppointment = (e.EditedAppointment as ScheduleMeeting); var appointmentID = Convert.ToInt32(editedAppointment.AppointmentID); if (!e.IsNew) { meeting = (from data in scheduleMeetings.Meeting_Tables where data.ID == appointmentID select data).First() as Meeting_Table; meeting.Subject = editedAppointment.MappedSubject; meeting.StartTime = editedAppointment.MappedStartTime.ToString(); meeting.EndTime = editedAppointment.MappedEndTime.ToString(); meeting.Color = editedAppointment.MappedColor.ToString(); meeting.IsAllDay = editedAppointment.MappedIsAllDay.ToString(); meeting.ID = appointmentID; } else { meeting = new Meeting_Table(); meeting.Subject = editedAppointment.MappedSubject; meeting.StartTime = editedAppointment.MappedStartTime.ToString(); meeting.EndTime = editedAppointment.MappedEndTime.ToString(); meeting.Color = editedAppointment.MappedColor.ToString(); meeting.IsAllDay = editedAppointment.MappedIsAllDay.ToString(); meeting.ID = appointmentID; scheduleMeetings.Meeting_Tables.InsertOnSubmit(meeting); } scheduleMeetings.SubmitChanges(); } if (e.Action == EditorClosedAction.Delete) { var editedAppointment = (e.OriginalAppointment as ScheduleMeeting); var appointmentID = Convert.ToInt32(editedAppointment.AppointmentID); meeting = (from data in scheduleMeetings.Meeting_Tables where data.ID == appointmentID select data).First() as Meeting_Table; scheduleMeetings.Meeting_Tables.DeleteOnSubmit(meeting); scheduleMeetings.SubmitChanges(); } }
partial void DeleteMeeting_Table(Meeting_Table instance);
partial void UpdateMeeting_Table(Meeting_Table instance);
partial void InsertMeeting_Table(Meeting_Table instance);