示例#1
0
        private bool SyncCards()
        {
            NotifyMsg(string.Format("{0}{1}......", Resources.Resource1.FrmSyncDataToStandby_Synchronizing, Resources.Resource1.FrmSyncDataToStandby_Card));
            NotifyProgress(100, 0);

            bool          success = true;
            CommandResult result  = null;

            CardBll masterbll  = new CardBll(AppSettings.CurrentSetting.CurrentMasterConnect);
            CardBll standbybll = new CardBll(AppSettings.CurrentSetting.CurrentStandbyConnect);

            QueryResultList <CardInfo> infos = masterbll.GetAllCards();

            success = infos.Result == ResultCode.Successful;
            if (success)
            {
                success = standbybll.DeteleAllCards().Result == ResultCode.Successful;
                if (success)
                {
                    NotifyProgress(infos.QueryObjects.Count, 0);
                    foreach (CardInfo info in infos.QueryObjects)
                    {
                        result  = standbybll.Insert(info);
                        success = result.Result == ResultCode.Successful;
                        NotifyProgress(null, null);
                        if (!success)
                        {
                            break;
                        }
                    }
                }
            }

            if (!success)
            {
                NotifyMsg(string.Format("{0}{1}", Resources.Resource1.FrmSyncDataToStandby_Card, Resources.Resource1.Form_Fail), Color.Red);
            }
            else
            {
                NotifyMsg(string.Format("{0}{1}", Resources.Resource1.FrmSyncDataToStandby_Card, Resources.Resource1.Form_Success));
            }

            return(success);
        }