private void SaveButton_Click(object sender, EventArgs e) { string timestamp = SqlUpdater.CreateTimestamp(); int userId = SqlUpdater.GetCurrentUserID(); string username = SqlUpdater.GetCurrentUserName(); int appointmentId = Convert.ToInt32(SearchBar.Text); int customerId = Convert.ToInt32(TeamIdBox.Text); string type = TypeBox.Text; DateTime startTime = DateTime.Parse(StartTimeBox.Text).ToUniversalTime(); DateTime endTime = DateTime.Parse(EndTimeBox.Text).ToUniversalTime(); //String st = DateTime.Parse(StartTimeBox.Text).ToUniversalTime().ToString("u"); //String et = DateTime.Parse(EndTimeBox.Text).ToUniversalTime().ToString("u"); String st = DateTime.Parse(StartTimeBox.Text).ToUniversalTime().ToString("yyyy-MM-dd hh:mm:ss"); String et = DateTime.Parse(EndTimeBox.Text).ToUniversalTime().ToString("yyyy-MM-dd hh:mm:ss"); bool pass = Validator(); if (pass) { try { if (AppHasConflict(startTime, endTime)) { throw new ScheduleException(); } else { try { if (OutsideBusinessHours(startTime, endTime)) { throw new ScheduleException(); } else { SqlUpdater.UpdateAppt(customerId, userId, st, et, type, timestamp, username, appointmentId); mainScheduleObject.UpdateCalendar(); MessageBox.Show("Update Sucessfull."); Close(); } } catch (ScheduleException ex) { ex.BusinessHours(); } } } catch (ScheduleException ex) { ex.AppOverlap(); } } else { MessageBox.Show("Add Schedule Error."); } }