private void SetCreateTemplateScheduleClicked()
 {
     Mediator.GetInstance().CreateTemplateScheduleButtonClicked += (templateSchedule) =>
     {
         if (IsVisible)
         {
             if (Shifts.Count == 0)
             {
                 MessageBox.Show("No shifts has been added!");
             }
             else
             {
                 try
                 {
                     TemplateScheduleProxy templateScheduleProxy = new TemplateScheduleProxy();
                     templateSchedule.TemplateShifts = Shifts;
                     templateScheduleProxy.AddTemplateScheduleToDb(templateSchedule);
                     Shifts.Clear();
                     MessageBox.Show("Template schedule is now saved onto database");
                     Clear();
                 }
                 catch (Exception)
                 {
                     MessageBox.Show("Something went wrong! Templateschedule could not be saved! Too bad");
                 }
             }
         }
     };
 }
 public ViewEditTemplateSchedule()
 {
     InitializeComponent();
     TemplateSchedules = new List <TemplateSchedule>();
     _departmentProxy  = new DepartmentProxy();
     _templateProxy    = new TemplateScheduleProxy();
     BindDataDepartmentcBox();
     EventChangesListener();
     BtnSaveUpdatedTemplateSchedule.IsEnabled = false;
 }
 private void SetTemplateScheduleUpdateClicked()
 {
     Mediator.GetInstance().TemplateScheduleUpdateClicked += (schedule, e) =>
     {
         if (IsVisible)
         {
             try
             {
                 e.TemplateSchedule.TemplateShifts = Shifts;
                 TemplateScheduleProxy templateScheduleProxy = new TemplateScheduleProxy();
                 templateScheduleProxy.UpdateTemplateScheduleWithDelete(e.TemplateSchedule, DeletedShifts);
                 Clear();
             }
             catch (Exception)
             {
                 MessageBox.Show("Something went wrong! Could not save changes to template schedules");
             }
         }
     };
 }