Пример #1
0
        public IHttpActionResult GetBatch(string batchRef, string pageNumber, string pageSize, string sortCol)
        {
            string retVal = "";
            var serviceBatchObject = new ServiceBatchObject();

            var batchSearchFilter = new BatchSearchFilter();

            var validator = new BatchValidator();

            batchSearchFilter.Ref = batchRef;

            try
            {
                serviceBatchObject = _batchSearch.Search(batchSearchFilter, new DataShaping() { RecordPageSize = pageSize.ToInt32(), RecordStart = pageNumber.ToInt32() }, validator);
            }
            catch (Exception ex1)
            {
                retVal = "Exception: " + ex1.Message;
            }

            if (retVal != "")
            {
                return Content(HttpStatusCode.BadRequest, retVal);
            }

            return Ok(serviceBatchObject);
        }
Пример #2
0
        public List<BatchDto> GetBatchsAndContents(BatchSearchFilter searchFilter)
        {
            using (var context = new GeneralModelContainer())
            {
                //search filter current unused

                return context.BatchLog.ToList().Select(b => new BatchDto
                {
                    Id = b.Id, BatchId = b.BatchId, PersonId = b.PersonId, MarriageId = b.MarriageId, SourceId = b.SourceId, ParishId = b.ParishId, TimeRun = b.TimeRun, Ref = b.Ref, IsDeleted = b.IsDeleted.GetValueOrDefault()
                }).ToList();
            }
        }
Пример #3
0
 public List<ShortBatch> GetBatchList(BatchSearchFilter searchFilter)
 {
     using (var context = new GeneralModelContainer())
     {
         //search filter current unused
         return context.BatchLog.ToList().GroupBy(g => g.BatchId).Select(b => new ShortBatch
         {
             BatchId = b.First().BatchId,
             TimeRun = b.First().TimeRun,
             Ref = b.First().Ref,
             IsDeleted = b.First().IsDeleted.GetValueOrDefault()
         }).ToList();
     }
 }
Пример #4
0
        public ServiceBatchObject GetBatch(string batch_ref,string page_number, string page_size, string sort_col)
        {
            var serviceBatchObject = new ServiceBatchObject();

            var batchSearchFilter = new BatchSearchFilter();

            var validator = new BatchValidator();

            batchSearchFilter.Ref = batch_ref;

            try
            {
                serviceBatchObject = _batchSearch.Search(batchSearchFilter, new DataShaping() { RecordPageSize = page_size.ToInt32(), RecordStart = page_number.ToInt32() }, validator);
            }
            catch (Exception e)
            {
                if (WebOperationContext.Current == null) return serviceBatchObject;

                WebOperationContext.Current.OutgoingResponse.StatusCode = HttpStatusCode.InternalServerError;
                WebOperationContext.Current.OutgoingResponse.StatusDescription = e.Message;
            }

            return serviceBatchObject;
        }
Пример #5
0
        public void DeleteBatch(BatchSearchFilter sourceTypeSearchFilter)
        {
            if (!_security.IsValidDelete()) return;

            _batchDal.RemoveBatch(sourceTypeSearchFilter.BatchId);
        }
Пример #6
0
        public ServiceBatchObject Search(BatchSearchFilter batchSearchFilter, DataShaping shaper, BatchValidator validator = null)
        {
            if (!_security.IsvalidSelect()) return new ServiceBatchObject();

            if (validator != null && !validator.ValidEntry()) return new ServiceBatchObject();

            return _batchDal.GetBatchList(batchSearchFilter).ToServiceBatchObject(shaper.Column, shaper.RecordPageSize, shaper.RecordStart);
        }