protected override IList <Department> GetItemsForExport(IReadContext context, int firstRow, int maxRows) { var where = new DepartmentSearchCriteria(); where.Id.SortAsc(0); return(context.GetBroker <IDepartmentBroker>().Find(where, new SearchResultPage(firstRow, maxRows))); }
/// <summary> /// Applies this filter to the specified criteria object. /// </summary> /// <param name="criteria"></param> /// <param name="wqc"></param> public void Apply(DepartmentSearchCriteria criteria, IWorklistQueryContext wqc) { if (!this.IsEnabled) { return; } criteria.In(this.Values); }
//Search Option public List <Department> GetDepartmentBySearch(DepartmentSearchCriteria model) { IEnumerable <Department> departments = db.Departments.Where(d => d.isDelete == false).AsQueryable(); if (!string.IsNullOrEmpty(model.Name)) { departments = departments.Where(b => b.Name.ToString().ToLower().Contains(model.Name.ToString().ToLower())); } return(departments.ToList()); }
// // GET: /DepartMent/ public ActionResult Index(DepartmentSearchCriteria model) { var departments = _departMentManager.GetAllDepartments(); if (departments == null) { departments = new List <Department>(); } model.Departments = departments; return(View(model)); }
public ListDepartmentsResponse ListDepartments(ListDepartmentsRequest request) { Platform.CheckForNullReference(request, "request"); var where = new DepartmentSearchCriteria(); where.Id.SortAsc(0); var broker = PersistenceContext.GetBroker<IDepartmentBroker>(); var items = broker.Find(where, request.Page); var assembler = new DepartmentAssembler(); return new ListDepartmentsResponse( CollectionUtils.Map(items,(Department item) => assembler.CreateSummary(item, PersistenceContext)) ); }
public string GetDepartments(string DeptartmentName) { IDepartmentService service = null; try { // Create search criteria. DepartmentSearchCriteria criteria = new DepartmentSearchCriteria(); criteria.City = DeptartmentName; // Create the service. service = AppService.Create <IDepartmentService>(); // TODO: Need to change. UserAuthentication authentication = new UserAuthentication(); service.AppManager = authentication.AppManager; // Call service method. List <Department> Departments = service.Searchdpt(criteria); string DepartmentsJson = "[]"; if (Departments != null) { var resultList = from item in Departments where item.IsActive = true select new { Id = item.Id, City = item.Name }; // Serialize. JavaScriptSerializer serializer = new JavaScriptSerializer(); DepartmentsJson = serializer.Serialize(resultList); } // Return the value. return(DepartmentsJson); } catch { throw; } finally { // Dispose. if (service != null) { service.Dispose(); } } }
public ListDepartmentsResponse ListDepartments(ListDepartmentsRequest request) { Platform.CheckForNullReference(request, "request"); var where = new DepartmentSearchCriteria(); where.Id.SortAsc(0); var broker = PersistenceContext.GetBroker <IDepartmentBroker>(); var items = broker.Find(where, request.Page); var assembler = new DepartmentAssembler(); return(new ListDepartmentsResponse( CollectionUtils.Map(items, (Department item) => assembler.CreateSummary(item, PersistenceContext)) )); }
/// <summary> /// This Method gets all the department disregard of the branch as this is required on the load of the /// search page /// </summary> private void BindDeptDropDownList() { BranchDeptServiceClient departmentSearch = null; try { DepartmentSearchCriteria searchCriteria = new DepartmentSearchCriteria(); //Set this flag to true to get all the departments searchCriteria.AllDepartment = true; departmentSearch = new BranchDeptServiceClient(); CollectionRequest collectionRequest = new CollectionRequest(); collectionRequest.ForceRefresh = false; DepartmentSearchReturnValue returnValue = departmentSearch.DepartmentSearch(_logonSettings.LogonId, collectionRequest, searchCriteria); if (returnValue.Success) { foreach (DepartmentSearchItem department in returnValue.Departments.Rows) { ListItem item = new ListItem(); item.Text = department.Name; item.Value = department.Id.ToString() + "$" + department.No; _ddlDepartment.Items.Add(item); } AddDefaultToDropDownList(_ddlDepartment, "All Departments"); } else { throw new Exception(returnValue.Message); } } catch (Exception ex) { throw ex; } finally { if (departmentSearch != null) { if (departmentSearch.State != System.ServiceModel.CommunicationState.Faulted) { departmentSearch.Close(); } } } }
/// <summary> /// Search departments based on the organisation ID /// </summary> /// <param name="oHostSecurityToken">The Host Security Token from IWS</param> /// <param name="collectionRequest">Collection request value</param> /// <param name="criteria">Department search criteria</param> /// <returns>Collection of department search item</returns> public DepartmentSearchReturnValue DepartmentSearch(HostSecurityToken oHostSecurityToken, CollectionRequest collectionRequest, DepartmentSearchCriteria criteria) { DepartmentSearchReturnValue returnValue = null; if (Functions.ValidateIWSToken(oHostSecurityToken)) { oBranchDeptService = new BranchDeptService(); returnValue = oBranchDeptService.DepartmentSearch(Functions.GetLogonIdFromToken(oHostSecurityToken), collectionRequest, criteria); } else { returnValue = new DepartmentSearchReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return returnValue; }
/// <summary> /// Search departments based on the organisation ID /// </summary> /// <param name="oHostSecurityToken">The Host Security Token from IWS</param> /// <param name="collectionRequest">Collection request value</param> /// <param name="criteria">Department search criteria</param> /// <returns>Collection of department search item</returns> public DepartmentSearchReturnValue DepartmentSearch(HostSecurityToken oHostSecurityToken, CollectionRequest collectionRequest, DepartmentSearchCriteria criteria) { DepartmentSearchReturnValue returnValue = null; if (Functions.ValidateIWSToken(oHostSecurityToken)) { oBranchDeptService = new BranchDeptService(); returnValue = oBranchDeptService.DepartmentSearch(Functions.GetLogonIdFromToken(oHostSecurityToken), collectionRequest, criteria); } else { returnValue = new DepartmentSearchReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return(returnValue); }
public GetOrderEntryFormDataResponse GetOrderEntryFormData(GetOrderEntryFormDataRequest request) { Platform.CheckForNullReference(request, "request"); // Sorted list of facility summaries for active facilities var facilityAssembler = new FacilityAssembler(); var facilitySearchCriteria = new FacilitySearchCriteria(); facilitySearchCriteria.Deactivated.EqualTo(false); facilitySearchCriteria.Name.SortAsc(0); var facilities = CollectionUtils.Map( this.PersistenceContext.GetBroker <IFacilityBroker>().Find(facilitySearchCriteria), (Facility f) => facilityAssembler.CreateFacilitySummary(f)); // Sorted list of department summaries for active departments var departmentAssembler = new DepartmentAssembler(); var departmentSearchCriteria = new DepartmentSearchCriteria(); departmentSearchCriteria.Deactivated.EqualTo(false); departmentSearchCriteria.Name.SortAsc(0); var departments = CollectionUtils.Map( this.PersistenceContext.GetBroker <IDepartmentBroker>().Find(departmentSearchCriteria), (Department d) => departmentAssembler.CreateSummary(d, this.PersistenceContext)); // Sorted list of department summaries for active departments var modalityAssembler = new ModalityAssembler(); var modalitySearchCriteria = new ModalitySearchCriteria(); modalitySearchCriteria.Deactivated.EqualTo(false); modalitySearchCriteria.Name.SortAsc(0); var modalities = CollectionUtils.Map( this.PersistenceContext.GetBroker <IModalityBroker>().Find(modalitySearchCriteria), (Modality d) => modalityAssembler.CreateModalitySummary(d)); return(new GetOrderEntryFormDataResponse( facilities, departments, modalities, EnumUtils.GetEnumValueList <OrderPriorityEnum>(this.PersistenceContext), EnumUtils.GetEnumValueList <OrderCancelReasonEnum>(this.PersistenceContext), EnumUtils.GetEnumValueList <LateralityEnum>(this.PersistenceContext), EnumUtils.GetEnumValueList <SchedulingCodeEnum>(this.PersistenceContext) )); }
protected Department GetPerformingDepartment(Facility facility, string department) { if (facility == null || String.IsNullOrEmpty(department)) { return(null); } var criteria = new DepartmentSearchCriteria(); criteria.Facility.EqualTo(facility); criteria.Name.EqualTo(department); try { return(PersistenceContext.GetBroker <IDepartmentBroker>().FindOne(criteria)); } catch (EntityNotFoundException) { return(null); } }
private static Department LoadOrCreateDepartment(string id, string name, Facility facility, IPersistenceContext context) { Department d; try { // see if already exists in db var where = new DepartmentSearchCriteria(); where.Id.EqualTo(id); d = context.GetBroker <IDepartmentBroker>().FindOne(where); } catch (EntityNotFoundException) { // create it d = new Department(id, name, facility, null); context.Lock(d, DirtyState.New); } return(d); }
protected override void Import(WorklistData data, IUpdateContext context) { var worklist = LoadOrCreateWorklist(data.Name, data.Class, context); worklist.Description = data.Description; if (data.StaffSubscribers != null) { foreach (var s in data.StaffSubscribers) { var criteria = new StaffSearchCriteria(); criteria.Id.EqualTo(s.StaffId); var staff = context.GetBroker <IStaffBroker>().Find(criteria); if (staff.Count == 1) { worklist.StaffSubscribers.Add(CollectionUtils.FirstElement(staff)); } } } if (data.GroupSubscribers != null) { foreach (var s in data.GroupSubscribers) { var criteria = new StaffGroupSearchCriteria(); criteria.Name.EqualTo(s.StaffGroupName); var groups = context.GetBroker <IStaffGroupBroker>().Find(criteria); if (groups.Count == 1) { worklist.GroupSubscribers.Add(CollectionUtils.FirstElement(groups)); } } } // proc type filter ImportFilter( worklist.ProcedureTypeFilter, data.Filters.ProcedureTypes, delegate(WorklistData.ProcedureTypeData s) { var criteria = new ProcedureTypeSearchCriteria(); criteria.Id.EqualTo(s.Id); var broker = context.GetBroker <IProcedureTypeBroker>(); return(CollectionUtils.FirstElement(broker.Find(criteria))); }); // proc type group filter ImportFilter( worklist.ProcedureTypeGroupFilter, data.Filters.ProcedureTypeGroups, delegate(WorklistData.ProcedureTypeGroupData s) { var criteria = new ProcedureTypeGroupSearchCriteria(); criteria.Name.EqualTo(s.Name); var broker = context.GetBroker <IProcedureTypeGroupBroker>(); return(CollectionUtils.FirstElement(broker.Find(criteria, ProcedureTypeGroup.GetSubClass(s.Class, context)))); }); //Bug #2284: don't forget to set the IncludeWorkingFacility property // facility filter worklist.FacilityFilter.IncludeWorkingFacility = data.Filters.Facilities.IncludeWorkingFacility; ImportFilter( worklist.FacilityFilter, data.Filters.Facilities, delegate(WorklistData.EnumValueData s) { var criteria = new FacilitySearchCriteria(); criteria.Code.EqualTo(s.Code); var broker = context.GetBroker <IFacilityBroker>(); return(CollectionUtils.FirstElement(broker.Find(criteria))); }); // department filter ImportFilter( worklist.DepartmentFilter, data.Filters.Departments, delegate(WorklistData.DepartmentData s) { var criteria = new DepartmentSearchCriteria(); criteria.Id.EqualTo(s.Id); var broker = context.GetBroker <IDepartmentBroker>(); return(CollectionUtils.FirstElement(broker.Find(criteria))); }); // priority filter ImportFilter( worklist.OrderPriorityFilter, data.Filters.OrderPriorities, delegate(WorklistData.EnumValueData s) { var broker = context.GetBroker <IEnumBroker>(); return(broker.Find <OrderPriorityEnum>(s.Code)); }); // ordering prac filter ImportFilter( worklist.OrderingPractitionerFilter, data.Filters.OrderingPractitioners, delegate(WorklistData.PractitionerData s) { var criteria = new ExternalPractitionerSearchCriteria(); criteria.Name.FamilyName.EqualTo(s.FamilyName); criteria.Name.GivenName.EqualTo(s.GivenName); // these criteria may not be provided (the data may not existed when exported), // but if available, they help to ensure the correct practitioner is being mapped if (!string.IsNullOrEmpty(s.BillingNumber)) { criteria.BillingNumber.EqualTo(s.BillingNumber); } if (!string.IsNullOrEmpty(s.LicenseNumber)) { criteria.LicenseNumber.EqualTo(s.LicenseNumber); } var broker = context.GetBroker <IExternalPractitionerBroker>(); return(CollectionUtils.FirstElement(broker.Find(criteria))); }); // patient class filter ImportFilter( worklist.PatientClassFilter, data.Filters.PatientClasses, delegate(WorklistData.EnumValueData s) { var broker = context.GetBroker <IEnumBroker>(); return(broker.Find <PatientClassEnum>(s.Code)); }); // patient location filter ImportFilter( worklist.PatientLocationFilter, data.Filters.PatientLocations, delegate(WorklistData.LocationData s) { var criteria = new LocationSearchCriteria(); criteria.Id.EqualTo(s.Id); var broker = context.GetBroker <ILocationBroker>(); return(CollectionUtils.FirstElement(broker.Find(criteria))); }); // portable filter worklist.PortableFilter.IsEnabled = data.Filters.Portable.Enabled; worklist.PortableFilter.Value = data.Filters.Portable.Value; //Bug #2429: don't forget to include the time filter // time filter worklist.TimeFilter.IsEnabled = data.Filters.TimeWindow.Enabled; worklist.TimeFilter.Value = data.Filters.TimeWindow == null || data.Filters.TimeWindow.Value == null ? null : data.Filters.TimeWindow.Value.CreateTimeRange(); // reporting filters if (Worklist.GetSupportsReportingStaffRoleFilter(worklist.GetClass())) { ImportReportingWorklistFilters(data, worklist.As <ReportingWorklist>(), context); } }
/// <summary> /// Gets the departments. /// </summary> private void GetDepartments() { if (_ddlBranch.SelectedValue != string.Empty) { BranchDeptServiceClient departmentSearch = null; try { CollectionRequest collectionRequest = new CollectionRequest(); DepartmentSearchCriteria searchCriteria = new DepartmentSearchCriteria(); searchCriteria.OrganisationId = new Guid(GetBranchValueOnIndex(_ddlBranch.SelectedValue, 1)); searchCriteria.IncludeArchived = true; departmentSearch = new BranchDeptServiceClient(); DepartmentSearchReturnValue returnValue = departmentSearch.DepartmentSearch(_logonSettings.LogonId, collectionRequest, searchCriteria); //Store the previous selected value. This will prevent the dept from being reset //if its valid for the current branch string prevValue = _ddlDepartment.SelectedValue; _ddlDepartment.Items.Clear(); if (returnValue.Success) { foreach (DepartmentSearchItem department in returnValue.Departments.Rows) { ListItem item = new ListItem(); item.Text = department.Name; item.Value = department.Id.ToString() + "$" + department.No; _ddlDepartment.Items.Add(item); } AddDefaultToDropDownList(_ddlDepartment, "All Departments"); //Set the prev value if it is valid for the current branch if (_ddlDepartment.Items.FindByValue(prevValue) != null) { _ddlDepartment.SelectedValue = prevValue; } } else { throw new Exception(returnValue.Message); } } catch (Exception ex) { throw ex; } finally { if (departmentSearch != null) { if (departmentSearch.State != System.ServiceModel.CommunicationState.Faulted) { departmentSearch.Close(); } } } } else { //No branch selected. Reset Departments _ddlDepartment.Items.Clear(); BindDeptDropDownList(); } }
public List <Department> GetDepartmentBySearch(DepartmentSearchCriteria model) { return(_departMentRepository.GetDepartmentBySearch(model)); }
/// <summary> /// Gets the departments. /// </summary> private void GetDepartments() { if (_ddlBranch.SelectedValue != string.Empty) { BranchDeptServiceClient departmentSearch = null; try { CollectionRequest collectionRequest = new CollectionRequest(); DepartmentSearchCriteria searchCriteria = new DepartmentSearchCriteria(); searchCriteria.OrganisationId = new Guid(GetBranchValueOnIndex(_ddlBranch.SelectedValue, 1)); searchCriteria.IncludeArchived = false; departmentSearch = new BranchDeptServiceClient(); DepartmentSearchReturnValue returnValue = departmentSearch.DepartmentSearch(_logonSettings.LogonId, collectionRequest, searchCriteria); //Store the previous selected value. This will prevent the dept from being reset //if its valid for the current branch string prevValue = _ddlDepartment.SelectedValue; _ddlDepartment.Items.Clear(); if (returnValue.Success) { _ddlDepartment.DataSource = returnValue.Departments.Rows; _ddlDepartment.DataTextField = "Name"; _ddlDepartment.DataValueField = "id"; _ddlDepartment.DataBind(); //Set the prev value if it is valid for the current branch if (_ddlDepartment.Items.FindByValue(prevValue) != null) { _ddlDepartment.SelectedValue = prevValue; } } else { throw new Exception(returnValue.Message); } AddDefaultToDropDownList(_ddlDepartment); } catch (Exception ex) { throw ex; } finally { if (departmentSearch != null) { if (departmentSearch.State != System.ServiceModel.CommunicationState.Faulted) departmentSearch.Close(); } } } }
/// <summary> /// Search departments based on the organisation ID /// </summary> /// <param name="logonId">The logon id</param> /// <param name="collectionRequest">Collection request value</param> /// <param name="criteria">Department search criteria</param> /// <returns>Collection of department search item</returns> public DepartmentSearchReturnValue DepartmentSearch(Guid logonId, CollectionRequest collectionRequest, DepartmentSearchCriteria criteria) { DepartmentSearchReturnValue returnValue = new DepartmentSearchReturnValue(); 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: case DataConstants.UserType.Client: case DataConstants.UserType.ThirdParty: // Can do everything break; default: throw new Exception("Access denied"); } // Create a data list creator for a list of matters DataListCreator <DepartmentSearchItem> dataListCreator = new DataListCreator <DepartmentSearchItem>(); // Declare an inline event (annonymous delegate) to read the // dataset if it is required dataListCreator.ReadDataSet += delegate(object Sender, ReadDataSetEventArgs e) { if (criteria.AllDepartment) { // Create the dataset for department search to get all departments e.DataSet = SrvDepartmentLookup.GetDepartments(); } else { // Create the dataset e.DataSet = SrvDepartmentLookup.GetDepartments(criteria.OrganisationId, criteria.IncludeArchived); } DataTable dt = Functions.SortDataTable(e.DataSet.Tables[0], "deptName"); e.DataSet.Tables.Remove(e.DataSet.Tables[0]); e.DataSet.Tables.Add(dt); }; // Create the data list returnValue.Departments = dataListCreator.Create(logonId, // Give the query a name so it can be cached "DepartmentSearch", // 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", "deptID"), new ImportMapping("No", "deptNo"), new ImportMapping("Name", "deptName"), new ImportMapping("IsArchived", "deptArchived") } ); } 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); }
public GetOrderEntryFormDataResponse GetOrderEntryFormData(GetOrderEntryFormDataRequest request) { Platform.CheckForNullReference(request, "request"); // Sorted list of facility summaries for active facilities var facilityAssembler = new FacilityAssembler(); var facilitySearchCriteria = new FacilitySearchCriteria(); facilitySearchCriteria.Deactivated.EqualTo(false); facilitySearchCriteria.Name.SortAsc(0); var facilities = CollectionUtils.Map( this.PersistenceContext.GetBroker<IFacilityBroker>().Find(facilitySearchCriteria), (Facility f) => facilityAssembler.CreateFacilitySummary(f)); // Sorted list of department summaries for active departments var departmentAssembler = new DepartmentAssembler(); var departmentSearchCriteria = new DepartmentSearchCriteria(); departmentSearchCriteria.Deactivated.EqualTo(false); departmentSearchCriteria.Name.SortAsc(0); var departments = CollectionUtils.Map( this.PersistenceContext.GetBroker<IDepartmentBroker>().Find(departmentSearchCriteria), (Department d) => departmentAssembler.CreateSummary(d, this.PersistenceContext)); // Sorted list of department summaries for active departments var modalityAssembler = new ModalityAssembler(); var modalitySearchCriteria = new ModalitySearchCriteria(); modalitySearchCriteria.Deactivated.EqualTo(false); modalitySearchCriteria.Name.SortAsc(0); var modalities = CollectionUtils.Map( this.PersistenceContext.GetBroker<IModalityBroker>().Find(modalitySearchCriteria), (Modality d) => modalityAssembler.CreateModalitySummary(d)); return new GetOrderEntryFormDataResponse( facilities, departments, modalities, EnumUtils.GetEnumValueList<OrderPriorityEnum>(this.PersistenceContext), EnumUtils.GetEnumValueList<OrderCancelReasonEnum>(this.PersistenceContext), EnumUtils.GetEnumValueList<LateralityEnum>(this.PersistenceContext), EnumUtils.GetEnumValueList<SchedulingCodeEnum>(this.PersistenceContext) ); }
/// <summary> /// Search departments based on the organisation ID /// </summary> /// <param name="logonId">The logon id</param> /// <param name="collectionRequest">Collection request value</param> /// <param name="criteria">Department search criteria</param> /// <returns>Collection of department search item</returns> public DepartmentSearchReturnValue DepartmentSearch(Guid logonId, CollectionRequest collectionRequest, DepartmentSearchCriteria criteria) { DepartmentSearchReturnValue returnValue = new DepartmentSearchReturnValue(); 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: case DataConstants.UserType.Client: case DataConstants.UserType.ThirdParty: // Can do everything break; default: throw new Exception("Access denied"); } // Create a data list creator for a list of matters DataListCreator<DepartmentSearchItem> dataListCreator = new DataListCreator<DepartmentSearchItem>(); // Declare an inline event (annonymous delegate) to read the // dataset if it is required dataListCreator.ReadDataSet += delegate(object Sender, ReadDataSetEventArgs e) { if (criteria.AllDepartment) { // Create the dataset for department search to get all departments e.DataSet = SrvDepartmentLookup.GetDepartments(); } else { // Create the dataset e.DataSet = SrvDepartmentLookup.GetDepartments(criteria.OrganisationId, criteria.IncludeArchived); } DataTable dt = Functions.SortDataTable(e.DataSet.Tables[0], "deptName"); e.DataSet.Tables.Remove(e.DataSet.Tables[0]); e.DataSet.Tables.Add(dt); }; // Create the data list returnValue.Departments = dataListCreator.Create(logonId, // Give the query a name so it can be cached "DepartmentSearch", // 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", "deptID"), new ImportMapping("No", "deptNo"), new ImportMapping("Name", "deptName"), new ImportMapping("IsArchived", "deptArchived") } ); } 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; }