示例#1
0
 /// <summary>
 /// 功能描述    :  添加[tblFW_User]表的记录
 /// 创建者      :  Auto Generator
 /// 创建日期    :  2009-03-27
 /// 修改者      :
 /// 修改日期    :
 /// 修改原因    :
 /// </summary>
 /// <param name="objInsert">需要添加的实体类</param>
 /// <returns>返回新增记录的PK主键的值</returns>
 public int Insert(tblFW_User objInsert)
 {
     try
     {
         usp_tblFW_User_Insert uspInsert = new usp_tblFW_User_Insert();
         uspInsert.ReceiveParameter(objInsert);
         uspInsert.ExecNoQuery();
         if (uspInsert.fldAutoID > 0)
         {
             return(uspInsert.fldAutoID);
         }
         else
         {
             throw new Exception("插入新记录失败");
         }
     }
     catch (DBOpenException e)
     {
         throw new InsertException("打开数据库连接失败", "RuletblFW_User", "Insert", objInsert.ToString());
     }
     catch (DBPKException e)
     {
         throw new InsertPKException("相同的记录已经存在,违反表的唯一键约束", "RuletblFW_User", "Insert", objInsert.ToString());
     }
     catch (DBQueryException e)
     {
         throw new InsertException("执行Sql语句失败", "RuletblFW_User", "Insert", objInsert.ToString());
     }
     catch (Exception e)
     {
         throw new InsertException(e.Message, "RuletblFW_User", "Insert", objInsert.ToString());
     }
 }
示例#2
0
 /// <summary>
 /// 功能描述    :  更新[tblFW_User]表的记录
 /// 创建者      :  Auto Generator
 /// 创建日期    :  2009-04-26
 /// 修改者      :
 /// 修改日期    :
 /// 修改原因    :
 /// </summary>
 /// <param name="objUpdate_old">需要更新的实体类</param>
 /// <param name="objUpdate_new">更新后的实体类</param>
 /// <returns>true / false</returns>
 public bool Update(tblFW_User objUpdate_old, tblFW_User objUpdate_new)
 {
     try
     {
         usp_tblFW_User_Update uspUpdate = new usp_tblFW_User_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("打开数据库连接失败", "RuletblFW_User", "Update",
                                   "objUpdate_old:" + objUpdate_old.ToString() + ";objUpdate_new:" + objUpdate_new.ToString());
     }
     catch (DBQueryException e)
     {
         throw new UpdateException("执行Sql语句失败", "RuletblFW_User", "Update",
                                   "objUpdate_old:" + objUpdate_old.ToString() + ";objUpdate_new:" + objUpdate_new.ToString());
     }
     catch (Exception e)
     {
         throw new UpdateException(e.Message, "RuletblFW_User", "Update",
                                   "objUpdate_old:" + objUpdate_old.ToString() + ";objUpdate_new:" + objUpdate_new.ToString());
     }
 }
示例#3
0
 /// <summary>
 /// 功能描述    :  更新[tblFW_User]表的密码
 /// 创建者      :  Auto Generator
 /// 创建日期    :  2009-04-08
 /// 修改者      :
 /// 修改日期    :
 /// 修改原因    :
 /// </summary>
 /// <param name="objUpdate">需要更新的实体类</param>
 /// <returns>true / false</returns>
 public bool UpdatePassword(tblFW_User objUpdate)
 {
     try
     {
         usp_tblFW_User_UpdatePassword uspUpdate = new usp_tblFW_User_UpdatePassword();
         uspUpdate.ReceiveParameter(objUpdate);
         int iResult = uspUpdate.ExecNoQuery();
         if (iResult > 0)
         {
             return(true);
         }
         else
         {
             throw new Exception("更新记录失败,未找到对应的记录");
         }
     }
     catch (DBOpenException e)
     {
         throw new UpdateException("打开数据库连接失败", "RuletblFW_User", "UpdatePassword", objUpdate.ToString());
     }
     catch (DBQueryException e)
     {
         throw new UpdateException("执行Sql语句失败", "RuletblFW_User", "UpdatePassword", objUpdate.ToString());
     }
     catch (Exception e)
     {
         throw new UpdateException(e.Message, "RuletblFW_User", "UpdatePassword", objUpdate.ToString());
     }
 }