Example #1
0
        public long InsertUser(UserEntity entity)
        {
            var dbCommand = DB.GetStoredProcCommand("spA_User_i");
            AddInParameter(dbCommand, entity, false);
            DB.AddOutParameter(dbCommand, "@UserId", DbType.Int64, 8);

            DB.ExecuteNonQuery(dbCommand);
            entity.UserId = DbHelper.ConvertTo<long>(DB.GetParameterValue(dbCommand, "@UserId"));
            return entity.UserId;
        }
Example #2
0
 protected void AddInParameter(DbCommand command, UserEntity entity, bool containsPrimaryKey)
 {
     DB.AddInParameter(command, "@UserName", DbType.String, entity.UserName);
     DB.AddInParameter(command, "@CreateTime", DbType.DateTime, entity.CreateTime);
     DB.AddInParameter(command, "@UpdateTime", DbType.DateTime, entity.UpdateTime);
    
     if (containsPrimaryKey)
     {
         DB.AddInParameter(command, "@UserId", DbType.Int64, entity.UserId);
     }
 }
Example #3
0
 public void DeleteUser(UserEntity entity)
 {
     var command = DB.GetStoredProcCommand("spA_User_d");
     DB.AddInParameter(command, "@UserId", DbType.Int64, entity.UserId);
     DB.ExecuteNonQuery(command);
 }
Example #4
0
 public bool UpdateUser(UserEntity entity)
 {
     var dbCommand = DB.GetStoredProcCommand("spA_User_u");
     AddInParameter(dbCommand, entity, true);
     return DbHelper.ConvertTo<int>(DB.ExecuteScalar(dbCommand)) == 0;
 }
Example #5
0
 public void DeleteUser(UserEntity entity)
 {
     userInsertDB.DeleteUser(entity);
 }
Example #6
0
 public bool UpdateUser(UserEntity entity)
 {
     return userInsertDB.UpdateUser(entity);
 }
Example #7
0
 public long AddUser(UserEntity entity)
 {
     return userInsertDB.InsertUser(entity);
 }