Exemplo n.º 1
0
 /// <summary>
 /// Check access into method
 /// </summary>
 /// <param name="userID">User identifier</param>
 /// <param name="functionCode">Function code</param>
 /// <returns>RoleDetailModel</returns>
 private RoleDetailModel AllowAccess(Guid userID, string functionCode)
 {
     try
     {
         using (var _context = new TDHEntities())
         {
             var _permision = _context.PROC_SYS_CheckAccess(UserID, functionCode).FirstOrDefault();
             if (_permision != null)
             {
                 return(new RoleDetailModel()
                 {
                     View = _permision.view,
                     Add = _permision.add,
                     Edit = _permision.edit,
                     Delete = _permision.delete
                 });
             }
             return(new RoleDetailModel()
             {
                 View = false,
                 Add = false,
                 Edit = false,
                 Delete = false
             });
         }
     }
     catch (Exception ex)
     {
         Notifier.Notification(userID, Message.Error, Notifier.TYPE.Error);
         Log.WriteLog(FILE_NAME, MethodInfo.GetCurrentMethod().Name, userID, ex);
         throw new ApplicationException();
     }
 }