private bool Sync_TarrifSetting()
        {
            bool success = true;
            Dictionary <int, List <EntranceInfo> > parksIDAndEntrances = this.hardwareTree1.GetSelectedParksIDAndEntrances();

            if (parksIDAndEntrances != null)
            {
                foreach (int parkID in parksIDAndEntrances.Keys)
                {
                    foreach (EntranceInfo entrance in parksIDAndEntrances[parkID])
                    {
                        IParkingAdapter pad = ParkingAdapterManager.Instance[entrance.RootParkID];
                        bool            ret = false;
                        if (pad != null)
                        {
                            NotifyMessage(string.Format(Resources.Resource1.FrmDownLoadTariffSetting_Download, entrance.EntranceName));
                            ret = pad.DownloadTariffSettingToEntrance(entrance.EntranceID, TariffSetting.Current);
                            if (!ret)
                            {
                                WaitingCommandBLL  wcBll  = new WaitingCommandBLL(AppSettings.CurrentSetting.CurrentMasterConnect);
                                WaitingCommandInfo wcInfo = new WaitingCommandInfo();
                                wcInfo.EntranceID = entrance.EntranceID;
                                wcInfo.Command    = BusinessModel.Enum.CommandType.DownloadTariffs;
                                wcBll.DeleteAndInsert(wcInfo);
                            }
                        }
                        success = ret ? success : false;
                        NotifyHardwareTreeEntrance(entrance.EntranceID, ret);
                    }
                }
            }
            return(success);
        }
        private bool Sync_TarrifSetting()
        {
            bool success = true;
            Dictionary <int, List <EntranceInfo> > parksIDAndEntrances = this.hardwareTree1.GetSelectedParksIDAndEntrances();

            if (parksIDAndEntrances != null)
            {
                foreach (int parkID in parksIDAndEntrances.Keys)
                {
                    foreach (EntranceInfo entrance in parksIDAndEntrances[parkID])
                    {
                        IParkingAdapter pad = ParkingAdapterManager.Instance[entrance.RootParkID];
                        bool            ret = false;
                        if (pad != null)
                        {
                            NotifyMessage(string.Format(Resources.Resource1.FrmDownLoadTariffSetting_Download, entrance.EntranceName));
                            ret = pad.DownloadTariffSettingToEntrance(entrance.EntranceID, TariffSetting.Current);
                        }
                        success = ret ? success : false;
                        NotifyHardwareTreeEntrance(entrance.EntranceID, ret);
                    }
                }
            }
            return(success);
        }
Beispiel #3
0
 public bool DownloadTariffSettingToEntrance(int entranceID, TariffSetting tariffSetting)
 {
     try
     {
         if (_Channel != null)
         {
             return(_Channel.DownloadTariffSettingToEntrance(entranceID, tariffSetting));
         }
     }
     catch (CommunicationException)
     {
         if (ParkAdapterConnectFail != null)
         {
             ParkAdapterConnectFail(this, EventArgs.Empty);
         }
     }
     catch (Exception ex)
     {
         Ralid.GeneralLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex);
     }
     return(false);
 }