private void buttonGetMethods_Click(object sender, RoutedEventArgs e)
 {
     //ServiceReference1.MultiSpeakMsgHeader header = new ServiceReference1.MultiSpeakMsgHeader();
     try
     {
         GetMethodsRequest request = new GetMethodsRequest();
         request.MultiSpeakMsgHeader        = new MultiSpeakMsgHeader();
         request.MultiSpeakMsgHeader.UserID = textBoxUserName.Text;
         request.MultiSpeakMsgHeader.Pwd    = passwordBoxPassword.Password;
         GetMethodsResponse response = _Proxy.GetMethods(request);
         if (response == null)
         {
             DisplayMsg("MockSCADAServerService RESPONSE IS NULL");
             return;
         }
         if (response.MultiSpeakMsgHeader == null)
         {
             DisplayMsg("MockSCADAServerService RESPONSE IS MISSIMG MSGHEADER");
             return;
         }
         if (response.GetMethodsResult == null)
         {
             DisplayMsg("MockSCADAServerService GetMethodsResult IS NULL");
             return;
         }
         for (int i = 0; i < response.GetMethodsResult.Length; i++)
         {
             DisplayMsg(String.Format("MockSCADAServerService Method: {0} IS SUPPORTED", response.GetMethodsResult[i]));
         }
     }
     catch (Exception ex)
     {
         DisplayMsg(String.Format("ex: {0}", ex.Message));
     }
 }
Beispiel #2
0
    public GetMethodsResponse GetMethods(GetMethodsRequest request)
    {
        GetMethodsResponse response = null;

        try
        {
            response = new GetMethodsResponse();
            response.MultiSpeakMsgHeader = new MultiSpeakMsgHeader();
            response.MultiSpeakMsgHeader.TimeStampSpecified = true;
            response.MultiSpeakMsgHeader.TimeStamp          = DateTime.Now;
            response.GetMethodsResult    = new string[5];
            response.GetMethodsResult[0] = "GetMethods";
            response.GetMethodsResult[1] = "PingURL";
            response.GetMethodsResult[2] = "GetAllSCADAPoints";
            response.GetMethodsResult[3] = "GetSCADAAnalogBySCADAPointID";
            response.GetMethodsResult[4] = "GetSCADAStatusBySCADAPointID";
            return(response);
        }
        catch (Exception ex)
        {
            response.GetMethodsResult = new string[1];
            errorObject[] eObject = new errorObject[1];
            eObject[0]                   = new errorObject();
            eObject[0].Value             = ex.Message;
            response.GetMethodsResult[0] = ex.Message;
            return(response);
        }
    }
Beispiel #3
0
        public GetMethodsResponse GetMethods(GetMethodsRequest requests)
        {
            var methods  = DataContext.Methods.ToList();
            var response = new GetMethodsResponse();

            response.Methods = methods.MapTo <GetMethodsResponse.Method>();

            return(response);
        }
Beispiel #4
0
    public GetMethodsResponse GetMethods(GetMethodsRequest request)
    {
        LogInfo("GetMethods() Entered");
        GetMethodsResponse response = null;

        try
        {
            if (_UdpClient == null)
            {
                String            path = @"C:\\DCSystems\Logs\";
                ConfigurationList cl   = new ConfigurationList();
                cl.Add("Process Name", "MockNotServerService");
                cl.Add("Log Output Directory", path);
                _Logger = new Logger(cl);

                LogInfo("()");

                _UdpClient = new UdpClient();
                _UdpClient.Connect(new IPEndPoint(IPAddress.Parse("127.0.0.1"), 7373));
            }
            Byte[] sendBytes = Encoding.ASCII.GetBytes("GetURL,OK");
            _UdpClient.Send(sendBytes, sendBytes.Length);

            response = new GetMethodsResponse();
            response.MultiSpeakMsgHeader = new MultiSpeakMsgHeader();
            response.MultiSpeakMsgHeader.TimeStampSpecified = true;
            response.MultiSpeakMsgHeader.TimeStamp          = DateTime.Now;
            response.GetMethodsResult    = new string[4];
            response.GetMethodsResult[0] = "GetMethods";
            response.GetMethodsResult[1] = "PingURL";
            response.GetMethodsResult[2] = "SCADAAnalogChangedNotification";
            response.GetMethodsResult[3] = "SCADAStatusChangedNotification";
            return(response);
        }
        catch (Exception ex)
        {
            LogError(String.Format("GetMethods() ex:{0}", ex));
            response.GetMethodsResult = new string[1];
            errorObject[] eObject = new errorObject[1];
            eObject[0]                   = new errorObject();
            eObject[0].Value             = ex.Message;
            response.GetMethodsResult[0] = ex.Message;
            return(response);
        }
    }
Beispiel #5
0
        public GetMethodsResponse GetMethods(GetMethodsRequest requests)
        {
            int totalRecord;
            var data = SortData(requests.Search, requests.SortingDictionary, out totalRecord);

            if (requests.Take != -1)
            {
                data = data.Skip(requests.Skip).Take(requests.Take);
            }

            return(new GetMethodsResponse
            {
                TotalRecords = totalRecord,
                Methods = data.ToList().MapTo <GetMethodsResponse.Method>()
            });
            //var methods = DataContext.Methods.ToList();
            //var response = new GetMethodsResponse();
            //response.Methods = methods.MapTo<GetMethodsResponse.Method>();

            //return response;
        }