public SbdLocation Get(int id) { _sbdLocation = dbConnection.GetSbdLocationById(id); return(_sbdLocation); }
public List<SbdLocation> GetAllSbdLocation() { var items = new List<SbdLocation>(); string commandText = "SELECT * FROM PUB_ACS.PAS_SBD_LOCATION_INFO"; using (OracleConnection con = new OracleConnection(MdallDBConnection)) { OracleCommand cmd = new OracleCommand(commandText, con); try { con.Open(); using (OracleDataReader dr = cmd.ExecuteReader()) { if (dr.HasRows) { while (dr.Read()) { var item = new SbdLocation(); item.original_licence_no = dr["ORIGINAL_LICENCE_NO"] == DBNull.Value ? 0 : Convert.ToInt32(dr["ORIGINAL_LICENCE_NO"]); item.sbd_notice_web_loc = dr["SBD_NOTICE_WEB_LOC"] == DBNull.Value ? string.Empty : dr["SBD_NOTICE_WEB_LOC"].ToString().Trim(); item.sbd_web_loc = dr["SBD_WEB_LOC"] == DBNull.Value ? string.Empty : dr["SBD_WEB_LOC"].ToString().Trim(); item.pkg_insert1_keyword = dr["PKG_INSERT1_KEYWORD"] == DBNull.Value ? string.Empty : dr["PKG_INSERT1_KEYWORD"].ToString().Trim(); item.pkg_insert1_loc = dr["PKG_INSERT1_LOC"] == DBNull.Value ? string.Empty : dr["PKG_INSERT1_LOC"].ToString().Trim(); item.pkg_insert2_keyword = dr["PKG_INSERT2_KEYWORD"] == DBNull.Value ? string.Empty : dr["PKG_INSERT2_KEYWORD"].ToString().Trim(); item.pkg_insert2_loc = dr["PKG_INSERT2_LOC"] == DBNull.Value ? string.Empty : dr["PKG_INSERT2_LOC"].ToString().Trim(); item.pkg_insert3_keyword = dr["PKG_INSERT3_KEYWORD"] == DBNull.Value ? string.Empty : dr["PKG_INSERT3_KEYWORD"].ToString().Trim(); item.pkg_insert3_loc = dr["PKG_INSERT3_LOC"] == DBNull.Value ? string.Empty : dr["PKG_INSERT3_LOC"].ToString().Trim(); item.op_manual1_keyword = dr["OP_MANUAL1_KEYWORD"] == DBNull.Value ? string.Empty : dr["OP_MANUAL1_KEYWORD"].ToString().Trim(); item.op_manual1_loc = dr["OP_MANUAL1_LOC"] == DBNull.Value ? string.Empty : dr["OP_MANUAL1_LOC"].ToString().Trim(); item.op_manual2_keyword = dr["OP_MANUAL2_KEYWORD"] == DBNull.Value ? string.Empty : dr["OP_MANUAL2_KEYWORD"].ToString().Trim(); item.op_manual2_loc = dr["OP_MANUAL2_LOC"] == DBNull.Value ? string.Empty : dr["OP_MANUAL2_LOC"].ToString().Trim(); item.op_manual3_keyword = dr["OP_MANUAL3_KEYWORD"] == DBNull.Value ? string.Empty : dr["OP_MANUAL3_KEYWORD"].ToString().Trim(); item.op_manual3_loc = dr["OP_MANUAL3_LOC"] == DBNull.Value ? string.Empty : dr["OP_MANUAL3_LOC"].ToString().Trim(); item.additional_op_pkg = dr["ADDITIONAL_OP_PKG"] == DBNull.Value ? string.Empty : dr["ADDITIONAL_OP_PKG"].ToString().Trim(); items.Add(item); } } } } catch (Exception ex) { string errorMessages = string.Format("DbConnection.cs - GetAllSbdLocationInfo()"); ExceptionHelper.LogException(ex, errorMessages); } finally { if (con.State == ConnectionState.Open) con.Close(); } } return items; }
public SbdLocation Get(int id) { _sbdLocation = dbConnection.GetSbdLocationById(id); return _sbdLocation; }