public void CountTest() { IDaoFactory daoFactory = new DaoFactory("projects", 0); Task task = daoFactory.GetTaskDao().GetById(1337); Console.WriteLine(daoFactory.GetCommentDao().Count(task)); }
public void BuildUsersWorkReport1() { var daoFactory = new DaoFactory("projects", 0); var result = daoFactory.GetReportDao().BuildUsersWorkReport(new ReportFilter()); Console.WriteLine(result.Count); }
public void SaveOrUpdateTest() { var daoFactory = new DaoFactory("projects", 0); var eventDao = daoFactory.GetEventDao(); eventDao.Save(new Event { Title = "123", FromDate = DateTime.Now, ToDate = DateTime.Now }); }
public void BuildProjectWithoutOpenTask() { ASC.Core.CoreContext.TenantManager.SetCurrentTenant(0); IDaoFactory daoFactory = new DaoFactory("projects", 0); Console.WriteLine(daoFactory.GetReportDao().BuildProjectWithoutOpenMilestone(new ReportFilter()).Count); }
public void BuildUsersWorkReport() { IDaoFactory daoFactory = new DaoFactory("projects", 0); Project project = daoFactory.GetProjectDao().GetById(5); Console.WriteLine(daoFactory.GetTimeSpendDao().GetByProject(project.ID).Count); }
public void SaveOrUpdateTest() { var daoFactory = new DaoFactory("projects", 0); var task = daoFactory.GetTaskDao().GetById(187); var participant = new Participant(SecurityContext.CurrentAccount.ID); Console.WriteLine(task.UniqID); daoFactory.GetParticipantDao().Read(participant.ID, task.UniqID, DateTime.Now); Console.WriteLine(daoFactory.GetParticipantDao().WhenReaded(participant.ID, task.UniqID)); }
public void SearchTest() { ASC.Core.CoreContext.TenantManager.SetCurrentTenant(0); IDaoFactory daoFactory = new DaoFactory("projects", 0); EngineFactory engineFactory = new Engine.EngineFactory("projects", 0, null); IList searchDao = engineFactory.GetSearchEngine().Search("p", 0); Console.WriteLine(searchDao.Count); }
/// <summary> /// project_id, project_title, project_leader, project_status,milestone_count, task_count, participian_count /// </summary> /// <param name="projectStatus"></param> /// <returns></returns> public void BuildProjectListReport() { ASC.Core.CoreContext.TenantManager.SetCurrentTenant(0); IDaoFactory daoFactory = new DaoFactory("projects", 0); /// IList queryResult = daoFactory.GetProjectDao().BuildProjectListReport(null); // Console.WriteLine(queryResult.Count); }
public void MilestoneDeadline() { ASC.Core.CoreContext.TenantManager.SetCurrentTenant(0); IDaoFactory daoFactory = new DaoFactory("projects", 0); var milestones = daoFactory.GetMilestoneDao().GetByDeadLine(DateTime.Now); Console.WriteLine(milestones.Count); }
public void SaveOrUpdateTest() { IDaoFactory daoFactory = new DaoFactory("projects", 0); Project project = daoFactory.GetProjectDao().GetById(10); Console.WriteLine(daoFactory.GetProjectDao().GetTeam(project.ID).Length); daoFactory.GetProjectDao().AddToTeam(project.ID, new Guid("777fc1c2-b444-4303-9d71-f8766796e4b4")); Console.WriteLine(daoFactory.GetProjectDao().GetTeam(project.ID).Length); }
public void SaveOrUpdateTest() { var daoFactory = new DaoFactory("projects", 0); var messageDao = daoFactory.GetMessageDao(); var message = new Message() { Title = "New Message", Project = daoFactory.GetProjectDao().GetById(1), Content = "Content", }; messageDao.Save(message); }
public void Test() { ASC.Core.CoreContext.TenantManager.SetCurrentTenant(0); IDaoFactory daoFactory = new DaoFactory("projects", 0); var result = daoFactory.GetReportDao().BuildMilestonesReport(new ReportFilter()); Console.WriteLine(result.Count); }
public void SaveOrUpdateTest() { IDaoFactory daoFactory = new DaoFactory("projects", 0); ProjectChangeRequest projectChangeRequest = new ProjectChangeRequest(); projectChangeRequest.ProjectID = 10; projectChangeRequest.RequestType = ProjectRequestType.Create; projectChangeRequest.Status = ProjectStatus.Open; projectChangeRequest.Description = "asdf"; projectChangeRequest.Title = "New Project 123"; projectChangeRequest.Responsible = SecurityContext.CurrentAccount.ID; // projectChangeRequest.CreateBy = new Participant(ASC.Core.SecurityContext.CurrentAccount.ID); daoFactory.GetProjectChangeRequestDao().Save(projectChangeRequest); }
public void SaveOrUpdateTimeSpend() { IDaoFactory daoFactory = new DaoFactory("projects", 0); Project project = daoFactory.GetProjectDao().GetById(5); var timeSpend = new TimeSpend { Date = ASC.Core.Tenants.TenantUtil.DateTimeNow(), Hours = 10, Note = "asdfasdf", Person = SecurityContext.CurrentAccount.ID, Project = project.ID, }; daoFactory.GetTimeSpendDao().Save(timeSpend); }
public void SaveOrUpdate() { IDaoFactory daoFactory = new DaoFactory("projects", 0); Task task = daoFactory.GetTaskDao().GetById(25); Comment comment = new Comment { Content = "ghb", TargetUniqID = typeof(Task).Name + task.ID.ToString(), }; // task.Comments.Add(comment); daoFactory.GetCommentDao().Save(comment); Console.WriteLine(comment.ID); }
public void AcceptProjectChangeRequest() { IDaoFactory daoFactory = new DaoFactory("projects", 0); IProjectDao _projectDao = daoFactory.GetProjectDao(); IProjectChangeRequestDao _projectChangeRequestDao = daoFactory.GetProjectChangeRequestDao(); ProjectChangeRequest projectChangeRequest = daoFactory.GetProjectChangeRequestDao().GetById(48); Project project = projectChangeRequest.RequestType == ProjectRequestType.Edit ? _projectDao.GetById(projectChangeRequest.ProjectID) : new Project(); project.Title = projectChangeRequest.Title; project.Description = projectChangeRequest.Description; project.Responsible = projectChangeRequest.Responsible; project.Status = projectChangeRequest.Status; project = _projectDao.Save(project); daoFactory.GetProjectDao().AddToTeam(project.ID, project.Responsible); _projectChangeRequestDao.Delete(projectChangeRequest.ID); }
public void SaveOrUpdateTest123() { IDaoFactory daoFactory = new DaoFactory("projects", 0); Project newProject = new Project(); newProject.Title = "Test project 2"; newProject.Description = "Description"; newProject.Responsible = SecurityContext.CurrentAccount.ID; daoFactory.GetProjectDao().Save(newProject); daoFactory.GetProjectDao().AddToTeam(newProject.ID, SecurityContext.CurrentAccount.ID); Console.WriteLine(newProject.ID); }
public void GetProjectTags() { IDaoFactory daoFactory = new DaoFactory("projects", 0); Project project = daoFactory.GetProjectDao().GetById(8); var tags = daoFactory.GetTagDao().GetProjectTags(project.ID); Console.WriteLine(tags.Length); }
public void GetTaskCount() { IDaoFactory daoFactory = new DaoFactory("projects", 0); Console.WriteLine(daoFactory.GetProjectDao().GetTaskCount(new List<int>(new[] { 1 }), TaskStatus.Open, TaskStatus.NotAccept, TaskStatus.Closed)); }
public void LoadProject() { IDaoFactory daoFactory = new DaoFactory("projects", 0); Console.WriteLine(daoFactory.GetProjectDao().GetTeam(15).Length); }
private void SendMsgMilestoneDeadline(DateTime scheduleDate) { var date = DateTime.UtcNow.AddDays(2); foreach (var r in new DaoFactory(Global.DB_ID, Tenant.DEFAULT_TENANT).GetMilestoneDao().GetInfoForReminder(date)) { var tenant = CoreContext.TenantManager.GetTenant((int)r[0]); if (tenant == null || tenant.Status != TenantStatus.Active) continue; var localTime = TenantUtil.DateTimeFromUtc(tenant, date); if (localTime.Date == ((DateTime)r[2]).Date) { try { CoreContext.TenantManager.SetCurrentTenant(tenant); var m = new DaoFactory(Global.DB_ID, tenant.TenantId).GetMilestoneDao().GetById((int)r[1]); if (m != null) { var sender = !m.Responsible.Equals(Guid.Empty) ? m.Responsible : m.Project.Responsible; NotifyClient.Instance.SendMilestoneDeadline(sender, m); } } catch (Exception ex) { LogManager.GetLogger("ASC.Projects.Tasks").Error("SendMsgMilestoneDeadline", ex); } } } }
public void HasTime() { IDaoFactory daoFactory = new DaoFactory("projects", 0); }
public static void SendMsgMilestoneDeadline(DateTime scheduleDate) { var date = DateTime.UtcNow.AddDays(2); foreach (var r in new DaoFactory(Global.DbID, Tenant.DEFAULT_TENANT).GetMilestoneDao().GetInfoForReminder(date)) { var tenant = CoreContext.TenantManager.GetTenant((int)r[0]); if (tenant == null || tenant.Status != TenantStatus.Active || TariffState.NotPaid <= CoreContext.PaymentManager.GetTariff(tenant.TenantId).State) { continue; } var localTime = TenantUtil.DateTimeFromUtc(tenant, date); if (localTime.Date == ((DateTime)r[2]).Date) { try { CoreContext.TenantManager.SetCurrentTenant(tenant); SecurityContext.AuthenticateMe(ASC.Core.Configuration.Constants.CoreSystem); var m = new DaoFactory(Global.DbID, tenant.TenantId).GetMilestoneDao().GetById((int)r[1]); if (m != null) { var sender = !m.Responsible.Equals(Guid.Empty) ? m.Responsible : m.Project.Responsible; var user = CoreContext.UserManager.GetUsers(sender); if (!Constants.LostUser.Equals(user) && user.Status == EmployeeStatus.Active) { SecurityContext.AuthenticateMe(user.ID); Thread.CurrentThread.CurrentCulture = user.GetCulture(); Thread.CurrentThread.CurrentUICulture = user.GetCulture(); NotifyClient.Instance.SendMilestoneDeadline(sender, m); } } } catch (Exception ex) { LogManager.GetLogger("ASC.Projects.Tasks").Error("SendMsgMilestoneDeadline, tenant: " + tenant.TenantDomain, ex); } } } }
public void BuildMilestoneListReport() { var daoFactory = new DaoFactory("projects", 0); var result = daoFactory.GetReportDao().BuildMilestonesReport(new ReportFilter()); Console.WriteLine(result.Count); }