コード例 #1
0
        private void InternalLoadDiaryItems(ModuleCommunityDiary module, Int32 idCommunity, Int32 idModule, String unknownUser)
        {
            lm.Comol.Core.FileRepository.Domain.RepositoryIdentifier identifier       = lm.Comol.Core.FileRepository.Domain.RepositoryIdentifier.Create((idCommunity > 0 ? lm.Comol.Core.FileRepository.Domain.RepositoryType.Community :  lm.Comol.Core.FileRepository.Domain.RepositoryType.Portal), idCommunity);
            lm.Comol.Core.FileRepository.Domain.ModuleRepository     moduleRepository = ServiceRepository.GetPermissions(identifier, UserContext.CurrentUserID);
            List <lm.Comol.Core.DomainModel.Repository.RepositoryAttachmentUploadActions> availableActions = Service.GetAvailableUploadActions(module, moduleRepository);

            lm.Comol.Core.DomainModel.Repository.RepositoryAttachmentUploadActions dAction = (availableActions == null || !availableActions.Any()) ? lm.Comol.Core.DomainModel.Repository.RepositoryAttachmentUploadActions.none : availableActions.FirstOrDefault();
            View.RepositoryIdentifier = identifier;
            View.InitializeAttachmentsControl(availableActions, dAction);
            List <dtoDiaryItem> items = Service.GetDtoDiaryItems(idCommunity, View.DisplayOrderAscending, module, moduleRepository, (module.Administration || module.Edit), availableActions, dAction, unknownUser);


            View.AllowAddItem     = module.Administration || module.AddItem;
            View.AllowPrint       = module.PrintList;
            View.AllowDeleteDiary = module.Administration;
            if (module.Administration || module.AddItem)
            {
                View.SetAddItemUrl(idCommunity);
            }
            int ItemsCountForDelete = (from item in items where item.Permission.AllowDelete select item.Id).Count();

            View.AllowItemsSelection = ((module.Administration || module.Edit || module.DeleteItem) && ItemsCountForDelete > 0);
            View.AllowMultipleDelete = ((module.Administration || module.Edit || module.DeleteItem) && ItemsCountForDelete > 0);
            View.LoadItems(items, idCommunity, idModule);
        }
コード例 #2
0
        public void InitView(long idEvent, long idEventItem, Int32 lessonNumber, lm.Comol.Core.DomainModel.Repository.RepositoryAttachmentUploadActions action, lm.Comol.Core.FileRepository.Domain.RepositoryIdentifier identifier, lm.Comol.Core.FileRepository.Domain.ModuleRepository rPermissions = null)
        {
            if (!UserContext.isAnonymous)
            {
                View.CurrentAction    = action;
                View.IdEvent          = idEvent;
                View.IdEventItem      = idEventItem;
                View.IdEventCommunity = identifier.IdCommunity;
                View.LessonNumber     = lessonNumber;
                if (View.DisplayInfo)
                {
                    DisplayEventItemInfo(idEventItem, lessonNumber);
                }
                switch (action)
                {
                case Core.DomainModel.Repository.RepositoryAttachmentUploadActions.addurltomoduleitem:

                    View.InitializeUploaderControl(action, identifier);
                    break;

                case Core.DomainModel.Repository.RepositoryAttachmentUploadActions.uploadtomoduleitem:
                    View.InitializeUploaderControl(action, identifier);
                    break;

                case Core.DomainModel.Repository.RepositoryAttachmentUploadActions.linkfromcommunity:
                    if (rPermissions == null)
                    {
                        rPermissions = ServiceRepository.GetPermissions(identifier, UserContext.CurrentUserID);
                    }
                    if (rPermissions != null && identifier.IdCommunity > 0)
                    {
                        View.InitializeLinkRepositoryItems(UserContext.CurrentUserID, rPermissions, identifier, Service.AttachmentsGetBaseLinkedFiles(idEventItem));
                    }
                    break;

                case Core.DomainModel.Repository.RepositoryAttachmentUploadActions.uploadtomoduleitemandcommunity:
                    if (rPermissions == null)
                    {
                        rPermissions = ServiceRepository.GetPermissions(identifier, UserContext.CurrentUserID);
                    }
                    if (rPermissions != null && identifier.IdCommunity > 0)
                    {
                        View.InitializeCommunityUploader(identifier);
                    }
                    break;

                case Core.DomainModel.Repository.RepositoryAttachmentUploadActions.addurltomoduleitemandcommunity:
                    break;
                }
            }
            else
            {
                View.CurrentAction = Core.DomainModel.Repository.RepositoryAttachmentUploadActions.none;
            }
        }
