public bool Save() { GIDB db = new GIDB(); bool bDBIsNothing = db == null; if (bDBIsNothing) { db = new GIDB(); } bool retval = false; try { SearchRecordsDto obj = this; retval = db.SaveSearchRecords(ref obj); this.ID = db.Identity; } catch (Exception ex) { throw new Exception("SearchRecordsDto.Save: \r\n" + ex.Message); } finally { if (bDBIsNothing) { db = null; } } return(retval); }
public bool SaveSearchRecords(ref SearchRecordsDto dto) { SQLParamCollection p = new SQLParamCollection(); p.AddWithValue("@ID", dto.ID); p.AddWithValue("@tblUserID", dto.tblUserID); p.AddWithValue("@ProgramName", dto.ProgramName); p.AddWithValue("@GrantSubject", dto.GrantSubject); p.AddWithValue("@AgencyName", dto.AgencyName); p.AddWithValue("@LastUpdated", dto.LastUpdated); p.AddWithValue("@CostShareType", dto.CostShareType); p.AddWithValue("@FundingType", dto.FundingType); p.AddWithValue("@IdentityVal", 0, SqlDbType.Int, ParameterDirection.Output); return(SaveCommand("SaveSearchRecords", p)); }