示例#1
0
文件: Form1.cs 项目: csai38/ProjectTm
        private void getMilstonesEppm_Click(object sender, EventArgs e)
        {
            if (selProjects.Count == 0)
            {
                MessageBox.Show("Выберите проекты");
                return;
            }
            using (WBSService wbsService = new WBSService())
            {
                using (ActivityService taskService = new ActivityService())
                {
                    wbsService.Url              = String.Format("{0}/p6ws/services/WBSService", Properties.Settings.Default.EppmWsUrl);
                    wbsService.CookieContainer  = eppmConnection.sessionCookie;
                    taskService.Url             = String.Format("{0}/p6ws/services/ActivityService", Properties.Settings.Default.EppmWsUrl);
                    taskService.CookieContainer = eppmConnection.sessionCookie;
                    ReadAllActivitiesByWBS readTasks = new ReadAllActivitiesByWBS();
                    //readTasks.Filter = String.Format("Type IN ('{0}','{1}')", "Start Milestone", "Finish Milestone");

                    readTasks.Field = new ActivityFieldType[7] {
                        ActivityFieldType.ProjectObjectId, ActivityFieldType.Id, ActivityFieldType.Type, ActivityFieldType.StartDate, ActivityFieldType.FinishDate, ActivityFieldType.WBSName, ActivityFieldType.Name
                    };
                    Activity[] tasks = null;
                    foreach (int wbsId in selProjects)
                    {
                        readTasks.WBSObjectId = wbsId;
                        tasks = taskService.ReadAllActivitiesByWBS(readTasks);
                        Debug.Write(tasks.Length);
                        if (tasks.Length > 0)
                        {
                            foreach (Activity t in tasks)
                            {
                                string   tType = (t.Type == ActivityType.FinishMilestone) ? "E" : "S";
                                DateTime aDate = (t.Type == ActivityType.FinishMilestone) ? t.FinishDate : t.StartDate;
                                //ptmDs.pcm_milstones.Addpcm_milstonesRow(t.ProjectObjectId, t.Id, tType, String.Format("{0} :: {1}", t.WBSName, t.Name), aDate, aDate, 0);
                            }
                        }
                    }
                }
            }
        }
示例#2
0
        private void syncOperationBySttings()
        {
            if (selProjects.Count == 0)
            {
                MessageBox.Show("Выберите проекты");
                return;
            }
            if (wbsIsSync.Checked)
            {
                using (WBSService wbsService = new WBSService())
                {
                    using (PpDsTableAdapters.projwbsTableAdapter wbsTab = new PpDsTableAdapters.projwbsTableAdapter())
                    {
                        wbsService.Url             = String.Format("{0}/p6ws/services/WBSService", Properties.Settings.Default.EppmWsUrl);
                        wbsService.CookieContainer = eppm.sessionCookie;
                        ReadAllWBS readAllWBS = new ReadAllWBS();
                        readAllWBS.Field = new WBSFieldType[5] {
                            WBSFieldType.ObjectId, WBSFieldType.ParentObjectId, WBSFieldType.ProjectObjectId, WBSFieldType.Name, WBSFieldType.GUID
                        };
                        WBS[] wbses = null;
                        foreach (int wbsId in selProjects)
                        {
                            readAllWBS.ObjectId = wbsId;
                            wbses = wbsService.ReadAllWBS(readAllWBS);
                            foreach (WBS w in wbses)
                            {
                                if (wbsTab.CheckByGUID(w.GUID) == 0)
                                {
                                    wbsTab.Insert(w.ObjectId, w.ParentObjectId, w.ProjectObjectId, w.Name, w.GUID);
                                }
                            }
                        }
                    }
                }
            }
            if (taskIsSync.Checked)
            {
                using (ActivityService taskService = new ActivityService())
                {
                    taskService.Url             = String.Format("{0}/p6ws/services/ActivityService", Properties.Settings.Default.EppmWsUrl);
                    taskService.CookieContainer = eppm.sessionCookie;
                    ReadAllActivitiesByWBS readTasks = new ReadAllActivitiesByWBS();
                    //readTasks.Filter = String.Format("Type IN ('{0}','{1}')", "Start Milestone", "Finish Milestone");

                    readTasks.Field = new ActivityFieldType[7] {
                        ActivityFieldType.WBSObjectId, ActivityFieldType.Id, ActivityFieldType.Type, ActivityFieldType.StartDate, ActivityFieldType.FinishDate, ActivityFieldType.WBSName, ActivityFieldType.Name
                    };
                    Activity[] tasks = null;
                    foreach (int wbsId in selProjects)
                    {
                        readTasks.WBSObjectId = wbsId;
                        tasks = taskService.ReadAllActivitiesByWBS(readTasks);
                        Debug.Write(tasks.Length);
                        if (tasks.Length > 0)
                        {
                            foreach (Activity t in tasks)
                            {
                                string   tType = (t.Type == ActivityType.FinishMilestone) ? "E" : "S";
                                DateTime aDate = (t.Type == ActivityType.FinishMilestone) ? t.FinishDate : t.StartDate;
                                //ptmDs.pcm_milstones.Addpcm_milstonesRow(t.ProjectObjectId, t.Id, tType, String.Format("{0} :: {1}", t.WBSName, t.Name), aDate, aDate, 0);
                            }
                        }
                    }
                }

                using (RelationshipService relService = new RelationshipService())
                {
                }
            }
        }