Esempio n. 1
0
 public ActionResult Save(Bam.Net.DaoRef.Right[] values)
 {
     try
     {
         RightCollection saver = new RightCollection();
         saver.AddRange(values);
         saver.Save();
         return(Json(new { Success = true, Message = "", Dao = "" }));
     }
     catch (Exception ex)
     {
         return(GetErrorResult(ex));
     }
 }
Esempio n. 2
0
 public void MoveAllItems(bool LeftToRight)
 {
     if (LeftToRight)
     {
         rightCollection.Clear();
         foreach (var item in leftCollection)
         {
             RightCollection.Add(item);
         }
         leftCollection.Clear();
     }
     else
     {
         leftCollection.Clear();
         foreach (var item in rightCollection)
         {
             leftCollection.Add(item);
         }
         rightCollection.Clear();
     }
 }
        /// <summary>
        /// Gets the collection of rights of a specified role.
        /// </summary>
        /// <param name="role">The role.</param>
        /// <returns></returns>
        public RightCollection GetRights(Role role)
        {
            RightCollection rights = new RightCollection();

            //Checking whether that specified role is in each and every Role-Right-assignment object of RoleRightAssignments collection.
            //If it is there,find the right of that Role-Right-Assignment object and add that to RightCollection-rights.
            foreach (RoleRightAssignment rra in this.RoleRightAssignments)
            {
                if (rra.Role.Id == role.Id)
                    rights.Add(rra.Right);
            }

            //returns the RightCollection.
            return rights;
        }
Esempio n. 4
0
 /// <summary>
 /// Adds the specified rights,adding Right objects into RightCollection.
 /// </summary>
 /// <param name="rights">The rights.</param>
 public void Add(RightCollection rights)
 {
     foreach (Right right in rights)
         this.Add(right);
 }
 /// <summary>
 /// 给出产生式内容
 /// </summary>
 /// <returns></returns>
 public override string ToString()
 {
     return(string.Format("{0} ::= {1};", Left.ToString(), RightCollection.ToString()));
     //return base.ToString();
 }