/// <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(); } } }
public AppointmentSearchReturnValue AppointmentSearch(HostSecurityToken oHostSecurityToken, CollectionRequest collectionRequest, AppointmentSearchCriteria criteria) { AppointmentSearchReturnValue returnValue = null; if (Functions.ValidateIWSToken(oHostSecurityToken)) { oDiaryService = new DiaryService(); returnValue = oDiaryService.AppointmentSearch(Functions.GetLogonIdFromToken(oHostSecurityToken), collectionRequest, criteria); } else { returnValue = new AppointmentSearchReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return returnValue; }
public AppointmentSearchReturnValue AppointmentSearch(HostSecurityToken oHostSecurityToken, CollectionRequest collectionRequest, AppointmentSearchCriteria criteria) { AppointmentSearchReturnValue returnValue = null; if (Functions.ValidateIWSToken(oHostSecurityToken)) { oDiaryService = new DiaryService(); returnValue = oDiaryService.AppointmentSearch(Functions.GetLogonIdFromToken(oHostSecurityToken), collectionRequest, criteria); } else { returnValue = new AppointmentSearchReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return(returnValue); }
/// <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(); } } } }
public AppointmentSearchReturnValue AppointmentSearch(Guid logonId, CollectionRequest collectionRequest, AppointmentSearchCriteria criteria) { AppointmentSearchReturnValue returnValue = new AppointmentSearchReturnValue(); try { // Get the logged on user from the current logons and add their // ApplicationSettings the list of concurrent sessions. Host.LoadLoggedOnUser(logonId); try { Functions.RestrictRekoopIntegrationUser(UserInformation.Instance.DbUid); switch (UserInformation.Instance.UserType) { case DataConstants.UserType.Staff: // Can do everything break; case DataConstants.UserType.Client: case DataConstants.UserType.ThirdParty: throw new Exception("Access denied"); default: throw new Exception("Access denied"); } // Create a data list creator for a list of matters DataListCreator<Appointment> dataListCreator = new DataListCreator<Appointment>(); // Declare an inline event (annonymous delegate) to read the // dataset if it is required dataListCreator.ReadDataSet += delegate(object Sender, ReadDataSetEventArgs e) { DiaryMemberSearchItem diaryMembers = this.GetDiaryMemberDetails(criteria.MemberID); string UsersChosenMemberID = criteria.MemberID; DateTime usersDiaryDate = DateTime.Today; int CurrentDiaryDays = 1; bool ShowCancelled = false; bool ShowTasks = false; bool ExcludeEmptyDiaryDaysForUsers = true; bool ExcludeEmptyDiaryDaysForGroups = true; string memberIds; string[] usersChosenMemberIDs = new string[] { }; int usersDiaryDaysView = 7; DiaryViewDts dvDiary = new DiaryViewDts(); if (criteria.Date == DataConstants.BlankDate) { usersDiaryDate = DateTime.Today; } else { usersDiaryDate = Convert.ToDateTime(criteria.Date); } if (!diaryMembers.IsGroup) { UsersChosenMemberID = diaryMembers.MemberID; dvDiary = SrvBookingEntryLookup.GetDiaryBookingsForMember(UsersChosenMemberID, usersDiaryDate, CurrentDiaryDays, ShowCancelled, ShowTasks, usersDiaryDaysView, ExcludeEmptyDiaryDaysForUsers); } else { usersChosenMemberIDs = this.ResolveGroupMembers(int.Parse(diaryMembers.MemberID)); memberIds = string.Join(",", usersChosenMemberIDs); dvDiary = SrvBookingEntryLookup.GetDiaryBookingsForMembers(memberIds, usersDiaryDate, CurrentDiaryDays, ShowCancelled, ShowTasks, usersDiaryDaysView, ExcludeEmptyDiaryDaysForGroups); } // Add New Column Editable dvDiary.Tables[0].Columns.Add("isEdit"); for (int i = 0; i < dvDiary.Tables[0].Rows.Count; i++) { dvDiary.Tables[0].Rows[i]["isEdit"] = this.IsOccurrenceViewableBy(Convert.ToInt32(dvDiary.Tables[0].Rows[i]["OccurrenceID"])); } e.DataSet = dvDiary; if (criteria.OrderBy != string.Empty) { DataTable dt = Functions.SortDataTable(e.DataSet.Tables[0], criteria.OrderBy); e.DataSet.Tables.Remove("DiaryEntries"); e.DataSet.Tables.Add(dt); } }; returnValue.Appointments = dataListCreator.Create(logonId, "AppointmentSearch", // Tell it the query criteria used so if the cache is accessed // again it knows if it is the same query criteria.ToString(), collectionRequest, // Import mappings to map the dataset row fields to the data // list entity properties new ImportMapping[] { new ImportMapping("Id", "OccurrenceID"), new ImportMapping("StartDate", "Date"), new ImportMapping("Subject", "OccSpecificText"), new ImportMapping("StartTime", "StartTime"), new ImportMapping("EndTime", "EndTime"), new ImportMapping("Notes", "OccurrenceNoteText"), new ImportMapping("VenueText", "VenueDescription"), new ImportMapping("Duration", "EstTime"), new ImportMapping("IsEditable", "isEdit") // More fields are required here but the service layer query may not be // providing them. This is enough for a test. } ); } finally { // Remove the logged on user's ApplicationSettings from the // list of concurrent sessions Host.UnloadLoggedOnUser(); } } catch (System.Data.SqlClient.SqlException) { returnValue.Success = false; returnValue.Message = Functions.SQLErrorMessage; } catch (Exception ex) { returnValue.Success = false; returnValue.Message = ex.Message; } return returnValue; }