protected void _btnSave_Click(object sender, EventArgs e) { string errorMessage = CheckMandatoryFields(); if (string.IsNullOrEmpty(errorMessage)) { DiaryServiceClient diaryService = null; try { IRIS.Law.WebServiceInterfaces.Diary.Task taskDetails = GetControlData(); diaryService = new DiaryServiceClient(); TaskReturnValue returnValue = diaryService.SaveTask(_logonSettings.LogonId, taskDetails); if (returnValue.Success) { _hdnTaskId.Value = Convert.ToString(returnValue.Task.Id); _lblError.CssClass = "successMessage"; _lblError.Text = "Task Saved Successfully."; } else { _lblError.CssClass = "errorMessage"; if (returnValue.Message == "SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.") _lblError.Text = "Due Date is invalid"; else _lblError.Text = returnValue.Message; } } catch (System.ServiceModel.EndpointNotFoundException) { _lblError.Text = DataConstants.WSEndPointErrorMessage; _lblError.CssClass = "errorMessage"; } catch (Exception ex) { _lblError.CssClass = "errorMessage"; _lblError.Text = ex.Message; } finally { if (diaryService != null) { if (diaryService.State != System.ServiceModel.CommunicationState.Faulted) diaryService.Close(); } } } else { _lblError.CssClass = "errorMessage"; _lblError.Text = errorMessage; } }
protected void _btnSave_Click(object sender, EventArgs e) { string errorMessage = CheckMandatoryFields(); if (string.IsNullOrEmpty(errorMessage)) { DiaryServiceClient diaryService = null; try { IRIS.Law.WebServiceInterfaces.Diary.Task taskDetails = GetControlData(); diaryService = new DiaryServiceClient(); TaskReturnValue returnValue = diaryService.SaveTask(_logonSettings.LogonId, taskDetails); if (returnValue.Success) { _hdnTaskId.Value = Convert.ToString(returnValue.Task.Id); _lblError.CssClass = "successMessage"; _lblError.Text = "Task Saved Successfully."; } else { _lblError.CssClass = "errorMessage"; if (returnValue.Message == "SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.") { _lblError.Text = "Due Date is invalid"; } else { _lblError.Text = returnValue.Message; } } } catch (System.ServiceModel.EndpointNotFoundException) { _lblError.Text = DataConstants.WSEndPointErrorMessage; _lblError.CssClass = "errorMessage"; } catch (Exception ex) { _lblError.CssClass = "errorMessage"; _lblError.Text = ex.Message; } finally { if (diaryService != null) { if (diaryService.State != System.ServiceModel.CommunicationState.Faulted) { diaryService.Close(); } } } } else { _lblError.CssClass = "errorMessage"; _lblError.Text = errorMessage; } }