private void Button_Click(object sender, RoutedEventArgs e)
 {
     errorBlock.Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FFF90505"));
     if (endDateCalendar.SelectedDate < startDateCalendar.SelectedDate)
     {
         DateTime dateTime = (DateTime)startDateCalendar.SelectedDate;
         errorBlock.Visibility        = Visibility.Visible;
         endDateCalendar.SelectedDate = dateTime.AddDays(1);
         errorBlock.Foreground        = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FFF90505"));
         errorBlock.Text = "End date must come after start date";
     }
     else
     {
         errorBlock.Visibility = Visibility.Visible;
         DateTime startDate   = (DateTime)startDateCalendar.SelectedDate;
         DateTime endDate     = (DateTime)endDateCalendar.SelectedDate;
         int      workingDays = GeneralUtils.CalculateWorkingDays(startDate, endDate);
         if (startDate.Year > DateTime.Now.Year || endDate.Year > DateTime.Now.Year)
         {
             errorBlock.Text = "Sorry, not accepting holiday requests for next year yer";
             return;
         }
         if (workingDays == 0)
         {
             errorBlock.Text = "You selected weekend days, no need for holiday allowance";
         }
         else if (workingDays > GeneralUtils.MAX_POSSIBLE_HOLIDAY)
         {
             errorBlock.Text = "Too many days selected, it exceeds the maximum allowance";
         }
         else
         {
             try
             {
                 this.Cursor = Cursors.Wait;
                 startDate   = GeneralUtils.simplifyStartDate(startDate);
                 endDate     = GeneralUtils.simplifyEndDate(endDate);
                 string username = (string)Application.Current.Resources["username"];
                 string password = (string)Application.Current.Resources["password"];
                 int    res      = client.HolidayRequest(startDate, endDate, workingDays, username, password);
                 this.Cursor = Cursors.Arrow;
                 if (res == 1)
                 {
                     errorBlock.Text       = "Holiday Request Submitted";
                     errorBlock.Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FF0E8B19"));
                 }
                 else if (res == -4)
                 {
                     errorBlock.Text = "Invalid parameters, please double check your selection";
                 }
                 else
                 {
                     errorBlock.Text = "Request failed. Please logout and try again later";
                 }
             }
             catch
             {
                 errorBlock.Text = "Request failed, please try again later";
             }
         }
     }
 }