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; }
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; }
public bool Update(PersonRole personrole ,int old_personRoleId) { PersonRoleDAC personroleComponent = new PersonRoleDAC(); return personroleComponent.UpdatePersonRole( personrole.RoleId, personrole.PersonId, personrole.ModifiedDate, old_personRoleId); }
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; }