Beispiel #1
0
 public List<UserMonitor> GetAll()
 {
     UserMonitorDAC _userMonitorComponent = new UserMonitorDAC();
      IDataReader reader =  _userMonitorComponent.GetAllUserMonitor().CreateDataReader();
      List<UserMonitor> _userMonitorList = new List<UserMonitor>();
      while(reader.Read())
      {
      if(_userMonitorList == null)
          _userMonitorList = new List<UserMonitor>();
          UserMonitor _userMonitor = new UserMonitor();
          if(reader["UserMonitorId"] != DBNull.Value)
              _userMonitor.UserMonitorId = Convert.ToInt32(reader["UserMonitorId"]);
          if(reader["PersonId"] != DBNull.Value)
              _userMonitor.PersonId = Convert.ToInt32(reader["PersonId"]);
          if(reader["IsSuccess"] != DBNull.Value)
              _userMonitor.IsSuccess = Convert.ToBoolean(reader["IsSuccess"]);
          if(reader["UserIP"] != DBNull.Value)
              _userMonitor.UserIP = Convert.ToString(reader["UserIP"]);
          if(reader["UserName"] != DBNull.Value)
              _userMonitor.UserName = Convert.ToString(reader["UserName"]);
          if(reader["DateCreated"] != DBNull.Value)
              _userMonitor.DateCreated = Convert.ToDateTime(reader["DateCreated"]);
      _userMonitor.NewRecord = false;
      _userMonitorList.Add(_userMonitor);
      }             reader.Close();
      return _userMonitorList;
 }
Beispiel #2
0
 public UserMonitor GetByID(int _userMonitorId)
 {
     UserMonitorDAC _userMonitorComponent = new UserMonitorDAC();
      IDataReader reader = _userMonitorComponent.GetByIDUserMonitor(_userMonitorId);
      UserMonitor _userMonitor = null;
      while(reader.Read())
      {
          _userMonitor = new UserMonitor();
          if(reader["UserMonitorId"] != DBNull.Value)
              _userMonitor.UserMonitorId = Convert.ToInt32(reader["UserMonitorId"]);
          if(reader["PersonId"] != DBNull.Value)
              _userMonitor.PersonId = Convert.ToInt32(reader["PersonId"]);
          if(reader["IsSuccess"] != DBNull.Value)
              _userMonitor.IsSuccess = Convert.ToBoolean(reader["IsSuccess"]);
          if(reader["UserIP"] != DBNull.Value)
              _userMonitor.UserIP = Convert.ToString(reader["UserIP"]);
          if(reader["UserName"] != DBNull.Value)
              _userMonitor.UserName = Convert.ToString(reader["UserName"]);
          if(reader["DateCreated"] != DBNull.Value)
              _userMonitor.DateCreated = Convert.ToDateTime(reader["DateCreated"]);
      _userMonitor.NewRecord = false;             }             reader.Close();
      return _userMonitor;
 }
Beispiel #3
0
 public bool Insert(UserMonitor usermonitor)
 {
     int autonumber = 0;
     UserMonitorDAC usermonitorComponent = new UserMonitorDAC();
     bool endedSuccessfuly = usermonitorComponent.InsertNewUserMonitor( ref autonumber,  usermonitor.PersonId,  usermonitor.IsSuccess,  usermonitor.UserIP,  usermonitor.UserName,  usermonitor.DateCreated);
     if(endedSuccessfuly)
     {
         usermonitor.UserMonitorId = autonumber;
     }
     return endedSuccessfuly;
 }
Beispiel #4
0
 public bool Update(UserMonitor usermonitor ,int old_userMonitorId)
 {
     UserMonitorDAC usermonitorComponent = new UserMonitorDAC();
     return usermonitorComponent.UpdateUserMonitor( usermonitor.PersonId,  usermonitor.IsSuccess,  usermonitor.UserIP,  usermonitor.UserName,  usermonitor.DateCreated,  old_userMonitorId);
 }