public DocumentClasses GetDocumentClasses() { //Retrieve document classes DocumentClasses docs = null; try { docs = new DocumentClasses(); System.Xml.XmlDataDocument xmlDoc = new System.Xml.XmlDataDocument(); xmlDoc.DataSet.ReadXml(System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath + "\\App_Data\\documentclass.xml"); for (int i = 0; i < xmlDoc.DataSet.Tables["DocumentClassTable"].Rows.Count; i++) { DocumentClass dc = new DocumentClass(xmlDoc.DataSet.Tables["DocumentClassTable"].Rows[i]["Department"].ToString(), xmlDoc.DataSet.Tables["DocumentClassTable"].Rows[i]["ClassName"].ToString()); docs.Add(dc); } } catch (Exception ex) { throw new ApplicationException("Unexpected error in GetDocumentClasses().", ex); } return(docs); }
public DocumentClasses GetDocumentClasses(string department) { //Retrieve document classes DocumentClasses docs = null; try { docs = new DocumentClasses(); DocumentClasses _docs = GetDocumentClasses(); foreach (DocumentClass dc in _docs) { if (dc.Department == department) { docs.Add(dc); } } } catch (Exception ex) { throw new ApplicationException("Unexpected error in GetDocumentClasses(string).", ex); } return(docs); }