コード例 #1
0
        /// <summary>
        /// Inizializzazione pagina
        /// </summary>
        public void InitView()
        {
            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout();
                return;
            }


            long idCall = View.IdCall;
            long idComm = View.IdComm;

            if (idCall > 0 && idComm > 0)
            {
                dto.dtoCommissionEdit dto = CallService.CommissionGet(idComm);

                if (dto == null)
                {
                    View.DisplayNoPermission(UserContext.CurrentCommunityID, CallService.ServiceModuleID());
                    SendAction(ModuleCallForPaper.ActionType.NoPermission, ModuleCallForPaper.ObjectType.AdvCommission, idComm.ToString());
                    return;
                }



                bool _isManager = isManager();

                bool canAccess = _isManager || ((int)dto.Permission > (int)CommissionPermission.None);

                dto.canEdit = (_isManager || dto.HasCommissionPermission(CommissionPermission.Edit));

                if (!(dto.Status == CommissionStatus.Draft || dto.Status == CommissionStatus.ViewSubmission))
                {
                    dto.canEdit = false;
                }

                if (dto != null && dto.Id > 0 && canAccess)
                {
                    View.Init(dto, isManager());
                    if (isManager())
                    {
                        SendAction(ModuleCallForPaper.ActionType.AdvCommissionModify, ModuleCallForPaper.ObjectType.AdvCommission, idComm.ToString());
                    }
                    else
                    {
                        SendAction(ModuleCallForPaper.ActionType.AdvCommissionView, ModuleCallForPaper.ObjectType.AdvCommission, idComm.ToString());
                    }
                }
                else
                {
                    View.DisplayNoPermission(UserContext.CurrentCommunityID, CallService.ServiceModuleID());
                    SendAction(ModuleCallForPaper.ActionType.NoPermission, ModuleCallForPaper.ObjectType.AdvCommission, idComm.ToString());
                }
            }
        }