예제 #1
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            SqlServer server = SqlServer.CurrentServer;

            SqlAdmin.SqlServerRole serverRole;
            server.Connect();
            SqlServerRoleCollection serverRoles = server.Roles;

            server.Disconnect();

            // Create DataSet from list of databases
            DataSet ds = new DataSet();

            ds.Tables.Add();
            ds.Tables[0].Columns.Add("FullName");
            ds.Tables[0].Columns.Add("Name");
            ds.Tables[0].Columns.Add("Description");

            for (int i = 0; i < serverRoles.Count; i++)
            {
                serverRole = serverRoles[i];

                ds.Tables[0].Rows.Add(
                    new object[] {
                    Server.HtmlEncode(serverRole.FullName),
                    Server.HtmlEncode(serverRole.Name),
                    Server.HtmlEncode(serverRole.Description),
                });
            }

            RoleDataGrid.DataSource = ds;
            RoleDataGrid.DataBind();
        }
        private void Init()
        {
            ResponseModel response = rbacService_.GetRoles();

            if (response.Code == 1 && response.DataCount >= 1)
            {
                roles_ = serializer_.Deserialize <List <Roles> >(serializer_.Serialize(response.Data));
                RoleDataGrid.DataSource = roles_;
                RoleDataGrid.Refresh();
            }
            else
            {
                MessageBox.Show(response.Message);
            }
        }
예제 #3
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            SqlServer server = SqlServer.CurrentServer;

            SqlAdmin.SqlServerRole serverRole;
            try
            {
                server.Connect();
            }
            catch (System.Exception ex)
            {
                //Response.Redirect("Error.aspx?errorPassCode=" + 2002);
                Response.Redirect(String.Format("error.aspx?errormsg={0}&stacktrace={1}", Server.UrlEncode(ex.Message), Server.UrlEncode(ex.StackTrace)));
            }
            SqlServerRoleCollection serverRoles = server.Roles;

            server.Disconnect();

            // Create DataSet from list of databases
            DataSet ds = new DataSet();

            ds.Tables.Add();
            ds.Tables[0].Columns.Add("FullName");
            ds.Tables[0].Columns.Add("Name");
            ds.Tables[0].Columns.Add("Description");

            for (int i = 0; i < serverRoles.Count; i++)
            {
                serverRole = serverRoles[i];

                ds.Tables[0].Rows.Add(
                    new object[] {
                    Server.HtmlEncode(serverRole.FullName),
                    Server.HtmlEncode(serverRole.Name),
                    Server.HtmlEncode(serverRole.Description),
                }
                    );
            }

            RoleDataGrid.DataSource = ds;
            RoleDataGrid.DataBind();
        }