예제 #1
0
        public async Task <IActionResult> GetBatch(long id)
        {
            var batch = await _batchService.GetBatch(id);

            if (batch != null)
            {
                return(Ok(batch));
            }

            return(StatusCode(500, "Unable to retrieve batch."));
        }
예제 #2
0
        public async Task <IActionResult> Get(int id)
        {
            try
            {
                BatchDto batch = await BatchService.GetBatch(id);

                return(Ok(batch));
            }
            catch (Exception ex)
            {
                Log.Error($"Error geting batch with ID \"{id}\".");
                throw;
            }
        }
예제 #3
0
        public bool SendNomination(List <string> transactionIDs)
        {
            bool   sendToTest = Convert.ToBoolean(ConfigurationManager.AppSettings["SendToTest"]);
            bool   results    = false;
            var    identity   = (ClaimsPrincipal)Thread.CurrentPrincipal;
            string company    = identity.Claims.Where(c => c.Type == "CompanyId")
                                .Select(c => c.Value).SingleOrDefault();

            int         companyID = String.IsNullOrEmpty(company) ? 0:int.Parse(company);
            List <bool> tempBool  = new List <bool>();

            foreach (var transactionID in transactionIDs)
            {
                BatchDTO batch = batchService.GetBatch(Guid.Parse(transactionID));
                if (batch == null || batch.StatusID != (int)NomStatus.Draft || batch.DateBeg.Date < DateTime.Now.Date || batch.DateEnd.Date < DateTime.Now.Date)
                {
                    tempBool.Add(false);
                }
                else
                {
                    bool result;
                    if (batchService.ValidateNomination(Guid.Parse(transactionID), batch.pipeDUNSNo))
                    {
                        result = pntNominationService.SendNominationTransaction(new Guid(transactionID), companyID, sendToTest);
                    }
                    else
                    {
                        result = false;
                    }
                    tempBool.Add(result);
                }
            }
            if ((tempBool.Where(a => a == false).Count()) == 0)
            {
                results = true;
            }
            return(results);
        }
예제 #4
0
        public IActionResult GetBatch()
        {
            var result = _service.GetBatch();

            return(File(result.MemStream, result.ContentType, result.FileName));
        }
 public Batch GetBatch(long batchId)
 {
     return(_batchService.GetBatch(batchId));
 }
예제 #6
0
 public IHttpActionResult GetBatch()
 {
     return(Ok(new { results = batchService.GetBatch() }));
 }