Exemplo n.º 1
0
        private void UserAccountSettings_Load(object sender, EventArgs e)
        {
            SBFAApi agent = new SBFAApi();

            using (new OperationContextScope(agent.context))
            {
                //get user profile
                sbfa.ApplicationUsers tempUser = agent.operation.GetUser(Globals.userLogged);

                txtName.Text    = tempUser.FirstName;
                txtSurname.Text = tempUser.Surname;
                txtEmail.Text   = tempUser.EmailAddress;
                txtPhone.Text   = tempUser.MobileNumber;
            }
        }
Exemplo n.º 2
0
        private void ManagerUserProperties_Load(object sender, EventArgs e)
        {
            try
            {
                SBFAApi agent = new SBFAApi();
                using (new OperationContextScope(agent.context))
                {
                    sbfa.ApplicationUsers response = agent.operation.GetUser(SBFAMain.currentUsername);
                    lblUsername.Text   = SBFAMain.currentUsername;
                    chkActive.Checked  = response.Active;
                    chkExpires.Checked = response.PasswordExpires;
                    chkLocked.Checked  = response.Locked;
                    lblChanged.Text    = response.PasswordLastChanged.ToShortDateString();
                    lblExpiry.Text     = response.PasswordExpiryDate.ToShortDateString();
                    txtEmail.Text      = response.EmailAddress;
                    txtMobile.Text     = response.MobileNumber;
                    txtName.Text       = response.FirstName;
                    txtSurname.Text    = response.Surname;
                    Globals.SetPickList(cmbStakeholder, "stahol");
                    Globals.SetPickListValue(cmbStakeholder, response.FK_StakeholderId);

                    //get application user roles
                    sbfa.ApplicationRoles[] roles = agent.operation.GetApplicationRoles("default");
                    foreach (sbfa.ApplicationRoles role in roles)
                    {
                        string currentRole = role.Name;
                        treeSystemRoles.Nodes["systemRoles"].Nodes.Add(currentRole, currentRole);
                        treeSystemRoles.Nodes["systemRoles"].Nodes[currentRole].Nodes.Add(role.Description);
                    }
                    //get selected user roles
                    sbfa.ApplicationRoles[] userRoles = agent.operation.GetApplicationRoles(SBFAMain.currentUsername);
                    foreach (sbfa.ApplicationRoles role in userRoles)
                    {
                        string currentRole = role.Name;
                        treeUserRoles.Nodes["userSystemRoles"].Nodes.Add(currentRole, currentRole);
                        treeUserRoles.Nodes["userSystemRoles"].Nodes[currentRole].Nodes.Add(role.Description);
                        //remove from system roles
                        treeSystemRoles.Nodes["systemRoles"].Nodes[currentRole].Remove();
                    }
                    //get user group roles
                    //get application user group roles
                    sbfa.ApplicationRoleGroups[] rolesGroup = agent.operation.GetApplicationGroupRoles("default");
                    foreach (sbfa.ApplicationRoleGroups role in rolesGroup)
                    {
                        string currentRole = role.Name;
                        treeSystemRoles.Nodes["systemGroupRoles"].Nodes.Add(currentRole, currentRole);
                        treeSystemRoles.Nodes["systemGroupRoles"].Nodes[currentRole].Nodes.Add(role.Description);
                    }
                    //get selected user roles
                    sbfa.ApplicationRoleGroups[] userRolesGroup = agent.operation.GetApplicationGroupRoles(SBFAMain.currentUsername);
                    foreach (sbfa.ApplicationRoleGroups role in userRolesGroup)
                    {
                        string currentRole = role.Name;
                        treeUserRoles.Nodes["userSystemGroupRoles"].Nodes.Add(currentRole, currentRole);
                        treeUserRoles.Nodes["userSystemGroupRoles"].Nodes[currentRole].Nodes.Add(role.Description);
                        //remove from system roles
                        treeSystemRoles.Nodes["systemGroupRoles"].Nodes[currentRole].Remove();
                    }
                }
            }
            catch
            {
                ShowErrorMessage("Failed to initialize status");
            }
        }