IList <Injector> IInjectorStorage.ListInjector(QueryInjector pQueryInjector)
        {
            List <Injector> injectorList = null;
            SqlConnection   conn;
            IDataReader     reader;

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

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

                conn.Open();

                reader = InjectorSelectWrapper.ExecuteReader(
                    conn,
                    pQueryInjector);

                if (reader != null)
                {
                    injectorList = new List <Injector>();

                    while (reader.Read())
                    {
                        Injector myInjector = DAUtil.ReadInjector(
                            reader);

                        injectorList.Add(myInjector);
                    }
                }

                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(injectorList);
        }
        Injector IInjectorStorage.ReadInjector(int pInjectorID)
        {
            Injector      myInjector = null;
            SqlConnection conn       = null;
            IDataReader   reader     = null;

            try
            {
                Verify.ArgumentNotNull(pInjectorID);

                myInjector = new Injector();

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

                conn.Open();

                reader = InjectorByInjectorIdSelectWrapper.ExecuteReader(
                    conn,
                    pInjectorID);

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

                myInjector = DAUtil.ReadInjector(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(myInjector);
        }