Ejemplo n.º 1
0
        public void TransformPoToEntity(ref ElementPermission elementPermission, int permissionId)
        {
            elementPermission.Value = this.Value;
            elementPermission.PermissionId = permissionId;
            elementPermission.PropertyId = this.GraphicProperty.Id;
            elementPermission.ElementId = this.Element.Id;

        }
 public void InsertElementPermission(ElementPermission elementPermission)
 {
     if ((elementPermission.EntityState != EntityState.Added))
     {
         if ((elementPermission.EntityState != EntityState.Detached))
         {
             this.ObjectContext.ObjectStateManager.
                 ChangeObjectState(elementPermission, EntityState.Added);
         }
         else
         {
             this.ObjectContext.AddToElementPermission(elementPermission);
         }
         this.ObjectContext.SaveChanges();
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the ElementPermission EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToElementPermission(ElementPermission elementPermission)
 {
     base.AddObject("ElementPermission", elementPermission);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Create a new ElementPermission object.
 /// </summary>
 /// <param name="permissionId">Initial value of the PermissionId property.</param>
 /// <param name="elementId">Initial value of the ElementId property.</param>
 /// <param name="propertyId">Initial value of the PropertyId property.</param>
 public static ElementPermission CreateElementPermission(global::System.Int32 permissionId, global::System.Int64 elementId, global::System.Int32 propertyId)
 {
     ElementPermission elementPermission = new ElementPermission();
     elementPermission.PermissionId = permissionId;
     elementPermission.ElementId = elementId;
     elementPermission.PropertyId = propertyId;
     return elementPermission;
 }
 /// <summary>
 /// Called when [add] is pressed.
 /// </summary>
 public void OnAdd()
 {
     ElementPermission elementPermission=new ElementPermission();
     elementPermission.ElementId = SelectedElement.Id;
     elementPermission.PropertyId = SelectedProperty;
     elementPermission.Value = Value;
     elementPermission.PermissionId = PermissionId;
     _permissionsDomainContext.InsertElementPermission(elementPermission);
     TryClose();
 }
 public void DeleteElementPermission(ElementPermission elementPermission)
 {
     if ((elementPermission.EntityState == EntityState.Detached))
     {
         this.ObjectContext.ElementPermission.Attach(elementPermission);
     }
     this.ObjectContext.DeleteObject(elementPermission);
     this.ObjectContext.SaveChanges();
 }
        public void UpdateElementPermission(ElementPermission elementPermission)
        {
            ElementPermission permission = this.ChangeSet.GetOriginal(elementPermission);
            if (permission != null)
            {
                this.ObjectContext.CreateObjectSet<ElementPermission>().AttachAsModified(elementPermission, permission);
            }
            else
            {
                this.ObjectContext.ElementPermission.Attach(elementPermission);
            }

            this.ObjectContext.SaveChanges();
        }
 private void DetachElementPermission(ElementPermission entity)
 {
     entity.Element = null;
 }
 private bool FilterElementPermission(ElementPermission entity)
 {
     return (entity.ElementId == this.Id);
 }
 private void AttachElementPermission(ElementPermission entity)
 {
     entity.Element = this;
 }
 /// <summary>
 /// Asynchronously invokes the 'InsertElementPermission' method of the DomainService.
 /// </summary>
 /// <param name="elementPermission">The value for the 'elementPermission' parameter of this action.</param>
 /// <returns>An operation instance that can be used to manage the asynchronous request.</returns>
 public InvokeOperation InsertElementPermission(ElementPermission elementPermission)
 {
     Dictionary<string, object> parameters = new Dictionary<string, object>();
     parameters.Add("elementPermission", elementPermission);
     this.ValidateMethod("InsertElementPermission", parameters);
     return this.InvokeOperation("InsertElementPermission", typeof(void), parameters, true, null, null);
 }
 /// <summary>
 /// Asynchronously invokes the 'InsertElementPermission' method of the DomainService.
 /// </summary>
 /// <param name="elementPermission">The value for the 'elementPermission' 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 InsertElementPermission(ElementPermission elementPermission, Action<InvokeOperation> callback, object userState)
 {
     Dictionary<string, object> parameters = new Dictionary<string, object>();
     parameters.Add("elementPermission", elementPermission);
     this.ValidateMethod("InsertElementPermission", parameters);
     return this.InvokeOperation("InsertElementPermission", typeof(void), parameters, true, callback, userState);
 }
 private void DetachElementPermission(ElementPermission entity)
 {
     entity.GraphicProperty = null;
 }
 private void AttachElementPermission(ElementPermission entity)
 {
     entity.GraphicProperty = this;
 }