Пример #1
0
        /// <summary>
        /// 网络型下载卡片
        /// </summary>
        private bool SyncCards(List <CardInfo> cards)
        {
            bool result = true;

            foreach (EntranceInfo entrance in _Entrances)
            {
                IParkingAdapter pad = ParkingAdapterManager.Instance[entrance.RootParkID];
                if (pad != null)
                {
                    bool success = true;
                    if (_DownLoadAll)
                    {
                        //全部下载时,下载前需要清空卡片名单
                        CancelNeedWaiting = true;
                        NotifyMessage(string.Format("{0} {1} {2}", Resources.Resource1.FrmDownLoadAllCards_Entrance, entrance.EntranceName, Resources.Resource1.FrmDownloadAllCards_Clear));
                        success = pad.ClearCardsToEntrance(entrance.EntranceID);//删除所有卡片
                        CancelWaitingEvent.Set();
                        CancelNeedWaiting = false;
                    }
                    if (success)
                    {
                        foreach (CardInfo card in cards)
                        {
                            string msg = _DownLoadCard ? Resources.Resource1.FrmDownloadAllCards_CardProcessing : Resources.Resource1.FrmDownLoadAllCards_Delete;
                            NotifyMessage(string.Format("{0} {1} {2}", Resources.Resource1.FrmDownLoadAllCards_Entrance, entrance.EntranceName, string.Format(msg, card.CardID)));
                            if (_DownLoadCard)
                            {
                                success = pad.SaveCardToEntrance(entrance.EntranceID, card, ActionType.Add) ? success : false;
                            }
                            else
                            {
                                success = pad.DeleteCardToEntrance(entrance.EntranceID, card) ? success : false;//删除选定卡片
                            }
                            NotifyProgress(null);
                        }
                    }
                    result = success ? result : false;
                    NotifyHardwareTreeEntrance(entrance.EntranceID, success);
                }
            }
            return(result);
        }
Пример #2
0
 public bool DeleteCardToEntrance(int entranceID, CardInfo card)
 {
     try
     {
         if (_Channel != null)
         {
             return(_Channel.DeleteCardToEntrance(entranceID, card));
         }
     }
     catch (CommunicationException)
     {
         if (ParkAdapterConnectFail != null)
         {
             ParkAdapterConnectFail(this, EventArgs.Empty);
         }
     }
     catch (Exception ex)
     {
         Ralid.GeneralLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex);
     }
     return(false);
 }