Beispiel #1
0
        private static void Write(StreamWriter writer, MetalCurs metal)
        {
            string date  = reqDate.AddDays(-1).ToString("M/d/yyyy", CultureInfo.InvariantCulture);
            string date1 = reqDate.ToString("MM/d/yyyy", CultureInfo.InvariantCulture);

            writer.Write($"{metal.ISOCode},");
            writer.Write($"1,");
            writer.Write($"{metal.Price.Replace(',', '.')},");
            writer.Write($"{date1},");
            writer.Write($"{date},");
            writer.Write($"{DateTime.Now.TimeOfDay:hh\\:mm\\:ss}\r\n", CultureInfo.InvariantCulture);
        }
Beispiel #2
0
        private static List <MetalCurs> ExtractMetalCurs()
        {
            StringBuilder MetalSoap = GenerateMetalSoap();
            XmlDocument   document  = GetDocument(MetalSoap.ToString());

            if (document == null)
            {
                return(null);
            }
            List <MetalCurs> metals = new List <MetalCurs>();
            XmlNode          rs     = document.ChildNodes[1].FirstChild.FirstChild.FirstChild.FirstChild;

            foreach (XmlNode node in rs.ChildNodes)
            {
                MetalCurs metal = new MetalCurs();
                foreach (XmlNode childNode in node)
                {
                    switch (childNode.Name)
                    {
                    case ("DateMet"):
                        metal.DateMet = Convert.ToDateTime(childNode.InnerText.Trim());
                        break;

                    case ("CodMet"):
                        metal.Code = Convert.ToInt32(childNode.InnerText.Trim());
                        break;

                    case ("price"):
                        metal.Price = childNode.InnerText.Trim();
                        break;
                    }
                }
                metals.Add(metal);
            }
            return(metals);
        }