Esempio n. 1
0
 public List<PersonRole> GetAll(int RoleID)
 {
     PersonRoleDAC _personRoleComponent = new PersonRoleDAC();
     IDataReader reader = _personRoleComponent.GetAllPersonRole("RoleId=" + RoleID).CreateDataReader();
     List<PersonRole> _personRoleList = new List<PersonRole>();
     while (reader.Read())
     {
         if (_personRoleList == null)
             _personRoleList = new List<PersonRole>();
         PersonRole _personRole = new PersonRole();
         if (reader["PersonRoleId"] != DBNull.Value)
             _personRole.PersonRoleId = Convert.ToInt32(reader["PersonRoleId"]);
         if (reader["RoleId"] != DBNull.Value)
             _personRole.RoleId = Convert.ToInt32(reader["RoleId"]);
         if (reader["PersonId"] != DBNull.Value)
             _personRole.PersonId = Convert.ToInt32(reader["PersonId"]);
         if (reader["ModifiedDate"] != DBNull.Value)
             _personRole.ModifiedDate = Convert.ToDateTime(reader["ModifiedDate"]);
         _personRole.NewRecord = false;
         _personRoleList.Add(_personRole);
     } reader.Close();
     return _personRoleList;
 }
Esempio n. 2
0
 public bool Insert(PersonRole personrole)
 {
     int autonumber = 0;
     PersonRoleDAC personroleComponent = new PersonRoleDAC();
     bool endedSuccessfuly = personroleComponent.InsertNewPersonRole( ref autonumber,  personrole.RoleId,  personrole.PersonId,  personrole.ModifiedDate);
     if(endedSuccessfuly)
     {
         personrole.PersonRoleId = autonumber;
     }
     return endedSuccessfuly;
 }
Esempio n. 3
0
 public bool Update(PersonRole personrole ,int old_personRoleId)
 {
     PersonRoleDAC personroleComponent = new PersonRoleDAC();
     return personroleComponent.UpdatePersonRole( personrole.RoleId,  personrole.PersonId,  personrole.ModifiedDate,  old_personRoleId);
 }
Esempio n. 4
0
 public PersonRole GetByID(int _personRoleId)
 {
     PersonRoleDAC _personRoleComponent = new PersonRoleDAC();
      IDataReader reader = _personRoleComponent.GetByIDPersonRole(_personRoleId);
      PersonRole _personRole = null;
      while(reader.Read())
      {
          _personRole = new PersonRole();
          if(reader["PersonRoleId"] != DBNull.Value)
              _personRole.PersonRoleId = Convert.ToInt32(reader["PersonRoleId"]);
          if(reader["RoleId"] != DBNull.Value)
              _personRole.RoleId = Convert.ToInt32(reader["RoleId"]);
          if(reader["PersonId"] != DBNull.Value)
              _personRole.PersonId = Convert.ToInt32(reader["PersonId"]);
          if(reader["ModifiedDate"] != DBNull.Value)
              _personRole.ModifiedDate = Convert.ToDateTime(reader["ModifiedDate"]);
      _personRole.NewRecord = false;             }             reader.Close();
      return _personRole;
 }