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)); }
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); } }
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)); }
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)); }
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)); }
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)); }
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; } }