예제 #1
0
        void roleDDL_SelectedIndexChanged(object sender, EventArgs e)
        {
            DropDownList ddl    = (DropDownList)sender;
            String       action = ddl.ID;
            Permit       permit = Manager.Permits.Find(per => per.Action.ToString() == action);

            if (permit != null)
            {
                permit.Role = int.Parse(ddl.SelectedValue);
            }
            DataAccess.Save(Manager);
        }
예제 #2
0
 private void UpdatePermits()
 {
     foreach (Permit permit in Manager.Permits)
     {
         if (!Enum.IsDefined(typeof(Actions), permit.Action))
         {
             Manager.Permits.Remove(permit);
             DataAccess.Save(Manager);
         }
     }
     foreach (Actions newAction in Enum.GetValues(typeof(Actions)))
     {
         if (!Manager.Permits.Exists(permit => permit.Action == newAction))
         {
             Permit permit = new Permit();
             permit.Action = newAction;
             permit.Role   = 0;
             Manager.Permits.Add(permit);
             DataAccess.Save(Manager);
         }
     }
 }