Commit 9beec34f authored by 罗显健's avatar 罗显健

1.打包工具增加周期选择,2.表开发工具:列兼容系统关键字。

parent 7cf335ea
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
this.lstProject = new System.Windows.Forms.ListView(); this.lstProject = new System.Windows.Forms.ListView();
this.lblNotes = new System.Windows.Forms.Label(); this.lblNotes = new System.Windows.Forms.Label();
this.pnlTop = new System.Windows.Forms.Panel(); this.pnlTop = new System.Windows.Forms.Panel();
this.ckbMergeSql = new System.Windows.Forms.CheckBox();
this.ckbShowLog = new System.Windows.Forms.CheckBox(); this.ckbShowLog = new System.Windows.Forms.CheckBox();
this.ckbDelHisPack = new System.Windows.Forms.CheckBox(); this.ckbDelHisPack = new System.Windows.Forms.CheckBox();
this.btnOpenDirectory = new System.Windows.Forms.Button(); this.btnOpenDirectory = new System.Windows.Forms.Button();
...@@ -42,7 +43,7 @@ ...@@ -42,7 +43,7 @@
this.pnlLeft = new System.Windows.Forms.Panel(); this.pnlLeft = new System.Windows.Forms.Panel();
this.gpbLog = new System.Windows.Forms.GroupBox(); this.gpbLog = new System.Windows.Forms.GroupBox();
this.txtLog = new System.Windows.Forms.TextBox(); this.txtLog = new System.Windows.Forms.TextBox();
this.ckbMergeSql = new System.Windows.Forms.CheckBox(); this.cmbPeriod = new System.Windows.Forms.ComboBox();
this.pnlTop.SuspendLayout(); this.pnlTop.SuspendLayout();
this.pnlLeft.SuspendLayout(); this.pnlLeft.SuspendLayout();
this.gpbLog.SuspendLayout(); this.gpbLog.SuspendLayout();
...@@ -100,7 +101,7 @@ ...@@ -100,7 +101,7 @@
this.lstProject.RightToLeft = System.Windows.Forms.RightToLeft.No; this.lstProject.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.lstProject.RightToLeftLayout = true; this.lstProject.RightToLeftLayout = true;
this.lstProject.ShowGroups = false; this.lstProject.ShowGroups = false;
this.lstProject.Size = new System.Drawing.Size(672, 231); this.lstProject.Size = new System.Drawing.Size(1024, 231);
this.lstProject.TabIndex = 10; this.lstProject.TabIndex = 10;
this.lstProject.UseCompatibleStateImageBehavior = false; this.lstProject.UseCompatibleStateImageBehavior = false;
this.lstProject.View = System.Windows.Forms.View.List; this.lstProject.View = System.Windows.Forms.View.List;
...@@ -112,12 +113,13 @@ ...@@ -112,12 +113,13 @@
this.lblNotes.Location = new System.Drawing.Point(0, 289); this.lblNotes.Location = new System.Drawing.Point(0, 289);
this.lblNotes.Name = "lblNotes"; this.lblNotes.Name = "lblNotes";
this.lblNotes.Padding = new System.Windows.Forms.Padding(12, 8, 0, 0); this.lblNotes.Padding = new System.Windows.Forms.Padding(12, 8, 0, 0);
this.lblNotes.Size = new System.Drawing.Size(672, 52); this.lblNotes.Size = new System.Drawing.Size(1024, 52);
this.lblNotes.TabIndex = 11; this.lblNotes.TabIndex = 11;
this.lblNotes.Text = "注意:本工具只打包项目设定文件夹内通用文件。。。。。详细内容见源代码"; this.lblNotes.Text = "注意:本工具只打包项目设定文件夹内通用文件。。。。。详细内容见源代码";
// //
// pnlTop // pnlTop
// //
this.pnlTop.Controls.Add(this.cmbPeriod);
this.pnlTop.Controls.Add(this.ckbMergeSql); this.pnlTop.Controls.Add(this.ckbMergeSql);
this.pnlTop.Controls.Add(this.ckbShowLog); this.pnlTop.Controls.Add(this.ckbShowLog);
this.pnlTop.Controls.Add(this.ckbDelHisPack); this.pnlTop.Controls.Add(this.ckbDelHisPack);
...@@ -130,9 +132,21 @@ ...@@ -130,9 +132,21 @@
this.pnlTop.Location = new System.Drawing.Point(0, 0); this.pnlTop.Location = new System.Drawing.Point(0, 0);
this.pnlTop.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.pnlTop.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.pnlTop.Name = "pnlTop"; this.pnlTop.Name = "pnlTop";
this.pnlTop.Size = new System.Drawing.Size(672, 58); this.pnlTop.Size = new System.Drawing.Size(1024, 58);
this.pnlTop.TabIndex = 12; this.pnlTop.TabIndex = 12;
// //
// ckbMergeSql
//
this.ckbMergeSql.AutoSize = true;
this.ckbMergeSql.BackColor = System.Drawing.SystemColors.Control;
this.ckbMergeSql.ForeColor = System.Drawing.Color.Blue;
this.ckbMergeSql.Location = new System.Drawing.Point(573, 33);
this.ckbMergeSql.Name = "ckbMergeSql";
this.ckbMergeSql.Size = new System.Drawing.Size(93, 21);
this.ckbMergeSql.TabIndex = 14;
this.ckbMergeSql.Text = "合并Sql脚本";
this.ckbMergeSql.UseVisualStyleBackColor = false;
//
// ckbShowLog // ckbShowLog
// //
this.ckbShowLog.AutoSize = true; this.ckbShowLog.AutoSize = true;
...@@ -164,7 +178,7 @@ ...@@ -164,7 +178,7 @@
// //
this.btnOpenDirectory.BackColor = System.Drawing.SystemColors.Control; this.btnOpenDirectory.BackColor = System.Drawing.SystemColors.Control;
this.btnOpenDirectory.ForeColor = System.Drawing.SystemColors.WindowText; this.btnOpenDirectory.ForeColor = System.Drawing.SystemColors.WindowText;
this.btnOpenDirectory.Location = new System.Drawing.Point(486, 3); this.btnOpenDirectory.Location = new System.Drawing.Point(486, 4);
this.btnOpenDirectory.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.btnOpenDirectory.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.btnOpenDirectory.Name = "btnOpenDirectory"; this.btnOpenDirectory.Name = "btnOpenDirectory";
this.btnOpenDirectory.Size = new System.Drawing.Size(81, 27); this.btnOpenDirectory.Size = new System.Drawing.Size(81, 27);
...@@ -194,7 +208,7 @@ ...@@ -194,7 +208,7 @@
this.pnlLeft.Dock = System.Windows.Forms.DockStyle.Fill; this.pnlLeft.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlLeft.Location = new System.Drawing.Point(0, 0); this.pnlLeft.Location = new System.Drawing.Point(0, 0);
this.pnlLeft.Name = "pnlLeft"; this.pnlLeft.Name = "pnlLeft";
this.pnlLeft.Size = new System.Drawing.Size(672, 341); this.pnlLeft.Size = new System.Drawing.Size(1024, 341);
this.pnlLeft.TabIndex = 13; this.pnlLeft.TabIndex = 13;
// //
// gpbLog // gpbLog
...@@ -217,25 +231,22 @@ ...@@ -217,25 +231,22 @@
this.txtLog.Size = new System.Drawing.Size(346, 319); this.txtLog.Size = new System.Drawing.Size(346, 319);
this.txtLog.TabIndex = 0; this.txtLog.TabIndex = 0;
// //
// ckbMergeSql // cmbPeriod
// //
this.ckbMergeSql.AutoSize = true; this.cmbPeriod.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.ckbMergeSql.BackColor = System.Drawing.SystemColors.Control; this.cmbPeriod.FormattingEnabled = true;
this.ckbMergeSql.ForeColor = System.Drawing.Color.Blue; this.cmbPeriod.Location = new System.Drawing.Point(573, 4);
this.ckbMergeSql.Location = new System.Drawing.Point(573, 33); this.cmbPeriod.Name = "cmbPeriod";
this.ckbMergeSql.Name = "ckbMergeSql"; this.cmbPeriod.Size = new System.Drawing.Size(90, 25);
this.ckbMergeSql.Size = new System.Drawing.Size(93, 21); this.cmbPeriod.TabIndex = 15;
this.ckbMergeSql.TabIndex = 14;
this.ckbMergeSql.Text = "合并Sql脚本";
this.ckbMergeSql.UseVisualStyleBackColor = false;
// //
// FrmMain // FrmMain
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1024, 341); this.ClientSize = new System.Drawing.Size(1024, 341);
this.Controls.Add(this.pnlLeft);
this.Controls.Add(this.gpbLog); this.Controls.Add(this.gpbLog);
this.Controls.Add(this.pnlLeft);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
...@@ -268,8 +279,9 @@ ...@@ -268,8 +279,9 @@
private System.Windows.Forms.Panel pnlLeft; private System.Windows.Forms.Panel pnlLeft;
private System.Windows.Forms.CheckBox ckbShowLog; private System.Windows.Forms.CheckBox ckbShowLog;
private System.Windows.Forms.GroupBox gpbLog; private System.Windows.Forms.GroupBox gpbLog;
private System.Windows.Forms.TextBox txtLog;
private System.Windows.Forms.CheckBox ckbMergeSql; private System.Windows.Forms.CheckBox ckbMergeSql;
private System.Windows.Forms.ComboBox cmbPeriod;
private System.Windows.Forms.TextBox txtLog;
} }
} }
...@@ -30,13 +30,11 @@ namespace Ftt.PatchPack ...@@ -30,13 +30,11 @@ namespace Ftt.PatchPack
new ToolTip().SetToolTip(ckbMergeSql, "合并未使用Use XX指令的脚本,Use指令的脚本文件独立存在并间隔合并操作。"); new ToolTip().SetToolTip(ckbMergeSql, "合并未使用Use XX指令的脚本,Use指令的脚本文件独立存在并间隔合并操作。");
} }
private void FrmMain_Load(object sender, EventArgs e) private void FrmMain_Load(object sender, EventArgs e)
{ {
InitForm(); InitForm();
} }
private void InitForm() private void InitForm()
{ {
LogVisible(false); LogVisible(false);
...@@ -47,9 +45,39 @@ namespace Ftt.PatchPack ...@@ -47,9 +45,39 @@ namespace Ftt.PatchPack
{ {
lstProject.Items.Add(cli.Key); lstProject.Items.Add(cli.Key);
} }
InitCmbPeriod();
} }
#region 打包周期
/// <summary>
/// 初始化打包周期
/// </summary>
private void InitCmbPeriod()
{
Dictionary<int, string> dic = new Dictionary<int, string>
{
{ 0, "默认" },
{ 30, "30天" },
{ 45, "45天" },
{ 60, "2个月" },
{ 90, "3个月" }
};
cmbPeriod.DataSource = new BindingSource(dic, null);
cmbPeriod.DisplayMember = "Value";
cmbPeriod.ValueMember = "Key";
cmbPeriod.SelectedValueChanged += CmbPeriod_SelectedValueChanged;
}
/// <summary>
/// 选择打包周期
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void CmbPeriod_SelectedValueChanged(object sender, EventArgs e)
{
Project.SetPatchTime((int)cmbPeriod.SelectedValue);
}
#endregion
#region 按钮操作 #region 按钮操作
...@@ -192,7 +220,6 @@ namespace Ftt.PatchPack ...@@ -192,7 +220,6 @@ namespace Ftt.PatchPack
#endregion #endregion
#region 内部方法 #region 内部方法
private void LogVisible(bool visible) private void LogVisible(bool visible)
......
...@@ -90,9 +90,9 @@ namespace Ftt.PatchPack ...@@ -90,9 +90,9 @@ namespace Ftt.PatchPack
//添加默认配置 //添加默认配置
config.AppSettings.Settings.Add("ExceptFiles", ""); config.AppSettings.Settings.Add("ExceptFiles", "");
config.AppSettings.Settings.Add("ContainFiles", ""); config.AppSettings.Settings.Add("ContainFiles", "");
config.AppSettings.Settings.Add("PatchTimeFrame_Dll", "48"); config.AppSettings.Settings.Add("PatchTimeFrame_Dll", PatchTimeFrame_Dll.ToString());
config.AppSettings.Settings.Add("PatchTimeFrame_Sql", "720"); config.AppSettings.Settings.Add("PatchTimeFrame_Sql", PatchTimeFrame_Sql.ToString());
config.AppSettings.Settings.Add("PatchTimeFrame_Xml", "720"); config.AppSettings.Settings.Add("PatchTimeFrame_Xml", PatchTimeFrame_Xml.ToString());
config.AppSettings.Settings.Add("Exclude_PDB", "1"); config.AppSettings.Settings.Add("Exclude_PDB", "1");
//保存配置文件 //保存配置文件
config.Save(ConfigurationSaveMode.Modified); config.Save(ConfigurationSaveMode.Modified);
...@@ -114,9 +114,7 @@ namespace Ftt.PatchPack ...@@ -114,9 +114,7 @@ namespace Ftt.PatchPack
foreach (var file in files) if (!ContainFiles.Contains(file)) ContainFiles.Add(file); foreach (var file in files) if (!ContainFiles.Contains(file)) ContainFiles.Add(file);
} }
Int32.TryParse(ConfigurationManager.AppSettings["PatchTimeFrame_Dll"], out PatchTimeFrame_Dll); SetPatchTime();
Int32.TryParse(ConfigurationManager.AppSettings["PatchTimeFrame_Sql"], out PatchTimeFrame_Sql);
Int32.TryParse(ConfigurationManager.AppSettings["PatchTimeFrame_Xml"], out PatchTimeFrame_Xml);
Int32.TryParse(ConfigurationManager.AppSettings["Exclude_PDB"], out int _exclude_PDB); //是否包含pdb文件 Int32.TryParse(ConfigurationManager.AppSettings["Exclude_PDB"], out int _exclude_PDB); //是否包含pdb文件
if (_exclude_PDB == 1) Exclude_PDB = true; if (_exclude_PDB == 1) Exclude_PDB = true;
} }
...@@ -217,6 +215,49 @@ namespace Ftt.PatchPack ...@@ -217,6 +215,49 @@ namespace Ftt.PatchPack
return MergeSqlFile ? MergeSql(valid) : valid; return MergeSqlFile ? MergeSql(valid) : valid;
} }
/// <summary>
/// 设置打包时间
/// </summary>
/// <param name="dayDll">Dll文件打包周期,单位:天</param>
/// <param name="daySql">Sql文件打包周期,单位:天</param>
/// <param name="dayXml">Xml文件打包周期,单位:天</param>
public static void SetPatchTime(int dayDll, int daySql, int dayXml)
{
if (dayDll <= 0 || daySql <= 0 || dayXml <= 0)
{
SetPatchTime();
}
else
{
PatchTimeFrame_Xml = 24 * dayXml;
PatchTimeFrame_Sql = 24 * daySql;
PatchTimeFrame_Dll = 24 * dayDll;
}
}
/// <summary>
/// 设置打包时间
/// </summary>
/// <param name="day">文件打包周期,单位:天</param>
public static void SetPatchTime(int day)
{
SetPatchTime(day, day, day);
}
/// <summary>
/// 设置打包时间,默认从配置文件读取
/// </summary>
public static void SetPatchTime()
{
Int32.TryParse(ConfigurationManager.AppSettings["PatchTimeFrame_Dll"], out PatchTimeFrame_Dll);
Int32.TryParse(ConfigurationManager.AppSettings["PatchTimeFrame_Sql"], out PatchTimeFrame_Sql);
Int32.TryParse(ConfigurationManager.AppSettings["PatchTimeFrame_Xml"], out PatchTimeFrame_Xml);
}
#endregion
#region 私有方法
/// <summary> /// <summary>
/// 获取据库脚本补丁,返回有效的文件夹,一个月以内 /// 获取据库脚本补丁,返回有效的文件夹,一个月以内
/// </summary> /// </summary>
...@@ -292,10 +333,6 @@ namespace Ftt.PatchPack ...@@ -292,10 +333,6 @@ namespace Ftt.PatchPack
return mergeSqlFiles; return mergeSqlFiles;
} }
#endregion
#region 私有方法
/// <summary> /// <summary>
/// 获取有效的打包文件列表 /// 获取有效的打包文件列表
/// </summary> /// </summary>
......
...@@ -932,7 +932,7 @@ namespace Tools.MyUtils ...@@ -932,7 +932,7 @@ namespace Tools.MyUtils
//列名与类型 //列名与类型
var FieldName = r["FieldName"].ToString(); var FieldName = r["FieldName"].ToString();
var ColumnType = r["ColumnType"].ToString(); var ColumnType = r["ColumnType"].ToString();
columninfo = $"{FieldName} {ColumnType}"; columninfo = $"[{FieldName}] {ColumnType}"; //兼容列名中包含系统关键字的情况 2025-02-28 11:06:53 lxj
//是否为空 //是否为空
var IsNotNull = r["IsNotNull"] == DBNull.Value ? false : (bool)r["IsNotNull"]; var IsNotNull = r["IsNotNull"] == DBNull.Value ? false : (bool)r["IsNotNull"];
columninfo += IsNotNull ? " NOT NULL" : " NULL"; columninfo += IsNotNull ? " NOT NULL" : " NULL";
......
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