Ejemplo n.º 1
0
        protected void getUsersData()
        {
            DataTable dttUsers = new DataTable();
            dttUsers.Columns.Add(new DataColumn("userId", System.Type.GetType("System.Int32")));
            dttUsers.Columns.Add(new DataColumn("userName", System.Type.GetType("System.String")));
            dttUsers.Columns.Add(new DataColumn("userLastName", System.Type.GetType("System.String")));
            dttUsers.Columns.Add(new DataColumn("userFirstName", System.Type.GetType("System.String")));
            dttUsers.Columns.Add(new DataColumn("userGroupId", System.Type.GetType("System.Int32")));
            dttUsers.Columns.Add(new DataColumn("userGroupDescription", System.Type.GetType("System.String")));
            dttUsers.Columns.Add(new DataColumn("userActive", System.Type.GetType("System.Boolean")));

            List<users> lstUsers = new List<users>();
            usersBus oUsers = new usersBus();

            usergroup auxGroup = new usergroup();
            usergroupBus oGroup = new usergroupBus();

            lstUsers = oUsers.usersGetAll();

            if (lstUsers.Count > 0)
            {
                foreach (users row in lstUsers)
                {
                    auxGroup = oGroup.usergroupGetById(row.UserGroupId);

                    dttUsers.Rows.Add(row.UserId,
                                      row.UserName,
                                      row.UserLastName,
                                      row.UserFirstName,
                                      row.UserGroupId,
                                      auxGroup.UserGroupDescription,
                                      row.UserActive);
                }

                gvUsers.DataSource = dttUsers;
                gvUsers.DataBind();
            }
        }
Ejemplo n.º 2
0
        protected void getUserGroupData()
        {
            List<usergroup> lstGroup = new List<usergroup>();
            usergroupBus oGroup = new usergroupBus();

            lstGroup = oGroup.usergroupGetAll();

            if (lstGroup.Count > 0)
            {
                ddlUserGroup.DataSource = lstGroup;
                ddlUserGroup.DataValueField = "userGroupId";
                ddlUserGroup.DataTextField = "userGroupDescription";
                ddlUserGroup.DataBind();
            }
        }