Esempio n. 1
0
        public List <PersonRole> GetAllByPersonID(int PersonID)
        {
            PersonRoleDAC     _personRoleComponent = new PersonRoleDAC();
            IDataReader       reader          = _personRoleComponent.GetAllPersonRole("PersonId=" + PersonID).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 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);
        }
Esempio n. 3
0
        public bool Insert(int RoleId, int PersonId, DateTime ModifiedDate)
        {
            ModifiedDate = DateTime.Now;
            PersonRoleDAC personroleComponent = new PersonRoleDAC();
            int           PersonRoleId        = 0;

            return(personroleComponent.InsertNewPersonRole(ref PersonRoleId, RoleId, PersonId, ModifiedDate));
        }
Esempio n. 4
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. 5
0
        public int UpdateDataset(System.Data.DataSet dataset)
        {
            PersonRoleDAC personrolecomponent = new PersonRoleDAC();

            return(personrolecomponent.UpdateDataset(dataset));
        }
Esempio n. 6
0
        public void Delete(int Original_PersonRoleId)
        {
            PersonRoleDAC personroleComponent = new PersonRoleDAC();

            personroleComponent.DeletePersonRole(Original_PersonRoleId);
        }
Esempio n. 7
0
        public bool Update(int RoleId, int PersonId, DateTime ModifiedDate, int Original_PersonRoleId)
        {
            PersonRoleDAC personroleComponent = new PersonRoleDAC();

            return(personroleComponent.UpdatePersonRole(RoleId, PersonId, ModifiedDate, Original_PersonRoleId));
        }
Esempio n. 8
0
        public bool Update(PersonRole personrole, int old_personRoleId)
        {
            PersonRoleDAC personroleComponent = new PersonRoleDAC();

            return(personroleComponent.UpdatePersonRole(personrole.RoleId, personrole.PersonId, personrole.ModifiedDate, old_personRoleId));
        }