Exemplo n.º 1
0
        private void UploadCard()
        {
            CommandResult       result  = null;
            CardSearchCondition cardcon = new CardSearchCondition();

            cardcon.UpdateFlag = false;
            List <CardInfo> sCards = _StandbyCardBll.GetCards(cardcon).QueryObjects;

            if (sCards != null && sCards.Count > 0)
            {
                foreach (CardInfo sCard in sCards)
                {
                    if (_SyncDataPause)
                    {
                        break;
                    }
                    CardInfo mCard = _MasterCardBll.GetCardByID(sCard.CardID).QueryObject;
                    if (mCard != null)
                    {
                        sCard.UpdateFlag = true;
                        result           = _MasterCardBll.UpdateCardPaymentInfo(sCard);
                        if (result.Result == ResultCode.Successful)
                        {
                            _StandbyCardBll.UpdateCard(sCard);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void SyncTime_Thread()
        {
            try
            {
                while (true)
                {
                    try
                    {
                        _SyncDateBaseEvent.WaitOne(SyncInterval * 60 * 1000);

                        if (DataBaseConnectionsManager.Current.MasterConnected &&
                            DataBaseConnectionsManager.Current.StandbyConnected)
                        {
                            CommandResult result = null;
                            if (!_SyncDataPause)
                            {
                                CardSearchCondition cardcon = new CardSearchCondition();
                                cardcon.UpdateFlag = false;
                                List <CardInfo> sCards = _StandbyCardBll.GetCards(cardcon).QueryObjects;
                                if (sCards != null && sCards.Count > 0)
                                {
                                    foreach (CardInfo sCard in sCards)
                                    {
                                        if (_SyncDataPause)
                                        {
                                            break;
                                        }
                                        CardInfo mCard = _MasterCardBll.GetCardByID(sCard.CardID).QueryObject;
                                        if (mCard != null)
                                        {
                                            sCard.UpdateFlag = true;
                                            result           = _MasterCardBll.UpdateCardPaymentInfo(sCard);
                                            if (result.Result == ResultCode.Successful)
                                            {
                                                _StandbyCardBll.UpdateCard(sCard);
                                            }
                                        }
                                    }
                                }
                            }

                            if (!_SyncDataPause)
                            {
                                CardPaymentRecordSearchCondition paymentcon = new CardPaymentRecordSearchCondition();
                                paymentcon.UpdateFlag = false;
                                List <CardPaymentInfo> sRecords = _StandbyPaymentBll.GetItems(paymentcon).QueryObjects;
                                if (sRecords != null && sRecords.Count > 0)
                                {
                                    foreach (CardPaymentInfo sRecord in sRecords)
                                    {
                                        if (_SyncDataPause)
                                        {
                                            break;
                                        }
                                        CardPaymentInfo cpInfo = sRecord.Clone();
                                        cpInfo.UpdateFlag = true;
                                        result            = _MasterPaymentBll.InsertRecordWithCheck(cpInfo);
                                        if (result.Result == ResultCode.Successful)
                                        {
                                            sRecord.UpdateFlag = true;
                                            _StandbyPaymentBll.Update(sRecord);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Ralid.GeneralLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex);
                    }
                }
            }
            catch (ThreadAbortException ex)
            {
                Ralid.GeneralLibrary.LOG.FileLog.Log("系统", "备用数据库同步到主数据库服务停止");
            }
        }