internal bool CheckExistRecordDetail(int id, string theTime) { try { bool boo = false; if (string.IsNullOrEmpty(theTime)) { return(boo); } theTime = DateTime.Parse(theTime).ToString("yyyy-MM-dd HH:mm:ss"); string content = DS_SqlService.GetRecordContentsByID(id); if (!string.IsNullOrEmpty(content.Trim())) { XmlDocument doc = new XmlDocument(); doc.LoadXml(content); List <string> list = DS_BaseService.GetEditEmrContentTimes(doc); string theTitle = DS_BaseService.GetEmrRecordTitle(doc, theTime); string nextTime = list.Where(p => DateTime.Parse(p) > DateTime.Parse(theTime)).OrderBy(q => DateTime.Parse(q)).FirstOrDefault(); string nextTitle = !string.IsNullOrEmpty(nextTime) ? DS_BaseService.GetEmrRecordTitle(doc, nextTime) : "</body></document>"; int startIndex = doc.InnerXml.IndexOf(theTitle); int endIndex = doc.InnerXml.IndexOf(nextTitle); if (startIndex < 0 || endIndex < 0 || startIndex > endIndex) { return(boo); } if (!string.IsNullOrEmpty(doc.InnerXml.Substring(startIndex, endIndex - startIndex))) { boo = true; } } return(boo); } catch (Exception ex) { throw new Exception(ex.Message); } }