Commit cb4c901d authored by 段廷瑞's avatar 段廷瑞

1、任务看板:增加双击查看详情;行颜色渲染优化

parent 62ddd31c
......@@ -3,7 +3,7 @@
<appSettings>
<add key="LoginInfo" value="wwF/xpBzWek=" />
<add key="LoginVerify" value="v86f5Q3Xa7U=" />
<add key="UpdateTime" value="2021-11-20 17:58:10.043" />
<add key="UpdateTime" value="2021-11-26 14:21:49.650" />
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
......
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset = "utf-8" />
</head>
<body>
<p>[describle]</p>
</body>
</html>
\ No newline at end of file
......@@ -130,6 +130,15 @@ namespace Tools.MyData
{
return this._db.IsExist(this._link, strSql);
}
/// <summary>
/// 执行并返回首个对象
/// </summary>
/// <param name="strSql"></param>
/// <returns></returns>
public object ExecScalar(string strSql)
{
return this._db.ExecScalar(this._link, strSql);
}
#region async methods
......
......@@ -432,6 +432,46 @@ namespace Tools.MyData
return iCount > 0;
}
/// <summary>
/// 执行SQL,并返回首个对象
/// </summary>
/// <param name="strLink"></param>
/// <param name="strSql"></param>
/// <returns></returns>
public object ExecScalar(string strLink, string strSql)
{
object result = null;
SqlConnection conn = null;
SqlTransaction tran = null;
try
{
conn = new SqlConnection(strLink);
conn.Open();
tran = conn.BeginTransaction();//开始事务
var cmd = new SqlCommand();
cmd.Connection = conn;//绑定连接
cmd.Transaction = tran;//绑定事务
cmd.CommandText = strSql;
cmd.CommandType = CommandType.Text;
result = cmd.ExecuteScalar();
//提交事务
tran.Commit();
}
catch (Exception ex)
{
if (tran != null)
tran.Rollback();
throw (new Exception("执行SQL出错:\r\n" + ex.Message));
}
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
}
return result;
}
#region async methods
......
......@@ -3,6 +3,7 @@ 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;
......@@ -10,6 +11,7 @@ using System.Windows.Forms;
//
using Tools.MyCommon;
using Tools.MyData;
using Tools.MyUtils;
namespace Tools.UI
{
......@@ -18,6 +20,10 @@ namespace Tools.UI
DBHelper _db = null;
DataTable _dt = null;
wBasic frmView = null;
WebBrowser _browser = null;
string _html = "";
string ProjectName => this.cbProjectName.Text;
string InChargeUser => this.cbInChargeUser.Text;
string TaskState => this.cbTaskState.Text;
......@@ -41,7 +47,16 @@ namespace Tools.UI
}
private void wTaskBoard_Shown(object sender, EventArgs e)
{
//初始化单元格背景
this.SetGridForeColor();
//双击查看任务明细初始化
this._html = File.ReadAllText($@"{Utils.TestPath}\TaskDetail.html");
this.frmView = new wBasic() { BackColor = Color.White, Size = new Size(600, 400) };
this._browser = new WebBrowser() { Parent = this.frmView, Dock = DockStyle.Fill };
this.frmView.FormClosing += FrmView_FormClosing;
//表格事件
this.dataGridView1.Sorted += DataGridView1_Sorted;
this.dataGridView1.DoubleClick += DataGridView1_DoubleClick;
}
/// <summary>
......@@ -125,7 +140,44 @@ namespace Tools.UI
//附加过滤条件
this.cb_SelectedIndexChanged(null, null);
}
//表格事件:排序后,重新渲染表格颜色
private void DataGridView1_Sorted(object sender, EventArgs e)
{
this.SetGridForeColor();
}
//表格事件:双击查看任务详情
private void DataGridView1_DoubleClick(object sender, EventArgs e)
{
if (this.dataGridView1.CurrentRow == null)
return;
var index = this.dataGridView1.CurrentRow.Index;
if (index < 0)
return;
//显示详情
this.ShowDetail(this._dt.DefaultView[index].Row);
}
//拦截窗口关闭事件
private void FrmView_FormClosing(object sender, FormClosingEventArgs e)
{
this.frmView.Visible = false;
e.Cancel = true;
}
/// <summary>
/// 显示任务详情
/// </summary>
/// <param name="text"></param>
private void ShowDetail(DataRow drNow)
{
if (drNow == null)
return;
var taskID = (int)drNow["TaskID"];
var content = this._db.ExecScalar($"select Describe from PM_Task where ID = {taskID}");
if (content == null)
return;
this._browser.DocumentText = this._html.Replace("<p>[describle]</p>", content.ToString());
this.frmView.Text = $"[{drNow["项目名称"]}]{drNow["需求内容"]}";
this.frmView.Show();
}
}
}
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