Example #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!User.Identity.IsAuthenticated)
        {
            FormsAuthentication.SignOut();
            return;
        }

        ErrMessage_Span.InnerHtml        = "";
        ErrMessage_Span.Style["display"] = "none";

        Message_Span.InnerHtml        = "";
        Message_Span.Style["display"] = "none";

        Master.Page.Title = "Control de acceso - Asociación entre roles y usuarios";

        if (!Page.IsPostBack)
        {
            HtmlGenericControl MyHtmlH2;

            MyHtmlH2 = (HtmlGenericControl)(Master.FindControl("PageTitle_TableCell"));
            if (MyHtmlH2 != null)
            {
                MyHtmlH2.InnerHtml = "Control de acceso - Asociación entre roles y usuarios";
            }

            Roles_ListBox.DataSource = Roles.GetAllRoles();
            Roles_ListBox.DataBind();

            Usuarios_ListBox.DataSource = Membership.GetAllUsers();
            Usuarios_ListBox.DataBind();
        }
    }
Example #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!User.Identity.IsAuthenticated)
        {
            FormsAuthentication.SignOut();
            return;
        }

        ErrMessage_Span.InnerHtml        = "";
        ErrMessage_Span.Style["display"] = "none";

        Message_Span.InnerHtml        = "";
        Message_Span.Style["display"] = "none";

        Master.Page.Title = "Control de acceso - Asociación entre compañías y usuarios";

        if (!Page.IsPostBack)
        {
            HtmlGenericControl MyHtmlH2;

            MyHtmlH2 = (HtmlGenericControl)(Master.FindControl("PageTitle_TableCell"));
            if (MyHtmlH2 != null)
            {
                MyHtmlH2.InnerHtml = "Control de acceso - Asociación entre compañías y usuarios";
            }

            dbContabUsersEntities usersContext = new dbContabUsersEntities();
            List <Compania>       companias    = usersContext.Companias.OrderBy(c => c.NombreCorto).ToList();

            Companias_ListBox.DataSource = companias;

            Companias_ListBox.DataTextField  = "NombreCorto";
            Companias_ListBox.DataValueField = "Numero";

            Companias_ListBox.DataBind();

            Usuarios_ListBox.DataSource = Membership.GetAllUsers();
            Usuarios_ListBox.DataBind();
        }
        else
        {
        }
    }