Esempio n. 1
0
        public void CountTest()
        {
            IDaoFactory daoFactory = new DaoFactory("projects", 0);

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

        }
Esempio n. 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 });
        }
Esempio n. 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);

        }
Esempio n. 5
0
        public void BuildUsersWorkReport()
        {
            IDaoFactory daoFactory = new DaoFactory("projects", 0);
            
            Project project = daoFactory.GetProjectDao().GetById(5);

            Console.WriteLine(daoFactory.GetTimeSpendDao().GetByProject(project.ID).Count);
            
        }
Esempio n. 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));
        }
Esempio n. 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);
        }
Esempio n. 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);


        }
Esempio n. 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);

        }
Esempio n. 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);

        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);

        }
Esempio n. 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);
        }
Esempio n. 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));
        }
Esempio n. 20
0
        public void LoadProject()
        {
            IDaoFactory daoFactory = new DaoFactory("projects", 0);

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


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