private void ParseMppFile() { try { _wbsOutput = new List <ArasHelpers.WbsElement>(); var ahelper = new ArasHelpers(); var tasks = _mpx.AllTasks.ToTaskList(); var wbsRoot = _inn.getNewID(); for (var i = 0; i < tasks.Count; i++) { i = ahelper.ParseTasks(_inn, ref _wbsOutput, tasks, i, wbsRoot); } // parse dependencies. has to be another iteration because dependencies can be forward references foreach (var wbs in _wbsOutput) { var ele = wbs; // looks weird but needed to pass by reference var origID = ele.OrigMppIndex; var origTask = (from ts in tasks where ts.ID.intValue() == origID select ts).FirstOrDefault(); if (origTask != null) { ahelper.ParsePredecessors(_wbsOutput, origTask, ref ele); } } // parse assignments foreach (var wbs in _wbsOutput) { var ele = wbs; // looks weird but needed to pass by reference var origID = ele.OrigMppIndex; var origTask = (from ts in tasks where ts.ID.intValue() == origID select ts).FirstOrDefault(); if (origTask != null) { ahelper.ParseAssignments(_wbsOutput, origTask, ref ele); } } } catch (Exception ex) { MessageBox.Show("MPP Parser error:" + ex.Message, "Failed", MessageBoxButtons.OK); Application.Exit(); } }
private void CreateProject(string wbsRoot, string projectID, ProjectHeader header) { var topWbs = _inn.newItem(); topWbs.setID(wbsRoot); topWbs.setType("WBS Element"); topWbs.setProperty("name", _projectTitle); topWbs.setProperty("is_top", "1"); topWbs.setAction("add"); ArasCommit(topWbs, "Top WBS", null); var iProject = _inn.newItem(); iProject.setID(projectID); if (!_isTemplate) // project { iProject.setType("Project"); _innovProjectNumber = _inn.getNextSequence("Project Number"); iProject.setProperty("date_start_target", ArasHelpers.ConvertDate(_inn, header.StartDate)); iProject.setProperty("date_due_target", ArasHelpers.ConvertDate(_inn, header.FinishDate)); iProject.setProperty("project_number", _innovProjectNumber); iProject.setProperty("scheduling_type", "Forward"); iProject.setProperty("scheduling_method", "7DC85B0668134E949B9212D7CE199265"); iProject.setProperty("update_method", "6E1133AB87A44D529DF5F9D1FD740100"); iProject.setProperty("scheduling_mode", "1"); iProject.setProperty("project_update_mode", "1"); } else // template { iProject.setType("Project Template"); } iProject.setProperty("name", _projectTitle); iProject.setProperty("wbs_id", wbsRoot); iProject.setAction("add"); ArasCommit(iProject, "Top Project", null); }