public static Surgical.PathologistHistoryList GetPathologistPatientHistory(string patientId)
        {
            Surgical.PathologistHistoryList result = new Surgical.PathologistHistoryList();
            SqlCommand cmd = new SqlCommand();
            cmd.CommandText = "prcGetPatientHistory_5";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@PatientId", SqlDbType.VarChar).Value = patientId;

            using (SqlConnection cn = new SqlConnection(YellowstonePathology.Properties.Settings.Default.CurrentConnectionString))
            {
                cn.Open();
                cmd.Connection = cn;
                using (SqlDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        Surgical.PathologistHistoryItem pathologistHistoryItem = new Surgical.PathologistHistoryItem();
                        Business.Persistence.SqlDataReaderPropertyWriter sqlDataReaderPropertyWriter = new Persistence.SqlDataReaderPropertyWriter(pathologistHistoryItem, dr);
                        sqlDataReaderPropertyWriter.WriteProperties();
                        result.Add(pathologistHistoryItem);
                    }
                    dr.NextResult();
                    while (dr.Read())
                    {
                        Surgical.PathologistHistoryItemListItem pathologistHistoryItemListItem = new Surgical.PathologistHistoryItemListItem();
                        Business.Persistence.SqlDataReaderPropertyWriter sqlDataReaderPropertyWriter = new Persistence.SqlDataReaderPropertyWriter(pathologistHistoryItemListItem, dr);
                        sqlDataReaderPropertyWriter.WriteProperties();
                        foreach(Surgical.PathologistHistoryItem pathologistHistoryItem in result)
                        {
                            if(pathologistHistoryItemListItem.ReportNo == pathologistHistoryItem.ReportNo)
                            {
                                pathologistHistoryItem.PathologistHistoryItemList.Add(pathologistHistoryItemListItem);
                                break;
                            }
                        }
                    }
                }
            }
            return result;
        }
        public static Surgical.PathologistHistoryList GetPathologistPatientHistory(string patientId)
        {
            Surgical.PathologistHistoryList result = new Surgical.PathologistHistoryList();
            StringBuilder xmlString = new StringBuilder();
            SqlCommand cmd = new SqlCommand();
            cmd.CommandText = "prcGetPatientHistory_4";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@PatientId", SqlDbType.VarChar).Value = patientId;

            using (SqlConnection cn = new SqlConnection(YellowstonePathology.Business.Properties.Settings.Default.CurrentConnectionString))
            {
                cn.Open();
                cmd.Connection = cn;
                using (XmlReader xmlReader = cmd.ExecuteXmlReader())
                {
                    while (xmlReader.Read())
                    {
                        xmlString.Append(xmlReader.ReadOuterXml());
                    }
                }
            }

            if (xmlString.Length != 0)
            {
                XElement resultElements = XElement.Parse(xmlString.ToString(), LoadOptions.PreserveWhitespace);
                List<XElement> pathologistHistoryItemElements = (from item in resultElements.Elements("PathologistHistoryItem")
                                                                 select item).ToList<XElement>();
                foreach (XElement pathologistHistoryElement in pathologistHistoryItemElements)
                {
                    YellowstonePathology.Business.Surgical.PathologistHistoryItem pathologistHistory = new Surgical.PathologistHistoryItem();
                    YellowstonePathology.Business.Persistence.XmlPropertyWriter xmlPropertyWriter = new Persistence.XmlPropertyWriter(pathologistHistoryElement, pathologistHistory);
                    xmlPropertyWriter.Write();

                    List<XElement> pathologistHistoryItemListElements = (from item in pathologistHistoryElement.Elements("PathologistHistoryItemList")
                                                                         select item).ToList<XElement>();
                    foreach (XElement pathologistHistoryItemListElement in pathologistHistoryItemListElements)
                    {
                        List<XElement> pathologistHistoryItemListItemElements = (from item in pathologistHistoryItemListElement.Elements("PathologistHistoryItemListItem")
                                                                                 select item).ToList<XElement>();
                        foreach (XElement pathologistHistoryItemListItemElement in pathologistHistoryItemListItemElements)
                        {
                            YellowstonePathology.Business.Surgical.PathologistHistoryItemListItem pathologistHistoryItemListItem = new Surgical.PathologistHistoryItemListItem();
                            YellowstonePathology.Business.Persistence.XmlPropertyWriter xmlPropertyWriter1 = new Persistence.XmlPropertyWriter(pathologistHistoryItemListItemElement, pathologistHistoryItemListItem);
                            xmlPropertyWriter1.Write();

                            pathologistHistory.PathologistHistoryItemList.Add(pathologistHistoryItemListItem);
                        }
                    }
                    result.Add(pathologistHistory);
                }
            }

            return result;
        }