/// <summary>
 /// Initializes a new instance of the <see cref="AlarmGetResponseTextListReply"/> class
 /// with the specified values for the properties.
 /// </summary>
 public AlarmGetResponseTextListReply(AlarmResponseTextFilter filter, Paging paging, 
     SortOrder sortOrder, params ResponseText[] responseTexts)
 {
     Filter = filter;
     Paging = paging;
     SortOrder = sortOrder;
     ResponseTexts = responseTexts;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AlarmGetResponseTextListRequest"/> class.
 /// </summary>
 /// <param name="alarmResponseTextFilter">The alarm response filter object.</param>
 /// <param name="paging">The paging object</param>
 /// <param name="sortOrder">The sort order object.</param>
 public AlarmGetResponseTextListRequest(
     AlarmResponseTextFilter alarmResponseTextFilter,
     Paging paging,
     SortOrder sortOrder)
 {
     Filter = alarmResponseTextFilter;
     Paging = paging;
     SortOrder = sortOrder;
 }
Exemplo n.º 3
0
        public void OrderTest()
        {
            // Arrange
            const string expected = "DESC";

            // Act
            var actual = new SortOrder { Order = "DESC" };

            // Assert
            Assert.AreEqual(expected, actual.Order);
        }
Exemplo n.º 4
0
        public void WithEmptySortOrderElementPresent()
        {
            // Arrange
            var expected = new SortOrder();
            const string xml = @"<SortOrder>
                                 </SortOrder>";

            // Act
            var actual = _sortOrderSerializer.Deserialize(xml);

            // Assert
            DtoAssert.AreEqual(expected, actual);
        }
Exemplo n.º 5
0
        public void WithAllElementsPresent()
        {
            // Arrange
            var expected = new SortOrder(new[] { new SortKey("1", "AlarmResponseText", "StartKey", "LastKey") }, "ASC");
            const string xml = @"<SortOrder>
                            <SortKeys>
                                <SortKey SequenceNumber=""1"">
                                    <Name>AlarmResponseText</Name>
                                    <StartKey>StartKey</StartKey>
                                    <LastKey>LastKey</LastKey>
                                </SortKey>
                            </SortKeys>
                            <Order>ASC</Order>
                        </SortOrder>";

            // Act
            var actual = _sortOrderSerializer.Deserialize(xml);

            // Assert
            DtoAssert.AreEqual(expected, actual);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Invokes the AlarmGetListEx service on the P2000 to retrieve the current list of active alarms.
        /// </summary>
        /// <param name="userName">The P2000 username associated with the specified session GUID</param>
        /// <param name="sessionGuid">Client’s P2000 session GUID</param>
        /// <param name="partition">Name of the Partition to filter on</param>
        /// <param name="alarmGuid">GUID (Alarm.ItemGuid) of the Alarm to be returned</param>
        /// <param name="alarmSiteName">Name of the Site to filter on</param>
        /// <param name="alarmTypeName">Name of the Alarm Type to filter on</param>
        /// <param name="itemName">Name of the Item associated with the Alarm(s) to filter on</param>
        /// <param name="operatorName">Name of the Operator who updated the Alarm(s) to filter on</param>
        /// <param name="recordsPerPage">Number of Records Per Page to be returned</param>
        /// <param name="sortOrder">A SortOrder object containing an array of SortKeys, and the sort Order</param>
        /// <returns>AlarmGetListExReply object containing the deserialized list of Alarms</returns>
        public AlarmGetListExReply AlarmGetListEx(string userName, string sessionGuid, string partition, string alarmGuid, string alarmSiteName, string alarmTypeName, string itemName, string operatorName, int recordsPerPage, SortOrder sortOrder)
        {
            if (userName == null) throw new ArgumentNullException("userName");
            if (sessionGuid == null) throw new ArgumentNullException("sessionGuid");

            var alarmGetListExRequest =
                new P2000AlarmGetListExRequestWrapper(
                    new AlarmGetListExRequest(
                        new AlarmFilter(partition, alarmGuid, alarmSiteName, alarmTypeName, itemName, operatorName),
                        recordsPerPage.ToString(CultureInfo.InvariantCulture), sortOrder));
            string xmlDoc = (new XmlSerializer<P2000AlarmGetListExRequestWrapper>()).Serialize(alarmGetListExRequest);
            P2000ReturnStructure response = _alarmServiceProxy.Invoke(proxy => proxy.AlarmGetListEx(userName, sessionGuid, xmlDoc));

            return
                (new XmlSerializer<P2000AlarmGetListExReplyWrapper>()).Deserialize(response.XmlDoc).AlarmGetListExReply;
        }
Exemplo n.º 7
0
        /// <summary>
        /// Invokes the AlarmDetails method on the P2000 to retrieve the list of details for a given alarm.
        /// </summary>
        /// <param name="userName">The P2000 username associated with the specified session GUID</param>
        /// <param name="sessionGuid">Client’s P2000 session GUID</param>
        /// <param name="alarmGuid">GUID (Alarm.ItemGuid) of the AlarmDetails to be returned</param>
        /// <param name="recordsPerPage">Number of Records Per Page to be returned</param>
        /// <param name="sortOrder">A SortOrder object containing an array of SortKeys, and the sort Order</param>
        /// <returns>
        /// AlarmDetailsReply object containing the details and history of the Alarm with the
        /// specified GUID.
        /// </returns>
        public AlarmDetailsReply AlarmDetails(string userName, string sessionGuid, string alarmGuid, int recordsPerPage, SortOrder sortOrder)
        {
            if (userName == null) throw new ArgumentNullException("userName");
            if (sessionGuid == null) throw new ArgumentNullException("sessionGuid");
            if (alarmGuid == null) throw new ArgumentNullException("alarmGuid");

            var alarmDetailRequest =
                new P2000AlarmDetailsRequestWrapper(new AlarmDetailsRequest(new AlarmDetailsFilter(alarmGuid), recordsPerPage.ToString(CultureInfo.InvariantCulture),
                                                                            sortOrder));

            string xmlDoc = (new XmlSerializer<P2000AlarmDetailsRequestWrapper>()).Serialize(alarmDetailRequest);

            P2000ReturnStructure response = _alarmServiceProxy.Invoke(proxy => proxy.AlarmDetails(userName, sessionGuid, xmlDoc));

            return (new XmlSerializer<P2000AlarmDetailsReplyWrapper>()).Deserialize(response.XmlDoc).AlarmDetailsReply;
        }
Exemplo n.º 8
0
        /// <summary>
        /// This function is provided clients to obtain a list of the response texts in the P2000 system. For performance reasons
        /// and to limit the impact of the server, this function supports paging.
        /// </summary>
        /// <param name="userName">The P2000 username associated with the specified session GUID</param>
        /// <param name="sessionGuid">Client’s P2000 session GUID</param>
        /// <param name="sortOrder">A SortOrder object containing an array of SortKeys, and the sort Order</param>
        /// <param name="paging">A Paging object containing the number of records per page, and page number being requested</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">Thrown if any argument is passed in as null.</exception>
        /// <exception cref="ServiceOperationException">Thrown if a Fault Code is returned by the RPC Server
        /// or if there are any <see cref="WebException"/> while trying to contact the XML-RPC Server.
        /// Captured exceptions will be included as an inner exception.</exception>
        public AlarmGetResponseTextListReply AlarmGetResponseTextList(string userName, string sessionGuid, SortOrder sortOrder, Paging paging)
        {
            if (userName == null) throw new ArgumentNullException("userName");
            if (sessionGuid == null) throw new ArgumentNullException("sessionGuid");

            // Create default Request object with Paging "Turned off"
            var alarmRequest = new P2000AlarmGetResponseTextListRequest(
                new AlarmGetResponseTextListRequest
                    {
                        Filter = new AlarmResponseTextFilter(),
                        Paging = paging,
                        SortOrder = sortOrder
                    });

            // Serialize the request object
            string xmlDoc = XmlSerializer<P2000AlarmGetResponseTextListRequest>.Instance.Serialize(alarmRequest);

            // Call the P2000, and get back a Serialized response within the returned string
            var responseStructure = _alarmServiceProxy.Invoke(proxy => proxy.AlarmGetResponseTextList(userName, sessionGuid, xmlDoc));

            // Deserialize the response into the P2000AlarmGetResponseTextListReply structure.
            var responseObj =
                XmlSerializer<P2000AlarmGetResponseTextListReply>.Instance.Deserialize(responseStructure.XmlDoc);

            return responseObj.AlarmGetResponseTextListReply;
        }
        public void SortOrderTest()
        {
            // Arrange
            var expected = new SortOrder(new[] { new SortKey("1", "Field1", null, null) });
            var requestObj = new AlarmGetResponseTextListRequest { SortOrder = new SortOrder(new[] { new SortKey("1", "Field1", null, null) }) };

            // Act
            var actual = requestObj.SortOrder;

            // Assert
            DtoAssert.AreEqual(expected, actual);
        }
 private static AlarmGetListExReply GetAlarmGetListExReply(AlarmMessage[] messages =null, SortOrder sortOrder =null)
 {
     return new AlarmGetListExReply
                {
                    AlarmMessages = messages??new AlarmMessage[0],
                    SortOrder = sortOrder?? new SortOrder(new[] {new Services.SortKey()})
                };
 }