IList <Vaccine> IVaccineStorage.ListVaccine(QueryVaccine pQueryVaccine)
        {
            List <Vaccine> vaccineList = null;
            SqlConnection  conn;
            IDataReader    reader;

            try
            {
                Verify.ArgumentNotNull(pQueryVaccine, "pQueryVaccine");

                conn = new SqlConnection(
                    ConfigurationManager
                    .ConnectionStrings["DEFAULT"].ToString());

                conn.Open();

                reader = VaccineSelectWrapper.ExecuteReader(
                    conn,
                    pQueryVaccine);

                if (reader != null)
                {
                    vaccineList = new List <Vaccine>();

                    while (reader.Read())
                    {
                        Vaccine myVaccine = DAUtil.ReadVaccine(
                            reader);

                        vaccineList.Add(myVaccine);
                    }
                }

                conn.Close();
            }
            catch (Exception ex)
            {
                ExceptionHandler.DealWithException(ex);
                //switch (ex.GetType().FullName)
                //{
                //    case "System.ArgumentNullException":
                //        {
                //            throw new ArgumentNullException(ex.Message);
                //        }
                //    case "System.ArgumentException":
                //        {
                //            throw new ArgumentException(ex.Message);
                //        }
                //    default:
                //        throw new Exception(ex.Message);
                //}
            }

            return(vaccineList);
        }
        Vaccine IVaccineStorage.ReadVaccine(int pVaccineID)
        {
            Vaccine       myVaccine = null;
            SqlConnection conn      = null;
            IDataReader   reader    = null;

            try
            {
                Verify.ArgumentNotNull(pVaccineID);

                myVaccine = new Vaccine();

                conn = new SqlConnection(
                    ConfigurationManager
                    .ConnectionStrings["DEFAULT"].ToString());

                conn.Open();

                reader = VaccineByVaccineIdSelectWrapper.ExecuteReader(
                    conn,
                    pVaccineID);

                if (!reader.Read())
                {
                    throw new Exception("Vaccine read failure!");
                }

                myVaccine = DAUtil.ReadVaccine(reader);

                conn.Close();
            }
            catch (Exception ex)
            {
                ExceptionHandler.DealWithException(ex);
                //switch (ex.GetType().FullName)
                //{
                //    case "System.ArgumentNullException":
                //        {
                //            throw new ArgumentNullException(ex.Message);
                //        }
                //    case "System.ArgumentException":
                //        {
                //            throw new ArgumentException(ex.Message);
                //        }
                //    default:
                //        throw new Exception(ex.Message);
                //}
            }
            #region Dispose

            finally
            {
                if (reader != null)
                {
                    reader.Dispose();
                }

                if (conn != null)
                {
                    conn.Dispose();
                }
            }

            #endregion

            return(myVaccine);
        }