Beispiel #1
0
        private void FixupROLE(ROLE previousValue)
        {
            if (previousValue != null && previousValue.USER.Contains(this))
            {
                previousValue.USER.Remove(this);
            }

            if (ROLE != null)
            {
                if (!ROLE.USER.Contains(this))
                {
                    ROLE.USER.Add(this);
                }
                if (RoleID != ROLE.ID)
                {
                    RoleID = ROLE.ID;
                }
            }
            else if (!_settingFK)
            {
                RoleID = null;
            }
        }
Beispiel #2
0
        private void FixupROLE(ROLE previousValue)
        {
            if (previousValue != null && previousValue.USER.Contains(this))
            {
                previousValue.USER.Remove(this);
            }

            if (ROLE != null)
            {
                if (!ROLE.USER.Contains(this))
                {
                    ROLE.USER.Add(this);
                }
                if (RoleID != ROLE.ID)
                {
                    RoleID = ROLE.ID;
                }
            }
            else if (!_settingFK)
            {
                RoleID = null;
            }
        }
 private void LoadRoles(int? selectedRole)
 {
     try
     {
         List<ROLE> roles = ApplicationContext.Current.Users.GetAllRoles();
         ROLE emptyRole = new ROLE() { ID = -1, Name = "" };
         roles.Insert(0, emptyRole);
         ddlRoles.DataSource = roles;
         ddlRoles.DataValueField = "ID";
         ddlRoles.DataTextField = "Name";
         if (selectedRole.HasValue)
         {
             ddlRoles.SelectedValue = selectedRole.Value.ToString();
         }
         ddlRoles.DataBind();
     }
     catch (Exception ex)
     {
         // TODO log error
         lblErrors.Visible = true;
         lblErrors.ForeColor = Color.Red;
         lblErrors.Text = "Error occurred: " + ex.Message;
     }
 }