示例#1
0
        public void LogUnlockingPortAsync(JDSUCiscoClass jdsuCisco, UnlockingPortStatus unlockingPortStatus)
        {
            var asyncAction = new Action(() =>
            {
                try
                {
                    using (
                        var serviceChannel = new ChannelFactory <IWaterGateService>(CreateBinding(),
                                                                                    new EndpointAddress(_address)))
                    {
                        var channel = serviceChannel.CreateChannel();

                        using (var contextScope = new OperationContextScope((IContextChannel)channel))
                        {
                            OperationContext.Current.OutgoingMessageHeaders.Add(_userHeader);
                            channel.LogUnlockingPort(jdsuCisco, unlockingPortStatus);
                        }
                    }
                }
                catch
                {
                    LogConnectionFailed();
                }
            });

            asyncAction.BeginInvoke(null, null);
        }
示例#2
0
        public void LogUnlockingPort(JDSUCiscoClass jdsuCisco, UnlockingPortStatus unlockingPortStatus)
        {
            var portString = "Порт " + jdsuCisco.JDSUPort + " " + jdsuCisco.CiscoIPCom.IP + " " + jdsuCisco.CiscoIPCom.Com + " " + jdsuCisco.CiscoPort.PortName + ".";

            switch (unlockingPortStatus)
            {
            case UnlockingPortStatus.Starting:
            {
                ClientLogService.Write(CurrentUser, "Начало разблокировки порта", portString + " Выполнено");
                return;
            }

            case UnlockingPortStatus.InvalidSmnp:
            {
                ClientLogService.Write(CurrentUser, "Начало разблокировки порта", portString + " Некорректный адрес SMNP");
                return;
            }

            case UnlockingPortStatus.NoResponse:
            {
                ClientLogService.Write(CurrentUser, "Разблокировки порта", portString + " Нет ответа");
                return;
            }

            case UnlockingPortStatus.NotActive:
            {
                ClientLogService.Write(CurrentUser, "Разблокировки порта", portString + " Порт не разблокирован");
                return;
            }

            case UnlockingPortStatus.Active:
            {
                ClientLogService.Write(CurrentUser, "Разблокировки порта", portString + " Порт разблокирован");
                return;
            }
            }
        }