Exemplo n.º 1
0
        public ActionResult GetUserDefaultZone(int id)
        {
            var tzlvm = CreateViewModel <TimeZoneListViewModel>();

            if (CurrentUser.Get().IsCompanyManager)
            {
                var upg = _userPermissionGroupRepository.FindById(id);
                //added
                tzlvm.IsModelReadOnly = upg.PermissionIsActive;
                //Commented

                /*if (upg.UserId == CurrentUser.Get().Id)
                 * {
                 *  tzlvm.IsModelReadOnly = upg.PermissionIsActive;
                 * }
                 * else
                 * {
                 *  upg = _userPermissionGroupRepository.FindById(upg.ParentUserPermissionGroupId.Value);
                 *  if( upg.UserId == CurrentUser.Get().Id)
                 *  {
                 *      tzlvm.IsModelReadOnly = upg.PermissionIsActive;
                 *  }
                 * }*/
            }

            var zones = new List <UserTimeZone>
            {
                _userTimeZoneRepository.FindById(_userPermissionGroupService.GetUserDefaultTimeZoneId(id))
            };

            Mapper.Map(zones, tzlvm.TimeZones);
            return(PartialView("PermList", tzlvm));
        }
Exemplo n.º 2
0
 public ActionResult GetDefaultZone(int id)
 {
     var tzlvm = CreateViewModel<TimeZoneListViewModel>();
     var upg = _userPermissionGroupRepository.FindById(id);
     if (CurrentUser.Get().IsCompanyManager)
     {
         tzlvm.IsModelReadOnly = upg.PermissionIsActive;
     }
     List<UserTimeZone> zones = new List<UserTimeZone>();
     zones.Add(_userTimeZoneRepository.FindById(_userPermissionGroupService.GetUserDefaultTimeZoneId(id)));
     Mapper.Map(zones, tzlvm.TimeZones);
     return PartialView("List", tzlvm);
 }