using System; using System.Data; using System.Collections; using System.Collections.Generic; using System.Xml; using DSWeb.Models; using System.Web; namespace DSWeb.TemplateManger { public class TemplateManager { private static TemplateManager configManager = new TemplateManager(); private TemplateManager() { } public static TemplateManager Instance() { return configManager; } public object GetConfigInfo(TemplateType tempConfigType) { object resultObj = null; switch (tempConfigType) { case TemplateType.INVOICECONFIG: IList invoiceConfigEntities = new List(); XmlNode xmlNode = GetXmlConfigObj("Templates/Templates.xml", "invoice"); int iCount = 0; for (int i = 0; i < xmlNode.ChildNodes.Count; i++) { InvoiceConfigEntity invoiceConfigEntity = new InvoiceConfigEntity(); invoiceConfigEntity.ItemName = xmlNode.ChildNodes[i].Name; invoiceConfigEntity.ItemValue = xmlNode.ChildNodes[i].InnerText; invoiceConfigEntities.Add(invoiceConfigEntity); iCount++; } if (iCount > 0) { resultObj = invoiceConfigEntities; } else { resultObj = invoiceConfigEntities; } break; } return resultObj; } private XmlNode GetXmlConfigObj(string tempXmlUrl, string tempNodeName) { XmlDocument xmlDoc = new XmlDocument(); XmlNode tempNode = null; string currentUrl = HttpContext.Current.Request.Url.AbsoluteUri; string xmlUrl = currentUrl.Substring(0, currentUrl.Substring(0, currentUrl.LastIndexOf("/")).LastIndexOf("/") + 1) + tempXmlUrl; try { xmlDoc.Load(xmlUrl); for(int i=0;i