Esempio n. 1
0
        public bool SendNomination(List <string> transactionIDs)
        {
            bool sendToTest = Convert.ToBoolean(ConfigurationManager.AppSettings["SendToTest"]);
            bool results    = false;

            ShipperReturnByIdentity currentIdentity = GetValueFromIdentity();
            int companyId = String.IsNullOrEmpty(currentIdentity.CompanyId) ? 0 : int.Parse(currentIdentity.CompanyId);

            List <bool> tempBool = new List <bool>();
            int         statusId = 0;

            foreach (var transactionID in transactionIDs)
            {
                statusId = pathedNominationService.GetStatusOnTransactionId(new Guid(transactionID));
                if (statusId == 11)
                {
                    var result = IPNTNominationService.SendNominationTransaction(new Guid(transactionID), companyId, sendToTest);
                    tempBool.Add(result);
                }
                else
                {
                    tempBool.Add(false);
                }
            }
            if ((tempBool.Where(a => a == false).Count()) == 0)
            {
                results = true;
            }
            return(results);
        }
Esempio n. 2
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);
        }