/// <summary> /// 功能描述 : 更新[tblEQIA_RD_ItemSTD]表的记录 /// 创建者 : Auto Generator /// 创建日期 : 2009-06-04 /// 修改者 : /// 修改日期 : /// 修改原因 : /// </summary> /// <param name="objUpdate_old">需要更新的实体类</param> /// <param name="objUpdate_new">更新后的实体类</param> /// <returns>true / false</returns> public bool Update(tblEQIA_RD_ItemSTD objUpdate_old, tblEQIA_RD_ItemSTD objUpdate_new) { try { usp_tblEQIA_RD_ItemSTD_Update uspUpdate = new usp_tblEQIA_RD_ItemSTD_Update(); uspUpdate.ReceiveParameter_Old(objUpdate_old); uspUpdate.ReceiveParameter_New(objUpdate_new); int iResult = uspUpdate.ExecNoQuery(); if (iResult > 0) { return(true); } else { throw new Exception("更新记录失败,未找到对应的记录"); } } catch (DBOpenException e) { throw new UpdateException("打开数据库连接失败", "RuletblEQIA_RD_ItemSTD", "Update", "objUpdate_old:" + objUpdate_old.ToString() + ";objUpdate_new:" + objUpdate_new.ToString()); } catch (DBPKException e) { throw new UpdatePKException("相同的记录已经存在,违反表的唯一键约束", "RuletblEQIA_RD_ItemSTD", "Update", "objUpdate_old:" + objUpdate_old.ToString() + ";objUpdate_new:" + objUpdate_new.ToString()); } catch (DBQueryException e) { throw new UpdateException("执行Sql语句失败", "RuletblEQIA_RD_ItemSTD", "Update", "objUpdate_old:" + objUpdate_old.ToString() + ";objUpdate_new:" + objUpdate_new.ToString()); } catch (Exception e) { throw new UpdateException(e.Message, "RuletblEQIA_RD_ItemSTD", "Update", "objUpdate_old:" + objUpdate_old.ToString() + ";objUpdate_new:" + objUpdate_new.ToString()); } }
/// <summary> /// 功能描述 : 添加[tblEQIA_RD_ItemSTD]表的记录 /// 创建者 : Auto Generator /// 创建日期 : 2009-06-04 /// 修改者 : /// 修改日期 : /// 修改原因 : /// </summary> /// <param name="objInsert">需要添加的实体类</param> /// <returns>返回新增记录的PK主键的值</returns> public int Insert(tblEQIA_RD_ItemSTD objInsert) { try { usp_tblEQIA_RD_ItemSTD_Insert uspInsert = new usp_tblEQIA_RD_ItemSTD_Insert(); uspInsert.ReceiveParameter(objInsert); uspInsert.ExecNoQuery(); if (uspInsert.fldAutoID > 0) { return(uspInsert.fldAutoID); } else { throw new Exception("插入新记录失败"); } } catch (DBOpenException e) { throw new InsertException("打开数据库连接失败", "RuletblEQIA_RD_ItemSTD", "Insert", objInsert.ToString()); } catch (DBPKException e) { throw new InsertPKException("相同的记录已经存在,违反表的唯一键约束", "RuletblEQIA_RD_ItemSTD", "Insert", objInsert.ToString()); } catch (DBQueryException e) { throw new InsertException("执行Sql语句失败", "RuletblEQIA_RD_ItemSTD", "Insert", objInsert.ToString()); } catch (Exception e) { throw new InsertException(e.Message, "RuletblEQIA_RD_ItemSTD", "Insert", objInsert.ToString()); } }