示例#1
0
        protected void ddlUserGroup_SelectedIndexChanged(object sender, EventArgs e)
        {
            List <userrolesmapping> lstGroupRolesMapping = new List <userrolesmapping>();
            userrolesmappingBus     oRolesMapping        = new userrolesmappingBus();

            userroles    auxRol = new userroles();
            userrolesBus oRoles = new userrolesBus();

            cblRolesRoles.Items.Clear();
            if (lstGroupRolesMapping.Count > 0)
            {
                int index = 0;
                foreach (userrolesmapping rowRolMapping in lstGroupRolesMapping)
                {
                    auxRol = oRoles.userrolesGetById(rowRolMapping.UserRoleId);
                    cblRolesRoles.Items.Add(auxRol.UserRoleDescription);
                    cblRolesRoles.Items[index].Selected = true;
                    index++;
                }
            }
        }
示例#2
0
        protected void gvUsers_SelectedIndexChanged(object sender, EventArgs e)
        {
            GridViewRow row = gvUsers.SelectedRow;

            users    auxUser = new users();
            usersBus oUser   = new usersBus();

            List <userrolesmapping> lstGroupRolesMapping = new List <userrolesmapping>();
            userrolesmappingBus     oRolesMapping        = new userrolesmappingBus();

            userroles    auxRol = new userroles();
            userrolesBus oRoles = new userrolesBus();

            try
            {
                ddlUserGroup.SelectedValue = ((Label)row.FindControl("userGroupId")).Text;
            }
            catch
            {
            }

            if ((Label)row.FindControl("userId") != null)
            {
                userId.Value = ((Label)row.FindControl("userId")).Text;
            }
            else
            {
                userId.Value = "";
            }
            if ((Label)row.FindControl("userName") != null)
            {
                txtUserName.Text = ((Label)row.FindControl("userName")).Text;
            }
            else
            {
                txtUserName.Text = "";
            }
            if ((Label)row.FindControl("userLastName") != null)
            {
                txtUserLastName.Text = ((Label)row.FindControl("userLastName")).Text;
            }
            else
            {
                txtUserLastName.Text = "";
            }
            if ((Label)row.FindControl("userFirstName") != null)
            {
                txtUserFirstName.Text = ((Label)row.FindControl("userFirstName")).Text;
            }
            else
            {
                txtUserFirstName.Text = "";
            }
            if ((CheckBox)row.FindControl("userActive") != null)
            {
                chkActive.Checked = ((CheckBox)row.FindControl("userActive")).Checked;
            }
            else
            {
                chkActive.Checked = false;
            }

            auxUser          = oUser.usersGetById(Convert.ToInt32(userId.Value));
            txtMail.Text     = auxUser.UserMail;
            txtPassword.Text = auxUser.UserPassword;
            txtSMS.Text      = auxUser.UserSMSNumber;

            cblRolesRoles.Items.Clear();
            lstGroupRolesMapping = oRolesMapping.userrolesmappingGetByUserGroupId(Convert.ToInt32(ddlUserGroup.SelectedValue));
            if (lstGroupRolesMapping.Count > 0)
            {
                int index = 0;
                foreach (userrolesmapping rowRolMapping in lstGroupRolesMapping)
                {
                    auxRol = oRoles.userrolesGetById(rowRolMapping.UserRoleId);
                    cblRolesRoles.Items.Add(auxRol.UserRoleDescription);
                    cblRolesRoles.Items[index].Selected = true;
                    index++;
                }
            }

            activateFields(true, false);
            btnSave.Enabled = true;
        }