Exemplo n.º 1
0
 public TaskEngine(IDaoFactory daoFactory, EngineFactory factory)
 {
     _factory      = factory;
     _taskDao      = daoFactory.GetTaskDao();
     _milestoneDao = daoFactory.GetMilestoneDao();
     _fileEngine   = factory.GetFileEngine();
     _subtaskDao   = daoFactory.GetSubtaskDao();
 }
Exemplo n.º 2
0
 public ProjectEntityEngine(INotifyAction notifyAction, EngineFactory factory)
 {
     SubscriptionProvider = NotifySource.Instance.GetSubscriptionProvider();
     RecipientProvider = NotifySource.Instance.GetRecipientsProvider();
     NotifyAction = notifyAction;
     FileEngine = factory != null ? factory.GetFileEngine() : null;
     Factory = factory;
 }
Exemplo n.º 3
0
 public TaskEngine(IDaoFactory daoFactory, EngineFactory factory)
 {
     _factory = factory;
     _taskDao = daoFactory.GetTaskDao();
     _milestoneDao = daoFactory.GetMilestoneDao();
     _fileEngine = factory.GetFileEngine();
     _subtaskDao = daoFactory.GetSubtaskDao();
 }
Exemplo n.º 4
0
        public ProjectEntityEngine(INotifyAction notifyAction, EngineFactory factory)
        {
            SubscriptionProvider = NotifySource.Instance.GetSubscriptionProvider();
            RecipientProvider    = NotifySource.Instance.GetRecipientsProvider();
            NotifyAction         = notifyAction;
            FileEngine           = factory != null?factory.GetFileEngine() : null;

            Factory = factory;
        }
Exemplo n.º 5
0
        public Project GetFullProjectByID(int projectID)
        {
            var project = projectDao.GetById(projectID);

            if (!CanRead(project))
            {
                return(null);
            }

            var filter = new TaskFilter
            {
                ProjectIds = new List <int> {
                    projectID
                },
                MilestoneStatuses = new List <MilestoneStatus> {
                    MilestoneStatus.Open
                },
                TaskStatuses = new List <TaskStatus> {
                    TaskStatus.Open
                }
            };

            project.MilestoneCount  = factory.GetMilestoneEngine().GetByFilterCount(filter);
            project.TaskCount       = factory.GetTaskEngine().GetByFilterCount(filter);
            project.DiscussionCount = factory.GetMessageEngine().GetByFilterCount(filter);

            using (var folderDao = FilesIntegration.GetFolderDao())
            {
                var folderId = factory.GetFileEngine().GetRoot(projectID);
                project.DocumentsCount = folderDao.GetItemsCount(folderId, true);
            }

            var time    = factory.GetTimeTrackingEngine().GetByProject(projectID).Sum(r => r.Hours);
            var hours   = (int)time;
            var minutes = (int)(Math.Round((time - hours) * 60));
            var result  = hours + ":" + minutes.ToString("D2");

            project.TimeTrackingTotal = !result.Equals("0:00", StringComparison.InvariantCulture) ? result : "";
            project.ParticipantCount  = GetTeam(projectID).Count;


            return(project);
        }
Exemplo n.º 6
0
        public Message SaveOrUpdate(Message message, bool notify, IEnumerable <Guid> participant, IEnumerable <int> fileIds, bool isImport)
        {
            if (message == null)
            {
                throw new ArgumentNullException("message");
            }

            var isNew = message.ID == default(int);

            message.LastModifiedBy = SecurityContext.CurrentAccount.ID;
            message.LastModifiedOn = TenantUtil.DateTimeNow();

            if (isNew)
            {
                if (message.CreateBy == default(Guid))
                {
                    message.CreateBy = SecurityContext.CurrentAccount.ID;
                }
                if (message.CreateOn == default(DateTime))
                {
                    message.CreateOn = TenantUtil.DateTimeNow();
                }

                ProjectSecurity.DemandCreateMessage(message.Project);
                _messageDao.Save(message);
                TimeLinePublisher.Message(message, isImport ? EngineResource.ActionText_Imported : EngineResource.ActionText_Create, UserActivityConstants.ContentActionType, UserActivityConstants.NormalContent);
            }
            else
            {
                ProjectSecurity.DemandEdit(message);
                _messageDao.Save(message);
                TimeLinePublisher.Message(message, EngineResource.ActionText_Update, UserActivityConstants.ActivityActionType, UserActivityConstants.NormalActivity, true);
            }

            var fileEngine = _engineFactory.GetFileEngine();

            if (fileIds != null)
            {
                foreach (var fileId in fileIds)
                {
                    fileEngine.AttachFileToMessage(message.ID, fileId);
                }
            }

            NotifyParticipiant(message, isNew, participant, fileEngine.GetMessageFiles(message), notify);

            return(message);
        }
Exemplo n.º 7
0
        public virtual void Delete(int projectId)
        {
            var project = GetByID(projectId);

            if (project == null)
            {
                return;
            }

            ProjectSecurity.DemandEdit(project);

            factory.GetFileEngine().RemoveRoot(projectId);

            projectDao.Delete(projectId);

            NotifyClient.Instance.SendAboutProjectDeleting(new HashSet <Guid> {
                project.Responsible
            }, project);
        }