Exemplo n.º 1
0
        public static YellowstonePathology.Business.Specimen.Model.SpecimenOrderCollection GetSpecimenOrderCollection(string containId)
        {
            YellowstonePathology.Business.Specimen.Model.SpecimenOrderCollection result = new Specimen.Model.SpecimenOrderCollection();
            SqlCommand cmd = new SqlCommand();
            cmd.CommandText = "Select * from tblSpecimenOrder where ContainId = @ContainerId";

            cmd.CommandType = CommandType.Text;
            cmd.Parameters.Add("@ContainerId", SqlDbType.DateTime).Value = containId;

            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();
                        YellowstonePathology.Business.Persistence.SqlDataReaderPropertyWriter sqlDataReaderPropertyWriter = new Persistence.SqlDataReaderPropertyWriter(specimenOrder, dr);
                        sqlDataReaderPropertyWriter.WriteProperties();
                        result.Add(specimenOrder);
                    }
                }
            }
            return result;
        }
Exemplo n.º 2
0
        public static YellowstonePathology.Business.Specimen.Model.SpecimenOrderCollection GetSpecimenOrderCollection(DateTime embeddingVerifiedDate)
        {
            YellowstonePathology.Business.Specimen.Model.SpecimenOrderCollection result = new Specimen.Model.SpecimenOrderCollection();
            SqlCommand cmd = new SqlCommand();
            cmd.CommandText = "Select s.* from tblSpecimenOrder s " +
                "where exists(select * from tblAliquotOrder where specimenOrderId = s.SpecimenOrderId and EmbeddingVerifiedDate between @EmbeddingVerifiedDate and @EmbeddingVerifiedDatePlus1)";
            cmd.Parameters.Add("@EmbeddingVerifiedDate", SqlDbType.VarChar).Value = embeddingVerifiedDate;
            cmd.Parameters.Add("@EmbeddingVerifiedDatePlus1", SqlDbType.VarChar).Value = embeddingVerifiedDate.AddDays(1);
            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();
                        YellowstonePathology.Business.Persistence.SqlDataReaderPropertyWriter sqlDataReaderPropertyWriter = new Persistence.SqlDataReaderPropertyWriter(specimenOrder, dr);
                        sqlDataReaderPropertyWriter.WriteProperties();
                        result.Add(specimenOrder);
                    }
                }
            }
            return result;
        }