Ejemplo n.º 1
0
        /*public static YellowstonePathology.Business.Domain.XElementFromSql GetXmlOrdersToAcknowledge(string panelOrderIds)
        {
            SqlCommand cmd = new SqlCommand();
            cmd.CommandText = "pGetXmlOrdersToAcknowledge_A1";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@PanelOrderIdString", SqlDbType.VarChar).Value = panelOrderIds;

            XElement fromSqlElement = new XElement("Document");
            using (SqlConnection cn = new SqlConnection(YellowstonePathology.Properties.Settings.Default.CurrentConnectionString))
            {
                cn.Open();
                cmd.Connection = cn;
                using (XmlReader xmlReader = cmd.ExecuteXmlReader())
                {
                    if (xmlReader.Read() == true)
                    {
                        fromSqlElement = XElement.Load(xmlReader);
                    }
                }
            }
            YellowstonePathology.Business.Domain.XElementFromSql xElementFromSql = new Domain.XElementFromSql();
            xElementFromSql.Document = fromSqlElement;
            return xElementFromSql;
        }*/
        public static YellowstonePathology.Business.Reports.LabOrderSheetData GetOrdersToAcknowledge(string panelOrderIds)
        {
            Reports.LabOrderSheetData result = new Reports.LabOrderSheetData();
            SqlCommand cmd = new SqlCommand();
            cmd.CommandText = "pGetXmlOrdersToAcknowledge_A2";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@PanelOrderIdString", SqlDbType.VarChar).Value = panelOrderIds;

            using (SqlConnection cn = new SqlConnection(YellowstonePathology.Properties.Settings.Default.CurrentConnectionString))
            {
                cn.Open();
                cmd.Connection = cn;
                using (SqlDataReader dr = cmd.ExecuteReader())
                {
                    while(dr.Read())
                    {
                        Reports.LabOrderSheetDataReport labOrderSheetDataReport = new Reports.LabOrderSheetDataReport();
                        Persistence.SqlDataReaderPropertyWriter sqlDataReaderPropertyWriter = new Persistence.SqlDataReaderPropertyWriter(labOrderSheetDataReport, dr);
                        sqlDataReaderPropertyWriter.WriteProperties();
                        result.Add(labOrderSheetDataReport);
                    }
                    dr.NextResult();

                    while (dr.Read())
                    {
                        Reports.LabOrderSheetDataPanelOrder labOrderSheetDataPanelOrder = new Reports.LabOrderSheetDataPanelOrder();
                        Persistence.SqlDataReaderPropertyWriter sqlDataReaderPropertyWriter = new Persistence.SqlDataReaderPropertyWriter(labOrderSheetDataPanelOrder, dr);
                        sqlDataReaderPropertyWriter.WriteProperties();
                        foreach(Reports.LabOrderSheetDataReport labOrderSheetDataReport in result)
                        {
                            if (labOrderSheetDataReport.ReportNo == labOrderSheetDataPanelOrder.ReportNo)
                            {
                                labOrderSheetDataReport.LabOrderSheetDataPanelOrders.Add(labOrderSheetDataPanelOrder);
                                break;
                            }
                        }
                    }
                    dr.NextResult();

                    while (dr.Read())
                    {
                        Reports.LabOrderSheetDataTestOrder labOrderSheetDataTestOrder = new Reports.LabOrderSheetDataTestOrder();
                        Persistence.SqlDataReaderPropertyWriter sqlDataReaderPropertyWriter = new Persistence.SqlDataReaderPropertyWriter(labOrderSheetDataTestOrder, dr);
                        sqlDataReaderPropertyWriter.WriteProperties();
                        foreach (Reports.LabOrderSheetDataReport labOrderSheetDataReport in result)
                        {
                            bool added = false;
                            foreach(Reports.LabOrderSheetDataPanelOrder labOrderSheetDataPanelOrder in labOrderSheetDataReport.LabOrderSheetDataPanelOrders)
                            {
                                if (labOrderSheetDataPanelOrder.PanelOrderId == labOrderSheetDataTestOrder.PanelOrderId)
                                {
                                    labOrderSheetDataPanelOrder.LabOrderSheetDataTestOrders.Add(labOrderSheetDataTestOrder);
                                    added = true;
                                    break;
                                }
                            }
                            if (added == true) break;
                        }
                    }
                }
            }
            return result;
        }
Ejemplo n.º 2
0
        public static YellowstonePathology.Business.Reports.LabOrderSheetData GetOrdersToAcknowledge(string panelOrderIds)
        {
            Reports.LabOrderSheetData result = new Reports.LabOrderSheetData();
            MySqlCommand cmd = new MySqlCommand();

            cmd.CommandText = "pGetXmlOrdersToAcknowledge_A2";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("PanelOrderIdString", panelOrderIds);

            using (MySqlConnection cn = new MySqlConnection(YellowstonePathology.Properties.Settings.Default.CurrentConnectionString))
            {
                cn.Open();
                cmd.Connection = cn;
                using (MySqlDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        Reports.LabOrderSheetDataReport         labOrderSheetDataReport     = new Reports.LabOrderSheetDataReport();
                        Persistence.SqlDataReaderPropertyWriter sqlDataReaderPropertyWriter = new Persistence.SqlDataReaderPropertyWriter(labOrderSheetDataReport, dr);
                        sqlDataReaderPropertyWriter.WriteProperties();
                        result.Add(labOrderSheetDataReport);
                    }
                    dr.NextResult();

                    while (dr.Read())
                    {
                        Reports.LabOrderSheetDataPanelOrder     labOrderSheetDataPanelOrder = new Reports.LabOrderSheetDataPanelOrder();
                        Persistence.SqlDataReaderPropertyWriter sqlDataReaderPropertyWriter = new Persistence.SqlDataReaderPropertyWriter(labOrderSheetDataPanelOrder, dr);
                        sqlDataReaderPropertyWriter.WriteProperties();
                        foreach (Reports.LabOrderSheetDataReport labOrderSheetDataReport in result)
                        {
                            if (labOrderSheetDataReport.ReportNo == labOrderSheetDataPanelOrder.ReportNo)
                            {
                                labOrderSheetDataReport.LabOrderSheetDataPanelOrders.Add(labOrderSheetDataPanelOrder);
                                break;
                            }
                        }
                    }
                    dr.NextResult();

                    while (dr.Read())
                    {
                        Reports.LabOrderSheetDataTestOrder      labOrderSheetDataTestOrder  = new Reports.LabOrderSheetDataTestOrder();
                        Persistence.SqlDataReaderPropertyWriter sqlDataReaderPropertyWriter = new Persistence.SqlDataReaderPropertyWriter(labOrderSheetDataTestOrder, dr);
                        sqlDataReaderPropertyWriter.WriteProperties();
                        foreach (Reports.LabOrderSheetDataReport labOrderSheetDataReport in result)
                        {
                            bool added = false;
                            foreach (Reports.LabOrderSheetDataPanelOrder labOrderSheetDataPanelOrder in labOrderSheetDataReport.LabOrderSheetDataPanelOrders)
                            {
                                if (labOrderSheetDataPanelOrder.PanelOrderId == labOrderSheetDataTestOrder.PanelOrderId)
                                {
                                    labOrderSheetDataPanelOrder.LabOrderSheetDataTestOrders.Add(labOrderSheetDataTestOrder);
                                    added = true;
                                    break;
                                }
                            }
                            if (added == true)
                            {
                                break;
                            }
                        }
                    }
                }
            }
            return(result);
        }