public void Convert() { var reader = new MPPReader(); var project = reader.read(_mpp); var writer = new MSPDIWriter(); writer.write(project, _xml); }
public void LeerProject(string ruta) { ProjectReader reader = new MPPReader(); ProjectFile projectObj = reader.read(ruta); foreach (Task task in projectObj.Tasks) { } }
public void Convert() { var reader = new MPPReader(); ProjectFile project = reader.read(_mpp); project.ProjectProperties.MpxCodePage = CodePage.RU; var writer = new MPXWriter(); writer.write(project, new FileOutputStream(_mpx)); }
private async void Button_Click(object sender, RoutedEventArgs e) { string instanceUrl = "https://greenwayhealth.my.salesforce.com/"; string accessToken = ""; string apiVersion = "v37.0"; string folderPath = ""; ForceClient client = new ForceClient(instanceUrl, accessToken, apiVersion); // Empty TextBlock statusBlock.Text = ""; using (var dialog = new System.Windows.Forms.FolderBrowserDialog()) { dialog.SelectedPath = Properties.Settings.Default.MPPFolderPath; System.Windows.Forms.DialogResult result = dialog.ShowDialog(); folderPath = dialog.SelectedPath; Properties.Settings.Default.MPPFolderPath = dialog.SelectedPath; Properties.Settings.Default.Save(); } DirectoryInfo objDirectoryInfo = new DirectoryInfo(folderPath); FileInfo[] mppFiles = objDirectoryInfo.GetFiles("*.mpp", SearchOption.TopDirectoryOnly); if (mppFiles.Length == 0) { System.Windows.MessageBox.Show("There are no MPP files"); } else { // Read mpp files foreach (var file in mppFiles) { ProjectReader reader = new MPPReader(); ProjectFile projectObj = reader.read($"{file.FullName}"); var projectName = file.Name.Replace(".mpp", ""); // Get Tasks from MPP file foreach (net.sf.mpxj.Task task in ToEnumerable(projectObj.getAllTasks())) { // Filter tasks to be updated if (task.getID().toString() == "222") { var projects = await client.QueryAsync <Project>( $"SELECT Id, Name, EHR_Actual_Go_Live_Date__c FROM pse__Proj__c where Name like 'Baton Rouge Primary Care Collaborative%' limit 1"); foreach (var project in projects.Records) { DateTime startDate = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddMilliseconds( task.getStart().getTime()).ToLocalTime(); DateTime endDate = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddMilliseconds( task.getFinish().getTime()).ToLocalTime(); string startDataVal = startDate.ToString("yyyy-MM-ddTHH:mm:ss+0000"); string endDataVal = startDate.ToString("yyyy-MM-ddTHH:mm:ss+0000"); var updateProject = new Project() { name = project.name, EHR_Actual_Go_Live_Date__c = startDataVal, Practice_Management_Actual_Go_Live_Date__c = startDataVal }; var success = await client.UpdateAsync("pse__Proj__c", project.Id, updateProject); var responseMessage = "is successfully updated!"; if (success.Success == true) { responseMessage = "is not updated"; } statusBlock.Text = statusBlock.Text + $"Project: {project.name} # " + $"Task: {task.getID().toString()} {responseMessage} \n"; //Resource r = projectObj.getResourceByUniqueID(task.getUniqueID()); //if (r != null) //{ // Console.WriteLine($"{r.getName()}"); //} } } } } } }