/// <summary> /// Returns a single job where the id in the request matches the record ID in the database. /// </summary> /// <param name="request">The request used for requesting the record from the database.</param> /// <returns>If FetchAsDto was set to false, the JarsJob item will be populated, if not then the JobDto record will have it's values set.</returns> public virtual JarsJobsResponse Any(GetJarsJob request) { //return ExecuteFaultHandledMethod(() => //{ JarsJobsResponse response = new JarsJobsResponse(); IJarsJobRepository _repository = _DataRepositoryFactory.GetDataRepository <IJarsJobRepository>(); response.Jobs.Add(_repository.GetById(request.Id, request.FetchEagerly).ConvertTo <JarsJobDto>()); return(response); //}); }
/// <summary> /// Update or create a single job or a list of jobs, depending on whether the Job or Jobs property has got a value set. /// If the Job property is set the Job will be created or updated and the Jobs property will be ignored. /// To create or update more than one job, assign a list to the Jobs property and make sure Job is set to nothing/null. /// </summary> /// <param name="request">The request containing the job or jobs that needs to be created or updated</param> /// <returns>depending on the values supplied, the updated job or jobs will be returned.</returns> public virtual JarsJobsResponse Any(StoreJobs request) { //return ExecuteFaultHandledMethod(() => //{ JarsJobsResponse response = new JarsJobsResponse(); IJarsJobRepository _repository = _DataRepositoryFactory.GetDataRepository <IJarsJobRepository>(); response.Jobs = _repository.CreateUpdateList(request.Jobs.ConvertAllTo <JarsJob>().ToList(), CurrentSessionUsername).ConvertAllTo <JarsJobDto>().ToList(); return(response); //}); }
/// <summary> /// Find a Job by specifying values for the properties available in the request. /// Date values: Start date will go from date forward, end date will be from end date back, and if both has values, /// it will be used as from (between) start to end /// </summary> /// <param name="request">The request used for building the find parameters</param> /// <returns>If LoadLazy was true, then a list of JarsJobBase items, otherwise a list of fully loaded JarsJobs</returns> public virtual JarsJobsResponse Any(FindJarsJobs request) { //return ExecuteFaultHandledMethod(() => //{ JarsJobsResponse response = new JarsJobsResponse(); if (request != null) { var query = BuildQuery(request); var _repository = _DataRepositoryFactory.GetDataRepository <IJarsJobRepository>(); response.Jobs = _repository.Where(query, request.FetchEagerly).ConvertAllTo <JarsJobDto>().ToList(); } return(response); ////}); }