예제 #1
0
        private static AcreRol ConvertToRol(DataRow dr)
        {
            AcreRol r = new AcreRol();

            if (dr != null)
            {
                r.RolId          = Convert.ToInt32(dr["RolId"]);
                r.RolDescripcion = Convert.ToString(dr["Rol"]);
                r.Codigo         = Convert.ToString(dr["Codigo"]);
                r.GrupoId        = Convert.ToInt32(dr["GrupoId"]);
            }
            return(r);
        }
예제 #2
0
        public static List <AcreRol> getRolGrupo(int grupoId)
        {
            List <AcreRol> lr = new List <AcreRol>();

            lr.Add(new AcreRol {
                RolId = 0, RolDescripcion = "Seleccione Rol", Codigo = null, GrupoId = 0
            });
            DBTransaction db = new DBTransaction();
            DataTable     dt = db.GetDataView(string.Format("[acre].[Roles] where GrupoId = {0}", grupoId));

            foreach (DataRow dr in dt.Rows)
            {
                AcreRol r = ConvertToRol(dr);
                lr.Add(r);
            }
            return(lr);
        }