コード例 #1
0
        /// <summary>
        /// Creates an entry for the particular location (like Folder\File.aspx) to be configured for access control.
        /// ControllerName refers to the "Folder" name of the location
        /// Action Name refers to the "File" name of the location
        /// </summary>
        /// <param name="ControllerName">Folder Name for the location to be added (* No leading and trailing slashes("/")).</param>
        /// <param name="ActionName">File name of the resource to be added.</param>
        public static void CreateAction(string ControllerName, string ActionName)
        {
            try
               {
               actions toCreate = new actions();
               toCreate.ControllerName = ControllerName;
               toCreate.ActionName = ActionName;

               Parichay.Security.Helper.NHibernateHelper.Save(toCreate);
               }
               catch (Exception ex)
               {
               throw (ex);
               }
        }
コード例 #2
0
        /// <summary>
        /// Deletes a particular location (like Folder\File.aspx) on the basis of ID
        /// </summary>
        /// <param name="Id">Input Action Id for a particular location as configured into the Actions table.</param>
        /// <returns></returns>
        public static int DeleteAction(int Id)
        {
            int result = 0;
               try
               {
               actions act = new actions();
               act.Id = Id;

               Parichay.Security.Helper.NHibernateHelper.DeleteByNamedQuery("roleactions.byActionId", Id, NHibernate.NHibernateUtil.Int32);

               Parichay.Security.Helper.NHibernateHelper.DeleteById(typeof(actions),Id);

               }
               catch (Exception ex)
               {
               throw (ex);
               }
               return (result);
        }