示例#1
0
 /// <summary>
 /// Transforms to entity.
 /// </summary>
 /// <param name="group">The group.</param>
 /// <returns></returns>
 public Group TransformToEntity(Group group)
 {
     group.Id = Id;
     group.Name = Name;
     group.Description = Description;
     group.Enabled = Enabled;
     return group;
 }
        //public IQueryable<Model.MapGroupPermission> GetAllMapPermissions()
        //{
        //    return ObjectContext.;
        //}

        public void InsertGroup(GroupDto group)
        {
            Group groupEntity=new Group();
            groupEntity.Name = group.Name;
            groupEntity.Description = group.Description;
            groupEntity.Enabled = group.Enabled;
            this.ObjectContext.AddToGroup(groupEntity);
            //if ((group.EntityState != EntityState.Added))
            //{
            //    if ((group.EntityState != EntityState.Detached))
            //    {
            //        this.ObjectContext.ObjectStateManager.
            //            ChangeObjectState(group, EntityState.Added);
            //    }
            //    else
            //    {
            //        this.ObjectContext.AddToGroup(group);
            //    }
            //}
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the Group EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToGroup(Group group)
 {
     base.AddObject("Group", group);
 }
 /// <summary>
 /// Create a new Group object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 public static Group CreateGroup(global::System.Int16 id, global::System.String name)
 {
     Group group = new Group();
     group.Id = id;
     group.Name = name;
     return group;
 }
示例#5
0
        /// <summary>
        /// Loads the po.
        /// </summary>
        /// <param name="group">The group.</param>
        public void LoadPo(Group group)
        {
            this.Id = group.Id;
            this.Name = group.Name;
            this.Description = group.Description;
            this.Enabled = group.Enabled;
            foreach (Permission ep in group.Permissions)
            {
                var permission = new PermissionPo();
                permission.Name = ep.Name;
                permission.Id = ep.Id;
                Permissions.Add(permission);

            }
            Permissions.ClearChanges();
        }
 /// <summary>
 /// Asynchronously invokes the 'AttachGroupGroup' method of the DomainService.
 /// </summary>
 /// <param name="group">The value for the 'group' 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 AttachGroupGroup(Group group, string userName, Action<InvokeOperation> callback, object userState)
 {
     Dictionary<string, object> parameters = new Dictionary<string, object>();
     parameters.Add("group", group);
     parameters.Add("userName", userName);
     this.ValidateMethod("AttachGroupGroup", parameters);
     return this.InvokeOperation("AttachGroupGroup", typeof(void), parameters, true, callback, userState);
 }
 /// <summary>
 /// Asynchronously invokes the 'DeattachGroup' method of the DomainService.
 /// </summary>
 /// <param name="group">The value for the 'group' 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 DeattachGroup(Group group, string userName)
 {
     Dictionary<string, object> parameters = new Dictionary<string, object>();
     parameters.Add("group", group);
     parameters.Add("userName", userName);
     this.ValidateMethod("DeattachGroup", parameters);
     return this.InvokeOperation("DeattachGroup", typeof(void), parameters, true, null, null);
 }
 private bool FilterGroups(Group entity)
 {
     return (entity.Id == this.Id);
 }
 private bool FilterParrent(Group entity)
 {
     return (entity.Id == this.ParrentGroup);
 }
 private bool FilterChilds(Group entity)
 {
     return (entity.ParrentGroup == this.Id);
 }
 private void DetachChilds(Group entity)
 {
     entity.Parrent = null;
 }
 private void AttachChilds(Group entity)
 {
     entity.Parrent = this;
 }