/// <summary> /// Searches for appointments that match the search criteria. /// </summary> public IRIS.Law.WebServiceInterfaces.Diary.Appointment[] SearchAppointment(int startRow, int pageSize, string sortBy, string user, string date, bool forceRefresh) { DiaryServiceClient diaryService = null; IRIS.Law.WebServiceInterfaces.Diary.Appointment[] appointments = null; try { if (HttpContext.Current.Session[SessionName.LogonSettings] != null) { Guid _logonId = ((LogonReturnValue)HttpContext.Current.Session[SessionName.LogonSettings]).LogonId; CollectionRequest collectionRequest = new CollectionRequest(); collectionRequest.ForceRefresh = forceRefresh; collectionRequest.StartRow = startRow; collectionRequest.RowCount = pageSize; AppointmentSearchCriteria criteria = new AppointmentSearchCriteria(); criteria.MemberID = user; criteria.OrderBy = sortBy; if (!string.IsNullOrEmpty(date)) { criteria.Date = Convert.ToDateTime(date); } else { criteria.Date = DataConstants.BlankDate; } diaryService = new DiaryServiceClient(); AppointmentSearchReturnValue returnValue = diaryService.AppointmentSearch(_logonId, collectionRequest, criteria); if (returnValue.Success) { _appointmentRowCount = returnValue.Appointments.TotalRowCount; appointments = returnValue.Appointments.Rows; } else { if (returnValue.Message == "SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.") throw new Exception("Date is invalid"); else throw new Exception(returnValue.Message); } } return appointments; } catch (Exception ex) { throw ex; } finally { if (diaryService != null) { if (diaryService.State != System.ServiceModel.CommunicationState.Faulted) diaryService.Close(); } } }
/// <summary> /// Searches for appointments that match the search criteria. /// </summary> public IRIS.Law.WebServiceInterfaces.Diary.Appointment[] SearchAppointment(int startRow, int pageSize, string sortBy, string user, string date, bool forceRefresh) { DiaryServiceClient diaryService = null; IRIS.Law.WebServiceInterfaces.Diary.Appointment[] appointments = null; try { if (HttpContext.Current.Session[SessionName.LogonSettings] != null) { Guid _logonId = ((LogonReturnValue)HttpContext.Current.Session[SessionName.LogonSettings]).LogonId; CollectionRequest collectionRequest = new CollectionRequest(); collectionRequest.ForceRefresh = forceRefresh; collectionRequest.StartRow = startRow; collectionRequest.RowCount = pageSize; AppointmentSearchCriteria criteria = new AppointmentSearchCriteria(); criteria.MemberID = user; criteria.OrderBy = sortBy; if (!string.IsNullOrEmpty(date)) { criteria.Date = Convert.ToDateTime(date); } else { criteria.Date = DataConstants.BlankDate; } diaryService = new DiaryServiceClient(); AppointmentSearchReturnValue returnValue = diaryService.AppointmentSearch(_logonId, collectionRequest, criteria); if (returnValue.Success) { _appointmentRowCount = returnValue.Appointments.TotalRowCount; appointments = returnValue.Appointments.Rows; } else { if (returnValue.Message == "SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.") { throw new Exception("Date is invalid"); } else { throw new Exception(returnValue.Message); } } } return(appointments); } catch (Exception ex) { throw ex; } finally { if (diaryService != null) { if (diaryService.State != System.ServiceModel.CommunicationState.Faulted) { diaryService.Close(); } } } }