Beispiel #1
0
        /// <summary>
        /// Loads the po.
        /// </summary>
        /// <param name="permission">The permission.</param>
        public void LoadPo(Permission permission)
        {
            Id = permission.Id;
            Description = permission.Description;
            Name = permission.Name;
            Enabled = permission.Enabled;

            foreach (ElementPermission ep in permission.ElementPermission)
            {
                var elemnetPermission = new ElementPermissionPo();
                elemnetPermission.Element = ep.Element;
                elemnetPermission.Value = ep.Value;
                elemnetPermission.GraphicProperty = ep.GraphicProperty;
                //elemnetPermission.SetRight(ep.Right);
                ElementsPermissions.Add(elemnetPermission);
            }

            foreach (DataPermission ep in permission.DataPermission)
            {
                var elemnetPermission = new DataPermissionPo();
                elemnetPermission.Condition = ep.Condition;
                elemnetPermission.Service=new DataServicePo();
                elemnetPermission.Service.ServiceName = ep.DataService.Service;
                elemnetPermission.Id = ep.Id;
                elemnetPermission.Service.ServiceMethod = ep.DataService.Method;
                elemnetPermission.Service.Id = ep.DataService.Id;
                DataPermissions.Add(elemnetPermission);
            }

            ElementsPermissions.ClearChanges();
            DataPermissions.ClearChanges();
        }
 /// <summary>
 /// Called when Add button is pressed.
 /// </summary>
 /// <param name="permission">Selected permission</param>
 public void OnAddPermission(Permission permission)
 {
     if (permission == null)
     {
         return;
     }
     PermissionPo permissionPo = new PermissionPo();
     permissionPo.LoadPo(permission);
     UsersPermissions.Add(permissionPo);
     NotifyOfPropertyChange(() => UsersPermissions);
     NotifyOfPropertyChange(() => Permissions);
     this.OnActivate();
 }
        public void UpdatePermission(Permission currentData)
        {
            Permission permission = this.ChangeSet.GetOriginal(currentData);
            if (permission != null)
            {
                this.ObjectContext.CreateObjectSet<Permission>().AttachAsModified(currentData, permission);
            }
            else
            {
                this.ObjectContext.Permission.Attach(currentData);
            }

            this.ObjectContext.SaveChanges();
        }
 public void InsertPermission(Permission currentData)
 {
     if ((currentData.EntityState != EntityState.Added))
     {
         if ((currentData.EntityState != EntityState.Detached))
         {
             this.ObjectContext.ObjectStateManager.
                 ChangeObjectState(currentData, EntityState.Added);
         }
         else
         {
             this.ObjectContext.AddToPermission(currentData);
         }
     }
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Permission EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToPermission(Permission permission)
 {
     base.AddObject("Permission", permission);
 }
 /// <summary>
 /// Create a new Permission object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 public static Permission CreatePermission(global::System.Int32 id)
 {
     Permission permission = new Permission();
     permission.Id = id;
     return permission;
 }
 /// <summary>
 /// Asynchronously invokes the 'DeattachPermission' method of the DomainService.
 /// </summary>
 /// <param name="permission">The value for the 'permission' parameter of this action.</param>
 /// <param name="userName">The value for the 'userName' parameter of this action.</param>
 /// <returns>An operation instance that can be used to manage the asynchronous request.</returns>
 public InvokeOperation DeattachPermission(Permission permission, string userName)
 {
     Dictionary<string, object> parameters = new Dictionary<string, object>();
     parameters.Add("permission", permission);
     parameters.Add("userName", userName);
     this.ValidateMethod("DeattachPermission", parameters);
     return this.InvokeOperation("DeattachPermission", typeof(void), parameters, true, null, null);
 }
 /// <summary>
 /// Asynchronously invokes the 'AttachPermission' method of the DomainService.
 /// </summary>
 /// <param name="permission">The value for the 'permission' parameter of this action.</param>
 /// <param name="userName">The value for the 'userName' parameter of this action.</param>
 /// <param name="callback">Callback to invoke when the operation completes.</param>
 /// <param name="userState">Value to pass to the callback.  It can be <c>null</c>.</param>
 /// <returns>An operation instance that can be used to manage the asynchronous request.</returns>
 public InvokeOperation AttachPermission(Permission permission, string userName, Action<InvokeOperation> callback, object userState)
 {
     Dictionary<string, object> parameters = new Dictionary<string, object>();
     parameters.Add("permission", permission);
     parameters.Add("userName", userName);
     this.ValidateMethod("AttachPermission", parameters);
     return this.InvokeOperation("AttachPermission", typeof(void), parameters, true, callback, userState);
 }
 private bool FilterPermission(Permission entity)
 {
     return (entity.Id == this.PermissionId);
 }
Beispiel #10
0
 /// <summary>
 /// Transforms the po to entity.
 /// </summary>
 /// <param name="permission">The permission.</param>
 /// <returns></returns>
 public Permission TransformPoToEntity(Permission permission)
 {
     permission.Id = Id;
     permission.Name = Name;
     permission.Description = Description;
     permission.Enabled = Enabled;
     return permission;
 }