Example #1
0
        private void LoadSampleCustomerData()
        {
            _customers = new List<Customer>();

            string embeddedCustomerXmlContent = ReadString("SampleData.CustomerData.xml");
            XmlDocument document = new XmlDocument();
            document.LoadXml(embeddedCustomerXmlContent);
            foreach (XmlNode customerNode in document.DocumentElement.ChildNodes)
            {
                int id = Convert.ToInt32(customerNode.Attributes["ID"].Value);
                string name = customerNode.Attributes["Name"].Value;
                string company = customerNode.Attributes["Company"].Value;
                string city = customerNode.Attributes["City"].Value;
                string postalCode = customerNode.Attributes["PostalCode"].Value;
                string country = customerNode.Attributes["Country"].Value;
                string phone = customerNode.Attributes["Phone"].Value;

                _customers.Add(new Customer(id, name, company, city, postalCode, country, phone));
            }
        }
        public static void ProcessFiles(IEnumerable<string> files)
        {
            var docFiles = new List<string>();
            var xlsFiles = new List<string>();
            var pptFiles = new List<string>();

            foreach (var file in files)
            {
                var extName = Path.GetExtension(file);

                switch (extName)
                {
                    case ".doc":
                        docFiles.Add(file);
                        break;
                    case ".xls":
                        xlsFiles.Add(file);
                        break;
                    case ".ppt":
                        pptFiles.Add(file);
                        break;
                }
            }
        }
Example #3
0
        public List<string> Read()
        {
            var result = new List<string>();

            foreach (Word.Paragraph p in document.Paragraphs)
            {
                result.Add(p.Range.Text);
            }

            return result;
        }