private static void ProcessSearchQueries(XmlTextWriter writer) { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load("../../reviews-queries.xml"); string xPathQuery = "/review-queries/query"; XmlNodeList queriesList = xmlDoc.SelectNodes(xPathQuery); foreach (XmlNode queryNode in queriesList) { var queryType = queryNode.Attributes["type"].InnerText; IList <ReviewComplexData> reviews; if (queryType == "by-period") { string startDateString = GetChildText(queryNode, "start-date"); string endDateString = GetChildText(queryNode, "end-date"); CultureInfo provider = CultureInfo.InvariantCulture; DateTime startDate = DateTime.ParseExact(startDateString, "d-MMM-yyyy", provider); DateTime endDate = DateTime.ParseExact(endDateString, "d-MMM-yyyy", provider); reviews = BooksDAL.FindReviewsByPeriod(startDate, endDate); } else { string authorName = GetChildText(queryNode, "author-name"); reviews = BooksDAL.FindReviewsByAuthorName(authorName); } WriteReviews(writer, reviews); //BooksDAL.WriteQueryInLog(queryNode.OuterXml); /* USING CODE FIRST */ SearchLogDAL.WriteQueryInLog(queryNode.OuterXml); } }