コード例 #3
0
        private void ReloadAttachments(litePerson person, CommunityEventItem item, ModuleCommunityDiary module, lm.Comol.Core.FileRepository.Domain.RepositoryIdentifier identifier, String unknownUser)
        {
            long idEvent = (item.EventOwner != null ? item.EventOwner.Id : 0);

            lm.Comol.Core.FileRepository.Domain.ModuleRepository moduleRepository = ServiceRepository.GetPermissions(identifier, UserContext.CurrentUserID);
            List <lm.Comol.Core.DomainModel.Repository.RepositoryAttachmentUploadActions> availableActions = Service.GetAvailableUploadActions(module, moduleRepository);

            lm.Comol.Core.DomainModel.Repository.RepositoryAttachmentUploadActions dAction = (availableActions == null || !availableActions.Any()) ? lm.Comol.Core.DomainModel.Repository.RepositoryAttachmentUploadActions.none : availableActions.FirstOrDefault();
            View.InitializeAttachmentsControl(idEvent, item.Id, availableActions, dAction);

            View.LoadAttachments(Service.AttachmentsGet(person, item, true, Service.GetItemPermission(person, item, module, moduleRepository), moduleRepository, unknownUser));
        }
コード例 #4
0
        public void InitView(long idMessage, lm.Comol.Core.DomainModel.Repository.RepositoryAttachmentUploadActions action, lm.Comol.Core.FileRepository.Domain.RepositoryIdentifier identifier, lm.Comol.Core.FileRepository.Domain.ModuleRepository rPermissions = null, Int32 idUploader = -1)
        {
            if (!UserContext.isAnonymous || (action == lm.Comol.Core.DomainModel.Repository.RepositoryAttachmentUploadActions.uploadtomoduleitem && View.AllowAnonymousUpload))
            {
                View.CurrentAction     = action;
                View.IdMessage         = idMessage;
                View.IdTicketCommunity = identifier.IdCommunity;
                switch (action)
                {
                case Core.DomainModel.Repository.RepositoryAttachmentUploadActions.uploadtomoduleitem:
                    View.InitializeUploaderControl(action, identifier, idUploader);
                    break;

                case Core.DomainModel.Repository.RepositoryAttachmentUploadActions.linkfromcommunity:
                    if (rPermissions == null)
                    {
                        rPermissions = ServiceRepository.GetPermissions(identifier, UserContext.CurrentUserID);
                    }
                    if (rPermissions != null && identifier.IdCommunity > 0)
                    {
                        View.InitializeLinkRepositoryItems(UserContext.CurrentUserID, rPermissions, identifier, Service.AttachmentsGetBaseLinkedFiles(idMessage));
                    }
                    break;

                case Core.DomainModel.Repository.RepositoryAttachmentUploadActions.uploadtomoduleitemandcommunity:
                    if (rPermissions == null)
                    {
                        rPermissions = ServiceRepository.GetPermissions(identifier, UserContext.CurrentUserID);
                    }
                    if (rPermissions != null && identifier.IdCommunity > 0)
                    {
                        View.InitializeCommunityUploader(identifier);
                    }
                    break;

                case Core.DomainModel.Repository.RepositoryAttachmentUploadActions.addurltomoduleitemandcommunity:
                    break;
                }
            }
            else
            {
                View.CurrentAction = Core.DomainModel.Repository.RepositoryAttachmentUploadActions.none;
            }
        }
コード例 #5
0
        public void InitView(long idProject, long idActivity, lm.Comol.Core.DomainModel.Repository.RepositoryAttachmentUploadActions action, lm.Comol.Core.FileRepository.Domain.RepositoryIdentifier identifier, lm.Comol.Core.FileRepository.Domain.ModuleRepository rPermissions = null)
        {
            if (!UserContext.isAnonymous)
            {
                View.CurrentAction      = action;
                View.IdProject          = idProject;
                View.IdActivity         = idActivity;
                View.IdProjectCommunity = identifier.IdCommunity;
                switch (action)
                {
                case Core.DomainModel.Repository.RepositoryAttachmentUploadActions.addurltomoduleitem:

                    View.InitializeUploaderControl(action, identifier);
                    break;

                case Core.DomainModel.Repository.RepositoryAttachmentUploadActions.uploadtomoduleitem:
                    View.InitializeUploaderControl(action, identifier);
                    break;

                case Core.DomainModel.Repository.RepositoryAttachmentUploadActions.linkfromcommunity:
                    if (rPermissions != null && identifier.IdCommunity > 0)
                    {
                        View.InitializeLinkRepositoryItems(UserContext.CurrentUserID, rPermissions, identifier, Service.AttachmentsGetBaseLinkedFiles(idProject, idActivity));
                    }
                    // View.InitializeUploaderControl(idCommunity);
                    break;

                case Core.DomainModel.Repository.RepositoryAttachmentUploadActions.uploadtomoduleitemandcommunity:
                    if (rPermissions != null && identifier.IdCommunity > 0)
                    {
                        View.InitializeCommunityUploader(identifier);
                    }
                    break;

                case Core.DomainModel.Repository.RepositoryAttachmentUploadActions.addurltomoduleitemandcommunity:
                    break;
                }
            }
            else
            {
                View.CurrentAction = Core.DomainModel.Repository.RepositoryAttachmentUploadActions.none;
            }
        }
