示例#1
0
        public void CountTest()
        {
            IDaoFactory daoFactory = new DaoFactory("projects", 0);

            Task task = daoFactory.GetTaskDao().GetById(1337);
            Console.WriteLine(daoFactory.GetCommentDao().Count(task));
        }
示例#2
0
        public void BuildUsersWorkReport1()
        {
            var daoFactory = new DaoFactory("projects", 0);
            var result = daoFactory.GetReportDao().BuildUsersWorkReport(new ReportFilter());
            Console.WriteLine(result.Count);

        }
示例#3
0
        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 });
        }
示例#4
0
        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);
            
        }
示例#6
0
        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));
        }
示例#7
0
        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);
        }
示例#8
0
        /// <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);


        }
示例#9
0
        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);

        }
示例#10
0
        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);

        }
示例#11
0
        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);
        }
示例#12
0
        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);
        }
示例#14
0
        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);
        }
示例#15
0
        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);
        }
示例#17
0
        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);

        }
示例#18
0
        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);
        }
示例#19
0
        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));
        }
示例#20
0
        public void LoadProject()
        {
            IDaoFactory daoFactory = new DaoFactory("projects", 0);

            Console.WriteLine(daoFactory.GetProjectDao().GetTeam(15).Length);


        }
示例#21
0
        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);
                    }
                }
            }
        }
示例#22
0
 public void HasTime()
 {
     IDaoFactory daoFactory = new DaoFactory("projects", 0);
 }
示例#23
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);
                    }
                }
            }
        }
示例#24
0
 public void BuildMilestoneListReport()
 {
     var daoFactory = new DaoFactory("projects", 0);
     var result = daoFactory.GetReportDao().BuildMilestonesReport(new ReportFilter());
     Console.WriteLine(result.Count);
 }