Beispiel #1
0
 /// <summary>
 /// 更新数据
 /// </summary>
 /// <param name="obj"></param>
 /// <returns>返回:ture 成功,false 失败</returns>
 public bool Update(MAccount obj)
 {
     if (obj == null) throw new ArgumentNullException("obj");
     String stmtId = "MAccount.Update";
     int result = SqlMapper.Instance().QueryForObject<int>(stmtId, obj);
     return result > 0 ? true : false;
 }
Beispiel #2
0
 /// <summary>
 /// 插入数据
 /// </summary>
 /// <param name="obj">对象</param>
 /// <returns>返回:该条数据的主键Id</returns>
 public int Insert(MAccount obj)
 {
     if (obj == null) throw new ArgumentNullException("obj");
     String stmtId = "MAccount.Insert";
     return SqlMapper.Instance().QueryForObject<int>(stmtId, obj);
 }
Beispiel #3
0
 /// <summary>
 /// 插入数据
 /// </summary>
 /// <param name="obj">对象</param>
 /// <returns>返回:该条数据的主键Id</returns>
 public int Insert(MAccount obj)
 {
     return dal.Insert(obj);
 }
Beispiel #4
0
 /// <summary>
 /// 更新数据
 /// </summary>
 /// <param name="obj"></param>
 /// <returns>返回:ture 成功,false 失败</returns>
 public bool Update(MAccount obj)
 {
     return dal.Update(obj);
 }
Beispiel #5
0
 /// <summary>
 /// 提取账户信息,如果没有则新建账户
 /// </summary>
 /// <param name="userId"></param>
 /// <returns></returns>
 public MAccount GetByUserId(int userId)
 {
     MAccount acc = dal.GetByUserId(userId);
     if (acc == null) {
         acc = new MAccount()
         {
             UserId = userId,
             CreateTime = DateTime.Now
         };
         Insert(acc);
         acc = dal.GetByUserId(userId);
     }
     return acc;
 }