public static XElement GetOrderComments(string masterAccessionNo) { SqlCommand cmd = new SqlCommand(); cmd.CommandText = "Select * from tblOrderCommentLog where MasterAccessionNo = @MasterAccessionNo; "; cmd.CommandType = CommandType.Text; cmd.Parameters.Add("@MasterAccessionNo", SqlDbType.VarChar).Value = masterAccessionNo; XElement result = new XElement("OrderComments"); using (SqlConnection cn = new SqlConnection(YellowstonePathology.Business.Properties.Settings.Default.CurrentConnectionString)) { cn.Open(); cmd.Connection = cn; using (SqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { YellowstonePathology.Business.Domain.OrderCommentLog orderCommentLog = new Domain.OrderCommentLog(); YellowstonePathology.Business.Domain.Persistence.DataReaderPropertyWriter propertyWriter = new Business.Domain.Persistence.DataReaderPropertyWriter(dr); orderCommentLog.WriteProperties(propertyWriter); YellowstonePathology.Business.Domain.Persistence.XmlPropertyReader xmlPropertyReader = new Domain.Persistence.XmlPropertyReader(); xmlPropertyReader.Initialize("OrderComment"); orderCommentLog.ReadProperties(xmlPropertyReader); result.Add(xmlPropertyReader.Document); } } } return result; }
/*public static XElement GetSpecimenOrder(string masterAccessionNo) { XElement result = new XElement("SpecimenOrders"); SqlCommand cmd = new SqlCommand(); cmd.CommandText = "Select * from tblSpecimenOrder where MasterAccessionno = '" + masterAccessionNo + "' order by SpecimenNumber"; cmd.CommandType = CommandType.Text; using (SqlConnection cn = new SqlConnection(YellowstonePathology.Properties.Settings.Default.CurrentConnectionString)) { cn.Open(); cmd.Connection = cn; using (SqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { YellowstonePathology.Business.Specimen.Model.SpecimenOrder specimenOrder = new Specimen.Model.SpecimenOrder(); XElement specimenOrderElement = new XElement("SpecimenOrder"); YellowstonePathology.Business.Persistence.SqlDataReaderPropertyWriter sqlDataReaderPropertyWriter = new Persistence.SqlDataReaderPropertyWriter(specimenOrder, dr); sqlDataReaderPropertyWriter.WriteProperties(); YellowstonePathology.Business.Persistence.XmlPropertyReader xmlPropertyReader = new Persistence.XmlPropertyReader(specimenOrder, specimenOrderElement); xmlPropertyReader.Write(); result.Add(specimenOrderElement); } } } return result; }*/ /*public static XElement GetAccessionOrder(string masterAccessionNo) { SqlCommand cmd = new SqlCommand(); cmd.CommandText = "Select * from tblAccessionOrder where MasterAccessionno = '" + masterAccessionNo + "'"; cmd.CommandType = CommandType.Text; YellowstonePathology.Business.Test.AccessionOrder accessionOrder = new Test.AccessionOrder(); using (SqlConnection cn = new SqlConnection(YellowstonePathology.Properties.Settings.Default.CurrentConnectionString)) { cn.Open(); cmd.Connection = cn; using (SqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { YellowstonePathology.Business.Persistence.SqlDataReaderPropertyWriter propertyWriter = new YellowstonePathology.Business.Persistence.SqlDataReaderPropertyWriter(accessionOrder, dr); propertyWriter.WriteProperties(); } } } XElement result = new XElement("AccessionOrder"); YellowstonePathology.Business.Persistence.XmlPropertyReader xmlPropertyReader = new YellowstonePathology.Business.Persistence.XmlPropertyReader(accessionOrder, result); xmlPropertyReader.Write(); return result; }*/ /*public static XElement GetClientOrders(string masterAccessionNo) { XElement result = new XElement("ClientOrders"); YellowstonePathology.Business.ClientOrder.Model.ClientOrderCollection clientOrderCollection = YellowstonePathology.Business.Gateway.ClientOrderGateway.GetClientOrdersByMasterAccessionNo(masterAccessionNo); foreach (YellowstonePathology.Business.ClientOrder.Model.ClientOrder clientOrder in clientOrderCollection) { XElement clientOrderElement = new XElement("ClientOrder"); YellowstonePathology.Business.Persistence.XmlPropertyReader clientOrderPropertyWriter = new Persistence.XmlPropertyReader(clientOrder, clientOrderElement); clientOrderPropertyWriter.Write(); result.Add(clientOrderElement); foreach (YellowstonePathology.Business.ClientOrder.Model.ClientOrderDetail clientOrderDetail in clientOrder.ClientOrderDetailCollection) { XElement clientOrderDetailElement = new XElement("ClientOrderDetail"); YellowstonePathology.Business.Persistence.XmlPropertyReader clientOrderDetailPropertyWriter = new Persistence.XmlPropertyReader(clientOrderDetail, clientOrderDetailElement); clientOrderDetailPropertyWriter.Write(); clientOrderElement.Add(clientOrderDetailElement); } } return result; }*/ public static XElement GetOrderComments(string masterAccessionNo) { SqlCommand cmd = new SqlCommand(); cmd.CommandText = "Select * from tblOrderCommentLog where MasterAccessionNo = @MasterAccessionNo; "; cmd.CommandType = CommandType.Text; cmd.Parameters.Add("@MasterAccessionNo", SqlDbType.VarChar).Value = masterAccessionNo; XElement result = new XElement("OrderComments"); using (SqlConnection cn = new SqlConnection(YellowstonePathology.Properties.Settings.Default.CurrentConnectionString)) { cn.Open(); cmd.Connection = cn; using (SqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { YellowstonePathology.Business.Domain.OrderCommentLog orderCommentLog = new Domain.OrderCommentLog(); YellowstonePathology.Business.Domain.Persistence.DataReaderPropertyWriter propertyWriter = new Business.Domain.Persistence.DataReaderPropertyWriter(dr); orderCommentLog.WriteProperties(propertyWriter); YellowstonePathology.Business.Domain.Persistence.XmlPropertyReader xmlPropertyReader = new Domain.Persistence.XmlPropertyReader(); xmlPropertyReader.Initialize("OrderComment"); orderCommentLog.ReadProperties(xmlPropertyReader); result.Add(xmlPropertyReader.Document); } } } return result; }