public void InitView(dtoOwnership owner)
        {
            View.IsInitialized = true;
            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                if (owner.IdCommunity == -1 && owner.ModuleObject != null)
                {
                    owner.IdCommunity = owner.ModuleObject.CommunityID;
                }

                owner.IsPortal = owner.IsPortal || (owner.IdCommunity == 0);
                if (owner.IdModule > 0 && String.IsNullOrEmpty(owner.ModuleCode))
                {
                    owner.ModuleCode = CurrentManager.GetModuleCode(owner.IdModule);
                }
                else if (owner.IdModule == 0 && !String.IsNullOrEmpty(owner.ModuleCode))
                {
                    owner.IdModule = CurrentManager.GetModuleID(owner.ModuleCode);
                }
                View.IdCommunityContainer = owner.IdCommunity;
                View.IdModuleContainer    = owner.IdModule;
                View.CodeModuleContainer  = owner.ModuleCode;
                View.ObjContainer         = owner.ModuleObject;
                View.LoadMessages(Service.GetDisplayMessages(owner, UserContext.CurrentUserID));
            }
        }
Beispiel #2
0
        public List <dtoFilteredDisplayMessage> GetObjectMessages(Int32 idUser, ModuleObject obj, Int32 idCommunity = -1, Boolean isPortal = false, Int32 idModule = 0, String moduleCode = "")
        {
            dtoOwnership ownership = new dtoOwnership();

            ownership.ModuleObject = obj;
            if (obj != null && obj.ServiceID > 0 && String.IsNullOrEmpty(obj.ServiceCode))
            {
                ownership.ModuleObject.ServiceCode = Manager.GetModuleCode(obj.ServiceID);
            }
            else if (obj != null && obj.ServiceID < 1 && !String.IsNullOrEmpty(obj.ServiceCode))
            {
                ownership.ModuleObject.ServiceID = Manager.GetModuleID(obj.ServiceCode);
            }
            ownership.IdCommunity = idCommunity;
            ownership.IsPortal    = isPortal || (ownership.IdCommunity == 0);
            ownership.IdModule    = idModule;
            ownership.ModuleCode  = moduleCode;
            //ownership.IdCommunity = idCommunity;
            //if (ownership.IdCommunity == -1 && ownership.ModuleObject != null)
            //    ownership.IdCommunity = ownership.ModuleObject.CommunityID;
            //ownership.IsPortal = isPortal || (ownership.IdCommunity == 0);
            //ownership.ModuleObject = obj;
            //ownership.IdModule = idModule;
            //ownership.ModuleCode = moduleCode;
            //if (ownership.IdModule > 0 && String.IsNullOrEmpty(ownership.ModuleCode))
            //    ownership.ModuleCode = Manager.GetModuleCode(ownership.IdModule);
            //else if (ownership.IdModule == 0 && !String.IsNullOrEmpty(ownership.ModuleCode))
            //    ownership.IdModule = Manager.GetModuleID(ownership.ModuleCode);
            //else if (obj != null && obj.ServiceID > 0 && String.IsNullOrEmpty(obj.ServiceCode))
            //    ownership.ModuleCode = Manager.GetModuleCode(obj.ServiceID);
            //else if (obj != null && ownership.IdModule == 0 && !String.IsNullOrEmpty(obj.ServiceCode))
            //    ownership.IdModule = Manager.GetModuleID(obj.ServiceCode);
            //else if (obj != null) {
            //    ownership.IdModule = obj.ServiceID;
            //    ownership.ModuleCode = obj.ServiceCode;
            //}
            return(GetDisplayMessages(ownership, idUser).Select(m => new dtoFilteredDisplayMessage(m)).ToList());
        }