增加数据库架构对话框

This commit is contained in:
Falcon 2024-07-26 11:47:59 +08:00
parent 3767a98dde
commit 52b72a0c3c
6 changed files with 270 additions and 122 deletions

View File

@ -60,19 +60,22 @@
ToolStripMenuItem = new ToolStripMenuItem();
ToolStripMenuItem = new ToolStripMenuItem();
tabPage1 = new TabPage();
flowLayoutPanel5 = new FlowLayoutPanel();
bt_m_dbshc = new Button();
label5 = new Label();
flowLayoutPanel4 = new FlowLayoutPanel();
bt_m_Backup = new Button();
label1 = new Label();
flowLayoutPanel3 = new FlowLayoutPanel();
bt_m_ys = new Button();
label3 = new Label();
lab_m_dbsize = new Label();
flowLayoutPanel2 = new FlowLayoutPanel();
bt_m_Clean = new Button();
label2 = new Label();
panel2 = new Panel();
panel3 = new Panel();
OpenFileDlg = new OpenFileDialog();
lab_m_dbsize = new Label();
tabControl1.SuspendLayout();
tpWorkManage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)splitContainer1).BeginInit();
@ -91,6 +94,7 @@
toolStrip1.SuspendLayout();
cms_FileList.SuspendLayout();
tabPage1.SuspendLayout();
flowLayoutPanel5.SuspendLayout();
flowLayoutPanel4.SuspendLayout();
flowLayoutPanel3.SuspendLayout();
flowLayoutPanel2.SuspendLayout();
@ -441,6 +445,7 @@
//
// tabPage1
//
tabPage1.Controls.Add(flowLayoutPanel5);
tabPage1.Controls.Add(flowLayoutPanel4);
tabPage1.Controls.Add(flowLayoutPanel3);
tabPage1.Controls.Add(flowLayoutPanel2);
@ -454,6 +459,38 @@
tabPage1.Text = "管理";
tabPage1.UseVisualStyleBackColor = true;
//
// flowLayoutPanel5
//
flowLayoutPanel5.AutoSize = true;
flowLayoutPanel5.Controls.Add(bt_m_dbshc);
flowLayoutPanel5.Controls.Add(label5);
flowLayoutPanel5.Dock = DockStyle.Top;
flowLayoutPanel5.Location = new Point(3,120);
flowLayoutPanel5.Name = "flowLayoutPanel5";
flowLayoutPanel5.Padding = new Padding(5);
flowLayoutPanel5.Size = new Size(705,39);
flowLayoutPanel5.TabIndex = 6;
//
// bt_m_dbshc
//
bt_m_dbshc.Location = new Point(8,8);
bt_m_dbshc.Name = "bt_m_dbshc";
bt_m_dbshc.Size = new Size(75,23);
bt_m_dbshc.TabIndex = 0;
bt_m_dbshc.Text = "架构";
bt_m_dbshc.UseVisualStyleBackColor = true;
bt_m_dbshc.Click += bt_m_dbshc_Click;
//
// label5
//
label5.AutoSize = true;
label5.Font = new Font("微软雅黑",12F,FontStyle.Regular,GraphicsUnit.Point);
label5.Location = new Point(89,5);
label5.Name = "label5";
label5.Size = new Size(122,21);
label5.TabIndex = 1;
label5.Text = "查看数据库架构";
//
// flowLayoutPanel4
//
flowLayoutPanel4.AutoSize = true;
@ -519,6 +556,16 @@
label3.TabIndex = 1;
label3.Text = "压缩数据库文件尺寸,减少文件大小";
//
// lab_m_dbsize
//
lab_m_dbsize.AutoSize = true;
lab_m_dbsize.Font = new Font("微软雅黑",12F,FontStyle.Regular,GraphicsUnit.Point);
lab_m_dbsize.Location = new Point(361,5);
lab_m_dbsize.Name = "lab_m_dbsize";
lab_m_dbsize.Size = new Size(42,21);
lab_m_dbsize.TabIndex = 2;
lab_m_dbsize.Text = "当前";
//
// flowLayoutPanel2
//
flowLayoutPanel2.AutoSize = true;
@ -574,16 +621,6 @@
//
OpenFileDlg.Multiselect = true;
//
// lab_m_dbsize
//
lab_m_dbsize.AutoSize = true;
lab_m_dbsize.Font = new Font("微软雅黑",12F,FontStyle.Regular,GraphicsUnit.Point);
lab_m_dbsize.Location = new Point(361,5);
lab_m_dbsize.Name = "lab_m_dbsize";
lab_m_dbsize.Size = new Size(42,21);
lab_m_dbsize.TabIndex = 2;
lab_m_dbsize.Text = "当前";
//
// WorkMain
//
AutoScaleDimensions = new SizeF(7F,17F);
@ -619,6 +656,8 @@
cms_FileList.ResumeLayout(false);
tabPage1.ResumeLayout(false);
tabPage1.PerformLayout();
flowLayoutPanel5.ResumeLayout(false);
flowLayoutPanel5.PerformLayout();
flowLayoutPanel4.ResumeLayout(false);
flowLayoutPanel4.PerformLayout();
flowLayoutPanel3.ResumeLayout(false);
@ -676,5 +715,8 @@
private ToolStripSeparator toolStripSeparator1;
private ToolStripButton tsb_loadin;
private Label lab_m_dbsize;
private FlowLayoutPanel flowLayoutPanel5;
private Button bt_m_dbshc;
private Label label5;
}
}

