BExIS.IO.Transform.Output.DataWriter.GetDataStructureTemplatePath C# (CSharp) Method

GetDataStructureTemplatePath() public method

public GetDataStructureTemplatePath ( long dataStructureId, string extention ) : string
dataStructureId long
extention string
return string
        public string GetDataStructureTemplatePath(long dataStructureId, string extention)
        {
            DataStructureManager dataStructureManager = new DataStructureManager();

            StructuredDataStructure dataStructure = dataStructureManager.StructuredDataStructureRepo.Get(dataStructureId);
            string dataStructureTitle = dataStructure.Name;
            // load datastructure from db an get the filepath from this object

            ExcelTemplateProvider provider = new ExcelTemplateProvider("BExISppTemplate_Clean.xlsm");
            string path = "";

            if (dataStructure.TemplatePaths != null)
            {
                XmlNode resources = dataStructure.TemplatePaths.FirstChild;

                XmlNodeList resource = resources.ChildNodes;

                foreach (XmlNode x in resource)
                {
                    if (x.Attributes.GetNamedItem("Type").Value == "Excel")
                        if (File.Exists(x.Attributes.GetNamedItem("Path").Value))
                        {
                            path = x.Attributes.GetNamedItem("Path").Value;
                        }
                        else
                        {
                            path = provider.CreateTemplate(dataStructure);
                        }
                }
                //string dataPath = AppConfiguration.DataPath; //Path.Combine(AppConfiguration.WorkspaceRootPath, "Data");
                return Path.Combine(AppConfiguration.DataPath, path);
            }
            path = provider.CreateTemplate(dataStructure);
            return Path.Combine(AppConfiguration.DataPath, path);
        }