Ejemplo n.º 1
0
        public static Domain.OrderComment GetLabEventByEventId(int orderCommentId)
        {
            Domain.OrderComment result = new Domain.OrderComment();
            SqlCommand cmd = new SqlCommand();
            cmd.CommandText = "SELECT * from tblOrderComment where OrderCommentId = @OrderCommentId";
            cmd.CommandType = System.Data.CommandType.Text;
            cmd.Parameters.Add("@OrderCommentId", System.Data.SqlDbType.Int).Value = orderCommentId;

            using (SqlConnection cn = new SqlConnection(Properties.Settings.Default.ProductionConnectionString))
            {
                cn.Open();
                cmd.Connection = cn;
                using (SqlDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        result = new YellowstonePathology.Business.Domain.OrderComment();
                        YellowstonePathology.Business.Persistence.SqlDataReaderPropertyWriter sqlDataReaderPropertyWriter = new Persistence.SqlDataReaderPropertyWriter(result, dr);
                        sqlDataReaderPropertyWriter.WriteProperties();
                    }
                }
            }
            return result;
        }
Ejemplo n.º 2
0
        public static YellowstonePathology.Business.Domain.OrderCommentCollection GetAllLabEvents()
        {
            YellowstonePathology.Business.Domain.OrderCommentCollection result = new Domain.OrderCommentCollection();
            SqlCommand cmd = new SqlCommand();
            cmd.CommandText = "SELECT * from tblOrderComment order by OrderCommentId";
            cmd.CommandType = System.Data.CommandType.Text;

            using (SqlConnection cn = new SqlConnection(Properties.Settings.Default.ProductionConnectionString))
            {
                cn.Open();
                cmd.Connection = cn;
                using (SqlDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        YellowstonePathology.Business.Domain.OrderComment orderComment = new Domain.OrderComment();
                        YellowstonePathology.Business.Persistence.SqlDataReaderPropertyWriter sqlDataReaderPropertyWriter = new Persistence.SqlDataReaderPropertyWriter(orderComment, dr);
                        sqlDataReaderPropertyWriter.WriteProperties();
                        result.Add(orderComment);
                    }
                }
            }
            return result;
        }