public ZipCodePart Copy() { ZipCodePart _zipCodePart = new ZipCodePart(); _zipCodePart.StateCode = _stateCode; _zipCodePart.ZipPart = _zipPart; return(_zipCodePart); }
static private void LoadZipCodePart(ZipCodePart objZipCodePart, IDataReader _reader) { if (_reader.IsDBNull(0) != true) { objZipCodePart.StateCode = _reader.GetString(0); } if (_reader.IsDBNull(1) != true) { objZipCodePart.ZipPart = _reader.GetString(1); } }
static public List <ZipCodePart> GetForState(string StateCode) { List <ZipCodePart> objZipCodeParts = new List <ZipCodePart>(); Database db = DatabaseFactory.CreateDatabase("BRGCaseMail"); using (IDataReader reader = db.ExecuteReader(CommandType.Text, _selectViewSQL + " Where StateCode = '" + StateCode + "' order by StateCode asc, ZipPart asc")) { while (reader.Read()) { ZipCodePart objZipCodePart = new ZipCodePart(); LoadZipCodePart(objZipCodePart, reader); objZipCodePart.IsModified = false; objZipCodeParts.Add(objZipCodePart); } // always call Close when done reading. reader.Close(); return(objZipCodeParts); } }
static public ZipCodePart GetByID(int ID) { ZipCodePart objZipCodePart = new ZipCodePart(); string query = _selectViewSQL + " where ID = " + ID; Database db = DatabaseFactory.CreateDatabase("BRGCaseMail"); using (IDataReader reader = db.ExecuteReader(CommandType.Text, query)) { if (reader.Read()) { LoadZipCodePart(objZipCodePart, reader); // always call Close when done reading. reader.Close(); objZipCodePart.IsModified = false; return(objZipCodePart); } else { return(null); } } }