コード例 #6
0
 public void InitView(long idCall, CallForPaperType type, lm.Comol.Core.DomainModel.Repository.RepositoryAttachmentUploadActions action, lm.Comol.Core.FileRepository.Domain.RepositoryIdentifier identifier, lm.Comol.Core.FileRepository.Domain.ModuleRepository rPermissions = null)
 {
     if (!UserContext.isAnonymous)
     {
         View.CurrentAction   = action;
         View.IdCall          = idCall;
         View.CallType        = type;
         View.IdCallCommunity = identifier.IdCommunity;
         switch (action)
         {
         case Core.DomainModel.Repository.RepositoryAttachmentUploadActions.uploadtomoduleitem:
             View.InitializeUploaderControl(action, identifier);
             break;
         }
     }
     else
     {
         View.CurrentAction = Core.DomainModel.Repository.RepositoryAttachmentUploadActions.none;
     }
 }
コード例 #7
0
        //public bool AddAttachment(Int64 MessageId, bool IsVisible)
        //{
        //    Domain.Message msg = service.MessageGet(MessageId);
        //    if (msg == null || msg.Ticket == null) return false;

        //    List<lm.Comol.Core.BaseModules.Tickets.TicketService.TmpTkAttachment> attachment =
        //        service.AttachmentsAddFiles(msg, View.UploadFiles(MessageId, msg.Ticket.Id));

        //    //files = View.UploadFiles(project);
        //    return false;
        //}


        public void InitView(long idProject, long idActivity, lm.Comol.Core.DomainModel.Repository.RepositoryAttachmentUploadActions action, Int32 idCommunity = -1, CoreModuleRepository rPermissions = null)
        {
            if (!UserContext.isAnonymous)
            {
                //View.CurrentAction = action;
                //View.IdProject = idProject;
                //View.IdActivity = idActivity;
                //View.IdProjectCommunity = idCommunity;
                switch (action)
                {
                case Core.DomainModel.Repository.RepositoryAttachmentUploadActions.addurltomoduleitem:

                    //View.InitializeUploaderControl(action, idCommunity);
                    break;

                //case Core.DomainModel.Repository.RepositoryAttachmentUploadActions.uploadtomoduleitem:
                //    if (idCommunity > 0)
                //        //View.InitializeUploaderControl(action, idCommunity);
                //    break;
                //case Core.DomainModel.Repository.RepositoryAttachmentUploadActions.linkfromcommunity:
                //    if (rPermissions != null && idCommunity > 0)
                //        //View.InitializeLinkRepositoryItems(rPermissions, idCommunity, Service.AttachmentsGetLinkedFiles(idProject, idActivity));
                //    // View.InitializeUploaderControl(idCommunity);
                //    break;
                //case Core.DomainModel.Repository.RepositoryAttachmentUploadActions.uploadtomoduleitemandcommunity:
                //    if (rPermissions != null && idCommunity > 0)
                //        //View.InitializeCommunityUploader(rPermissions, idCommunity);
                //    break;
                case Core.DomainModel.Repository.RepositoryAttachmentUploadActions.addurltomoduleitemandcommunity:
                    break;
                }
            }
            else
            {
            }
            //View.CurrentAction = Core.DomainModel.Repository.RepositoryAttachmentUploadActions.none;
        }
