Esempio n. 1
0
 public static string BusinessPropsToString(BusinessProps bp)
 {
     lock (locker)
     {
         return(string.Format("BusinessProps {{LastTransactionId = {0}, LastTicketNumber = {1}, LastCreditNoteNumber = {2}}}", bp.LastTransactionId, bp.LastTicketNumber, bp.LastCreditNoteNumber));
     }
 }
Esempio n. 2
0
        public void Initialize(string sStationNumber, BusinessProps bp)
        {
            lock (locker)
            {
                Log.InfoFormat("Initializing '{0}' {1}", sStationNumber, BusinessPropsToString(bp));

                m_sStationNumber = sStationNumber;

                ExcpHelper.ThrowIf(string.IsNullOrEmpty(m_sStationNumber), "Station Number is invalid");
                List <TransactionQueueSr> lObjects = TransactionQueueSr.GetByQuery("SELECT * FROM TransactionQueue WHERE Type = {0} OR Type = {1} OR Type = {2} ORDER BY TransactionQueueID DESC", (int)eTransactionQueueType.Ticket, (int)eTransactionQueueType.DepositByCreditNote, (int)eTransactionQueueType.Deposit);

                foreach (TransactionQueueSr tq in lObjects)
                {
                    eTransactionQueueType eType = (eTransactionQueueType)tq.Type;

                    if (eType == eTransactionQueueType.Ticket && m_lLastTicketNumber == 0)
                    {
                        m_lastTicket        = SerializeHelper.StringToDataContractObject <TicketWS>(tq.Object1);
                        m_lLastTicketNumber = ParseNumberId(m_lastTicket.ticketNbr);
                    }
                    else if (eType == eTransactionQueueType.DepositByCreditNote && m_lLastCreditNoteNumber == 0)
                    {
                        string sNoteNumber = tq.Object2;

                        m_lLastCreditNoteNumber = ParseNumberId(sNoteNumber);
                    }

                    if (m_lLastTicketNumber > 0 && m_lLastCreditNoteNumber > 0)
                    {
                        break;
                    }
                }


                m_lLastTransactionID    = bp.LastTransactionId;
                m_lLastTicketNumber     = Math.Max(m_lLastTicketNumber, bp.LastTicketNumber);
                m_lLastCreditNoteNumber = Math.Max(m_lLastCreditNoteNumber, bp.LastCreditNoteNumber);
            }
        }