Exemplo n.º 1
0
 private void ShowDependentOnRole(Role role)
 {
     if (!role.Permissions.Where(x => x.Title == "Edit User").Any())
     {
         barSaveButton.Visibility = BarItemVisibility.Never;
         barSaveAndNewButton.Visibility = BarItemVisibility.Never;
         barNewButton.Visibility = BarItemVisibility.Never;
     }
     if (!role.Permissions.Where(x => x.Title == "Activate User").Any())
     {
         userStateButton.Visibility = BarItemVisibility.Never;
     }
     if (!role.Permissions.Where(x => x.Title == "Deactivate User").Any())
     {
         userStateButton.Visibility = BarItemVisibility.Never;
     }
 }
Exemplo n.º 2
0
 public void Save(Role currentRole)
 {
     RoleRepository.Update(currentRole);
 }
Exemplo n.º 3
0
 public void Create(Role currentRole)
 {
     RoleRepository.Create(currentRole);
 }
 private void ShowDependentOnRole(Role role)
 {
     if (!role.Permissions.Any(x => x.Title == "Search Client by City"))
         clientCityTextEdit.Enabled = false;
 }
Exemplo n.º 5
0
 private void ShowDependentOnRole(Role role)
 {
     if (!role.Permissions.Any(x => x.Title == "Edit Client"))
     {
         clientBarSaveButton.Visibility = BarItemVisibility.Never;
         clientBarSaveAndNewButton.Visibility = BarItemVisibility.Never;
         clientBarNewButton.Visibility = BarItemVisibility.Never;
         buttonAddNewTelephoneEdit.Enabled = false;
     }
     if (!role.Permissions.Any(x => x.Title == "Activate Client"))
     {
         clientStateButton.Visibility = BarItemVisibility.Never;
     }
     if (!role.Permissions.Any(x => x.Title == "Deactivate Client"))
     {
         clientStateButton.Visibility = BarItemVisibility.Never;
     }
     if (!role.Permissions.Any(x => x.Title == "Comment Client"))
     {
         сlientNewCommentTextBox.Enabled = false;
         сlientAddCommentButton.Enabled = false;
     }
 }
Exemplo n.º 6
0
 private void ShowDependentOnRole(Role role)
 {
     if (!role.Permissions.Any(x => x.Title == "Add Category"))
     {
         addCategoryBarButton.Visibility = BarItemVisibility.Never;
     }
     if (!role.Permissions.Any(x => x.Title == "Edit Category"))
     {
         saveBarButton.Visibility = BarItemVisibility.Never;
     }
     if (!role.Permissions.Any(x => x.Title == "Comment Category"))
     {
         addNewCommentTextEdit.Enabled = false;
         addNewCommentButton.Enabled = false;
     }
 }
Exemplo n.º 7
0
 public void Update(Role entity)
 {
     dbContext.Entry(entity).State = System.Data.Entity.EntityState.Modified;
     dbContext.SaveChanges();
 }
Exemplo n.º 8
0
 public void Delete(Role entity)
 {
     dbContext.Roles.Remove(entity);
     dbContext.SaveChanges();
 }
Exemplo n.º 9
0
 public void Create(Role entity)
 {
     dbContext.Roles.Add(entity);
     dbContext.SaveChanges();
 }
Exemplo n.º 10
0
        private void ShowDependentOnRole(Role role)
        {
            if (!role.Permissions.Any(x => x.Title == "Add User"))
                UserBarButton.Visibility = BarItemVisibility.Never;
            if (!role.Permissions.Any(x => x.Title == "Add Client"))
                ClientBarButton.Visibility = BarItemVisibility.Never;
            if (!role.Permissions.Any(x => x.Title == "Add Product"))
                ProductBarButton.Visibility = BarItemVisibility.Never;
            if (!role.Permissions.Any(x => x.Title == "Add Order"))
                OrderBarButton.Visibility = BarItemVisibility.Never;
            if (!role.Permissions.Any(x => x.Title == "Add Role"))
                RolesBarButton.Visibility = BarItemVisibility.Never;

            if (!role.Permissions.Any(x => x.Title == "Search User"))
                UsersListBarButton.Visibility = BarItemVisibility.Never;
            if (!role.Permissions.Any(x => x.Title == "Search Client"))
                ClientsListBarButton.Visibility = BarItemVisibility.Never;
            if (!role.Permissions.Any(x => x.Title == "Search Product"))
                ProductsListBarButton.Visibility = BarItemVisibility.Never;
            if (!role.Permissions.Any(x => x.Title == "Search Order"))
                OrdersListBarButton.Visibility = BarItemVisibility.Never;
            if (!role.Permissions.Any(x => x.Title == "Search Category"))
                ProductsListBarButton.Visibility = BarItemVisibility.Never;
        }
 private void ShowDependentOnRole(Role role)
 {
     if (!role.Permissions.Any(x => x.Title == "Search Product by Category"))
         categoryLookUpEdit.Enabled = false;
 }
Exemplo n.º 12
0
 public void UsePermissionWithRoleID(int id)
 {
     _currentRole = _roles.First(x => x.Id == id);//.Clone() as Role;
 }
Exemplo n.º 13
0
 protected bool Equals(Role other)
 {
     return string.Equals(Title, other.Title) && Equals(Permissions, other.Permissions) && Id.Equals(other.Id);
 }
Exemplo n.º 14
0
 private void ShowDependentOnRole(Role role)
 {
     if (!role.Permissions.Any(x => x.Title == "Edit Product"))
     {
         barSaveButton.Visibility = BarItemVisibility.Never;
         barSaveAndNewButton.Visibility = BarItemVisibility.Never;
         barNewButton.Visibility = BarItemVisibility.Never;
     }
     if (!role.Permissions.Any(x => x.Title == "Activate Product"))
     {
         productStateButton.Visibility = BarItemVisibility.Never;
     }
     if (!role.Permissions.Any(x => x.Title == "Deactivate Product"))
     {
         productStateButton.Visibility = BarItemVisibility.Never;
     }
     if (!role.Permissions.Any(x => x.Title == "Comment Product"))
     {
         newCommentTextBox.Enabled = false;
         addCommentButton.Enabled = false;
     }
 }
Exemplo n.º 15
0
 private void ShowDependentOnRole(Role role)
 {
     if (!role.Permissions.Any(x => x.Title == "Edit Role"))
        {
        barSaveButton.Visibility = BarItemVisibility.Never;
        barAddButton.Visibility = BarItemVisibility.Never;
        }
 }