コード例 #8
0
        public void InitView(Int32 idCommunity, long idItem, String unknownUser, Boolean isForAdd = false)
        {
            idCommunity = (idCommunity == 0 ? UserContext.CurrentCommunityID : idCommunity);
            if (!UserContext.isAnonymous)
            {
                litePerson         person = CurrentManager.GetLitePerson(UserContext.CurrentUserID);
                CommunityEventItem item   = (idItem > 0  ? Service.EventItemGet(idItem) :null);
                if (item != null && idCommunity != item.IdCommunityOwner)
                {
                    idCommunity = item.IdCommunityOwner;
                }
                View.IdCommunityDiary       = idCommunity;
                View.IdModuleCommunityDiary = GetIdModule();
                View.IdModuleRepository     = ServiceRepository.GetIdModule();
                liteCommunity community = CurrentManager.GetLiteCommunity(idCommunity);
                if ((community == null && idCommunity > 0) || (!isForAdd && idItem == 0))
                {
                    View.NoPermission(idCommunity, GetIdModule());
                }
                else
                {
                    if (item == null && !isForAdd)
                    {
                        View.ShowNoItemWithThisID(idCommunity, GetIdModule(), idItem);
                    }
                    else
                    {
                        long idEvent = ((item != null && item.EventOwner != null)? item.EventOwner.Id : 0);
                        View.CurrentIdItem  = idItem;
                        View.CurrentIdEvent = idEvent;
                        ModuleCommunityDiary module = Service.GetPermissions(UserContext.CurrentUserID, idCommunity);
                        if ((module.AddItem && isForAdd) || (module.Administration || module.Edit))
                        {
                            String description = "";
                            if (idItem == 0)
                            {
                                item                  = new CommunityEventItem();
                                item.Title            = "";
                                item.Note             = "";
                                item.Owner            = CurrentManager.GetLitePerson(UserContext.CurrentUserID);
                                item.ModifiedOn       = DateTime.Now;
                                item.StartDate        = new DateTime(item.ModifiedOn.Year, item.ModifiedOn.Month, item.ModifiedOn.Day, 8, 0, 0);
                                item.EndDate          = new DateTime(item.ModifiedOn.Year, item.ModifiedOn.Month, item.ModifiedOn.Day, 11, 0, 0);
                                item.IsVisible        = true;
                                item.Link             = "";
                                item.Place            = "";
                                item.Title            = "";
                                item.IdCommunityOwner = idCommunity;
                                item.ShowDateInfo     = true;
                            }
                            else
                            {
                                description = Service.EventItemGetDescription(item);
                            }

                            lm.Comol.Core.FileRepository.Domain.RepositoryIdentifier identifier = lm.Comol.Core.FileRepository.Domain.RepositoryIdentifier.Create((idCommunity > 0 ? lm.Comol.Core.FileRepository.Domain.RepositoryType.Community : lm.Comol.Core.FileRepository.Domain.RepositoryType.Portal), idCommunity);

                            View.RepositoryIdentifier = identifier;
                            String communityName = (community != null ? community.Name : View.GetPortalNameTranslation());
                            List <dtoAttachmentItem> attachments = null;
                            if (idItem > 0)
                            {
                                lm.Comol.Core.FileRepository.Domain.ModuleRepository moduleRepository = ServiceRepository.GetPermissions(identifier, UserContext.CurrentUserID);
                                List <lm.Comol.Core.DomainModel.Repository.RepositoryAttachmentUploadActions> availableActions = Service.GetAvailableUploadActions(module, moduleRepository);
                                lm.Comol.Core.DomainModel.Repository.RepositoryAttachmentUploadActions        dAction          = (availableActions == null || !availableActions.Any()) ? lm.Comol.Core.DomainModel.Repository.RepositoryAttachmentUploadActions.none : availableActions.FirstOrDefault();
                                View.InitializeAttachmentsControl(idEvent, idItem, availableActions, dAction);

                                attachments              = Service.AttachmentsGet(person, item, true, Service.GetItemPermission(person, item, module, moduleRepository), moduleRepository, unknownUser);
                                View.AllowEdit           = true;
                                View.AllowFileManagement = availableActions.Any();
                            }
                            else
                            {
                                View.AllowEdit           = module.Administration || module.AddItem;
                                View.AllowFileManagement = false;
                            }
                            View.LoadItem(item, description, communityName, attachments);
                        }
                        else
                        {
                            View.NoPermission(idCommunity, GetIdModule());
                        }
                    }
                    View.SetBackToDiary(idCommunity, idItem);
                }
            }
            else
            {
                View.DisplaySessionTimeout(idCommunity, idItem);
            }
        }
コード例 #9
0
 public void InitView(long idMessage, lm.Comol.Core.DomainModel.Repository.RepositoryAttachmentUploadActions action, Int32 idCommunity, lm.Comol.Core.FileRepository.Domain.ModuleRepository rPermissions, Int32 idUploader = -1)
 {
     InitView(idMessage, action, lm.Comol.Core.FileRepository.Domain.RepositoryIdentifier.Create((idCommunity <= 0 ? lm.Comol.Core.FileRepository.Domain.RepositoryType.Portal : Core.FileRepository.Domain.RepositoryType.Community), idCommunity), rPermissions, idUploader);
 }