Commit 7dd0be7c authored by tr's avatar tr

1、数据库开发工具:配置界面优化

parent a0fbe3d3
......@@ -112,6 +112,7 @@
//
this.tbDocExportPath.Location = new System.Drawing.Point(162, 90);
this.tbDocExportPath.Name = "tbDocExportPath";
this.tbDocExportPath.ReadOnly = true;
this.tbDocExportPath.Size = new System.Drawing.Size(179, 21);
this.tbDocExportPath.TabIndex = 5;
//
......@@ -119,6 +120,7 @@
//
this.tbSqlExportPath.Location = new System.Drawing.Point(162, 62);
this.tbSqlExportPath.Name = "tbSqlExportPath";
this.tbSqlExportPath.ReadOnly = true;
this.tbSqlExportPath.Size = new System.Drawing.Size(179, 21);
this.tbSqlExportPath.TabIndex = 4;
//
......@@ -126,6 +128,7 @@
//
this.tbModelExportPath.Location = new System.Drawing.Point(162, 34);
this.tbModelExportPath.Name = "tbModelExportPath";
this.tbModelExportPath.ReadOnly = true;
this.tbModelExportPath.Size = new System.Drawing.Size(179, 21);
this.tbModelExportPath.TabIndex = 3;
//
......
......@@ -14,11 +14,17 @@ using Tools.MyUtils;
namespace Tools.MyUtils
{
/// <summary>
/// 系统配置
/// </summary>
public partial class wSysSetting : wBasic
{
DataTable dtSetting = null;
DbItemModel LinkModel = null;
/// <summary>
/// 系统配置-构造函数
/// </summary>
public wSysSetting()
{
InitializeComponent();
......@@ -26,6 +32,11 @@ namespace Tools.MyUtils
this.DialogResult = DialogResult.None;
}
/// <summary>
/// 事件:窗体加载
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void wSysSetting_Load(object sender, EventArgs e)
{
//读取设置信息
......@@ -46,6 +57,11 @@ namespace Tools.MyUtils
this.btnSave.Click += BtnSave_Click;
}
/// <summary>
/// 按钮事件:选择数据库
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void BtnSelectDbLink_Click(object sender, EventArgs e)
{
var frm = new wDbSetting();
......@@ -55,31 +71,38 @@ namespace Tools.MyUtils
this.tbDefaultLink.Text = this.LinkModel.ToString();
}
}
/// <summary>
/// 按钮事件:选择Model导出路径
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void BtnSelectModelPath_Click(object sender, EventArgs e)
{
var frm = new FolderBrowserDialog();
if (frm.ShowDialog() == DialogResult.OK)
{
this.tbModelExportPath.Text = frm.SelectedPath;
}
this.SelectPath(this.tbModelExportPath);
}
/// <summary>
/// 按钮事件:选择Sql导出路径
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void BtnSelectSqlPath_Click(object sender, EventArgs e)
{
var frm = new FolderBrowserDialog();
if (frm.ShowDialog() == DialogResult.OK)
{
this.tbSqlExportPath.Text = frm.SelectedPath;
}
this.SelectPath(this.tbSqlExportPath);
}
/// <summary>
/// 按钮事件:选择Excel/Word导出路径
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void BtnSelectDocPath_Click(object sender, EventArgs e)
{
var frm = new FolderBrowserDialog();
if (frm.ShowDialog() == DialogResult.OK)
{
this.tbDocExportPath.Text = frm.SelectedPath;
}
this.SelectPath(this.tbDocExportPath);
}
/// <summary>
/// 按钮事件:保存配置
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void BtnSave_Click(object sender, EventArgs e)
{
//将设置写入结构表
......@@ -92,6 +115,12 @@ namespace Tools.MyUtils
this.DialogResult = DialogResult.OK;
}
/// <summary>
/// 获取指定配置值
/// </summary>
/// <param name="dt"></param>
/// <param name="name"></param>
/// <returns></returns>
private string GetValue(DataTable dt, string name)
{
var result = "";
......@@ -102,6 +131,12 @@ namespace Tools.MyUtils
}
return result;
}
/// <summary>
/// 设置指定配置值
/// </summary>
/// <param name="dt"></param>
/// <param name="name"></param>
/// <param name="value"></param>
private void SetValue(DataTable dt, string name, string value)
{
var rows = dt.Select($"Name='{name}'");
......@@ -111,6 +146,19 @@ namespace Tools.MyUtils
rows[0].EndEdit();
}
}
/// <summary>
/// 选择路径并赋值到文本框
/// </summary>
/// <param name="tb"></param>
private void SelectPath(TextBox tb)
{
var frm = new FolderBrowserDialog();
if (frm.ShowDialog() == DialogResult.OK)
{
tb.Text = frm.SelectedPath;
}
}
}
}
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