View File

@ -355,5 +355,10 @@ namespace CalendarNotepad
private void tsb_loadin_Click(object sender,EventArgs e) {
ToolStripMenuItem_Click(sender,EventArgs.Empty);
}
private void bt_m_dbshc_Click(object sender,EventArgs e) {
var dlg = new dlgDatabaseSchemas();
dlg.Show();
}
}
}

View File

@ -117,78 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="tabControl1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="tpWorkManage.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="splitContainer1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="groupBox1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="C_WorkOut.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="radioButton9.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="radioButton6.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="radioButton8.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="radioButton7.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="flowLayoutPanel1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="btSave.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="btReset.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="gbWorkTypes.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="C_WorkTypes.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="radioButton1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="radioButton3.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="radioButton2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="radioButton4.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="radioButton5.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="mcWorkDay.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="splitContainer2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="rtbMsg.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="toolStrip1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="tsb_palse.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
@ -208,54 +139,12 @@
AAAAAElFTkSuQmCC
</value>
</data>
<metadata name="FileListView.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cms_FileList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>127, 17</value>
</metadata>
<metadata name="tabPage1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="flowLayoutPanel4.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="bt_m_Backup.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="flowLayoutPanel3.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="bt_m_ys.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label3.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="flowLayoutPanel2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="bt_m_Clean.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="panel2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="panel3.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="OpenFileDlg.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>248, 17</value>
</metadata>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>36</value>
</metadata>

View File

@ -0,0 +1,57 @@
namespace CalendarNotepad
{
partial class dlgDatabaseSchemas
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if(disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
richTextBox1 = new RichTextBox();
SuspendLayout();
//
// richTextBox1
//
richTextBox1.Dock = DockStyle.Fill;
richTextBox1.Location = new Point(0,0);
richTextBox1.Name = "richTextBox1";
richTextBox1.Size = new Size(432,281);
richTextBox1.TabIndex = 0;
richTextBox1.Text = "";
//
// dlgDatabaseSchemas
//
AutoScaleDimensions = new SizeF(7F,17F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(432,281);
Controls.Add(richTextBox1);
Name = "dlgDatabaseSchemas";
StartPosition = FormStartPosition.CenterParent;
Text = "数据库架构文本";
Load += dlgDatabaseSchemas_Load;
ResumeLayout(false);
}
#endregion
private RichTextBox richTextBox1;
}
}

View File

@ -0,0 +1,35 @@
using CalendarNotepad.Extends;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CalendarNotepad
{
public partial class dlgDatabaseSchemas:Form
{
public dlgDatabaseSchemas() {
InitializeComponent();
}
private void dlgDatabaseSchemas_Load(object sender,EventArgs e) {
StringBuilder sb = new();
using var db = new DbContext();
var tables = db.DbMaintenance.GetTableInfoList(false);
sb.AppendLine($"查询共{tables.Count}张表");
foreach(var t in tables) {
sb.AppendLine($"Table{t.Name}");
var cols = db.DbMaintenance.GetColumnInfosByTableName(t.Name,false);
foreach(var c in cols) {
sb.AppendLine($" Column{c.DbColumnName}{c.DataType}:{c.Length}:{c.ColumnDescription}");
}
}
this.richTextBox1.Text = sb.ToString();
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>