private void btnSaveChanges_Click(object sender, RoutedEventArgs e) { DataTable_Processing dataTable_Processing = new DataTable_Processing(); DataTable dt = (DataTable)dgLoadMappingTable.DataContext; string mappingDataJsonString = dataTable_Processing.DataTableToJSONWithJSONNet(dt); string allInfo = (string)lblColumnName.Content; string folderName = allInfo.Split('|')[0] + datetimeString; string fileName = allInfo.Split('|')[1]; string mappingInfoFolder = ""; string dirPath = mappingInfoFolder != ""? mappingInfoFolder + "//" + folderName:folderName; if (!Directory.Exists(dirPath)) { Directory.CreateDirectory(dirPath); } string filePath = dirPath != ""? dirPath + "//" + fileName : fileName; if (File.Exists(filePath + ".json")) { File.Delete(filePath + ".json"); } using (StreamWriter sw = new StreamWriter((filePath + ".json"))) { sw.Write(mappingDataJsonString); } }
private void btnSaveAllExpressions_Click(object sender, RoutedEventArgs e) { DataTable dt = DictToDT(); DataTable_Processing dataTable_Processing = new DataTable_Processing(); string jsonString = dataTable_Processing.DataTableToJSONWithJSONNet(dt); ChildWindow childWindow = new ChildWindow(); childWindow.saveFile(dataTable.TableName + ChildWindow.datetimeString, "ExpressionsList", "", jsonString); }