Esempio n. 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CoreLibrary.Security.RoleController roleController = new CoreLibrary.Security.RoleController();
        if ((HttpContext.Current.Session["CurrentUser"] == null) || (!HttpContext.Current.User.IsInRole(roleController.GetRoleCodeByURL(Request.AppRelativeCurrentExecutionFilePath))))
            FormsAuthentication.RedirectToLoginPage();

        //((Label)(this.Parent.FindControl("lblTitlePageMaster"))).Text = "Bienvenido";

        //if (HttpContext.Current.User.IsInRole("Global_Admin"))
    }
Esempio n. 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        User entCurrenUser = (User)Session["currentUser"];

        if (entCurrenUser != null)
        {
            lblUserCompleteName.Text = entCurrenUser.UserCompleteName;
            Menu.Visible = true;

            CoreLibrary.Security.RoleController roleController = new CoreLibrary.Security.RoleController();
            if (!HttpContext.Current.User.IsInRole(roleController.GetRoleCodeByURL("~/MB/Configuration/Default.aspx")))
                mnConfigPage.Visible = false;
        }
        else
        {
            lblUserCompleteName.Text = "";
            Menu.Visible = false;
        }
            //FormsAuthentication.RedirectToLoginPage();

        lblFecha.Text = String.Format("Hoy es {0:D}", DateTime.Now);
    }
Esempio n. 3
0
    private TreeNode BuildTreeView(TreeNode node, List<SiteMapTree> smtList, int ilItem)
    {
        CoreLibrary.Security.RoleController roleController = new CoreLibrary.Security.RoleController();
        Dictionary<int, int> Roles = roleController.GetRolesSiteMapByIdRole(EntRole.IdRole);
        if (ilItem < smtList.Count)
        {

            SiteMapTree smtItem = smtList[ilItem];
            ilItem= ilItem+1;
            if (node != null)
            {
                if (node.Value == smtItem.IdParent.ToString())
                {
                    TreeNode tnItem = new TreeNode();
                    int ilValue=Roles.Where(s => s.Key == smtItem.IdSiteMap).FirstOrDefault().Value;
                    tnItem.Value = smtItem.IdSiteMap.ToString();
                    tnItem.Text = smtItem.Name;
                    tnItem.SelectAction = TreeNodeSelectAction.None;
                    if (ilValue != 0)
                        tnItem.Checked = true;

                    tnItem = BuildTreeView(tnItem, smtList, ilItem);
                    node.ChildNodes.Add(tnItem);

                }

                node = BuildTreeView(node, smtList, ilItem);
            }
            else
            {
                node = new TreeNode();
                int ilValue = Roles.Where(s => s.Key == smtItem.IdSiteMap).FirstOrDefault().Value;
                node.Value = smtItem.IdSiteMap.ToString();
                node.Text = smtItem.Name;
                node.SelectAction = TreeNodeSelectAction.None;
                node.Checked = true;
                node = BuildTreeView(node, smtList, ilItem);
                tvSiteMap.Nodes.Add(node);
            }
        }
        return node;
    }
Esempio n. 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            lblError.Visible = false;
            CoreLibrary.Security.RoleController roleController = new CoreLibrary.Security.RoleController();
            int IdRole = int.Parse(Request.Params["IdRole"]);

            if (IdRole > 0)
            {
                EntRole = roleController.GetRoleByID(IdRole);
                SetDataToForm();
            }
            else
            {
                EntRole = new RoleInfo();

            }
            EntRole.EntListSiteMap = new List<ServicesLibrary.Entities.SiteMap>();

            BuidlRolesTree();
            tbxName.Focus();
        }
        tvSiteMap.Attributes.Add("onclick", "client_OnTreeNodeChecked();");
        Page.ClientScript.RegisterClientScriptInclude("role", Page.ResolveUrl("~/js/Roles.js"));

        //TreeNode tnItem = new TreeNode();
        //tnItem.

        //TreeView2.Nodes.Add(
    }
Esempio n. 5
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        lblError.Visible = false;
        CoreLibrary.Security.RoleController roleController = new CoreLibrary.Security.RoleController();
        Dictionary<int, int> rolesitemap = new Dictionary<int, int>();
        rolesitemap = CheckParentThatHasCheckedChildren(tvSiteMap.Nodes[0], rolesitemap);
        GetDataFromForm();
        if (roleController.Save(EntRole, rolesitemap))
        {

            Response.Redirect("Default.aspx");
        }
        else
        {
            lblError.Visible = true;
            lblError.Text = "Error al guardar la información";
        }
    }
Esempio n. 6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     CoreLibrary.Security.RoleController roleController = new CoreLibrary.Security.RoleController();
     if ((HttpContext.Current.Session["CurrentUser"] == null) || (!HttpContext.Current.User.IsInRole(roleController.GetRoleCodeByURL(Request.AppRelativeCurrentExecutionFilePath))))
         FormsAuthentication.RedirectToLoginPage();
 }