private void Producer()
        {
            EtzbkDataContext     db     = new EtzbkDataContext();
            List <E_TRANSACTION> etzTrx = db.E_TRANSACTION.Where(a => a.TRANS_CODE == "P" && (a.PROCESS_STATUS == "0" || a.PROCESS_STATUS == null)).Take(Settings.number_of_record_perround).ToList();

            try
            {
                Parallel.ForEach(etzTrx, item =>
                {
                    bool successful = DataManupulation.CheckTransactionStatusOnTMC(item.UNIQUE_TRANSID, item.TRANS_CODE);

                    if (successful)
                    {
                        enqueData.Add(item);
                        Console.WriteLine("Equeued Payment Data " + item.UNIQUE_TRANSID);
                    }
                    else
                    {
                        itemsToRemove.Add(item);
                    }
                });
            }
            catch (Exception ex)
            {
                Logger logger = new Logger();
                Console.WriteLine("Exception from " + System.Reflection.MethodBase.GetCurrentMethod().Name + " " + ExceptionExtensions.GetFullMessage(ex));
                logger.LogInfoMessage(nameof(PaymentProducer) + " " + ExceptionExtensions.GetFullMessage(ex));
            }
            enqueData.CompleteAdding();
            DataManupulation.RemoveTransactionFromSettlement(itemsToRemove);
            DataManupulation.UpdateTransactionAsProcccessed(etzTrx);
        }
Exemple #2
0
        private void Producer()
        {
            using (EtzbkDataContext db = new EtzbkDataContext())
            {
                try
                {
                    List <E_TRANSACTION> etzTrx = db.E_TRANSACTION.Where(a => a.TRANS_CODE == "T" && (a.PROCESS_STATUS == "0" || a.PROCESS_STATUS == null)).Take(Settings.number_of_record_perround).ToList();


                    Parallel.ForEach(etzTrx, item =>
                    {
                        bool successful = DataManupulation.CheckTransactionStatusOnTMC(item.UNIQUE_TRANSID, item.TRANS_CODE);

                        if (successful)
                        {
                            enqueData.Add(item);
                            Console.WriteLine("Equeued Data" + item.UNIQUE_TRANSID);
                        }
                        else
                        {
                            itemsToRemove.Add(item);
                            logger.LogInfoMessage(nameof(TransferProducer) + " round saved to database ");
                        }
                    });


                    enqueData.CompleteAdding();
                    DataManupulation.RemoveTransactionFromSettlement(itemsToRemove);
                    DataManupulation.UpdateTransactionAsProcccessed(etzTrx);
                }
                catch (Exception ex)
                {
                    Logger logger = new Logger();
                    Console.WriteLine("Exception from EtranzactChannelTransaction Run " + ExceptionExtensions.GetFullMessage(ex));
                    logger.LogInfoMessage("Exception from Run " + nameof(TransferProducer) + " " + ExceptionExtensions.GetFullMessage(ex));
                }
            }
        }