Exemplo n.º 1
0
        public GetConfirmationTemplatesResponse getConfirmationTemplates(GetConfirmationTemplatesRequest getConfirmationTemplatesRequest)
        {
            try
            {
                Log.Info("ConfirmationsManager GetConfirmationTemplatesRequest: " + (getConfirmationTemplatesRequest == null ? "null" : getConfirmationTemplatesRequest.ToString()));
                var confirmationTemplateNames = new String[] { "template1", "template2" };

                var attributes1           = new Attribute[] { new Attribute("Group", "ISDA"), new Attribute("Category", "OIL") };
                var confirmationTemplate1 = new ConfirmationTemplate("OIL.BONITO.EXCH", attributes1);

                var attributes2           = new Attribute[] { new Attribute("Group", "ISDA"), new Attribute("Category", "OIL") };
                var confirmationTemplate2 = new ConfirmationTemplate("OIL.BONITO.EXCH", attributes2);


                XmlDocument xml = new XmlDocument();
                xml.Load(getFilePath("TemplateList.xml"));
                XmlNode root = xml.DocumentElement;

                var confirmationTemplates = new List <ConfirmationTemplate>();
                foreach (XmlNode node in xml.DocumentElement.ChildNodes)
                {
                    String templateName = null;
                    var    attributes   = new List <Attribute>();

                    foreach (XmlNode node2 in node.ChildNodes)
                    {
                        if (node2.Name.Equals("TemplateName"))
                        {
                            templateName = node2.InnerText;
                        }
                        else
                        {
                            var name  = node2.Name;
                            var value = node2.InnerText;
                            attributes.Add(new Attribute(name, value));
                        }
                    }

                    if (templateName != null)
                    {
                        var confirmationTemplate = new ConfirmationTemplate(templateName, attributes.ToArray());
                        confirmationTemplates.Add(confirmationTemplate);
                    }
                }

                var response = new GetConfirmationTemplatesResponse(confirmationTemplates.ToArray());

                Log.Info("ConfirmationsManager getConfirmationTemplatesResponse: " + (response == null ? "null" : response.ToString()));
                return(response);
            }
            catch (Exception e)
            {
                Log.Error("Failed to process getConfirmationTemplates() service call", e);
                throw e;
            }
        }
        public GetConfirmationTemplatesResponse getConfirmationTemplates(GetConfirmationTemplatesRequest getConfirmationTemplatesRequest)
        {
            try
            {
                Log.Info("ConfirmationsManager GetConfirmationTemplatesRequest: " + (getConfirmationTemplatesRequest == null ? "null" : getConfirmationTemplatesRequest.ToString()));
                var confirmationTemplateNames = new String[] { "template1", "template2" };

                var attributes1 = new Attribute[] { new Attribute("Group", "ISDA"), new Attribute("Category", "OIL") };
                var confirmationTemplate1 = new ConfirmationTemplate("OIL.BONITO.EXCH", attributes1);

                var attributes2 = new Attribute[] { new Attribute("Group", "ISDA"), new Attribute("Category", "OIL") };
                var confirmationTemplate2 = new ConfirmationTemplate("OIL.BONITO.EXCH", attributes2);


                XmlDocument xml = new XmlDocument();
                xml.Load( getFilePath( "TemplateList.xml") );
                XmlNode root = xml.DocumentElement;

                var confirmationTemplates = new List<ConfirmationTemplate>();
                foreach ( XmlNode node in xml.DocumentElement.ChildNodes )
                {                    
                    String templateName =null;
                    var attributes = new List<Attribute>();

                    foreach (XmlNode node2 in node.ChildNodes)
                    {
                        if (node2.Name.Equals("TemplateName") )
                            templateName = node2.InnerText;
                        else
                        {
                            var name = node2.Name;
                            var value = node2.InnerText;
                            attributes.Add(new Attribute(name, value));
                        }                        
                    }

                    if (templateName != null)
                    {
                        var confirmationTemplate = new ConfirmationTemplate(templateName, attributes.ToArray() );
                        confirmationTemplates.Add(confirmationTemplate);
                    } 

                }

                var response = new GetConfirmationTemplatesResponse(confirmationTemplates.ToArray() );

                Log.Info("ConfirmationsManager getConfirmationTemplatesResponse: " + (response == null ? "null" : response.ToString()));
                return response;
            }
            catch (Exception e)
            {
                Log.Error("Failed to process getConfirmationTemplates() service call", e);
                throw e;
            }
        }
 public GetConfirmationTemplatesResponse(ConfirmationTemplate[] confirmationTemplates)
 {
     this.confirmationTemplates = confirmationTemplates;
 }