使用C#的项目中的TimeScaleData

时间:2017-10-06 05:09:04

标签: c# vsto ms-project

当我读资源名称已于2017年4月3日开始并于2017年4月7日结束时,他在工作期间 在2017年4月6日关闭并在2017年4月7日返回。所以,我尝试在3,4,5,7的其他节目实际工作中使用timescaledata它只运行3,4,5并跳过7.So,如何获得所有3,4,5和7的价值

更新

  private void button5_Click(object sender, EventArgs e)
    {
        Microsoft.Office.Interop.MSProject.Application app = new Microsoft.Office.Interop.MSProject.Application();
        app.FileOpenEx(Path, false, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
        PjPoolOpen.pjPoolReadWrite, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
        Microsoft.Office.Interop.MSProject.Project pj = app.ActiveProject;
            foreach (Task taskmbc in pj.Tasks)
            {
                foreach(Resource re in taskmbc.Resources)
                {
                    DateTime date = taskmbc.Start;
                    string def = date.ToString("MM/dd/yyyy");
                    foreach (Assignment assign in taskmbc.Assignments)
                    {

                        var tsvs = assign.TimeScaleData(dateTimePicker1.Value, dateTimePicker2.Value, MSProject.PjAssignmentTimescaledData.pjAssignmentTimescaledWork, MSProject.PjTimescaleUnit.pjTimescaleDays);
                      foreach (TimeScaleValue tsv in tsvs)
                            { 
                          try
                        {


                                MessageBox.Show(assign.TaskName + "Start" + tsv.StartDate + (tsv.Value) / 60 + assign.ResourceName + tsv.EndDate);
                            }

                        catch { }
                          }
                        }
                    }
            }
            }

0 个答案:

没有答案