예제 #1
0
        private void ManagerUserProperties_Load(object sender, EventArgs e)
        {
            SenpaApi agent = new SenpaApi();

            using (new OperationContextScope(agent.context)) {
                senpa.ApplicationUsers response = agent.operation.GetUser(SEnPAMain.currentUsername);
                lblUsername.Text   = SEnPAMain.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
                senpa.ApplicationRoles[] roles = agent.operation.GetApplicationRoles("default");
                foreach (senpa.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
                senpa.ApplicationRoles[] userRoles = agent.operation.GetApplicationRoles(SEnPAMain.currentUsername);
                foreach (senpa.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
                senpa.ApplicationRoleGroups[] rolesGroup = agent.operation.GetApplicationGroupRoles("default");
                foreach (senpa.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
                senpa.ApplicationRoleGroups[] userRolesGroup = agent.operation.GetApplicationGroupRoles(SEnPAMain.currentUsername);
                foreach (senpa.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();
                }
            }
        }
예제 #2
0
        private void UserAccountSettings_Load(object sender, EventArgs e)
        {
            SenpaApi agent = new SenpaApi();

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

                txtName.Text    = tempUser.FirstName;
                txtSurname.Text = tempUser.Surname;
                txtEmail.Text   = tempUser.EmailAddress;
                txtPhone.Text   = tempUser.MobileNumber;
            }
        }