/// <summary> /// 功能描述 : 根据城市代码取得[tblFW_RegCity]表的记录 /// 创建者 : 马立军 /// 创建日期 : 2009-04-15 /// 修改者 : /// 修改日期 : /// 修改原因 : /// </summary> /// <param name="sSTCode">城市代码</param> /// <returns>tblFW_RegCity</returns> public tblFW_RegCity ByCode(string sSTCode) { try { usp_tblFW_RegCity_ByCode uspByCode = new usp_tblFW_RegCity_ByCode(); uspByCode.fldSTCode = sSTCode; DataTable tblData = uspByCode.ExecDataTable(1); if (tblData != null) { tblFW_RegCity objData = new tblFW_RegCity(); objData.MetaDataTable = tblData; return(objData); } else { throw new Exception("取得单条记录失败,未找到对应的记录"); } } catch (DBOpenException e) { throw new GetByPKException("打开数据库连接失败", "RuletblFW_RegCity", "ByCode", sSTCode); } catch (DBQueryException e) { throw new GetByPKException("执行Sql语句失败", "RuletblFW_RegCity", "ByCode", sSTCode); } catch (Exception e) { throw new GetByPKException(e.Message, "RuletblFW_RegCity", "ByCode", sSTCode); } }
/// <summary> /// 功能描述 : 根据主键取得[tblFW_RegCity]表的记录 /// 创建者 : Auto Generator /// 创建日期 : 2009-04-09 /// 修改者 : /// 修改日期 : /// 修改原因 : /// </summary> /// <param name="iPK">PK主键值</param> /// <returns>tblFW_RegCity</returns> public tblFW_RegCity ByPK(int iPK) { try { usp_tblFW_RegCity_ByPK uspByPK = new usp_tblFW_RegCity_ByPK(); uspByPK.fldAutoID = iPK; DataTable tblData = uspByPK.ExecDataTable(1); if (tblData != null) { tblFW_RegCity objData = new tblFW_RegCity(); objData.MetaDataTable = tblData; return(objData); } else { throw new Exception("取得单条记录失败,未找到对应的记录"); } } catch (DBOpenException e) { throw new GetByPKException("打开数据库连接失败", "RuletblFW_RegCity", "ByPK", iPK.ToString()); } catch (DBQueryException e) { throw new GetByPKException("执行Sql语句失败", "RuletblFW_RegCity", "ByPK", iPK.ToString()); } catch (Exception e) { throw new GetByPKException(e.Message, "RuletblFW_RegCity", "ByPK", iPK.ToString()); } }
/// <summary> /// 功能描述 : 根据城市代码取得[tblFW_RegCity]表的记录 /// 创建者 : 朱春华 /// 创建日期 : 2010-08-24 /// 修改者 : /// 修改日期 : /// 修改原因 : /// </summary> /// <param name="sSTCode">城市代码</param> /// <returns>tblFW_RegCity</returns> public IList <tblFW_RegCity> ByAllCode(string sSTCode) { try { usp_tblFW_RegCity_ByAllCode uspByCode = new usp_tblFW_RegCity_ByAllCode(); uspByCode.fldSTCode = sSTCode; DataTable tblData = uspByCode.ExecDataTable(1); if (tblData != null) { IList <tblFW_RegCity> listAll = new List <tblFW_RegCity>(); for (int i = 0; i < tblData.Rows.Count; i++) { DataTable tblTmp = tblData.Clone(); tblTmp.Rows.Add(tblData.Rows[i].ItemArray); tblFW_RegCity objData = new tblFW_RegCity(); objData.MetaDataTable = tblTmp; listAll.Add(objData); } return(listAll); } else { throw new Exception("取得记录失败,未找到对应的记录"); } } catch (DBOpenException e) { throw new GetByPKException("打开数据库连接失败", "RuletblFW_RegCity", "ByAllCode", sSTCode); } catch (DBQueryException e) { throw new GetByPKException("执行Sql语句失败", "RuletblFW_RegCity", "ByAllCode", sSTCode); } catch (Exception e) { throw new GetByPKException(e.Message, "RuletblFW_RegCity", "ByAllCode", sSTCode); } }