private void DeleteHoliday() { string sMessageBoxText = "Do you want to delete this holiday?"; string sCaption = "Are you Sure?"; MessageBoxButton btnMessageBox = MessageBoxButton.YesNo; MessageBoxImage icnMessageBox = MessageBoxImage.Warning; MessageBoxResult rsltMessageBox = System.Windows.MessageBox.Show(sMessageBoxText, sCaption, btnMessageBox, icnMessageBox); switch (rsltMessageBox) { case MessageBoxResult.Yes: HolidayManager hm = new HolidayManager(); HolidayCollection hc = new HolidayCollection(); hm.DeleteHoliday(selectedHolidayId); hc.RetreiveAllHolidays(); MessageBox.Show("Holiday successfully deleted."); Close(); break; case MessageBoxResult.No: break; } }
private void updateHoliday() { if (!string.IsNullOrEmpty(tbHolidayName.Text)) { HolidayItem item = new HolidayItem(); item._HOLIDAY_ID = selectedHolidayId; item._HOLIDAY_NAME = tbHolidayName.Text; item._HOLIDAY_DATE = (DateTime)dpHolidayDate.SelectedDate; item._HOLIDAY_TYPE = cbHolidayType.SelectedValue.ToString(); try { HolidayManager hm = new HolidayManager(); hm.UpdateHoliday(item); MessageBox.Show("Holiday successfully updated."); } catch (System.Exception) { MessageBox.Show("Server not responding."); } HolidayCollection holidayList = new HolidayCollection(); holidayList.RetreiveAllHolidays(); Close(); } else { MessageBox.Show("Please input holiday name."); } }
private void saveHoliday() { if (isHolidayValid()) { HolidayItem item = new HolidayItem(); item._HOLIDAY_NAME = tbHolidayName.Text; item._HOLIDAY_DATE = (DateTime)dpHolidayDate.SelectedDate; item._HOLIDAY_TYPE = cbHolidayType.SelectedValue.ToString(); try { HolidayManager hm = new HolidayManager(); hm.SaveHoliday(item); MessageBox.Show("New Holiday added."); } catch (System.Exception) { MessageBox.Show("Server not responding."); } HolidayCollection holidayList = new HolidayCollection(); holidayList.RetreiveAllHolidays(); Close(); } }
public HolidayWindow() { InitializeComponent(); HolidayCollection holicol = new HolidayCollection(); holicol.RetreiveAllHolidays(); currentDate = DateTime.Today; DisplayCurrentDate(); }
private void getAllHolidays() { HolidayCollection myHolidayCollection = new HolidayCollection(); myHolidayCollection.RetreiveAllHolidays(); }