コード例 #1
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            ListNotificationsResponse response = new ListNotificationsResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("NextToken", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.NextToken = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("NotificationSummaries", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <NotificationSummary, NotificationSummaryUnmarshaller>(NotificationSummaryUnmarshaller.Instance);
                    response.NotificationSummaries = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
コード例 #2
0
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonWellArchitectedConfig config = new AmazonWellArchitectedConfig();

            config.RegionEndpoint = region;
            ConfigureClient(config);
            AmazonWellArchitectedClient client = new AmazonWellArchitectedClient(creds, config);

            ListNotificationsResponse resp = new ListNotificationsResponse();

            do
            {
                ListNotificationsRequest req = new ListNotificationsRequest
                {
                    NextToken = resp.NextToken
                    ,
                    MaxResults = maxItems
                };

                resp = client.ListNotifications(req);
                CheckError(resp.HttpStatusCode, "200");

                foreach (var obj in resp.NotificationSummaries)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
コード例 #3
0
        /// <summary>
        /// Crea el response del API Movilway dependiendo de la operacion
        /// </summary>
        protected override AGenericApiResponse CreateResponseObject(string PageContent, int BranchId = -1, string CountryAcronym = null)
        {
            AGenericApiResponse objectData = null;
            XmlDocument         xmlDoc     = new XmlDocument();
            string statuscode = "";
            string message    = "";

            xmlDoc.LoadXml(PageContent);
            statuscode = xmlDoc.DocumentElement.SelectSingleNode("response/operation/result/statuscode").InnerText;
            message    = xmlDoc.DocumentElement.SelectSingleNode("response/operation/result/message").InnerText;

            XmlNode NodeDetails = xmlDoc.DocumentElement.SelectSingleNode("response/operation/Details");

            objectData = new ListNotificationsResponse();
            if (NodeDetails != null && statuscode.Equals("200"))
            {
                ((ListNotificationsResponse)objectData).ResponseCode    = 0;
                ((ListNotificationsResponse)objectData).ResponseMessage = "Transacción aprobada";
                ((ListNotificationsResponse)objectData).Notifications   = new System.Collections.Generic.List <Notification>();

                XmlNodeList listRecordNodes      = NodeDetails.SelectNodes("record");
                string[]    camposxmlResponseGet = GetcamposxmlOutput;
                foreach (XmlNode auxRecord in listRecordNodes)
                {
                    Notification newNotification = new Notification();
                    foreach (string nameItem in camposxmlResponseGet)
                    {
                        XmlNode tempNode = auxRecord.SelectSingleNode("parameter[name[text() = '" + nameItem + "']]");
                        if (tempNode != null)
                        {
                            string valueItem = tempNode.SelectSingleNode("value").InnerText;
                            if (nameItem.Equals("createddate"))
                            {
                                newNotification.Createddate = UtilsSOSIT.FromUtcToLocalTime(valueItem);;
                            }
                            else if (nameItem.Equals("notifyid"))
                            {
                                newNotification.Notifyid = Convert.ToInt32(valueItem);
                            }
                            else if (nameItem.Equals("from"))
                            {
                                newNotification.From = valueItem;
                            }
                        }
                    }
                    ((ListNotificationsResponse)objectData).Notifications.Add(newNotification);
                }
            }
            else
            {
                ((ListNotificationsResponse)objectData).ResponseCode    = 07;
                ((ListNotificationsResponse)objectData).ResponseMessage = "No fue posible consultar el listado de  notas asociadas a una solicitud";
            }
            return(objectData);
        }