IList <ManagerUser> IManagerUserStorage.ListManagerUser( QueryManagerUser pQueryManagerUser) { List <ManagerUser> managerUserList = null; SqlConnection conn; IDataReader reader; try { Verify.ArgumentNotNull(pQueryManagerUser, "pQueryManagerUser"); conn = new SqlConnection( ConfigurationManager .ConnectionStrings["DEFAULT"].ToString()); conn.Open(); reader = ManagerUserSelectWrapper.ExecuteReader( conn, pQueryManagerUser); if (reader != null) { managerUserList = new List <ManagerUser>(); while (reader.Read()) { ManagerUser myManagerUser = DAUtil.ReadManagerUser( reader); managerUserList.Add(myManagerUser); } } conn.Close(); } catch (Exception 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(managerUserList); }
IList <Manufacturers> IManufacturersStorage.ListManufacturers(QueryManufacturers pQueryManufacturers) { List <Manufacturers> manufacturersList = null; SqlConnection conn; IDataReader reader; try { Verify.ArgumentNotNull(pQueryManufacturers, "pQueryManufacturers"); conn = new SqlConnection( ConfigurationManager .ConnectionStrings["DEFAULT"].ToString()); conn.Open(); reader = ManufacturersSelectWrapper.ExecuteReader( conn, pQueryManufacturers); if (reader != null) { manufacturersList = new List <Manufacturers>(); while (reader.Read()) { Manufacturers myManufacturers = DAUtil.ReadManufacturers( reader); manufacturersList.Add(myManufacturers); } } 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(manufacturersList); }
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); }
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); }
Manufacturers IManufacturersStorage.ReadManufacturers(int pManufacturersID) { Manufacturers myManufacturers = null; SqlConnection conn = null; IDataReader reader = null; try { Verify.ArgumentNotNull(pManufacturersID); myManufacturers = new Manufacturers(); conn = new SqlConnection( ConfigurationManager .ConnectionStrings["DEFAULT"].ToString()); conn.Open(); reader = ManufacturersByManufacturersIdSelectWrapper.ExecuteReader( conn, pManufacturersID); if (!reader.Read()) { throw new Exception("Manufacturers read failure!"); } myManufacturers = DAUtil.ReadManufacturers(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(myManufacturers); }
ManagerUser IManagerUserStorage.ReadManagerUser(int pUserId) { ManagerUser myManagerUser = null; SqlConnection conn = null; IDataReader reader = null; try { Verify.ArgumentNotNull(pUserId); myManagerUser = new ManagerUser(); conn = new SqlConnection( ConfigurationManager .ConnectionStrings["DEFAULT"].ToString()); conn.Open(); reader = ManagerUserByUserIdSelectWrapper.ExecuteReader( conn, pUserId); if (!reader.Read()) { throw new Exception("ManagerUser read failure!"); } myManagerUser = DAUtil.ReadManagerUser(reader); conn.Close(); } catch (Exception 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(myManagerUser); }