private void ButtonViewSelectedAccession_Click(object sender, RoutedEventArgs e) { if (this.m_ClientOrder.Accessioned == false) { if (this.ListViewAccessionOrders.SelectedItem != null) { if (this.ViewAccessionOrder != null) { YellowstonePathology.Business.ClientOrder.Model.ClientOrderCollection clientOrders = this.GetClientOrdersForExternalOrderIds(); if (clientOrders != null) { YellowstonePathology.Business.View.RecentAccessionView recentAccessionView = (YellowstonePathology.Business.View.RecentAccessionView) this.ListViewAccessionOrders.SelectedItem; YellowstonePathology.UI.CustomEventArgs.MasterAccessionNoReturnEventArgs args = new CustomEventArgs.MasterAccessionNoReturnEventArgs(recentAccessionView.MasterAccessionNo); this.ViewAccessionOrder(this, args); } } } else { MessageBox.Show("You must selected an Accession from the list."); } } else { MessageBox.Show("This client order has already been accessioned."); } }
public static View.RecentAccessionViewCollection GetRecentAccessionOrders(string pLastName, string pFirstName) { YellowstonePathology.Business.View.RecentAccessionViewCollection result = new View.RecentAccessionViewCollection(); SqlCommand cmd = new SqlCommand(); cmd.CommandText = "select ao.MasterAccessionNo, pso.ReportNo, ao.PFirstName, ao.PLastName, ao.AccessionTime, ao.ClientName, ao.PhysicianName, ao.CollectionTime " + "from tblAccessionOrder ao " + "left outer join tblPanelSetOrder pso on ao.MasterAccessionNo = pso.MasterAccessionNo " + "where ao.PFirstName = @PFirstName and ao.PLastName = @PLastName and datediff(d, ao.AccessionDate, getdate()) <= 7 "; cmd.Parameters.Add("@PLastName", SqlDbType.VarChar).Value = pLastName; cmd.Parameters.Add("@PFirstName", SqlDbType.VarChar).Value = pFirstName; using (SqlConnection cn = new SqlConnection(Properties.Settings.Default.ProductionConnectionString)) { cn.Open(); cmd.Connection = cn; using (SqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { YellowstonePathology.Business.View.RecentAccessionView recentAccessionView = new YellowstonePathology.Business.View.RecentAccessionView(); YellowstonePathology.Business.Persistence.SqlDataReaderPropertyWriter sqlDataReaderPropertyWriter = new Persistence.SqlDataReaderPropertyWriter(recentAccessionView, dr); sqlDataReaderPropertyWriter.WriteProperties(); result.Add(recentAccessionView); } } } return result; }