コード例 #1
0
        public void ReassignTeam()
        {
            Project.Private = true;
            Project         = ProjectEngine.SaveOrUpdate(Project, false);
            ProjectEngine.SetTeamSecurity(Project, From,
                                          ProjectTeamSecurity.Contacts |
                                          ProjectTeamSecurity.Files |
                                          ProjectTeamSecurity.Messages |
                                          ProjectTeamSecurity.Milestone |
                                          ProjectTeamSecurity.Tasks);

            ProjectsReassign.Reassign(From, To);

            var team = ProjectEngine.GetTeam(Project.ID).Select(r => r.ID).ToList();

            Assert.That(team, Has.No.Member(From));
            Assert.That(team, Has.Member(To));

            var security = ProjectEngine.GetTeamSecurity(Project, To);

            Assert.That(security & ProjectTeamSecurity.Tasks, Is.EqualTo(ProjectTeamSecurity.Tasks));
            Assert.That(security & ProjectTeamSecurity.Contacts, Is.EqualTo(ProjectTeamSecurity.Contacts));
            Assert.That(security & ProjectTeamSecurity.Files, Is.EqualTo(ProjectTeamSecurity.Files));
            Assert.That(security & ProjectTeamSecurity.Messages, Is.EqualTo(ProjectTeamSecurity.Messages));
            Assert.That(security & ProjectTeamSecurity.Milestone, Is.EqualTo(ProjectTeamSecurity.Milestone));
        }
コード例 #2
0
        public void RunJob()
        {
            var logger = log4net.LogManager.GetLogger("ASC.Web");

            try
            {
                Percentage = 0;
                Status     = ProgressStatus.Started;

                CoreContext.TenantManager.SetCurrentTenant(_tenantId);
                SecurityContext.AuthenticateMe(Core.Configuration.Constants.CoreSystem);

                logger.InfoFormat("reassignment of data from {0} to {1}", _fromUserId, _toUserId);

                logger.Info("reassignment of data from documents");

                Percentage = 33;
                _docService.ReassignStorage(_fromUserId, _toUserId);

                logger.Info("reassignment of data from projects");

                Percentage = 66;
                _projectsReassign.Reassign(_fromUserId, _toUserId);

                logger.Info("reassignment of data from crm");

                Percentage = 99;
                using (var scope = DIHelper.Resolve(_tenantId))
                {
                    var crmDaoFactory = scope.Resolve <CrmDaoFactory>();
                    crmDaoFactory.ContactDao.ReassignContactsResponsible(_fromUserId, _toUserId);
                    crmDaoFactory.DealDao.ReassignDealsResponsible(_fromUserId, _toUserId);
                    crmDaoFactory.TaskDao.ReassignTasksResponsible(_fromUserId, _toUserId);
                    crmDaoFactory.CasesDao.ReassignCasesResponsible(_fromUserId, _toUserId);
                }

                SendSuccessNotify();

                Percentage = 100;
                Status     = ProgressStatus.Done;

                if (_deleteProfile)
                {
                    DeleteUserProfile();
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                Status = ProgressStatus.Failed;
                Error  = ex.Message;
                SendErrorNotify(ex.Message);
            }
            finally
            {
                logger.Info("data reassignment is complete");
                IsCompleted = true;
                SecurityContext.AuthenticateMe(_currentUserId);
            }
        }
コード例 #3
0
        public void ReassignProjectManager()
        {
            Project.Responsible = From;
            ProjectEngine.SaveOrUpdate(Project, false);

            ProjectsReassign.Reassign(From, To);

            Project = ProjectEngine.GetByID(Project.ID);
            Assert.That(Project.Responsible, Is.EqualTo(To));
        }
コード例 #4
0
        public void ReassignMilestone()
        {
            var milestone = DataGenerator.GenerateMilestone(Project);

            milestone.Responsible = From;
            milestone             = MilestoneEngine.SaveOrUpdate(milestone);

            ProjectsReassign.Reassign(From, To);

            milestone = MilestoneEngine.GetByID(milestone.ID);
            Assert.That(milestone.Responsible, Is.EqualTo(To));
        }
コード例 #5
0
        public void ReassignTask()
        {
            var task = DataGenerator.GenerateTask(Project);

            task.Responsibles = new List <Guid> {
                From
            };
            task = TaskEngine.SaveOrUpdate(task, new List <int>(), false);

            ProjectsReassign.Reassign(From, To);

            task = TaskEngine.GetByID(task.ID);
            Assert.That(task.Responsibles, Has.No.Member(From));
            Assert.That(task.Responsibles, Has.Member(To));
        }
コード例 #6
0
        public void ReassignSubtasks()
        {
            var task = DataGenerator.GenerateTask(Project);

            task.Responsibles = new List <Guid> {
                Admin
            };
            task = TaskEngine.SaveOrUpdate(task, new List <int>(), false);

            var subtask1 = DataGenerator.GenerateSubtask(task);

            subtask1.Responsible = From;
            subtask1             = SubtaskEngine.SaveOrUpdate(subtask1, task);

            var subtask2 = DataGenerator.GenerateSubtask(task);

            subtask2.Responsible = From;
            subtask2             = SubtaskEngine.SaveOrUpdate(subtask2, task);

            var subtask3 = DataGenerator.GenerateSubtask(task);

            subtask3.Responsible = From;
            subtask3             = SubtaskEngine.SaveOrUpdate(subtask3, task);
            SubtaskEngine.ChangeStatus(task, subtask3, TaskStatus.Closed);

            ProjectsReassign.Reassign(From, To);

            subtask1 = SubtaskEngine.GetById(subtask1.ID);
            Assert.That(subtask1.Responsible, Is.EqualTo(To));

            subtask2 = SubtaskEngine.GetById(subtask2.ID);
            Assert.That(subtask2.Responsible, Is.EqualTo(To));

            subtask3 = SubtaskEngine.GetById(subtask3.ID);
            Assert.That(subtask3.Responsible, Is.EqualTo(From));
        }
コード例 #7
0
        public void RunJob()
        {
            try
            {
                Percentage = 0;
                Status     = ProgressStatus.Started;

                CoreContext.TenantManager.SetCurrentTenant(_tenantId);
                SecurityContext.AuthenticateMe(_currentUserId);

                _crmDaoFactory.GetContactDao().ReassignContactsResponsible(_fromUserId, _toUserId);
                _crmDaoFactory.GetDealDao().ReassignDealsResponsible(_fromUserId, _toUserId);
                _crmDaoFactory.GetTaskDao().ReassignTasksResponsible(_fromUserId, _toUserId);
                _crmDaoFactory.GetCasesDao().ReassignCasesResponsible(_fromUserId, _toUserId);

                _docService.ReassignStorage(_fromUserId, _toUserId);

                _projectsReassign.Reassign(_fromUserId, _toUserId);

                SendNotify();

                Percentage = 100;
                Status     = ProgressStatus.Done;
            }
            catch (Exception ex)
            {
                log4net.LogManager.GetLogger("ASC.Web").Error(ex);
                Percentage = 0;
                Status     = ProgressStatus.Failed;
                Error      = ex.Message;
            }
            finally
            {
                IsCompleted = true;
            }
        }