更新图数据库相关数据
This commit is contained in:
@@ -1,10 +1,19 @@
|
||||
using Newtonsoft.Json;
|
||||
using Neo4j.Driver;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using Ramitta;
|
||||
using Ramitta.lib;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Data.SQLite;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Security.Policy;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
@@ -16,7 +25,11 @@ using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows.Threading;
|
||||
using System.Xml.Linq;
|
||||
|
||||
using static Ramitta.Excel;
|
||||
using static Ramitta.lib.Basic;
|
||||
using static Ramitta.lib.CryptoHelper;
|
||||
using static Ramitta.SQLite;
|
||||
using static Ramitta.winDataGrid;
|
||||
|
||||
namespace template
|
||||
@@ -24,8 +37,6 @@ namespace template
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
static string? filePath;
|
||||
private JToken? _currentJsonData = null;
|
||||
private string? _currentFilePath = null;
|
||||
|
||||
#region 初始化MainWindow
|
||||
public MainWindow(StartupEventArgs e)
|
||||
@@ -42,121 +53,52 @@ namespace template
|
||||
DebugBar(Debugtag, $"未指定操作目标", 警告橙色);
|
||||
}
|
||||
|
||||
xDataGrid.InitColumns(
|
||||
("标题", ColumnType.Label),
|
||||
("判断", ColumnType.CheckBox),
|
||||
("康波", ColumnType.ComboBox)
|
||||
);
|
||||
|
||||
(xDataGrid.AddRow()["标题"] as Label).Content = "1";
|
||||
(xDataGrid.AddRow()["标题"] as Label).Content = "2";
|
||||
(xDataGrid.AddRow()["标题"] as Label).Content = "3";
|
||||
|
||||
|
||||
|
||||
|
||||
// 修改按钮文本
|
||||
// 查找Content为"删除"的第一行
|
||||
|
||||
var targetRow = xDataGrid.Rows
|
||||
.FirstOrDefault(row => (row["标题"] as Label)?.Content.ToString() == "2");
|
||||
|
||||
(targetRow["判断"] as CheckBox).IsChecked= true;
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
private void 增(object sender, RoutedEventArgs e)
|
||||
private async void 增(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// 添加顶层节点
|
||||
TreeList.AddCheckboxNode("A");
|
||||
TreeList.AddCheckboxNode("B");
|
||||
|
||||
// 添加标签节点 "GroupC",并嵌套子节点 "D" 和 "E"
|
||||
var groupC = TreeList.AddLabelNode("GroupC");
|
||||
TreeList.AddCheckboxNode("D", parent: groupC); // GroupC 下的 "D"
|
||||
TreeList.AddCheckboxNode("E", parent: groupC); // GroupC 下的 "E"
|
||||
|
||||
// 添加标签节点 "GroupF",并嵌套子节点 "G" 和 "H"
|
||||
var groupF = TreeList.AddLabelNode("GroupF");
|
||||
TreeList.AddCheckboxNode("G", parent: groupF); // GroupF 下的 "G"
|
||||
var groupH = TreeList.AddCheckboxNode("H", parent: groupF); // GroupF 下的 "H"
|
||||
|
||||
// 在 "H" 下添加节点 "I" 和 "J"
|
||||
TreeList.AddCheckboxNode("I", parent: groupH); // "H" 下的 "I"
|
||||
TreeList.AddCheckboxNode("J", parent: groupH); // "H" 下的 "J"
|
||||
|
||||
// 添加多个类型为 "K" 的节点(分别加入不同层级)
|
||||
TreeList.AddCheckboxNode("K", "1"); // 顶层 "K" 节点
|
||||
TreeList.AddLabelNode("K", parent: groupH); // "H" 下的 "K" 节点
|
||||
TreeList.AddCheckboxNode("K", "3", parent: groupF); // "GroupF" 下的 "K" 节点
|
||||
TreeList.AddCheckboxNode("K", "4", parent: groupC); // "GroupC" 下的 "K" 节点
|
||||
|
||||
// 添加更多重复节点
|
||||
TreeList.AddCheckboxNode("A"); // 顶层重复 "A" 节点
|
||||
TreeList.AddCheckboxNode("B"); // 顶层重复 "B" 节点
|
||||
|
||||
// 再次在 GroupC 下添加重复节点 "D" 和 "E"
|
||||
TreeList.AddCheckboxNode("D", parent: groupC); // GroupC 下重复 "D"
|
||||
TreeList.AddCheckboxNode("E", parent: groupC); // GroupC 下重复 "E"
|
||||
|
||||
// 再次在 GroupF 下添加重复节点 "G"
|
||||
TreeList.AddCheckboxNode("G", parent: groupF); // GroupF 下重复 "G"
|
||||
|
||||
// 在 "H" 下添加重复节点 "I" 和 "J"
|
||||
TreeList.AddCheckboxNode("I", parent: groupH); // "H" 下重复 "I"
|
||||
TreeList.AddCheckboxNode("J", parent: groupH); // "H" 下重复 "J"
|
||||
|
||||
// 为了形成至少5层的嵌套,再加一个新的标签节点 "GroupG",并添加节点
|
||||
var groupG = TreeList.AddLabelNode("GroupG");
|
||||
TreeList.AddCheckboxNode("L", parent: groupG); // GroupG 下的 "L"
|
||||
TreeList.AddCheckboxNode("M", parent: groupG); // GroupG 下的 "M"
|
||||
|
||||
// 继续在 GroupG 下添加节点 "N"
|
||||
TreeList.AddCheckboxNode("N", parent: groupG); // GroupG 下的 "N"
|
||||
|
||||
// 再添加 GroupG 下的 "O" 和 "P"
|
||||
TreeList.AddCheckboxNode("O", parent: groupG); // GroupG 下的 "O"
|
||||
TreeList.AddCheckboxNode("P", parent: groupG); // GroupG 下的 "P"
|
||||
表升天();
|
||||
}
|
||||
|
||||
private void 改(object sender, RoutedEventArgs e)
|
||||
private async void 改(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string outputPath = @"C:\Users\Xeroly\Desktop\sieghail.json";
|
||||
|
||||
// 方法1:使用File.ReadAllText(推荐)
|
||||
string jsonContent = File.ReadAllText(outputPath);
|
||||
TreeList.JsonParse(jsonContent);
|
||||
|
||||
库表升天();
|
||||
}
|
||||
|
||||
private void 删(object sender, RoutedEventArgs e)
|
||||
private async void 删(object? sender = null, RoutedEventArgs? e=null)
|
||||
{
|
||||
xDataGrid.Rows.Clear();
|
||||
}
|
||||
|
||||
private void 查(object sender, RoutedEventArgs e)
|
||||
private async void 查(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string outputPath = @"C:\Users\Xeroly\Desktop\sieghail.json"; // 修改为你想要保存的路径
|
||||
|
||||
// 获取要输出的文本
|
||||
string outputText = TreeList.JsonPrint().ToString();
|
||||
|
||||
// 使用StreamWriter将文本写入文件
|
||||
try
|
||||
var properties = new Dictionary<string, string>
|
||||
{
|
||||
using (StreamWriter writer = new StreamWriter(outputPath, false)) // 'true'表示以追加模式写入文件
|
||||
{ "文件夹", "承重柱" }
|
||||
|
||||
};
|
||||
|
||||
var newmore = await neo4jService.GetRelatedNodesAsync("文件", properties);
|
||||
Debug.WriteLine("=== ☆ ===");
|
||||
|
||||
HashSet<string> 北平 = new HashSet<string>();
|
||||
foreach (var nodeDict in newmore)
|
||||
{
|
||||
if (nodeDict.ContainsKey("型号") && !string.IsNullOrEmpty(nodeDict["型号"]))
|
||||
{
|
||||
writer.WriteLine(outputText); // 写入文本
|
||||
北平.Add(nodeDict["型号"]);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("错误: " + ex.Message); // 如果写入过程中出现异常,弹出错误信息
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// 输出结果
|
||||
Debug.WriteLine($"不重复的型号数量: {北平.Count}");
|
||||
|
||||
foreach (var 型号 in 北平)
|
||||
{
|
||||
Debug.WriteLine($"型号: {型号}");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user