private void LoadRolesUIData()
    {
        ddlRoles.Items.Clear();
        List <EmployeeRoleToSelect> roles = empAuth.GetEmployeeRoleListToSelect();

        if (roles != null)
        {
            ddlRoles.DataTextField  = "DisplayText";
            ddlRoles.DataValueField = "RoleId";
            ddlRoles.DataSource     = roles;
            ddlRoles.DataBind();

            // move admin to last
            ListItem liAdmin = ddlRoles.Items.FindByValue("1");
            if (liAdmin != null)
            {
                ddlRoles.Items.Remove(liAdmin);
                ddlRoles.Items.Add(liAdmin);
            }
        }
    }
Esempio n. 2
0
    private void LoadCopyPrivilegeFromUIData()
    {
        ddlCopyPrivilegeFrom.Items.Clear();
        List <EmployeeRoleToSelect> roles = empAuth.GetEmployeeRoleListToSelect();

        if (roles != null)
        {
            // remove admin
            EmployeeRoleToSelect adminData = roles.Find(r => r.RoleName == "admin");

            if (adminData != null)
            {
                roles.Remove(adminData);
            }

            ddlCopyPrivilegeFrom.DataTextField  = "DisplayText";
            ddlCopyPrivilegeFrom.DataValueField = "RoleName";
            ddlCopyPrivilegeFrom.DataSource     = roles;
            ddlCopyPrivilegeFrom.DataBind();
        }

        ddlCopyPrivilegeFrom.Items.Insert(0, new ListItem(Resources.Lang.CopyOption_DontCopy, ""));
    }