Commit bd271843 authored by 徐盼盼's avatar 徐盼盼

新增:自定义配置工具

parent 7c3c23fa
......@@ -37,3 +37,12 @@ bin
/packages/CefSharp.WinForms.92.0.251
/AppHome/project.json
/AppHome/config/*.json
/DIYForm/Export/SunnyUI.dll
/DIYForm/Export/SunnyUI.Common.dll
/DIYForm/Export/Pan.DIYForm.pdb
/DIYForm/Export/Pan.DIYForm.exe.config
/DIYForm/Export/Pan.DIYForm.exe
/DIYForm/Export/Newtonsoft.Json.xml
/DIYForm/Export/Newtonsoft.Json.dll
/DIYForm/packages
/packages
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>
\ No newline at end of file
{
"Server": "192.168.1.204",
"Port": "",
"Database": "FTT_GeErRui",
"UserID": "sa",
"Password": "sa"
}
\ No newline at end of file
[
{
"Auth": "public",
"Type": "bool",
"MethodName": "CheckParentHasSubmit",
"Param": "DBCommand dbCmd, ObjectLinkInfo linkInfo",
"Content": "throw new NotImplementedException();",
"IsCreate": false,
"IsStatic": false,
"IsOverride": false,
"IsInterface": true,
"InterfaceName": "U.IFace.ISaveObjectData"
},
{
"Auth": "public",
"Type": "void",
"MethodName": "SaveObjectDetail",
"Param": "DBCommand dbCmd, object dataType, object objectData, int mainID",
"Content": "throw new NotImplementedException();",
"IsCreate": false,
"IsStatic": false,
"IsOverride": false,
"IsInterface": true,
"InterfaceName": "U.IFace.ISaveObjectData"
},
{
"Auth": "public",
"Type": "ObjectLinkInfo",
"MethodName": "GetObjectLinkInfo",
"Param": "DataRow[] drsParentData",
"Content": "throw new NotImplementedException();",
"IsCreate": false,
"IsStatic": false,
"IsOverride": false,
"IsInterface": true,
"InterfaceName": "U.IFace.IDataLinkObjRule"
},
{
"Auth": "public",
"Type": "DataSet",
"MethodName": "GetLinkObjData",
"Param": "params object[] pars",
"Content": "string sqlWhere = $\"a.SubmitDate >= '{pars[0]}' And a.SubmitDate < '{pars[1]}' \";\r\nstring sqlName = \"GetLinkData\";\r\nDataSet ds = U.Rule.RuleObjCommand.ExecImmediately(DsHighSetting, OBJECT_NAME, sqlName, U.Model.Enum.DocLinkType.Link, sqlWhere);\r\nreturn ds;",
"IsCreate": false,
"IsStatic": false,
"IsOverride": false,
"IsInterface": true,
"InterfaceName": "U.IFace.IDataLinkObjRule"
},
{
"Auth": "public",
"Type": "string",
"MethodName": "GetExportFilterString",
"Param": "bool pUnDo, bool pPartDone, bool pDone, bool pOverDone",
"Content": "throw new NotImplementedException();",
"IsCreate": false,
"IsStatic": false,
"IsOverride": false,
"IsInterface": true,
"InterfaceName": "U.IFace.IDataLinkObjRule"
},
{
"Auth": "public",
"Type": "void",
"MethodName": "ProcessAfterEditSure",
"Param": "DataSet linkData, int[] prevLinkIds",
"Content": "throw new NotImplementedException();",
"IsCreate": false,
"IsStatic": false,
"IsOverride": false,
"IsInterface": true,
"InterfaceName": "U.IFace.IDataLinkObjRule"
},
{
"Auth": "public",
"Type": "DataSet",
"MethodName": "GetSummanyObjData",
"Param": "string pWhere",
"Content": "throw new NotImplementedException();",
"IsCreate": false,
"IsStatic": false,
"IsOverride": false,
"IsInterface": true,
"InterfaceName": "U.IFace.IDataLinkObjRule"
},
{
"Auth": "public",
"Type": "DataSet",
"MethodName": "GetLinkPresiousDetail",
"Param": "DataRow[] pLinkdrs",
"Content": "throw new NotImplementedException();",
"IsCreate": false,
"IsStatic": false,
"IsOverride": false,
"IsInterface": true,
"InterfaceName": "U.IFace.IDataLinkObjRule"
}
]
\ No newline at end of file
namespace Pan.DIYForm.Controls
{
partial class ucCode
{
/// <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()
{
this.components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Text = "ucCode";
}
#endregion
}
}
\ No newline at end of file
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;
using Sunny.UI;
namespace Pan.DIYForm.Controls
{
public partial class ucCode : UIPanel
{
public ucCode()
{
InitializeComponent();
}
}
}
namespace Pan.DIYForm.Controls
{
partial class ucDesign
{
/// <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()
{
this.components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Text = "ucDesign";
}
#endregion
}
}
\ No newline at end of file
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;
using Sunny.UI;
namespace Pan.DIYForm.Controls
{
public partial class ucDesign : UIPanel
{
public ucDesign()
{
InitializeComponent();
}
}
}
This diff is collapsed.
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;
using Sunny.UI;
namespace Pan.DIYForm.Controls
{
public partial class ucProperty : UIPanel
{
public ucProperty()
{
InitializeComponent();
}
}
}
<?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>
\ No newline at end of file
namespace Pan.DIYForm.Controls
{
partial class ucTool
{
/// <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()
{
this.btnTool = new Sunny.UI.UISymbolButton();
this.SuspendLayout();
//
// btnTool
//
this.btnTool.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnTool.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnTool.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnTool.Location = new System.Drawing.Point(0, 0);
this.btnTool.MinimumSize = new System.Drawing.Size(1, 1);
this.btnTool.Name = "btnTool";
this.btnTool.Size = new System.Drawing.Size(200, 50);
this.btnTool.TabIndex = 0;
this.btnTool.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnTool.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
//
// ucTool
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.btnTool);
this.Name = "ucTool";
this.Size = new System.Drawing.Size(200, 50);
this.Text = "";
this.Load += new System.EventHandler(this.ucTool_Load);
this.ResumeLayout(false);
}
#endregion
public Sunny.UI.UISymbolButton btnTool;
}
}
\ No newline at end of file
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;
using Sunny.UI;
namespace Pan.DIYForm.Controls
{
public partial class ucTool : UIPanel
{
private Type _ControlType { get; set; }
public Type ControlType
{
get { return _ControlType; }
set { _ControlType = value; }
}
public ucTool()
{
InitializeComponent();
}
public ucTool(Type controlType)
{
ControlType = controlType;
InitializeComponent();
}
private void ucTool_Load(object sender, EventArgs e)
{
btnTool.Text = ControlType.FullName;
}
}
}
<?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>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;
using System.IO;
using Newtonsoft.Json;
namespace Pan.DIYForm.DB
{
public class DB
{
/// <summary>
/// 获取所有表名
/// </summary>
/// <returns></returns>
public static List<string> GetAllTableName()
{
List<string> list = new List<string>();
string sql = "SELECT Name FROM SYSOBJECTS WHERE XTYPE='U' ORDER BY NAME;";
Command cmd = new Command();
DataTable dt = cmd.ExecuteForDataSet(sql).Tables[0];
foreach(DataRow dr in dt.Rows)
list.Add(dr["Name"].ToString());
return list;
}
/// <summary>
/// 获取表中所有字段名和对应类型
/// </summary>
/// <param name="tableName">表名</param>
/// <param name="isConvert">是否转换C#类型</param>
/// <returns></returns>
public static Dictionary<string, string> GetColumnInfo(string tableName, bool isConvert = true)
{
Dictionary<string, string> cols = new Dictionary<string, string>();
string sql = $"SELECT Name,TYPE_NAME(xtype) AS DataType FROM SYSCOLUMNS WHERE ID=OBJECT_ID('{tableName}');";
Command cmd = new Command();
DataTable dt = cmd.ExecuteForDataSet(sql).Tables[0];
string typeName;
foreach (DataRow dr in dt.Rows)
{
typeName = dr["DataType"].ToString();
if (isConvert)
{
switch (typeName)
{
case "int": typeName = "System.Int32";break;
case "decimal": typeName = "System.Decimal";break;
case "bit": typeName = "System.Boolean"; break;
case "datetime": typeName = "System.DateTime"; break;
case "varbinary": typeName = "System.Byte[]"; break;
case "char": typeName = "System.Char"; break;
case "float": typeName = "System.Float"; break;
default: typeName = "System.String";break;
}
}
cols.Add(dr["Name"].ToString(), typeName);
}
return cols;
}
public static DataSet GetTableInfo(string tableName)
{
string sql = $@"EXEC sys.sp_help @objname = '{tableName}';
SELECT b.name AS FieldName, ISNULL(c.value,'') AS FieldDesc
FROM sys.tables a
INNER JOIN sys.columns b ON b.object_id = a.object_id
LEFT JOIN sys.extended_properties c ON c.major_id = b.object_id
AND c.minor_id = b.column_id
WHERE a.name = '{tableName}';
SELECT ISNULL(b.value,'') AS TableDesc
FROM sys.tables a
LEFT JOIN sys.extended_properties b ON(a.object_id = b.major_id AND b.minor_id = 0)
WHERE a.name = '{tableName}';";
Command cmd = new Command();
return cmd.ExecuteForDataSet(sql);
}
}
public class Command
{
public DBConfig _DBConfig { get; set; }
public DBConfig DBConfig
{
get
{
if (_DBConfig == null)
{
string json = File.ReadAllText("./ConfigFiles/DB.json");
_DBConfig = JsonConvert.DeserializeObject<DBConfig>(json);
}
return _DBConfig;
}
set { _DBConfig = value; }
}
public DBConfig Config { get; set; }
public Command() { Config = DBConfig; }
/// <summary>
/// 查询sql返回DataSet
/// </summary>
/// <param name="sql"></param>
/// <returns></returns>
/// <exception cref="Exception"></exception>
public DataSet ExecuteForDataSet(string sql)
{
DataSet ds = new DataSet();
try
{
SqlConnection conn = new SqlConnection(Config.ToString());
conn.Open();
SqlCommand cmd = new SqlCommand(sql, conn);
SqlDataAdapter adapter = new SqlDataAdapter() { SelectCommand = cmd };
adapter.Fill(ds);
}
catch (Exception ex)
{
throw new Exception("数据库连接出错:" + ex.Message);
}
return ds;
}
/// <summary>
/// 执行sql语句并返回受影响的行数
/// </summary>
/// <param name="sql"></param>
/// <returns></returns>
/// <exception cref="Exception"></exception>
public int ExecuteNonQuery(string sql)
{
using (SqlConnection conn = new SqlConnection(Config.ToString()))
{
conn.Open();
SqlTransaction trans = conn.BeginTransaction();
SqlCommand cmd = new SqlCommand(sql, conn);
cmd.Transaction = trans;
try
{
int re = cmd.ExecuteNonQuery();
trans.Commit();
return re;
}
catch (Exception ex)
{
trans.Rollback();
throw new Exception("数据库连接出错:" + ex.Message);
}
}
}
}
public class DBConfig
{
public string Server { get; set; }
public string Port { get; set; } = string.Empty;
public string Database { get; set; }
public string UserID { get; set; }
public string Password { get; set; }
public override string ToString()
{
return $"Password={Password};Persist Security Info=True;User ID={UserID};Initial Catalog={Database};" +
$"Data Source={Server}{(Port.Equals(string.Empty) ? string.Empty : $",{Port}")}";
}
}
}
namespace Pan.DIYForm.DIYControls
{
partial class BaseControl
{
/// <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()
{
this.components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Text = "FTTBaseControl";
}
#endregion
}
}
\ No newline at end of file
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;
using Sunny.UI;
using Pan.DIYForm.Models;
namespace Pan.DIYForm.DIYControls
{
public partial class BaseControl : UIPanel
{
private DIYControl _FTTControl { get; set; }
public DIYControl FTTControl
{
get { return _FTTControl; }
set { _FTTControl = value; }
}
public BaseControl()
{
InitializeComponent();
}
}
}
namespace Pan.DIYForm.DIYControls
{
partial class Button
{
/// <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()
{
this.components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Text = "FTTButton";
}
#endregion
}
}
\ No newline at end of file
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 Pan.DIYForm.DIYControls
{
public partial class Button : Form
{
public Button()
{
InitializeComponent();
}
}
}
{
"Server": "192.168.1.204",
"Port": "",
"Database": "FTT_GeErRui",
"UserID": "sa",
"Password": "sa"
}
\ No newline at end of file
[
{
"Auth": "public",
"Type": "bool",
"MethodName": "CheckParentHasSubmit",
"Param": "DBCommand dbCmd, ObjectLinkInfo linkInfo",
"Content": "throw new NotImplementedException();",
"IsCreate": false,
"IsStatic": false,
"IsOverride": false,
"IsInterface": true,
"InterfaceName": "U.IFace.ISaveObjectData"
},
{
"Auth": "public",
"Type": "void",
"MethodName": "SaveObjectDetail",
"Param": "DBCommand dbCmd, object dataType, object objectData, int mainID",
"Content": "throw new NotImplementedException();",
"IsCreate": false,
"IsStatic": false,
"IsOverride": false,
"IsInterface": true,
"InterfaceName": "U.IFace.ISaveObjectData"
},
{
"Auth": "public",
"Type": "ObjectLinkInfo",
"MethodName": "GetObjectLinkInfo",
"Param": "DataRow[] drsParentData",
"Content": "throw new NotImplementedException();",
"IsCreate": false,
"IsStatic": false,
"IsOverride": false,
"IsInterface": true,
"InterfaceName": "U.IFace.IDataLinkObjRule"
},
{
"Auth": "public",
"Type": "DataSet",
"MethodName": "GetLinkObjData",
"Param": "params object[] pars",
"Content": "string sqlWhere = $\"a.SubmitDate >= '{pars[0]}' And a.SubmitDate < '{pars[1]}' \";\r\nstring sqlName = \"GetLinkData\";\r\nDataSet ds = U.Rule.RuleObjCommand.ExecImmediately(DsHighSetting, OBJECT_NAME, sqlName, U.Model.Enum.DocLinkType.Link, sqlWhere);\r\nreturn ds;",
"IsCreate": false,
"IsStatic": false,
"IsOverride": false,
"IsInterface": true,
"InterfaceName": "U.IFace.IDataLinkObjRule"
},
{
"Auth": "public",
"Type": "string",
"MethodName": "GetExportFilterString",
"Param": "bool pUnDo, bool pPartDone, bool pDone, bool pOverDone",
"Content": "throw new NotImplementedException();",
"IsCreate": false,
"IsStatic": false,
"IsOverride": false,
"IsInterface": true,
"InterfaceName": "U.IFace.IDataLinkObjRule"
},
{
"Auth": "public",
"Type": "void",
"MethodName": "ProcessAfterEditSure",
"Param": "DataSet linkData, int[] prevLinkIds",
"Content": "throw new NotImplementedException();",
"IsCreate": false,
"IsStatic": false,
"IsOverride": false,
"IsInterface": true,
"InterfaceName": "U.IFace.IDataLinkObjRule"
},
{
"Auth": "public",
"Type": "DataSet",
"MethodName": "GetSummanyObjData",
"Param": "string pWhere",
"Content": "throw new NotImplementedException();",
"IsCreate": false,
"IsStatic": false,
"IsOverride": false,
"IsInterface": true,
"InterfaceName": "U.IFace.IDataLinkObjRule"
},
{
"Auth": "public",
"Type": "DataSet",
"MethodName": "GetLinkPresiousDetail",
"Param": "DataRow[] pLinkdrs",
"Content": "throw new NotImplementedException();",
"IsCreate": false,
"IsStatic": false,
"IsOverride": false,
"IsInterface": true,
"InterfaceName": "U.IFace.IDataLinkObjRule"
}
]
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Pan.DIYForm.Models
{
public class DIYControl
{
public string Name { get; set; }
public string Text { get; set; }
public int Width { get; set; }
public int Height { get; set; }
public int X { get; set; }
public int Y { get; set; }
public Point Location
{
get { return new Point(X, Y); }
set { X = value.X; Y = value.Y; }
}
}
}
using Pan.DIYForm.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Pan.DIYForm.Models
{
/// <summary>
/// 方法
/// </summary>
public class DIYMethod
{
/// <summary>
/// 权限
/// </summary>
public string Auth { get; set; }
/// <summary>
/// 类型
/// </summary>
public string Type { get; set; }
/// <summary>
/// 方法名
/// </summary>
public string MethodName { get; set; }
/// <summary>
/// 参数
/// </summary>
public string Param { get; set; }
/// <summary>
/// 方法内容
/// </summary>
public string Content { get; set; }
/// <summary>
/// 是否构造方法
/// </summary>
public bool IsCreate { get; set; }
/// <summary>
/// 是否静态方法
/// </summary>
public bool IsStatic { get; set; }
/// <summary>
/// 是否重写方法
/// </summary>
public bool IsOverride { get; set; }
/// <summary>
/// 是否接口
/// </summary>
public bool IsInterface { get; set; }
/// <summary>
/// 接口名称
/// </summary>
public string InterfaceName { get; set; }
/// <summary>
/// 重写ToString() - 直接返回格式化后的方法
/// </summary>
/// <returns></returns>
public override string ToString()
{
return General.AddMethod(Auth, Type, MethodName, Param, Content, IsCreate, IsStatic, IsOverride);
}
}
}
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Pan.DIYForm.Models
{
public class FormTemplate
{
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Pan.DIYForm.Models
{
/// <summary>
/// 业务类
/// </summary>
public class RuleTemplate
{
/// <summary>
/// 窗体名称(非程序集名称)
/// </summary>
public string FormName { get; set; }
/// <summary>
/// 业务类模块
/// </summary>
public string RuleModel { get; set; }
/// <summary>
/// 业务类名称(程序名称)
/// </summary>
public string RuleName { get; set; }
/// <summary>
/// 引用using
/// </summary>
public List<string> Refrences { get; set; }
/// <summary>
/// IDT
/// </summary>
public List<IDT> IDTs { get; set; }
/// <summary>
/// 父级单据
/// </summary>
public List<ParentDoc> ParentDocs { get; set; }
/// <summary>
/// 方法
/// </summary>
public List<DIYMethod> Methods { get; set; }
/// <summary>
/// IDT
/// </summary>
public class IDT
{
/// <summary>
/// IDT名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 表名
/// </summary>
public string TableName { get; set; }
/// <summary>
/// 外键
/// </summary>
public string ForeingKeyName { get; set; } = string.Empty;
/// <summary>
/// 描述
/// </summary>
public string Description { get; set; } = string.Empty;
}
/// <summary>
/// 父级单据
/// </summary>
public class ParentDoc
{
/// <summary>
/// 单据类型(对应DocType枚举值)
/// </summary>
public string DocType { get; set; }
/// <summary>
/// 父级单据表名
/// </summary>
public string ProviderTableName { get; set; }
/// <summary>
/// 键
/// </summary>
public string Key { get; set; }
/// <summary>
/// 外键
/// </summary>
public string ForeingKry { get; set; }
/// <summary>
/// 映射关系(一对一、一对多等)
/// </summary>
public string RelationType { get; set; }
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Pan.DIYForm.Models
{
public class Table
{
/// <summary>
/// 表名
/// </summary>
public string Name { get; set; }
/// <summary>
/// 表注释
/// </summary>
public string Desc { get; set; } = string.Empty;
/// <summary>
/// 创建时间
/// </summary>
public string CreateDate { get; set; } = DateTime.Now.ToString();
/// <summary>
/// 字段
/// </summary>
public List<Field> Fields { get; set; }
/// <summary>
/// 索引
/// </summary>
public List<Index> Indexs { get; set; }
/// <summary>
/// 约束
/// </summary>
public List<Table.Constraint> Constraints { get; set; }
/// <summary>
/// 外键
/// </summary>
public List<Table.ForeignKey> ForeignKeys { get; set; }
/// <summary>
/// 表外键
/// </summary>
public class ForeignKey
{
/// <summary>
/// 外键名称
/// </summary>
public string ForeignKeyName { get; set; }
/// <summary>
/// 外键引用表
/// </summary>
public string ForeignKeyTableName { get; set; }
}
/// <summary>
/// 表约束
/// </summary>
public class Constraint
{
/// <summary>
/// 表名
/// </summary>
public string ConstraintTable { get; set; }
/// <summary>
/// 约束名
/// </summary>
public string ConstraintName { get; set; }
/// <summary>
/// 约束字段
/// </summary>
public string ConstraintKeys { get; set; }
/// <summary>
/// 约束类型
/// </summary>
public string ConstraintType { get; set; }
/// <summary>
/// 外键引用表
/// </summary>
public string ConstraintReferenceTable { get; set; }
/// <summary>
/// 外键引用字段
/// </summary>
public string ConstraintReferenceKey { get; set; }
/// <summary>
/// 外键级联删除
/// </summary>
public bool IsOnDelete { get; set; }
/// <summary>
/// 检查表达式
/// </summary>
public string ConstraintCheckExpression { get; set; }
/// <summary>
/// 默认值
/// </summary>
public string ConstraintDefaultValue { get; set; }
/// <summary>
/// 约束描述
/// </summary>
public string ConstraintDesc { get; set; }
}
/// <summary>
/// 表索引
/// </summary>
public class Index
{
/// <summary>
/// 索引表名
/// </summary>
public string IndexTable { get; set; }
/// <summary>
/// 索引字段
/// </summary>
public string IndexKeys { get; set; }
/// <summary>
/// 是否唯一
/// </summary>
public bool IsUnique { get; set; }
/// <summary>
/// 聚集索引
/// </summary>
public bool IsClustered { get; set; }
/// <summary>
/// 索引名称
/// </summary>
public string IndexName { get; set; }
/// <summary>
/// 索引描述
/// </summary>
public string IndexDesc { set; get; }
}
/// <summary>
/// 字段
/// </summary>
public class Field
{
/// <summary>
/// 字段名
/// </summary>
public string FieldName { get; set; }
/// <summary>
/// 字段描述
/// </summary>
public string FieldDesc { get; set; }
/// <summary>
/// 字段类型
/// </summary>
public string FieldType { get; set; }
/// <summary>
/// 字段长度
/// </summary>
public string FieldLength { get; set; }
/// <summary>
/// 字段精度
/// </summary>
public string FieldPrecision { get; set; }
/// <summary>
/// 字段范围
/// </summary>
public string FieldScale { get; set; }
/// <summary>
/// 是否自增
/// </summary>
public bool IsIdentity { get; set; }
/// <summary>
/// 是否为空
/// </summary>
public bool IsNull { get; set; }
/// <summary>
/// 是否主键
/// </summary>
public bool IsPrimary { get; set; }
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Pan.DIYForm.Models
{
public class Views
{
/// <summary>
/// 编辑模式
/// </summary>
public enum EditModel
{
[Description("新增")]
Add = 0,
[Description("编辑")]
Edit = 1,
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Pan.DIYForm.Models
{
public class XMLTemplate
{
public class SQLScript
{
public string SQL { get; set; } = string.Empty;
public List<string> Parameters { get; set; } = new List<string>();
}
}
}
This diff is collapsed.

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.1.32319.34
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pan.DIYForm", "Pan.DIYForm.csproj", "{A7CC209D-A8E3-4A36-8940-C0548211F14E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A7CC209D-A8E3-4A36-8940-C0548211F14E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A7CC209D-A8E3-4A36-8940-C0548211F14E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A7CC209D-A8E3-4A36-8940-C0548211F14E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A7CC209D-A8E3-4A36-8940-C0548211F14E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {AF33C4B5-513E-4F3E-A6BD-0C19CE1F481A}
EndGlobalSection
EndGlobal
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using Pan.DIYForm.Views;
namespace Pan.DIYForm
{
internal static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FrmMain());
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("Pan..DIYForm")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Pan..DIYForm")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("a7cc209d-a8e3-4a36-8940-c0548211f14e")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Pan.DIYForm.Properties
{
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Pan..DIYForm.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}
<?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.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: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" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Pan.DIYForm.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Reflection;
namespace Pan.DIYForm.Utils
{
public class DTConvert
{
#region 表格转换成实例
public static T ToModel<T>(DataTable dt) where T : new()
{
T model = new T();
PropertyInfo info; //存储实体属性
for (int i = 0; i < model.GetType().GetProperties().Length; i++) //遍历属性
{
info = model.GetType().GetProperties()[i];
if (dt.Columns.Contains(info.Name)) //若表中字段包含属性Name就把表中该列第一行的值赋给该属性
info.SetValue(model, dt.Rows[0][info.Name].ToString().ToLower() == "false" || dt.Rows[0][info.Name].ToString().ToLower() == "true" ?
Convert.ToBoolean(dt.Rows[0][info.Name]) : dt.Rows[0][info.Name]);
}
return model;
}
public static List<T> ToModelList<T>(DataTable dt) where T : new()
{
List<T> models = new List<T>();
foreach (DataRow r in dt.Rows) //遍历表中所有行
{
T model = new T();
PropertyInfo[] infos = model.GetType().GetProperties(); //每次New新的实例属性
PropertyInfo info;
for (int i = 0; i < infos.Length; i++)
{
info = infos[i];
if (dt.Columns.Contains(info.Name))
{
if(r[info.Name].Equals(DBNull.Value)) continue;
info.SetValue(model, r[info.Name].ToString().ToLower() == "false" || r[info.Name].ToString().ToLower() == "true" ?
Convert.ToBoolean(r[info.Name]) : r[info.Name]);
}
}
models.Add(model);
}
return models;
}
#endregion
#region 实例转换成表格
public static DataTable FromModel<T>(DataTable dt, List<T> model) where T : new()
{
dt.Rows.Clear();
T newModel = new T();
PropertyInfo[] infos = newModel.GetType().GetProperties();
PropertyInfo info;
model.ForEach(m =>
{
DataRow dr = dt.NewRow();
for (int i = 0; i < infos.Length; i++)
{
info = infos[i];
if (dt.Columns.Contains(info.Name))
dr[info.Name] = info.GetValue(m);
}
dt.Rows.Add(dr);
});
return dt;
}
#endregion
#region 行转实例
public static T ToModel<T>(DataRow dr) where T : new()
{
T model = new T();
PropertyInfo info; //存储实体属性
for (int i = 0; i < model.GetType().GetProperties().Length; i++) //遍历属性
{
info = model.GetType().GetProperties()[i];
if (dr.Table.Columns.Contains(info.Name)) //若表中字段包含属性Name就把表中该列第一行的值赋给该属性
{
if (dr[info.Name].Equals(DBNull.Value))
continue;
info.SetValue(model, dr[info.Name].ToString().ToLower() == "false" || dr[info.Name].ToString().ToLower() == "true" ?
Convert.ToBoolean(dr[info.Name]) : dr[info.Name]);
}
}
return model;
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Sunny.UI;
namespace Pan.DIYForm.Utils
{
public class General
{
/// <summary>
/// 添加Region(方便模块划分、代码清晰)
/// </summary>
/// <param name="regionName"></param>
/// <param name="code"></param>
/// <returns></returns>
public static string AddRegion(string regionName, string code)
{
string region = string.Empty;
region += $"\n#region {regionName}\n";
region += code;
region += "\n#endregion\n";
return region;
}
/// <summary>
/// 添加方法
/// </summary>
/// <param name="auth">权限</param>
/// <param name="type">数据类型</param>
/// <param name="name">方法名</param>
/// <param name="param">参数</param>
/// <param name="isCreate">是否构造函数</param>
/// <param name="isStatic">是否静态</param>
/// <param name="isOverride">是否重写</param>
/// <returns></returns>
public static string AddMethod(string auth, string type, string name, string param, string content, bool isCreate = false, bool isStatic = false, bool isOverride = false)
{
string method = string.Empty;
method += $"\n{auth} {(isStatic ? "static" : string.Empty)} {(isOverride ? "override" : string.Empty)} {(isCreate ? string.Empty : type)} {name} ({param})\n{{\n";
method += content;
method += "\n}\n";
return method;
}
}
}
using Pan.DIYForm.Models;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Pan.DIYForm.Utils
{
public class RuleHelper
{
public static string CodeGenerate(Models.RuleTemplate rule)
{
const string NAME_PREFIX = "U.Rule";
string code = string.Empty;
// 1.引用
rule.Refrences.ForEach(r =>
{
code += $"using {r};\n";
});
// 2.命名空间
code += $"\nnamespace {NAME_PREFIX}.{rule.RuleModel}\n{{";
// 3.IDT
string IDT = string.Empty;
IDT =
$"\npublic enum {rule.RuleName.Remove(0, 1)}IDT" +
$"\n{{";
rule.IDTs.ForEach(i =>
{
IDT += $"[ObjectDataMapping(\"{i.TableName}\"";
if (!i.ForeingKeyName.Equals(string.Empty))
IDT += $",ForeingKeyName = \"{i.ForeingKeyName}\"";
if (!i.Description.Equals(string.Empty))
IDT += $",Description = \"{i.Description}\"";
IDT += $")]\n{i.Name},\n";
});
IDT += "}\n";
IDT = General.AddRegion($"{rule.RuleName}IDT", IDT);
code += IDT;
// 4.父级单据、级联关系
string parentDoc = string.Empty;
rule.ParentDocs.ForEach(p =>
{
parentDoc += $"[ParentProvider(U.Model.Enum.DocType.{p.DocType},\"{p.ProviderTableName}\",\"{p.Key}\",\"{p.ForeingKry}\",U.Model.Enum.ObjectRelationType.{p.RelationType})]\n";
});
parentDoc = General.AddRegion($"{rule.RuleName}父级单据", parentDoc);
code += parentDoc;
// 5.类定义
code += $"\npublic class {rule.RuleName} : U.BaseFrame.BaseRule, U.IFace.ISaveObjectData, U.IFace.IDataLinkObjRule\n{{";
// 6.常量、变量
string values = string.Empty;
// 6.1生成业务表名常量
rule.IDTs.ForEach(i =>
{
values += $"public const string OBJECT_{(i.Name == "BaseData" ? "NAME" : i.Name.ToUpper())} = \"{i.TableName}\";\n";
});
// 6.2窗体模块名称
values += $"public static readonly string OBJECT_TEXT = CLL.Convert(\"{rule.FormName}\");\n";
// 6.3变量
values +=
"private U.Model.ObjectLinkInfo m_linkInfo;\n" +
"private DataRow _VersionCurrentDataRow = null;\n" +
"public DataRow VersionCurrentDataRow { get => _VersionCurrentDataRow; set => _VersionCurrentDataRow = value; }\n" +
"private Hashtable _VersionRevisionOldDetail = null;\n" +
"public Hashtable VersionRevisionOldDetail { get => _VersionRevisionOldDetail; set => _VersionRevisionOldDetail = value; }\n" +
"private string _VersionTitle = string.Empty;\n" +
"public string VersionTitle { get => _VersionTitle; set => _VersionTitle = value; }\n\n" +
"public string[] LinkViewCfgXmlName { get => new string[] { OBJECT_NAME }; }\n" +
"public string[] EditViewCfgXmlName { get => new string[] { OBJECT_NAME, OBJECT_DETAIL }; }\n" +
"public string[] PresiousLinkCfgXmlName { get => new string[] { OBJECT_DETAIL }; }\n" +
"private DataSet m_DsHighSetting = null;\n" +
"public DataSet DsHighSetting\n{\n" +
"get\n{" +
"if (m_DsHighSetting == null) m_DsHighSetting = CacheXML.LoadXMLData(U.Model.OCD.m_XmlPath + this.Name + this.BusinessModelID);\n" +
"if (m_DsHighSetting == null) m_DsHighSetting = CacheXML.LoadXMLData(U.Model.OCD.m_XmlPath + this.Name);\n" +
"return m_DsHighSetting;\n}\n}\n";
if (rule.ParentDocs.Count > 0)
values += $"public DocType ParentDocType {{ get => U.Model.Enum.DocType.{rule.ParentDocs[0].DocType}; }}\n";
else
values += $"public DocType ParentDocType {{ get => U.Model.Enum.DocType.Null; }}\n";
values +=
"\npublic int NewID;\n" +
"public List<int> newDetailIds = new List<int>();\n";
values = General.AddRegion("常量、变量", values);
code += values;
// 7.构造函数
string createFunc = string.Empty;
createFunc += $"public {rule.RuleName}() : base(OBJECT_NAME)\n{{\n" +
$"base.Text = OBJECT_TEXT;\n}}\n";
createFunc = General.AddRegion("构造函数", createFunc);
code += createFunc;
// 8.接口实现
string interfaceString = string.Empty;
rule.Methods.Where(i => i.IsInterface && i.InterfaceName == "U.IFace.ISaveObjectData").ToList().ForEach(m =>
{
interfaceString += m.ToString();
});
interfaceString = General.AddRegion("实现U.IFace.ISaveObjectData接口", interfaceString);
code += interfaceString;
interfaceString = string.Empty;
rule.Methods.Where(i => i.IsInterface && i.InterfaceName == "U.IFace.IDataLinkObjRule").ToList().ForEach(m =>
{
interfaceString += m.ToString();
});
interfaceString = General.AddRegion("实现U.IFace.IDataLinkObjRule接口", interfaceString);
code += interfaceString;
// 9.自定义方法
string method = string.Empty;
rule.Methods.Where(i => !i.IsInterface).ToList().ForEach(m =>
{
method += m.ToString();
});
method = General.AddRegion("自定义方法", method);
code += method;
// 结尾
code += "\n}\n}";
return code;
}
/// <summary>
/// 表格转IDT
/// </summary>
/// <param name="dtIDT"></param>
/// <returns></returns>
public static List<Models.RuleTemplate.IDT> ConvertForIDT(DataTable dtIDT)
{
List<Models.RuleTemplate.IDT> iDTs = new List<Models.RuleTemplate.IDT>();
foreach (DataRow dr in dtIDT.Rows)
{
Models.RuleTemplate.IDT iDT = new Models.RuleTemplate.IDT();
iDT.Name = dr["Name"].ToString();
iDT.TableName = dr["TableName"].ToString();
iDT.Description = dr["Description"].Equals(DBNull.Value) ? string.Empty : dr["Description"].ToString();
iDT.ForeingKeyName = dr["ForeingKeyName"].Equals(DBNull.Value) ? string.Empty : dr["ForeingKeyName"].ToString();
iDTs.Add(iDT);
}
return iDTs;
}
/// <summary>
/// 表格转父级单据
/// </summary>
/// <param name="dtParentDoc"></param>
/// <returns></returns>
public static List<Models.RuleTemplate.ParentDoc> ConvertForParentDoc(DataTable dtParentDoc)
{
List<Models.RuleTemplate.ParentDoc> parentDocs = new List<Models.RuleTemplate.ParentDoc>();
foreach (DataRow dr in dtParentDoc.Rows)
{
Models.RuleTemplate.ParentDoc parentDoc = new Models.RuleTemplate.ParentDoc();
parentDoc.DocType = dr["DocType"].ToString();
parentDoc.ProviderTableName = dr["TableName"].ToString();
parentDoc.Key = dr["Key"].ToString();
parentDoc.ForeingKry = dr["ForeingKey"].ToString();
parentDoc.RelationType = dr["RelationType"].ToString();
parentDocs.Add(parentDoc);
}
return parentDocs;
}
/// <summary>
/// 表格转方法
/// </summary>
/// <param name="dtMethod"></param>
/// <returns></returns>
public static List<DIYMethod> ConvertForMethod(DataTable dtMethod)
{
List<DIYMethod> methods = new List<DIYMethod>();
foreach (DataRow dr in dtMethod.Rows)
{
DIYMethod method = new DIYMethod();
method.Auth = dr["Auth"].Equals(DBNull.Value) ? string.Empty : dr["Auth"].ToString();
method.Type = dr["Type"].Equals(DBNull.Value) ? string.Empty : dr["Type"].ToString();
method.MethodName = dr["Name"].Equals(DBNull.Value) ? string.Empty : dr["Name"].ToString();
method.Param = dr["Param"].Equals(DBNull.Value) ? string.Empty : dr["Param"].ToString();
method.IsCreate = dr["IsCreate"].Equals(DBNull.Value) ? false : Convert.ToBoolean(dr["IsCreate"]);
method.IsStatic = dr["IsStatic"].Equals(DBNull.Value) ? false : Convert.ToBoolean(dr["IsStatic"]);
method.IsOverride = dr["IsOverride"].Equals(DBNull.Value) ? false : Convert.ToBoolean(dr["IsOverride"]);
method.IsInterface = dr["IsInterface"].Equals(DBNull.Value) ? false : Convert.ToBoolean(dr["IsInterface"]);
method.InterfaceName = dr["InterfaceName"].Equals(DBNull.Value) ? string.Empty : dr["InterfaceName"].ToString();
methods.Add(method);
}
return methods;
}
}
}
This diff is collapsed.
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Sunny.UI;
using System.Reflection;
using Pan.DIYForm.Views;
namespace Pan.DIYForm.Utils
{
public class Views
{
/// <summary>
/// 加载页面
/// </summary>
/// <param name="pageName"></param>
public static void ShowBasePage(string pageName)
{
Assembly assembly = Assembly.GetExecutingAssembly();
Control control = (Control)assembly.CreateInstance(assembly.GetName() + "." + pageName);
FrmBasePage.ShowDialog(control);
}
/// <summary>
/// 添加选项卡页面
/// </summary>
/// <param name="tabControl">选项控件</param>
/// <param name="key">页面键</param>
/// <param name="title">页面标题</param>
/// <param name="control">页面</param>
public static void AddTabPage(TabControl tabControl, string key, string title, Control control)
{
tabControl.TabPages.Add(key, title);
tabControl.TabPages[key].Controls.Add(control);
tabControl.TabPages[key].Controls[control.Name].Visible = true;
}
/// <summary>
/// 设置表格默认格式(列适应最大化,行适应最大化,所有单元格居中显示,设置数据源)
/// </summary>
/// <param name="grv">表格</param>
/// <param name="dt">数据源</param>
public static void SetGridViewDefaultModel(UIDataGridView grv, DataTable dt = null)
{
grv.DataSource = dt;
grv.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
grv.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
grv.DefaultCellStyle.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
}
/// <summary>
/// 设置表格只读(表格只读,不能新增行,不能删除行)
/// </summary>
/// <param name="grv">表格</param>
public static void SetGridViewReadOnly(UIDataGridView grv)
{
grv.AllowUserToAddRows = false;
grv.AllowUserToDeleteRows = false;
grv.ReadOnly = true;
}
/// <summary>
/// 设置表格列只读
/// </summary>
/// <param name="grv">表格</param>
public static void SetGridViewColumnReadOnly(UIDataGridView grv, string[] fields, bool isAll = false)
{
if (fields == null)
return;
if (fields.Length == 0)
return;
foreach(DataGridViewColumn col in grv.Columns)
{
if (fields.Contains(col.DataPropertyName) || isAll)
col.ReadOnly = true;
}
}
/// <summary>
/// 获取表格列Header文本
/// </summary>
/// <param name="grv">表格</param>
public static void GetGridViewColumnHeader(UIDataGridView grv, out Dictionary<string, string> headers)
{
headers = new Dictionary<string, string>();
foreach (DataGridViewColumn col in grv.Columns)
headers.Add(col.DataPropertyName, col.HeaderText);
}
/// <summary>
/// 设置表格列Header文本
/// </summary>
/// <param name="grv">表格</param>
public static void SetGridViewColumnHeader(UIDataGridView grv, Dictionary<string, string> headers)
{
if (headers == null)
return;
if (headers.Count == 0)
return;
foreach (DataGridViewColumn col in grv.Columns)
{
if (headers.ContainsKey(col.DataPropertyName))
col.HeaderText = headers[col.DataPropertyName];
}
}
/// <summary>
/// 设置表格列Header文本
/// </summary>
/// <param name="grv">表格</param>
public static void CloneGridViewColumnCellTemplate(UIDataGridView grvSource, UIDataGridView grvEdit)
{
grvEdit.Columns.Clear();
foreach (object col in grvSource.Columns)
{
object newCol = new DataGridViewTextBoxColumn();
if (col.GetType() == typeof(DataGridViewTextBoxColumn))
newCol = new DataGridViewTextBoxColumn();
else if (col.GetType() == typeof(DataGridViewCheckBoxColumn))
newCol = new DataGridViewCheckBoxColumn();
else if (col.GetType() == typeof(DataGridViewComboBoxColumn))
{
newCol = new DataGridViewComboBoxColumn();
foreach(object o in ((DataGridViewComboBoxColumn)col).Items)
((DataGridViewComboBoxColumn)newCol).Items.Add(o);
}
((DataGridViewColumn)newCol).Name = ((DataGridViewColumn)col).Name;
((DataGridViewColumn)newCol).DataPropertyName = ((DataGridViewColumn)col).DataPropertyName;
((DataGridViewColumn)newCol).DefaultCellStyle = ((DataGridViewColumn)col).DefaultCellStyle;
((DataGridViewColumn)newCol).DisplayIndex = ((DataGridViewColumn)col).DisplayIndex;
grvEdit.Columns.Add((DataGridViewColumn)newCol);
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Xml;
using System.IO;
using static Pan.DIYForm.Models.XMLTemplate;
namespace Pan.DIYForm.Utils
{
public class XMLHelper
{
public static string Generate(string tableName, string tableKeyName, DataTable dtXMLColumn, Dictionary<string, SQLScript> SQL)
{
XmlDocument xmlDoc = new XmlDocument();
XmlNode columnsNode;
xmlDoc.AppendChild(xmlDoc.CreateXmlDeclaration("1.0", "utf-8", ""));
XmlNode root = xmlDoc.CreateElement("Entity");
xmlDoc.AppendChild(root);
//实体表
XmlElement personElement = xmlDoc.CreateElement("EntityTypeName");
personElement.InnerText = tableName;
root.AppendChild(personElement);
//数据库表
personElement = xmlDoc.CreateElement("TableKeyName");
personElement.InnerText = tableKeyName;
root.AppendChild(personElement);
//表名
personElement = xmlDoc.CreateElement("TableName");
personElement.InnerText = tableName;
root.AppendChild(personElement);
//查询
personElement = xmlDoc.CreateElement("LinkFilterCtl");
personElement.InnerText = "U.WinCtl.Design.ucAutoDateFilter,U.WinCtl.DLL";
root.AppendChild(personElement);
///配置窗体
personElement = xmlDoc.CreateElement("FormEditConfigure");
personElement.InnerText = "U.WinClientDoc.EditCtlconfigureHelper,U.WinClientDoc.DLL";
root.AppendChild(personElement);
//刷新
personElement = xmlDoc.CreateElement("RefreshOnStringEmpty");
personElement.InnerText = "true";
root.AppendChild(personElement);
//合并
personElement = xmlDoc.CreateElement("DetailMerge");
personElement.InnerText = " ";
root.AppendChild(personElement);
// <!-- 配置查询中需要的该对象查询分析列的别名 -->
personElement = xmlDoc.CreateElement("TableAlias");
personElement.InnerText = "a";
root.AppendChild(personElement);
// <!-- 图像浏览窗口必须配置的相关信息 -->
personElement = xmlDoc.CreateElement("ViewImageList");
XmlElement name = xmlDoc.CreateElement("KeyFieldName");
name.InnerText = " ";
personElement.AppendChild(name);
name = xmlDoc.CreateElement("RemarkFieldName");
name.InnerText = " ";
personElement.AppendChild(name);
name = xmlDoc.CreateElement("RemarkFieldCaption");
name.InnerText = " ";
personElement.AppendChild(name);
name = xmlDoc.CreateElement("ImageFieldName");
name.InnerText = " ";
personElement.AppendChild(name);
root.AppendChild(personElement);
// < !--网格编辑列需要配置的信息-- >
personElement = xmlDoc.CreateElement("EditUI");
personElement.InnerText = " ";
root.AppendChild(personElement);
columnsNode = xmlDoc.CreateElement("Columns");
root.AppendChild(columnsNode);
foreach (DataRow row in dtXMLColumn.Rows)
{
XmlNode col = xmlDoc.CreateNode(XmlNodeType.Element, "Column", "");
foreach (DataColumn dc in dtXMLColumn.Columns)
{
object value = row[dc.ColumnName];
if (dc.ColumnName == "Columns_Id" || value.ToString() == "") continue;
XmlAttribute attr = xmlDoc.CreateAttribute(dc.ColumnName);
attr.InnerText = dc.DataType.ToString() == "System.Boolean" ? value.ToString().ToLower() : value.ToString();
col.Attributes.Append(attr);
}
columnsNode.AppendChild(col);
}
columnsNode = xmlDoc.CreateElement("Sqls");
root.AppendChild(columnsNode);
if (SQL.Keys.Count > 0)
{
XmlNode sqlcol;
XmlAttribute sqlattr;
XmlNode stringcol;
StringBuilder str;
foreach (string key in SQL.Keys)
{
sqlcol = xmlDoc.CreateNode(XmlNodeType.Element, "Sql", "");
sqlattr = xmlDoc.CreateAttribute("Name");
sqlattr.Value = key;
sqlcol.Attributes.Prepend(sqlattr);
columnsNode.AppendChild(sqlcol);
stringcol = xmlDoc.CreateNode(XmlNodeType.Element, "String", "");
str = new StringBuilder();
str.Append(" <![CDATA[\n");
str.Append(SQL[key].SQL);
str.Append("\n]]>");
stringcol.InnerText = str.ToString();
stringcol.InnerXml = str.ToString();
sqlcol.AppendChild(stringcol);
foreach(string param in SQL[key].Parameters)
{
stringcol = xmlDoc.CreateNode(XmlNodeType.Element, "Param", "");
sqlattr = xmlDoc.CreateAttribute("Column");
sqlattr.Value = "" + param + "";
stringcol.Attributes.Prepend(sqlattr);
sqlcol.AppendChild(stringcol);
sqlattr = xmlDoc.CreateAttribute("Name");
sqlattr.Value = "@" + param + "";
stringcol.Attributes.Prepend(sqlattr);
sqlcol.AppendChild(stringcol);
}
}
}
return ConvertXmlToString(xmlDoc);
}
public static string ConvertXmlToString(XmlDocument xmlDoc)
{
MemoryStream stream = new MemoryStream();
XmlTextWriter writer = new XmlTextWriter(stream, null);
writer.Formatting = Formatting.Indented;
xmlDoc.Save(writer);
StreamReader sr = new StreamReader(stream, System.Text.Encoding.UTF8);
stream.Position = 0;
string xmlString = sr.ReadToEnd();
sr.Close();
stream.Close();
return xmlString;
}
}
}
This diff is collapsed.
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;
using Pan.DIYForm.Models;
using Sunny.UI;
namespace Pan.DIYForm.Views.Dialogs
{
public partial class DlgEditForeignKey : UIForm
{
private DataTable _dt;
private Table.Constraint _Constraint { get; set; }
public Table.Constraint Constraint
{
get
{
if(_Constraint == null)
{
_Constraint = new Table.Constraint()
{
ConstraintTable = txtTableName.Text,
ConstraintName = txtConstraintName.Text,
ConstraintType = "外键约束",
ConstraintKeys = cmbField.SelectedItem.ToString(),
ConstraintReferenceTable = cmbRefrenceTable.SelectedItem.ToString(),
ConstraintReferenceKey = cmbRefrenceKey.SelectedItem.ToString(),
IsOnDelete = chkOnDelete.Checked,
ConstraintDesc = "FOREIGN KEY"
};
}
return _Constraint;
}
set { _Constraint = value; }
}
public DlgEditForeignKey(DataTable dt, string tableName)
{
InitializeComponent();
_dt = dt;
foreach (DataRow r in dt.Rows)
this.cmbField.Items.Add(r["FieldName"].ToString());
DB.DB.GetAllTableName().ForEach(t =>
{
cmbRefrenceTable.Items.Add(t.ToString());
});
cmbRefrenceTable.ShowFilter = true;
txtTableName.Text = tableName;
txtConstraintName.Text = "FK_" + tableName;
}
public static bool Dialog(DataTable dt, out Table.Constraint constraint, string tableName = "")
{
DlgEditForeignKey dlg = new DlgEditForeignKey(dt, tableName);
if(dlg.ShowDialog() == DialogResult.OK)
{
constraint = dlg.Constraint;
return true;
}
constraint = null;
return false;
}
private bool CheckBeforeSure()
{
if(txtTableName.Text == "")
{
ShowErrorTip("请输入表名!");
return false;
}
if (txtConstraintName.Text == "")
{
ShowErrorTip("请输入约束名!");
return false;
}
if (cmbField.Text == "")
{
ShowErrorTip("请选择字段!");
return false;
}
if (cmbRefrenceTable.Text == "")
{
ShowErrorTip("请选择引用表名!");
return false;
}
if (cmbRefrenceKey.Text == "")
{
ShowErrorTip("请选择引用字段!");
return false;
}
return true;
}
private void btnSure_Click(object sender, EventArgs e)
{
if (!CheckBeforeSure())
return;
this.Close();
DialogResult = DialogResult.OK;
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.Close();
DialogResult = DialogResult.Cancel;
}
private void cmbRefrenceTable_SelectedValueChanged(object sender, EventArgs e)
{
string tableName = cmbRefrenceTable.Text;
DB.DB.GetColumnInfo(tableName).ForEach(c =>
{
cmbRefrenceKey.Items.Add(c.Key);
});
}
}
}
<?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>
\ No newline at end of file
namespace Pan.DIYForm.Views
{
partial class FrmBasePage
{
/// <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()
{
this.SuspendLayout();
//
// FrmBasePage
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Name = "FrmBasePage";
this.Padding = new System.Windows.Forms.Padding(0, 30, 0, 0);
this.Text = "页面通用窗体";
this.TitleHeight = 30;
this.ZoomScaleRect = new System.Drawing.Rectangle(15, 15, 800, 450);
this.ResumeLayout(false);
}
#endregion
}
}
\ No newline at end of file
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;
using Sunny.UI;
namespace Pan.DIYForm.Views
{
public partial class FrmBasePage : UIForm
{
public FrmBasePage(Control page, string title = "页面通用窗体")
{
InitializeComponent();
this.Text = title;
this.Height = page.Height;
this.Width = page.Width;
this.Controls.Add(page);
page.Visible = true;
}
public static DialogResult ShowDialog(Control control, string title = "页面通用窗体")
{
FrmBasePage frm = new FrmBasePage(control, title);
return frm.ShowDialog();
}
}
}
<?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>
\ No newline at end of file
namespace Pan.DIYForm.Views
{
partial class FrmDesign
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.uiNavBar = new Sunny.UI.UINavBar();
this.spToolsDesign = new Sunny.UI.UISplitContainer();
this.spCodeDesign = new Sunny.UI.UISplitContainer();
this.spPropertyDesign = new Sunny.UI.UISplitContainer();
this.uiSymbolLabel1 = new Sunny.UI.UISymbolLabel();
((System.ComponentModel.ISupportInitialize)(this.spToolsDesign)).BeginInit();
this.spToolsDesign.Panel2.SuspendLayout();
this.spToolsDesign.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.spCodeDesign)).BeginInit();
this.spCodeDesign.Panel1.SuspendLayout();
this.spCodeDesign.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.spPropertyDesign)).BeginInit();
this.spPropertyDesign.SuspendLayout();
this.SuspendLayout();
//
// uiNavBar
//
this.uiNavBar.Dock = System.Windows.Forms.DockStyle.Top;
this.uiNavBar.DropMenuFont = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiNavBar.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiNavBar.Location = new System.Drawing.Point(0, 30);
this.uiNavBar.MenuStyle = Sunny.UI.UIMenuStyle.Custom;
this.uiNavBar.Name = "uiNavBar";
this.uiNavBar.Size = new System.Drawing.Size(1159, 50);
this.uiNavBar.TabIndex = 1;
this.uiNavBar.Text = "uiNavBar1";
this.uiNavBar.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
//
// spToolsDesign
//
this.spToolsDesign.Cursor = System.Windows.Forms.Cursors.Default;
this.spToolsDesign.Dock = System.Windows.Forms.DockStyle.Fill;
this.spToolsDesign.Location = new System.Drawing.Point(0, 80);
this.spToolsDesign.MinimumSize = new System.Drawing.Size(20, 20);
this.spToolsDesign.Name = "spToolsDesign";
//
// spToolsDesign.Pan.el2
//
this.spToolsDesign.Panel2.Controls.Add(this.spCodeDesign);
this.spToolsDesign.Size = new System.Drawing.Size(1159, 563);
this.spToolsDesign.SplitterDistance = 228;
this.spToolsDesign.SplitterWidth = 11;
this.spToolsDesign.TabIndex = 2;
this.spToolsDesign.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
//
// spCodeDesign
//
this.spCodeDesign.Cursor = System.Windows.Forms.Cursors.Default;
this.spCodeDesign.Dock = System.Windows.Forms.DockStyle.Fill;
this.spCodeDesign.Location = new System.Drawing.Point(0, 0);
this.spCodeDesign.MinimumSize = new System.Drawing.Size(20, 20);
this.spCodeDesign.Name = "spCodeDesign";
this.spCodeDesign.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// spCodeDesign.Pan.el1
//
this.spCodeDesign.Panel1.Controls.Add(this.spPropertyDesign);
this.spCodeDesign.Size = new System.Drawing.Size(920, 563);
this.spCodeDesign.SplitterDistance = 363;
this.spCodeDesign.SplitterWidth = 11;
this.spCodeDesign.TabIndex = 0;
this.spCodeDesign.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
//
// spPropertyDesign
//
this.spPropertyDesign.Cursor = System.Windows.Forms.Cursors.Default;
this.spPropertyDesign.Dock = System.Windows.Forms.DockStyle.Fill;
this.spPropertyDesign.Location = new System.Drawing.Point(0, 0);
this.spPropertyDesign.MinimumSize = new System.Drawing.Size(20, 20);
this.spPropertyDesign.Name = "spPropertyDesign";
this.spPropertyDesign.Size = new System.Drawing.Size(920, 363);
this.spPropertyDesign.SplitterDistance = 291;
this.spPropertyDesign.SplitterWidth = 11;
this.spPropertyDesign.TabIndex = 0;
this.spPropertyDesign.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
//
// uiSymbolLabel1
//
this.uiSymbolLabel1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiSymbolLabel1.Location = new System.Drawing.Point(114, 35);
this.uiSymbolLabel1.MinimumSize = new System.Drawing.Size(1, 1);
this.uiSymbolLabel1.Name = "uiSymbolLabel1";
this.uiSymbolLabel1.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
this.uiSymbolLabel1.Size = new System.Drawing.Size(903, 35);
this.uiSymbolLabel1.TabIndex = 3;
this.uiSymbolLabel1.Text = "菜单(待用)";
this.uiSymbolLabel1.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
//
// MainForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(1159, 643);
this.Controls.Add(this.uiSymbolLabel1);
this.Controls.Add(this.spToolsDesign);
this.Controls.Add(this.uiNavBar);
this.Name = "MainForm";
this.Padding = new System.Windows.Forms.Padding(0, 30, 0, 0);
this.Text = "设计页面(FetetO)";
this.TitleHeight = 30;
this.ZoomScaleRect = new System.Drawing.Rectangle(15, 15, 1159, 643);
this.Load += new System.EventHandler(this.MainForm_Load);
this.spToolsDesign.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.spToolsDesign)).EndInit();
this.spToolsDesign.ResumeLayout(false);
this.spCodeDesign.Panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.spCodeDesign)).EndInit();
this.spCodeDesign.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.spPropertyDesign)).EndInit();
this.spPropertyDesign.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private Sunny.UI.UINavBar uiNavBar;
private Sunny.UI.UISplitContainer spToolsDesign;
private Sunny.UI.UISymbolLabel uiSymbolLabel1;
private Sunny.UI.UISplitContainer spCodeDesign;
private Sunny.UI.UISplitContainer spPropertyDesign;
}
}
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;
using Sunny.UI;
using Pan.DIYForm.Controls;
namespace Pan.DIYForm.Views
{
public partial class FrmDesign : UIForm
{
UIForm DesignForm;
public FrmDesign(string title = "设计页面")
{
InitializeComponent();
this.Text = title;
DesignForm = new UIForm()
{
TopLevel = false,
Dock = DockStyle.Fill
};
}
private void MainForm_Load(object sender, EventArgs e)
{
ucTool tool = new ucTool(typeof(UIButton))
{
Dock = DockStyle.Top,
Size = new Size(200, 30),
Visible = true
};
spToolsDesign.Panel1.Controls.Add(tool);
tool.btnTool.Click += BtnTool_Click;
ucProperty property = new ucProperty()
{
Dock = DockStyle.Fill,
Visible = true,
};
spPropertyDesign.Panel1.Controls.Add(property);
spPropertyDesign.Panel2.Controls.Add(DesignForm);
DesignForm.Show();
}
private void BtnTool_Click(object sender, EventArgs e)
{
object o = AssemblyEx.CreateInstance(((ucTool)((UISymbolButton)sender).Parent).ControlType);
Control ctl = o as Control;
spPropertyDesign.Panel2.Controls.Add(ctl);
}
}
}
<?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>
\ No newline at end of file
This diff is collapsed.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Newtonsoft.Json;
using Sunny.UI;
namespace Pan.DIYForm.Views
{
public partial class FrmEditDB : UIForm
{
DB.DBConfig _Config;
public FrmEditDB()
{
string json = File.ReadAllText("./ConfigFiles/DB.json");
_Config = JsonConvert.DeserializeObject<DB.DBConfig>(json);
InitializeComponent();
}
private void FrmEditDB_Load(object sender, EventArgs e)
{
txtServer.Text = _Config.Server;
txtPort.Text = _Config.Port;
txtDataBase.Text = _Config.Database;
txtUserID.Text = _Config.UserID;
txtPwd.Text = _Config.Password;
}
private void btnSave_Click(object sender, EventArgs e)
{
_Config.Server = txtServer.Text;
_Config.Port = txtPort.Text;
_Config.Database = txtDataBase.Text;
_Config.UserID = txtUserID.Text;
_Config.Password = txtPwd.Text;
string json = JsonConvert.SerializeObject(_Config);
File.WriteAllText("./ConfigFiles/DB.json", json);
this.ShowSuccessDialog("保存", "保存成功!");
this.Close();
}
}
}
<?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>
\ No newline at end of file
This diff is collapsed.
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;
using Pan.DIYForm.Models;
using Sunny.UI;
namespace Pan.DIYForm.Views
{
public partial class FrmEditForm : UIForm
{
public FrmEditForm(string title = "窗体配置")
{
InitializeComponent();
this.Text = title;
}
private void FrmEditForm_Load(object sender, EventArgs e)
{
}
private bool CheckBeforeGenerate()
{
if (txtRuleModel.Text == "")
{
this.ShowErrorTip("业务模块不能为空!");
return false;
}
if (txtRuleName.Text == "")
{
this.ShowErrorTip("业务类名不能为空!");
return false;
}
if (txtFormName.Text == "")
{
this.ShowErrorTip("窗体名称不能为空!");
return false;
}
return true;
}
private void btnGenerate_Click(object sender, EventArgs e)
{
if (!CheckBeforeGenerate())
return;
}
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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;
using Pan.DIYForm.Views.Pages;
using Sunny.UI;
namespace Pan.DIYForm.Views
{
public partial class FrmMain : UIForm
{
public FrmMain()
{
InitializeComponent();
this.btnXML.Click += BtnXML_Click;
this.btnRule.Click += BtnRule_Click;
this.btnDesign.Click += BtnDesign_Click;
this.btnGuide.Click += BtnGuide_Click;
}
private void BtnGuide_Click(object sender, EventArgs e)
{
ShowInfoDialog("第1步:建表");
FrmEditForm frm = new FrmEditForm();
frm.ShowDialog();
}
private void btnEditForm_Click(object sender, EventArgs e)
{
FrmEditForm frm = new FrmEditForm();
frm.ShowDialog();
}
private void BtnDesign_Click(object sender, EventArgs e)
{
FrmDesign frm = new FrmDesign();
frm.ShowDialog();
}
private void BtnRule_Click(object sender, EventArgs e)
{
FrmEditRule frm = new FrmEditRule();
frm.ShowDialog();
}
private void BtnXML_Click(object sender, EventArgs e)
{
FrmEditXML frm = new FrmEditXML();
frm.ShowDialog();
}
private void FrmMain_Load(object sender, EventArgs e)
{
}
private void btnDBSetting_Click(object sender, EventArgs e)
{
FrmEditDB frm = new FrmEditDB();
frm.ShowDialog();
}
private void btnAddTable_Click(object sender, EventArgs e)
{
FrmBasePage.ShowDialog(new PgEditTable(Models.Views.EditModel.Add), "新建表");
}
private void btnEditTable_Click(object sender, EventArgs e)
{
FrmBasePage.ShowDialog(new PgEditTable(Models.Views.EditModel.Edit), "编辑表");
}
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment