public DueCollections GetsByString(string sString) { DueCollections oDueCollections = new DueCollections(); try { SqlCommand cmd = new SqlCommand("SP_DueCollection_GetsByString", _conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@StuAcId", SqlDbType.VarChar)).Value = sString; if (_conn.State == ConnectionState.Open) { } else { cmd.Connection.Open(); } IDataReader reader = cmd.ExecuteReader(); oDueCollections = CreateObjects(reader); reader.Close(); cmd.Dispose(); cmd.Connection.Close(); } catch (Exception e) { throw new ServiceException(e.Message, e); } return(oDueCollections); }
public DueCollections Gets() { DueCollections oDueCollections = new DueCollections(); try { SqlCommand cmd = new SqlCommand("SP_DueCollection_Gets", _conn); cmd.CommandType = CommandType.StoredProcedure; if (_conn.State == ConnectionState.Open) { } else { cmd.Connection.Open(); } IDataReader reader = cmd.ExecuteReader(); oDueCollections = CreateObjects(reader); reader.Close(); cmd.Dispose(); cmd.Connection.Close(); } catch (Exception e) { throw new ServiceException(e.Message, e); } return(oDueCollections); }
private DueCollections CreateObjects(IDataReader oReader) { DueCollections oDueCollections = new DueCollections(); NullHandler oHandler = new NullHandler(oReader); while (oReader.Read()) { DueCollection oItem = CreateObject(oHandler); oDueCollections.Add(oItem); } return(oDueCollections); }