Commit 8b1cccb7 authored by 罗显健's avatar 罗显健
parents 93ea7fd9 e20bde6e
...@@ -35,3 +35,4 @@ bin ...@@ -35,3 +35,4 @@ bin
/packages/CefSharp.Common.92.0.251 /packages/CefSharp.Common.92.0.251
/packages/CefSharp.WinForms.92.0.251/lib/net452 /packages/CefSharp.WinForms.92.0.251/lib/net452
/packages/CefSharp.WinForms.92.0.251 /packages/CefSharp.WinForms.92.0.251
/AppHome/project.json
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<appSettings> <appSettings>
<add key="UpdateTime" value="2021-09-16 14:24:34.777" /> <add key="LoginInfo" value="wwF/xpBzWek=" />
<add key="LoginVerify" value="v86f5Q3Xa7U=" />
<add key="UpdateTime" value="2021-11-26 14:21:49.650" />
</appSettings> </appSettings>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup> </startup>
<runtime> <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="ICSharpCode.SharpZipLib" publicKeyToken="1b03e6acf1164f73" culture="neutral"/> <assemblyIdentity name="ICSharpCode.SharpZipLib" publicKeyToken="1b03e6acf1164f73" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.2.10" newVersion="1.3.2.10"/> <bindingRedirect oldVersion="0.0.0.0-1.3.2.10" newVersion="1.3.2.10" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CefSharp.Core.Runtime" processorArchitecture="x86" publicKeyToken="40c4b6fc221f4138" culture="neutral"/>
<codeBase version="92.0.251.0" href="x86/CefSharp.Core.Runtime.dll"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CefSharp.Core.Runtime" processorArchitecture="amd64" publicKeyToken="40c4b6fc221f4138" culture="neutral"/>
<codeBase version="92.0.251.0" href="x64/CefSharp.Core.Runtime.dll"/>
</dependentAssembly> </dependentAssembly>
</assemblyBinding> </assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/> <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0"/> <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly> </dependentAssembly>
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>
......
...@@ -84,4 +84,16 @@ ...@@ -84,4 +84,16 @@
<UserId>sa</UserId> <UserId>sa</UserId>
<Pwd>a*1</Pwd> <Pwd>a*1</Pwd>
</links> </links>
<links>
<Link>192.168.1.202</Link>
<DbName>FTT_LN_210716</DbName>
<UserId>sa</UserId>
<Pwd>sa</Pwd>
</links>
<links>
<Link>27.154.225.54,49296</Link>
<DbName>FTT_U6</DbName>
<UserId>sa</UserId>
<Pwd>a*1</Pwd>
</links>
</DocumentElement> </DocumentElement>
\ No newline at end of file
<!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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
//
using Tools.MyCommon;
using Tools.MyData;
using Tools.MyUtils;
namespace Tools
{
/// <summary>
/// 日志
/// </summary>
public class Log
{
/// <summary>
/// 数据库访问对象
/// </summary>
private static DBHelper _db = new DBHelper(Utils.GetDbLinkString204("FTT_Work"));
/// <summary>
/// 锁
/// </summary>
private static object _locker = new object();
/// <summary>
/// 记录操作日志
/// </summary>
/// <param name="action"></param>
public static void Write(string action)
{
lock (_locker)
{
try
{
var sql = $@"
INSERT INTO dbo.FTT_ToolPlatformLog ( UserName, ActionName, OccurTime, TOKEN )
VALUES ( '{LoginInfo.UserName}', '{action}', GETDATE(), '{APP.TOKEN}')";
_db?.ExecNonSql(sql);
}
finally
{
Monitor.Pulse(_locker); //释放锁
}
}
}
}
}
...@@ -6,10 +6,66 @@ using System.Threading.Tasks; ...@@ -6,10 +6,66 @@ using System.Threading.Tasks;
namespace Tools.MyCommon namespace Tools.MyCommon
{ {
/*
* 应用静态信息
*/
/// <summary>
/// 应用静态字段
/// </summary>
public class APP
{
/// <summary>
/// 登录信息
/// </summary>
public static string LOGIN_INFO => "LoginInfo";
/// <summary>
/// 登录验证
/// </summary>
public static string LOGIN_VERIFY => "LoginVerify";
/// <summary>
/// 更新时间
/// </summary>
public static string UPDATE_TIME => "UpdateTime";
/// <summary>
/// 临时用户名
/// </summary>
public static string TEMP_USER_NAME = "访客";
/// <summary>
/// 操作标识
/// </summary>
public static string TOKEN { get; set; }
}
/* /*
* Info : 全局的基础信息 * Info : 全局的基础信息
*/ */
/// <summary>
/// 用户信息
/// </summary>
public static class LoginInfo
{
/// <summary>
/// 用户名
/// </summary>
public static string UserName { get; set; } = APP.TEMP_USER_NAME;
/// <summary>
/// 密码
/// </summary>
public static string Password { get; set; }
/// <summary>
/// 是否部门负责人
/// </summary>
public static bool IsPrincipal { get; set; } = false;
/// <summary>
/// 是否公司员工
/// </summary>
public static bool IsStaff { get; set; } = false;
}
/// <summary> /// <summary>
/// 模块信息:菜单渲染时使用 /// 模块信息:菜单渲染时使用
/// </summary> /// </summary>
......
namespace Tools.MyCommon.controls
{
partial class TabControlEx
{
/// <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 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
this.ResumeLayout(false);
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Tools.MyCommon.controls
{
/// <summary>
/// Tab控件扩展
/// </summary>
[ToolboxBitmap(typeof(TabControl)), Description("选项卡")]
public partial class TabControlEx : TabControl
{
/// <summary>
/// [构造] Tab控件扩展
/// </summary>
public TabControlEx()
{
InitializeComponent();
//绘制样式
this.SetStyle(
ControlStyles.UserPaint //控件将自行绘制,而不是通过操作系统来绘制,重写OnPaint()方法
| ControlStyles.OptimizedDoubleBuffer //该控件首先在缓冲区中绘制,而不是直接绘制到屏幕上,这样可以减少闪烁
| ControlStyles.AllPaintingInWmPaint //控件将忽略 WM_ERASEBKGND 窗口消息以减少闪烁
| ControlStyles.ResizeRedraw //在调整控件大小时重绘控件
| ControlStyles.SupportsTransparentBackColor //控件接受 alpha 组件小于 255 的 BackColor 以模拟透明
, true);
//默认微软雅黑, 9 号字体
this.Font = new Font("微软雅黑", 9);
}
/// <summary>
/// 控件-背景色
/// </summary>
public Color BackgroundColor { get; set; } = Color.White;
/// <summary>
/// 激活标签-背景色
/// </summary>
public Color TabActivedBackColor { get; set; } = Color.FromArgb(41, 101, 204);
/// <summary>
/// 非激活标签-背景色
/// </summary>
public Color TabDeactivedBackColor { get; set; } = Color.FromArgb(246, 247, 254);
/// <summary>
/// 非激活标签-鼠标悬停背景色
/// </summary>
public Color TabDeactivedBackColorHover { get; set; } = Color.LightGreen;
/// <summary>
/// 激活标签-字体颜色
/// </summary>
public Color TabActivedFontColor { get; set; } = Color.FromArgb(250, 250, 250);
/// <summary>
/// 非激活标签-字体颜色
/// </summary>
public Color TabDeactivedFontColor { get; set; } = Color.FromArgb(55, 55, 55);
/// <summary>
/// 非激活标签-鼠标滑过字体颜色
/// </summary>
public Color TabDeactivedFontColorHover { get; set; } = Color.FromArgb(55, 55, 55);
/// <summary>
/// 标签-文本格式
/// </summary>
StringFormat fmt = new StringFormat {
Alignment = StringAlignment.Center,
LineAlignment = StringAlignment.Center
};
/// <summary>
/// 重写:绘制背景
/// </summary>
/// <param name="e"></param>
protected override void OnPaintBackground(PaintEventArgs e)
{
var g = e.Graphics;
//绘制控件背景
var brush = new SolidBrush(this.BackgroundColor);
g.FillRectangle(brush, e.ClipRectangle);
//扩展:绘制肩线(仅绘制一次:用以突出选中效果)
Rectangle client = this.ClientRectangle;
var x = client.X;
var y = client.Y + this.ItemSize.Height + 2;
var location = new Point(x + 2, y); //左右各留2像素
var size = new Size(client.Width - 3, 2);
var shoulder = new Rectangle(location, size);
var shoulderBrush = new SolidBrush(this.TabActivedBackColor); //肩线为激活颜色
g.FillRectangle(shoulderBrush, shoulder);
}
/// <summary>
/// 重写:绘制方法
/// </summary>
/// <param name="e"></param>
protected override void OnPaint(PaintEventArgs e)
{
var g = e.Graphics;
var pos = this.PointToClient(Cursor.Position); //光标位置,用于悬停判断
//绘制标签项
for (int index = 0; index < this.TabPages.Count; index++)
{
var tabRect = this.GetTabRect(index);
var isHover = tabRect.Contains(pos);
//选中颜色设定
var IsSelected = this.SelectedIndex.Equals(index);
var BackColor = IsSelected ? TabActivedBackColor : isHover ? TabDeactivedBackColorHover : TabDeactivedBackColor;
var FontColor = IsSelected ? TabActivedFontColor : isHover ? TabDeactivedFontColorHover : TabDeactivedFontColor;
//画笔、画刷准备
var backBrush = new SolidBrush(BackColor);
var fontBrush = new SolidBrush(FontColor);
//绘制并填充矩形框:背景
g.FillRectangle(backBrush, tabRect);
//绘制标题
var title = this.TabPages[index].Text;
g.DrawString(title, this.Font, fontBrush, tabRect, this.fmt);
}
//扩展:绘制标签项边框线(每轮绘制一次:用以突出选中效果)
this.DrawTabsBorder(g);
}
/// <summary>
/// 绘制所有标签边框
/// </summary>
/// <param name="g"></param>
private void DrawTabsBorder(Graphics g)
{
//先绘制未选中标签
for (int index = 0; index < this.TabPages.Count; index++)
{
if (index == this.SelectedIndex)
continue;
this.DrawTabRectBorder(g, index);
}
//最后绘制选中标签
this.DrawTabRectBorder(g, this.SelectedIndex, true);
}
/// <summary>
/// 绘制单个标签边框
/// </summary>
/// <param name="g"></param>
/// <param name="rect"></param>
/// <param name="pen"></param>
private void DrawTabRectBorder(Graphics g, int index, bool isSelected = false)
{
if (index < 0)
return;
var rect = this.GetTabRect(index);
var apex = this.GetRectApex(rect, 0);
//绘制框线:上、左、右
var color = isSelected ? TabActivedBackColor : BackgroundColor;
var pen = new Pen(color) { Width = 1 };
g.DrawLine(pen, apex.TopLeft, apex.TopRight); //上框线
g.DrawLine(pen, apex.TopLeft, new Point(apex.BtmLeft.X, apex.BtmLeft.Y - 1)); //左框线 : 剪短1像素,避免刺到肩线
g.DrawLine(pen, apex.TopRight, new Point(apex.BtmRight.X, apex.BtmRight.Y - 1)); //右框线
}
/// <summary>
/// 获取矩形框的顶点
/// </summary>
/// <param name="rect">矩形框</param>
/// <param name="padding">内边距</param>
/// <param name="topLeft"></param>
/// <param name="topRight"></param>
/// <param name="btmLeft"></param>
/// <param name="btmRight"></param>
private dynamic GetRectApex(Rectangle rect, int padding)
{
//内边距不能小于0
padding = Math.Max(0, padding);
//获取坐标位置
var left_x = rect.X + padding;
var left_y = rect.Y + padding;
var right_x = left_x + rect.Width - padding * 2;
var right_y = left_y + rect.Height - padding * 2;
//获取顶点位置
return new {
TopLeft = new Point(left_x, left_y),
TopRight = new Point(right_x, left_y),
BtmLeft = new Point(left_x, right_y),
BtmRight = new Point(right_x, right_y),
};
}
}
}
<?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>
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>
\ No newline at end of file
...@@ -253,7 +253,22 @@ namespace Tools.MyCommon ...@@ -253,7 +253,22 @@ namespace Tools.MyCommon
#endregion #endregion
#region 通用:控件初始化
/// <summary>
/// 初始化表格控件
/// </summary>
/// <param name="dgv"></param>
public void InitGridView(DataGridView dgv, bool isMultiSelect, bool isReadOnly)
{
dgv.ReadOnly = isReadOnly;
dgv.MultiSelect = isMultiSelect;
dgv.AutoGenerateColumns = false;
dgv.AllowUserToAddRows = false;
dgv.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
}
#endregion
} }
} }
...@@ -130,6 +130,15 @@ namespace Tools.MyData ...@@ -130,6 +130,15 @@ namespace Tools.MyData
{ {
return this._db.IsExist(this._link, strSql); 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 #region async methods
......
...@@ -432,6 +432,46 @@ namespace Tools.MyData ...@@ -432,6 +432,46 @@ namespace Tools.MyData
return iCount > 0; 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 #region async methods
......
...@@ -5,12 +5,8 @@ using System.Data; ...@@ -5,12 +5,8 @@ using System.Data;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Net;
using System.Net.Http;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Text; using System.Text;
using System.Threading.Tasks;
using System.Web;
// //
using System.Windows.Forms; using System.Windows.Forms;
...@@ -205,7 +201,7 @@ namespace Tools.MyUtils ...@@ -205,7 +201,7 @@ namespace Tools.MyUtils
} }
#endregion #endregion
#region 选择文件 #region 选择文件/路径
/// <summary> /// <summary>
/// 选择文件 /// 选择文件
...@@ -230,6 +226,25 @@ namespace Tools.MyUtils ...@@ -230,6 +226,25 @@ namespace Tools.MyUtils
} }
return result; return result;
} }
/// <summary>
/// 选择文件夹
/// </summary>
/// <returns></returns>
public static string SelectFolder()
{
var result = "";
var dlg = new FolderBrowserDialog()
{
Description = "请选择一个文件夹",
RootFolder = Environment.SpecialFolder.MyComputer,
ShowNewFolderButton = false,
};
if (dlg.ShowDialog() == DialogResult.OK)
{
result = dlg.SelectedPath;
}
return result;
}
#endregion #endregion
#region 检查文件大小 #region 检查文件大小
...@@ -267,6 +282,17 @@ namespace Tools.MyUtils ...@@ -267,6 +282,17 @@ namespace Tools.MyUtils
var result = MessageBox.Show(msg, "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); var result = MessageBox.Show(msg, "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
return result == DialogResult.Yes; return result == DialogResult.Yes;
} }
/// <summary>
/// 异常提示
/// </summary>
/// <param name="e"></param>
public static void TipException(Exception e)
{
if (e != null)
{
Tip($"错误消息:{e.Message}\r\n调用堆栈:\r\n{e.StackTrace}", 600, 400);
}
}
/// <summary> /// <summary>
/// 显示帮助信息 /// 显示帮助信息
......
...@@ -5,6 +5,8 @@ using System.IO; ...@@ -5,6 +5,8 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
//
using Tools.MyUtils;
namespace Tools namespace Tools
{ {
...@@ -16,10 +18,23 @@ namespace Tools ...@@ -16,10 +18,23 @@ namespace Tools
[STAThread] [STAThread]
static void Main() static void Main()
{ {
Application.ThreadException += Application_ThreadException;
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new wMain()); Application.Run(new wMain());
} }
//UI未处理异常
private static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
{
Utils.TipException(e.Exception);
}
//非UI未处理异常
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
Utils.TipException(e.ExceptionObject as Exception);
}
} }
} }
...@@ -290,6 +290,16 @@ namespace Tools.Properties { ...@@ -290,6 +290,16 @@ namespace Tools.Properties {
} }
} }
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap 文件夹 {
get {
object obj = ResourceManager.GetObject("文件夹", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary> /// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary> /// </summary>
......
...@@ -187,6 +187,9 @@ ...@@ -187,6 +187,9 @@
<data name="数据库" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="数据库" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\数据库.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\数据库.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="文件夹" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\文件夹.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="新增" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="新增" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\新增.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\新增.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
......
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Log.cs" />
<Compile Include="MyCommon\controls\MyTreeView.cs"> <Compile Include="MyCommon\controls\MyTreeView.cs">
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>
...@@ -99,12 +100,30 @@ ...@@ -99,12 +100,30 @@
<Compile Include="MyCommon\wEditBasic.Designer.cs"> <Compile Include="MyCommon\wEditBasic.Designer.cs">
<DependentUpon>wEditBasic.cs</DependentUpon> <DependentUpon>wEditBasic.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="MyCommon\controls\TabControlEx.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="MyCommon\controls\TabControlEx.Designer.cs">
<DependentUpon>TabControlEx.cs</DependentUpon>
</Compile>
<Compile Include="MyData\AnlysisHelper.cs" /> <Compile Include="MyData\AnlysisHelper.cs" />
<Compile Include="MyData\DBHelper.cs" /> <Compile Include="MyData\DBHelper.cs" />
<Compile Include="MyData\SqlHelper.cs" /> <Compile Include="MyData\SqlHelper.cs" />
<Compile Include="MyUtils\DrawHelper.cs" /> <Compile Include="MyUtils\DrawHelper.cs" />
<Compile Include="MyUtils\InputtingService.cs" /> <Compile Include="MyUtils\InputtingService.cs" />
<Compile Include="MyUtils\SegPicture.cs" /> <Compile Include="MyUtils\SegPicture.cs" />
<Compile Include="UI\sys\wLogin.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\sys\wLogin.Designer.cs">
<DependentUpon>wLogin.cs</DependentUpon>
</Compile>
<Compile Include="UI\sys\wTellUS.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\sys\wTellUS.Designer.cs">
<DependentUpon>wTellUS.cs</DependentUpon>
</Compile>
<Compile Include="UI\wCefDemo.cs"> <Compile Include="UI\wCefDemo.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
...@@ -245,6 +264,12 @@ ...@@ -245,6 +264,12 @@
<Compile Include="UI\wLoginPwd.Designer.cs"> <Compile Include="UI\wLoginPwd.Designer.cs">
<DependentUpon>wLoginPwd.cs</DependentUpon> <DependentUpon>wLoginPwd.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="UI\wLogViewer.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\wLogViewer.Designer.cs">
<DependentUpon>wLogViewer.cs</DependentUpon>
</Compile>
<Compile Include="UI\wModuleManager.cs"> <Compile Include="UI\wModuleManager.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
...@@ -306,6 +331,9 @@ ...@@ -306,6 +331,9 @@
<EmbeddedResource Include="MyCommon\wEditBasic.resx"> <EmbeddedResource Include="MyCommon\wEditBasic.resx">
<DependentUpon>wEditBasic.cs</DependentUpon> <DependentUpon>wEditBasic.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="MyCommon\controls\TabControlEx.resx">
<DependentUpon>TabControlEx.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MyUtils\wDbSetting.resx"> <EmbeddedResource Include="MyUtils\wDbSetting.resx">
<DependentUpon>wDbSetting.cs</DependentUpon> <DependentUpon>wDbSetting.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
...@@ -325,6 +353,12 @@ ...@@ -325,6 +353,12 @@
<DependentUpon>Resources.resx</DependentUpon> <DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
</Compile> </Compile>
<EmbeddedResource Include="UI\sys\wLogin.resx">
<DependentUpon>wLogin.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\sys\wTellUS.resx">
<DependentUpon>wTellUS.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\wCefDemo.resx"> <EmbeddedResource Include="UI\wCefDemo.resx">
<DependentUpon>wCefDemo.cs</DependentUpon> <DependentUpon>wCefDemo.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
...@@ -379,6 +413,9 @@ ...@@ -379,6 +413,9 @@
<EmbeddedResource Include="UI\wLoginPwd.resx"> <EmbeddedResource Include="UI\wLoginPwd.resx">
<DependentUpon>wLoginPwd.cs</DependentUpon> <DependentUpon>wLoginPwd.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="UI\wLogViewer.resx">
<DependentUpon>wLogViewer.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\wModuleManager.resx"> <EmbeddedResource Include="UI\wModuleManager.resx">
<DependentUpon>wModuleManager.cs</DependentUpon> <DependentUpon>wModuleManager.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
...@@ -498,6 +535,7 @@ ...@@ -498,6 +535,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="favior.ico" /> <Content Include="favior.ico" />
<None Include="Resources\文件夹.png" />
<None Include="Resources\nav_plain_red.png" /> <None Include="Resources\nav_plain_red.png" />
<None Include="Resources\nav_plain_green.png" /> <None Include="Resources\nav_plain_green.png" />
<None Include="Resources\nav_left_green.png" /> <None Include="Resources\nav_left_green.png" />
......
...@@ -46,9 +46,6 @@ namespace Tools.UI.sys ...@@ -46,9 +46,6 @@ namespace Tools.UI.sys
//表格事件 //表格事件
this.dgvDetail.CellContentClick += DgvDetail_CellContentClick; this.dgvDetail.CellContentClick += DgvDetail_CellContentClick;
} }
public override void InitData() public override void InitData()
{ {
this._ds = this._db.GetData(this.ModuleTableList, true); this._ds = this._db.GetData(this.ModuleTableList, true);
...@@ -70,6 +67,8 @@ namespace Tools.UI.sys ...@@ -70,6 +67,8 @@ namespace Tools.UI.sys
var drNew = this._ds.Tables[0].NewRow(); var drNew = this._ds.Tables[0].NewRow();
if (this.FillRowData(drNew, path)) if (this.FillRowData(drNew, path))
{ {
drNew["CreateUser"] = LoginInfo.UserName;
drNew["CreateDate"] = DateTime.Now;
this._ds.Tables[0].Rows.Add(drNew); this._ds.Tables[0].Rows.Add(drNew);
} }
} }
...@@ -92,6 +91,8 @@ namespace Tools.UI.sys ...@@ -92,6 +91,8 @@ namespace Tools.UI.sys
var drNow = this._ds.Tables[0].DefaultView[index].Row; var drNow = this._ds.Tables[0].DefaultView[index].Row;
if (this.FillRowData(drNow, list[0])) if (this.FillRowData(drNow, list[0]))
{ {
drNow["UpdateUser"] = LoginInfo.UserName;
drNow["UpdateDate"] = DateTime.Now;
this.Save(); this.Save();
} }
} }
...@@ -152,7 +153,6 @@ namespace Tools.UI.sys ...@@ -152,7 +153,6 @@ namespace Tools.UI.sys
dr["dName"] = Path.GetFileName(path); dr["dName"] = Path.GetFileName(path);
dr["dSize"] = (bytes.Length / 1024M).ToString("0.##"); dr["dSize"] = (bytes.Length / 1024M).ToString("0.##");
dr["dData"] = bytes; dr["dData"] = bytes;
dr["CreateDate"] = DateTime.Now;
dr.EndEdit(); dr.EndEdit();
return true; return true;
......
namespace Tools.UI.sys
{
partial class wLogin
{
/// <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.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.tbUserName = new System.Windows.Forms.TextBox();
this.tbPassword = new System.Windows.Forms.TextBox();
this.panel1 = new System.Windows.Forms.Panel();
this.btnLogin = new System.Windows.Forms.Button();
this.label4 = new System.Windows.Forms.Label();
this.tableLayoutPanel1.SuspendLayout();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 4;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 75F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 150F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.label2, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.label3, 1, 2);
this.tableLayoutPanel1.Controls.Add(this.tbUserName, 2, 1);
this.tableLayoutPanel1.Controls.Add(this.tbPassword, 2, 2);
this.tableLayoutPanel1.Controls.Add(this.panel1, 1, 3);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 4;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(340, 215);
this.tableLayoutPanel1.TabIndex = 0;
//
// label1
//
this.tableLayoutPanel1.SetColumnSpan(this.label1, 4);
this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
this.label1.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.label1.Location = new System.Drawing.Point(3, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(334, 82);
this.label1.TabIndex = 0;
this.label1.Text = "欢迎使用飞天兔工具平台";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label2
//
this.label2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.Location = new System.Drawing.Point(60, 82);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(69, 23);
this.label2.TabIndex = 1;
this.label2.Text = "用户名:";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label3
//
this.label3.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label3.Location = new System.Drawing.Point(60, 107);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(69, 23);
this.label3.TabIndex = 2;
this.label3.Text = "密 码:";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// tbUserName
//
this.tbUserName.Dock = System.Windows.Forms.DockStyle.Fill;
this.tbUserName.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.tbUserName.Location = new System.Drawing.Point(135, 85);
this.tbUserName.Name = "tbUserName";
this.tbUserName.Size = new System.Drawing.Size(144, 23);
this.tbUserName.TabIndex = 3;
//
// tbPassword
//
this.tbPassword.Dock = System.Windows.Forms.DockStyle.Fill;
this.tbPassword.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.tbPassword.Location = new System.Drawing.Point(135, 110);
this.tbPassword.Name = "tbPassword";
this.tbPassword.PasswordChar = '*';
this.tbPassword.Size = new System.Drawing.Size(144, 23);
this.tbPassword.TabIndex = 4;
//
// panel1
//
this.tableLayoutPanel1.SetColumnSpan(this.panel1, 2);
this.panel1.Controls.Add(this.label4);
this.panel1.Controls.Add(this.btnLogin);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(60, 135);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(219, 77);
this.panel1.TabIndex = 5;
//
// btnLogin
//
this.btnLogin.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnLogin.Location = new System.Drawing.Point(75, 12);
this.btnLogin.Name = "btnLogin";
this.btnLogin.Size = new System.Drawing.Size(75, 29);
this.btnLogin.TabIndex = 0;
this.btnLogin.Text = "登 录";
this.btnLogin.UseVisualStyleBackColor = true;
this.btnLogin.Click += new System.EventHandler(this.btnLogin_Click);
//
// label4
//
this.label4.Dock = System.Windows.Forms.DockStyle.Bottom;
this.label4.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label4.ForeColor = System.Drawing.Color.IndianRed;
this.label4.Location = new System.Drawing.Point(0, 55);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(219, 22);
this.label4.TabIndex = 1;
this.label4.Text = "提示:姓名+任务系统密码登录";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// wLogin
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(340, 215);
this.Controls.Add(this.tableLayoutPanel1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "wLogin";
this.Text = "登录窗口";
this.Load += new System.EventHandler(this.wLogin_Load);
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.panel1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox tbUserName;
private System.Windows.Forms.TextBox tbPassword;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button btnLogin;
private System.Windows.Forms.Label label4;
}
}
\ 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 Tools.MyCommon;
using Tools.MyData;
using Tools.MyUtils;
namespace Tools.UI.sys
{
public partial class wLogin : wBasic
{
DBHelper _db = null;
string TempName = "";
/// <summary>
/// 构造:登录窗口
/// </summary>
/// <param name="tempName">临时用户名</param>
public wLogin(string tempName)
{
InitializeComponent();
//
this.DialogResult = DialogResult.None;
this.TempName = tempName;
}
private void wLogin_Load(object sender, EventArgs e)
{
this.tbUserName.Text = string.IsNullOrEmpty(this.TempName) ? LoginInfo.UserName : this.TempName;
}
private void btnLogin_Click(object sender, EventArgs e)
{
if (_db == null)
_db = new DBHelper(Utils.GetDbLinkString204("FTT_Work"));
//获取用户名和密码
var userName = this.tbUserName.Text.Trim();
var password = Utils.Encryptor(this.tbPassword.Text);
var sql = $@"
SELECT ID,
ISNULL(IsPrincipal, 0) AS IsPrincipal,
CAST(CASE WHEN UserType = 5311 THEN 1 ELSE 0 END AS BIT) AS IsStaff
FROM dbo.AC_User
WHERE ISNULL(IsStop, 0) = 0
And Name='{userName}' And LoginPassword = '{password}'";
var dt = this._db.GetDataTable(sql, "user", false);
if (dt.DefaultView.Count == 0)
{
Utils.Tip("用户名或密码错误,请确认!");
return;
}
else
{
//刷新登录信息
LoginInfo.UserName = userName;
LoginInfo.Password = password;
LoginInfo.IsPrincipal = Convert.ToBoolean(dt.DefaultView[0]["IsPrincipal"].ToString());
LoginInfo.IsStaff = Convert.ToBoolean(dt.DefaultView[0]["IsStaff"].ToString());
//保存登录信息
Utils.AppSettings(APP.LOGIN_INFO, Utils.Encryptor(dt.DefaultView[0]["ID"].ToString()));
Utils.AppSettings(APP.LOGIN_VERIFY, password);
//关闭窗口
this.DialogResult = DialogResult.OK;
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 Tools.MyCommon;
using Tools.MyData;
using Tools.MyUtils;
namespace Tools.UI.sys
{
public partial class wTellUS : wEditBasic
{
/// <summary>
/// 数据源(单表)
/// </summary>
DataTable _dt = null;
/// <summary>
/// 是否新增(默认为True)
/// </summary>
bool _IsAdd = true;
/// <summary>
/// 编辑行,默认为null
/// </summary>
DataRow _EditRow = null;
public wTellUS()
{
InitializeComponent();
}
private void wTellUS_Load(object sender, EventArgs e)
{
//初始化模块表
this.ModuleTableList = new List<TQuery> { new TQuery("FTT_UserDemand", "SELECT * FROM FTT_UserDemand ") };
//初始化数据访问对象
this.InitDBHelper(Utils.GetDbLinkString204("FTT_Work"));
//初始化界面
this.InitUI();
//异步装载数据
Task.Run(() => this.InitData());
}
public override void InitData()
{
this._ds = this._db.GetData(this.ModuleTableList, true);
this._dt = this._ds.Tables[0];
}
public override void InitUI()
{
//默认全部填充
this.panelEdit.Dock = DockStyle.Fill;
this.panelHistory.Dock = DockStyle.Fill;
this.panelRevoke.Dock = DockStyle.Fill;
//显示编辑页面
this.InitGridView(this.dgvHistory, false, true);
this.InitGridView(this.dgvRevoked, false, true);
this.ShowEditPage();
//编辑相关事件
this.btnSubmit.Click += BtnSubmit_Click;
this.lbHistory.Click += LbHistory_Click;
//历史记录事件
this.btnReEdit.Click += BtnReEdit_Click;
this.btnRevoke.Click += BtnRevoke_Click;
this.lbRevokeHistory.Click += LbRevokeHistory_Click;
this.lbBackEdit.Click += LbBackEdit_Click;
//撤销记录事件
this.btnReSubmit.Click += BtnReSubmit_Click;
this.btnDelete.Click += BtnDelete_Click;
this.lbBackHistory.Click += LbBackHistory_Click;
}
private void BtnSubmit_Click(object sender, EventArgs e)
{
var text = this.tbDemand.Text;
if (string.IsNullOrEmpty(text))
{
MessageBox.Show("请先填写需求内容!");
return;
}
if (text.Length < 20)
{
MessageBox.Show("需求内容太短了,请完善一下吧!");
return;
}
//提交数据
this.Submit(this._IsAdd);
}
private void LbHistory_Click(object sender, EventArgs e)
{
this.ShowHistoryPage();
}
private void BtnReEdit_Click(object sender, EventArgs e)
{
if (this.dgvHistory.SelectedRows.Count == 0)
{
MessageBox.Show("请先选择一行信息!", "提示");
return;
}
if (this.tbDemand.Text.Trim() != "" && !Utils.TipYN("编辑页需求尚未保存,是否清空?"))
{
return;
}
//获取当前行索引
var index = this.dgvHistory.SelectedRows[0].Index;
//设定编辑行
this._IsAdd = false;
this._EditRow = this._dt.DefaultView[index].Row;
this.tbDemand.Text = this._EditRow["DemandText"].ToString();
this.ShowEditPage();
}
private void BtnRevoke_Click(object sender, EventArgs e)
{
this.SetStatus(DelStatus.Revoked);
}
private void LbRevokeHistory_Click(object sender, EventArgs e)
{
this.ShowRevokedPage();
}
private void LbBackEdit_Click(object sender, EventArgs e)
{
this.ShowEditPage();
}
private void BtnReSubmit_Click(object sender, EventArgs e)
{
this.SetStatus(DelStatus.Nomarl);
}
private void BtnDelete_Click(object sender, EventArgs e)
{
this.SetStatus(DelStatus.Deleted);
}
private void LbBackHistory_Click(object sender, EventArgs e)
{
this.ShowHistoryPage();
}
/// <summary>
/// 提交需求(新增或编辑)
/// </summary>
private void Submit(bool isAdd)
{
if (isAdd)
{
var drNew = this._dt.NewRow();
drNew["UserName"] = LoginInfo.UserName;
drNew["DemandText"] = this.tbDemand.Text;
drNew["CreateDate"] = DateTime.Now;
drNew["AcceptStatus"] = AcceptStatus.None;
drNew["DelStatus"] = DelStatus.Nomarl;
drNew.EndEdit();
this._dt.Rows.Add(drNew);
}
else
{
//有变化则更新
if (this._EditRow["DemandText"].ToString() != this.tbDemand.Text)
{
this._EditRow["DemandText"] = this.tbDemand.Text;
this._EditRow["ModifiedDate"] = DateTime.Now;
this._EditRow.EndEdit();
}
}
//保存数据
if (this.Save())
{
this._IsAdd = true; //恢复新增标志
this._EditRow = null; //清除编辑行
this.tbDemand.Text = ""; //清空文本
}
}
/// <summary>
/// 设置记录状态
/// </summary>
/// <param name="status"></param>
private void SetStatus(int status)
{
if (this.dgvHistory.SelectedRows.Count == 0)
{
MessageBox.Show("请先选择一行信息!", "提示");
return;
}
//设置状态并保存
var index = this.dgvHistory.SelectedRows[0].Index;
var drNow = this._dt.DefaultView[index].Row;
drNow["DelStatus"] = status;
drNow.EndEdit();
this.Save();
}
/// <summary>
/// 显示编辑页面
/// </summary>
private void ShowEditPage()
{
this.PageVisible(this.panelEdit, this.panelHistory, this.panelRevoke);
}
/// <summary>
/// 显示历史页面
/// </summary>
private void ShowHistoryPage()
{
this._dt.DefaultView.RowFilter = $"DelStatus = {DelStatus.Nomarl}";
this.dgvHistory.DataSource = this._dt.DefaultView;
this.PageVisible(this.panelHistory, this.panelEdit, this.panelRevoke);
}
/// <summary>
/// 显示已撤销页面
/// </summary>
private void ShowRevokedPage()
{
this._dt.DefaultView.RowFilter = $"DelStatus = {DelStatus.Revoked}";
this.dgvRevoked.DataSource = this._dt.DefaultView;
this.PageVisible(this.panelRevoke, this.panelEdit, this.panelHistory);
}
/// <summary>
/// 页面显示
/// </summary>
/// <param name="visiblePanel">显示的面板</param>
/// <param name="hidePanels">隐藏的面板</param>
private void PageVisible(Panel visiblePanel, params Panel[] hidePanels)
{
visiblePanel.Visible = true;
foreach (Panel p in hidePanels)
{
p.Visible = false;
}
}
}
/// <summary>
/// 受理状态
/// </summary>
internal class AcceptStatus
{
/// <summary>
/// 无
/// </summary>
public static string None => "";
/// <summary>
/// 已受理
/// </summary>
public static string Accepted => "已受理";
/// <summary>
/// 已回绝
/// </summary>
public static string Failed => "已回绝";
}
/// <summary>
/// 删除状态
/// </summary>
internal class DelStatus
{
/// <summary>
/// 正常
/// </summary>
public static int Nomarl => 0;
/// <summary>
/// 已撤销
/// </summary>
public static int Revoked => 1;
/// <summary>
/// 已删除
/// </summary>
public static int Deleted => 2;
}
}
<?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>
<metadata name="Column3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column5.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column6.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column7.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column8.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>
\ No newline at end of file
...@@ -118,9 +118,7 @@ namespace Tools.UI ...@@ -118,9 +118,7 @@ namespace Tools.UI
//系统路径初始化 //系统路径初始化
this.InitDefaultPath(); this.InitDefaultPath();
//数据表格初始化 //数据表格初始化
this.dgvData.AutoGenerateColumns = false; this.InitGridView(this.dgvData, false, false);
this.dgvData.AllowUserToAddRows = false;
this.dgvData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
this.dgvData.DataSource = this._ds.Tables[infoTable]; this.dgvData.DataSource = this._ds.Tables[infoTable];
this.dgvData.KeyUp += DgvData_KeyUp; this.dgvData.KeyUp += DgvData_KeyUp;
this.dgvData.CellValueChanged += DgvData_CellValueChanged; this.dgvData.CellValueChanged += DgvData_CellValueChanged;
...@@ -589,7 +587,8 @@ namespace Tools.UI ...@@ -589,7 +587,8 @@ namespace Tools.UI
[Description] = CONVERT(VARCHAR(200), isnull(d.[value],'')), [Description] = CONVERT(VARCHAR(200), isnull(d.[value],'')),
IsNotNull = CASE WHEN a.isnullable=1 THEN 0 ELSE 1 END, IsNotNull = CASE WHEN a.isnullable=1 THEN 0 ELSE 1 END,
DefaultValue = CASE WHEN e.name='datetime' THEN STUFF(STUFF(c.text, LEN(c.text), 1, ''), 1, 1, '') ELSE REPLACE(REPLACE(c.text, '(', ''), ')', '') END, DefaultValue = CASE WHEN e.name='datetime' THEN STUFF(STUFF(c.text, LEN(c.text), 1, ''), 1, 1, '') ELSE REPLACE(REPLACE(c.text, '(', ''), ')', '') END,
ColumnType = CASE WHEN CHARINDEX('varchar',e.name,0) > 0 THEN e.name+'('+CAST(a.length AS VARCHAR(50)) +')' ELSE e.name END ColumnType = CASE WHEN CHARINDEX('varchar',e.name,0) > 0 THEN e.name+'('+CASE WHEN a.length > -1 THEN CAST(a.length AS VARCHAR(10)) ELSE 'max' END +')'
WHEN CHARINDEX('decimal',e.name,0) > 0 THEN e.name + '(' + CAST(a.prec AS VARCHAR(10)) + ',' + CAST(a.scale AS VARCHAR(10)) + ')' ELSE e.name END
FROM dbo.syscolumns a FROM dbo.syscolumns a
INNER JOIN dbo.sysobjects b ON b.id = a.id AND b.xtype = 'U' AND b.name <> 'dtproperties' INNER JOIN dbo.sysobjects b ON b.id = a.id AND b.xtype = 'U' AND b.name <> 'dtproperties'
LEFT JOIN sys.syscomments c ON c.id = a.cdefault LEFT JOIN sys.syscomments c ON c.id = a.cdefault
......
...@@ -120,7 +120,7 @@ ...@@ -120,7 +120,7 @@
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(65, 12); this.label2.Size = new System.Drawing.Size(65, 12);
this.label2.TabIndex = 1; this.label2.TabIndex = 1;
this.label2.Text = "链 接:"; this.label2.Text = "内 容:";
// //
// label1 // label1
// //
...@@ -129,7 +129,7 @@ ...@@ -129,7 +129,7 @@
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(65, 12); this.label1.Size = new System.Drawing.Size(65, 12);
this.label1.TabIndex = 0; this.label1.TabIndex = 0;
this.label1.Text = "描 述:"; this.label1.Text = "标 题:";
// //
// dgvDetail // dgvDetail
// //
...@@ -158,7 +158,7 @@ ...@@ -158,7 +158,7 @@
// Column1 // Column1
// //
this.Column1.DataPropertyName = "Note"; this.Column1.DataPropertyName = "Note";
this.Column1.HeaderText = "描述"; this.Column1.HeaderText = "标题";
this.Column1.Name = "Column1"; this.Column1.Name = "Column1";
this.Column1.ReadOnly = true; this.Column1.ReadOnly = true;
this.Column1.Width = 200; this.Column1.Width = 200;
...@@ -166,7 +166,7 @@ ...@@ -166,7 +166,7 @@
// Column2 // Column2
// //
this.Column2.DataPropertyName = "Link"; this.Column2.DataPropertyName = "Link";
this.Column2.HeaderText = "链接"; this.Column2.HeaderText = "内容";
this.Column2.Name = "Column2"; this.Column2.Name = "Column2";
this.Column2.ReadOnly = true; this.Column2.ReadOnly = true;
this.Column2.Width = 400; this.Column2.Width = 400;
...@@ -180,7 +180,7 @@ ...@@ -180,7 +180,7 @@
this.Controls.Add(this.panel1); this.Controls.Add(this.panel1);
this.Controls.Add(this.toolStrip1); this.Controls.Add(this.toolStrip1);
this.Name = "wDbLinkMngr"; this.Name = "wDbLinkMngr";
this.Text = "数据库链接管理"; this.Text = "共享信息(标题+内容)";
this.Load += new System.EventHandler(this.wEvaluationOfEmployee_Load); this.Load += new System.EventHandler(this.wEvaluationOfEmployee_Load);
this.toolStrip1.ResumeLayout(false); this.toolStrip1.ResumeLayout(false);
this.toolStrip1.PerformLayout(); this.toolStrip1.PerformLayout();
......
...@@ -41,10 +41,7 @@ namespace Tools.UI ...@@ -41,10 +41,7 @@ namespace Tools.UI
} }
public override void InitUI() public override void InitUI()
{ {
this.dgvDetail.MultiSelect = false; this.InitGridView(this.dgvDetail, false, true);
this.dgvDetail.AllowUserToAddRows = false;
this.dgvDetail.AutoGenerateColumns = false;
this.dgvDetail.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
this.dgvDetail.DataSource = this._ds.Tables[0].DefaultView; this.dgvDetail.DataSource = this._ds.Tables[0].DefaultView;
this.dgvDetail.CellMouseClick += DgvDetail_CellMouseClick; this.dgvDetail.CellMouseClick += DgvDetail_CellMouseClick;
} }
...@@ -106,7 +103,18 @@ namespace Tools.UI ...@@ -106,7 +103,18 @@ namespace Tools.UI
//重复判断 //重复判断
var linkNow = r["link"].ToString(); var linkNow = r["link"].ToString();
var m = Utils.GetDbItemModel(linkNow); var m = Utils.GetDbItemModel(linkNow);
var sim = m.Compare(link); var m1 = Utils.GetDbItemModel(link);
Similarity sim = Similarity.None;
//都不是数据库链接时,当做字符串比较
if (m.Link == null && m1.Link == null)
{
var ret = string.Compare(link, linkNow, true);
sim = ret == 0 ? Similarity.Same : Similarity.Different;
}
else
{
sim = m.Compare(link);
}
if (sim == Similarity.Same) if (sim == Similarity.Same)
{ {
Utils.Tip(this.GenMessage("已维护了一个相同链接,请检查!", r, m), 400, 240); Utils.Tip(this.GenMessage("已维护了一个相同链接,请检查!", r, m), 400, 240);
......
...@@ -129,4 +129,13 @@ ...@@ -129,4 +129,13 @@
<metadata name="Column2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="Column2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="Column4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root> </root>
\ No newline at end of file
...@@ -61,10 +61,7 @@ namespace Tools.UI ...@@ -61,10 +61,7 @@ namespace Tools.UI
} }
public override void InitUI() public override void InitUI()
{ {
this.dgvDetail.MultiSelect = false; this.InitGridView(this.dgvDetail, false, true);
this.dgvDetail.AllowUserToAddRows = false;
this.dgvDetail.AutoGenerateColumns = false;
this.dgvDetail.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
this.dgvDetail.DataSource = this._ds.Tables[0].DefaultView; this.dgvDetail.DataSource = this._ds.Tables[0].DefaultView;
this.dgvDetail.CellMouseClick += DgvDetail_CellMouseClick; this.dgvDetail.CellMouseClick += DgvDetail_CellMouseClick;
//初始化工具栏月份下拉项 //初始化工具栏月份下拉项
......
...@@ -60,6 +60,8 @@ ...@@ -60,6 +60,8 @@
this.tsbHelp = new System.Windows.Forms.ToolStripButton(); this.tsbHelp = new System.Windows.Forms.ToolStripButton();
this.Column11 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column11 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column14 = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.Column15 = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.Column8 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column12 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column12 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column13 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column13 = new System.Windows.Forms.DataGridViewTextBoxColumn();
...@@ -254,6 +256,8 @@ ...@@ -254,6 +256,8 @@
this.dgvTemplates.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.dgvTemplates.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Column11, this.Column11,
this.Column7, this.Column7,
this.Column14,
this.Column15,
this.Column8, this.Column8,
this.Column12, this.Column12,
this.Column13}); this.Column13});
...@@ -324,7 +328,7 @@ ...@@ -324,7 +328,7 @@
this.tslDbLink.Font = new System.Drawing.Font("Microsoft YaHei UI", 7.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.tslDbLink.Font = new System.Drawing.Font("Microsoft YaHei UI", 7.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.tslDbLink.ForeColor = System.Drawing.Color.Green; this.tslDbLink.ForeColor = System.Drawing.Color.Green;
this.tslDbLink.Name = "tslDbLink"; this.tslDbLink.Name = "tslDbLink";
this.tslDbLink.Size = new System.Drawing.Size(114, 22); this.tslDbLink.Size = new System.Drawing.Size(113, 22);
this.tslDbLink.Text = "--请先选择数据库链接--"; this.tslDbLink.Text = "--请先选择数据库链接--";
// //
// toolStripSeparator2 // toolStripSeparator2
...@@ -356,6 +360,18 @@ ...@@ -356,6 +360,18 @@
this.Column7.Name = "Column7"; this.Column7.Name = "Column7";
this.Column7.Width = 150; this.Column7.Width = 150;
// //
// Column14
//
this.Column14.DataPropertyName = "IsStop";
this.Column14.HeaderText = "停用";
this.Column14.Name = "Column14";
//
// Column15
//
this.Column15.DataPropertyName = "IsDetailAutoRowHeight";
this.Column15.HeaderText = "明细自动行高";
this.Column15.Name = "Column15";
//
// Column8 // Column8
// //
this.Column8.DataPropertyName = "GrpTableName"; this.Column8.DataPropertyName = "GrpTableName";
...@@ -436,6 +452,8 @@ ...@@ -436,6 +452,8 @@
private System.Windows.Forms.DataGridViewTextBoxColumn Column9; private System.Windows.Forms.DataGridViewTextBoxColumn Column9;
private System.Windows.Forms.DataGridViewTextBoxColumn Column11; private System.Windows.Forms.DataGridViewTextBoxColumn Column11;
private System.Windows.Forms.DataGridViewTextBoxColumn Column7; private System.Windows.Forms.DataGridViewTextBoxColumn Column7;
private System.Windows.Forms.DataGridViewCheckBoxColumn Column14;
private System.Windows.Forms.DataGridViewCheckBoxColumn Column15;
private System.Windows.Forms.DataGridViewTextBoxColumn Column8; private System.Windows.Forms.DataGridViewTextBoxColumn Column8;
private System.Windows.Forms.DataGridViewTextBoxColumn Column12; private System.Windows.Forms.DataGridViewTextBoxColumn Column12;
private System.Windows.Forms.DataGridViewTextBoxColumn Column13; private System.Windows.Forms.DataGridViewTextBoxColumn Column13;
......
...@@ -38,7 +38,10 @@ namespace Tools.UI ...@@ -38,7 +38,10 @@ namespace Tools.UI
Prefix VARCHAR(50) NULL, Prefix VARCHAR(50) NULL,
TpName VARCHAR(50) NULL, TpName VARCHAR(50) NULL,
GrpTableName VARCHAR(50) NULL, GrpTableName VARCHAR(50) NULL,
GrpColumnName VARCHAR(50) NULL GrpColumnName VARCHAR(50) NULL,
ExportNameSOL VARCHAR(MAX) NULL,
IsStop BIT NULL,
IsDetailAutoRowHeight BIT NULL
) )
CREATE TABLE ModuleTemplateTable CREATE TABLE ModuleTemplateTable
......
...@@ -153,6 +153,12 @@ ...@@ -153,6 +153,12 @@
<metadata name="Column7.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="Column7.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="Column14.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column15.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column8.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="Column8.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
......
...@@ -133,7 +133,7 @@ ...@@ -133,7 +133,7 @@
this.Controls.Add(this.dgvDetail); this.Controls.Add(this.dgvDetail);
this.Controls.Add(this.toolStrip1); this.Controls.Add(this.toolStrip1);
this.Name = "wFlowShare"; this.Name = "wFlowShare";
this.Text = "wFlowShare"; this.Text = "共享文件(上传+更新+下载)";
this.Load += new System.EventHandler(this.wFlowShare_Load); this.Load += new System.EventHandler(this.wFlowShare_Load);
this.toolStrip1.ResumeLayout(false); this.toolStrip1.ResumeLayout(false);
this.toolStrip1.PerformLayout(); this.toolStrip1.PerformLayout();
......
...@@ -36,10 +36,7 @@ namespace Tools.UI ...@@ -36,10 +36,7 @@ namespace Tools.UI
public override void InitUI() public override void InitUI()
{ {
//表格初始化 //表格初始化
this.dgvDetail.ReadOnly = true; this.InitGridView(this.dgvDetail, false, true);
this.dgvDetail.AllowUserToAddRows = false;
this.dgvDetail.AutoGenerateColumns = false;
this.dgvDetail.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
//表格事件 //表格事件
this.dgvDetail.CellContentClick += DgvDetail_CellContentClick; this.dgvDetail.CellContentClick += DgvDetail_CellContentClick;
} }
...@@ -87,6 +84,7 @@ namespace Tools.UI ...@@ -87,6 +84,7 @@ namespace Tools.UI
var drNew = this._ds.Tables[0].NewRow(); var drNew = this._ds.Tables[0].NewRow();
if (this.FillRowData(drNew, path)) if (this.FillRowData(drNew, path))
{ {
drNew["CreateUser"] = LoginInfo.UserName;
drNew["CreateDate"] = DateTime.Now; drNew["CreateDate"] = DateTime.Now;
this._ds.Tables[0].Rows.Add(drNew); this._ds.Tables[0].Rows.Add(drNew);
} }
...@@ -110,6 +108,7 @@ namespace Tools.UI ...@@ -110,6 +108,7 @@ namespace Tools.UI
var drNow = this._ds.Tables[0].DefaultView[index].Row; var drNow = this._ds.Tables[0].DefaultView[index].Row;
if (this.FillRowData(drNow, list[0])) if (this.FillRowData(drNow, list[0]))
{ {
drNow["UpdateUser"] = LoginInfo.UserName;
drNow["UpdateDate"] = DateTime.Now; drNow["UpdateDate"] = DateTime.Now;
this.Save(); this.Save();
} }
......
namespace Tools.UI
{
partial class wLogViewer
{
/// <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.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel();
this.tstbLogPath = new System.Windows.Forms.ToolStripTextBox();
this.tsbSelectPath = new System.Windows.Forms.ToolStripButton();
this.listBox1 = new System.Windows.Forms.ListBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.toolStripLabel2 = new System.Windows.Forms.ToolStripLabel();
this.tscbEncoding = new System.Windows.Forms.ToolStripComboBox();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.toolStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.SuspendLayout();
//
// toolStrip1
//
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripLabel2,
this.tscbEncoding,
this.toolStripSeparator1,
this.toolStripLabel1,
this.tstbLogPath,
this.tsbSelectPath});
this.toolStrip1.Location = new System.Drawing.Point(0, 0);
this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(695, 25);
this.toolStrip1.TabIndex = 0;
this.toolStrip1.Text = "toolStrip1";
//
// toolStripLabel1
//
this.toolStripLabel1.Name = "toolStripLabel1";
this.toolStripLabel1.Size = new System.Drawing.Size(68, 22);
this.toolStripLabel1.Text = "日志路径:";
//
// tstbLogPath
//
this.tstbLogPath.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F);
this.tstbLogPath.Name = "tstbLogPath";
this.tstbLogPath.ReadOnly = true;
this.tstbLogPath.Size = new System.Drawing.Size(300, 25);
//
// tsbSelectPath
//
this.tsbSelectPath.Image = global::Tools.Properties.Resources.文件夹;
this.tsbSelectPath.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbSelectPath.Name = "tsbSelectPath";
this.tsbSelectPath.Size = new System.Drawing.Size(76, 22);
this.tsbSelectPath.Text = "选择路径";
//
// listBox1
//
this.listBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.listBox1.FormattingEnabled = true;
this.listBox1.ItemHeight = 12;
this.listBox1.Location = new System.Drawing.Point(0, 0);
this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(156, 425);
this.listBox1.TabIndex = 1;
//
// textBox1
//
this.textBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.textBox1.Location = new System.Drawing.Point(0, 0);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.textBox1.Size = new System.Drawing.Size(535, 423);
this.textBox1.TabIndex = 2;
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(0, 25);
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.listBox1);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.textBox1);
this.splitContainer1.Panel2.Controls.Add(this.progressBar1);
this.splitContainer1.Size = new System.Drawing.Size(695, 425);
this.splitContainer1.SplitterDistance = 156;
this.splitContainer1.TabIndex = 3;
//
// progressBar1
//
this.progressBar1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.progressBar1.Location = new System.Drawing.Point(0, 423);
this.progressBar1.MarqueeAnimationSpeed = 10;
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(535, 2);
this.progressBar1.TabIndex = 3;
//
// toolStripLabel2
//
this.toolStripLabel2.Name = "toolStripLabel2";
this.toolStripLabel2.Size = new System.Drawing.Size(44, 22);
this.toolStripLabel2.Text = "编码:";
//
// tscbEncoding
//
this.tscbEncoding.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.tscbEncoding.Name = "tscbEncoding";
this.tscbEncoding.Size = new System.Drawing.Size(75, 25);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25);
//
// wLogViewer
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(695, 450);
this.Controls.Add(this.splitContainer1);
this.Controls.Add(this.toolStrip1);
this.Name = "wLogViewer";
this.Text = "wLogViewer";
this.Load += new System.EventHandler(this.wLogViewer_Load);
this.Shown += new System.EventHandler(this.wLogViewer_Shown);
this.toolStrip1.ResumeLayout(false);
this.toolStrip1.PerformLayout();
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
this.splitContainer1.Panel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.ToolStrip toolStrip1;
private System.Windows.Forms.ToolStripLabel toolStripLabel1;
private System.Windows.Forms.ToolStripTextBox tstbLogPath;
private System.Windows.Forms.ToolStripButton tsbSelectPath;
private System.Windows.Forms.ListBox listBox1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.ProgressBar progressBar1;
private System.Windows.Forms.ToolStripLabel toolStripLabel2;
private System.Windows.Forms.ToolStripComboBox tscbEncoding;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
}
}
\ No newline at end of file
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;
using System.Threading.Tasks;
using System.Windows.Forms;
//
using Tools.MyCommon;
using Tools.MyUtils;
namespace Tools.UI
{
public partial class wLogViewer : wBasic
{
string LogPath { get => this.tstbLogPath.Text; set => this.tstbLogPath.Text = value; }
public wLogViewer()
{
InitializeComponent();
}
//窗体:加载
private void wLogViewer_Load(object sender, EventArgs e)
{
var list = new List<string> {
Encoding.Default.HeaderName.ToUpper(),
Encoding.UTF8.HeaderName.ToUpper(),
};
this.tscbEncoding.Items.AddRange(list.Distinct().ToArray());
this.tscbEncoding.SelectedIndex = 0;
}
//窗体:显示完成
private void wLogViewer_Shown(object sender, EventArgs e)
{
this.tsbSelectPath.Click += TsbSelectPath_Click;
this.tstbLogPath.TextChanged += TstbLogPath_TextChanged;
this.tscbEncoding.SelectedIndexChanged += TscbEncoding_SelectedIndexChanged;
this.listBox1.SelectedIndexChanged += ListBox1_SelectedIndexChanged;
}
/// <summary>
/// 选择路径
/// </summary>
private void TsbSelectPath_Click(object sender, EventArgs e)
{
var folder = Utils.SelectFolder();
if (!string.IsNullOrEmpty(folder))
{
this.LogPath = folder;
}
}
/// <summary>
/// 路径文本改变时,刷新列表框
/// </summary>
private void TstbLogPath_TextChanged(object sender, EventArgs e)
{
this.InitListBox();
}
/// <summary>
/// 编码切换:重新解析日志文件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void TscbEncoding_SelectedIndexChanged(object sender, EventArgs e)
{
this.OpenLogFile();
}
/// <summary>
/// 列表切换:加载选中日志文件
/// </summary>
private void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
this.OpenLogFile();
}
/// <summary>
/// 日志文件类型(兼容原有的txt日志和log4net日志)
/// </summary>
List<string> LogExtensions = new List<string> { ".txt", ".log" };
/// <summary>
/// 初始化列表框
/// </summary>
private void InitListBox()
{
//清空原有项
this.textBox1.Text = string.Empty;
this.listBox1.Items.Clear();
//重新加载
if (Directory.Exists(this.LogPath))
{
var dirInfo = new DirectoryInfo(this.LogPath);
var files = dirInfo.GetFiles().Where(f => this.LogExtensions.Contains(f.Extension.ToLower())).Select(f => f.Name);
this.listBox1.Items.AddRange(files.ToArray());
}
else
{
Utils.Tip("路径不存在,请检查!");
}
}
Task _task = null; //当前任务
CancellationTokenSource _tokenSource = new CancellationTokenSource(); //取消令牌
/// <summary>
/// 打开日志文件
/// </summary>
private void OpenLogFile()
{
var fileName = this.listBox1.SelectedItem.ToString();
var encode = Encoding.Default;
if (!string.IsNullOrEmpty(this.tscbEncoding.Text))
encode = Encoding.GetEncoding(this.tscbEncoding.Text);
//清空信息
this.textBox1.Text = string.Empty;
//如果上一个任务还未结束,则取消
if (_task != null && !_task.IsCompleted)
{
_tokenSource.Cancel();
}
//异步读取
CancellationToken token = this._tokenSource.Token;
this._task = Task.Run(() =>
{
if (token.IsCancellationRequested)
return;
//读取日志内容
var initLength = 1024;
var buffer = new byte[initLength];
var fs = new FileStream($@"{this.LogPath}\{fileName}", FileMode.Open, FileAccess.Read);
//初始化进度条
this.AsyncUI(() => {
this.progressBar1.Maximum = Math.Max(1, (int)(fs.Length / initLength));
this.progressBar1.Value = 0;
});
StringBuilder sb = new StringBuilder(initLength);
while (fs.Read(buffer, 0, buffer.Length) > 0)
{
this.AsyncUI(() =>
{
if (this.progressBar1.Value < this.progressBar1.Maximum)
this.progressBar1.Value += 1;
});
sb.Append(encode.GetString(buffer));
}
//显示日志内容
this.AsyncUI(() => {
this.textBox1.Text = sb.ToString();
if (this.textBox1.Text.Length == 0)
{
this.progressBar1.Value = this.progressBar1.Maximum;
this.textBox1.Text = "***该日志文件为空***";
}
});
//释放资源
sb.Clear();
fs.Close();
}, token);
}
}
}
<?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>
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
\ No newline at end of file
...@@ -34,27 +34,34 @@ ...@@ -34,27 +34,34 @@
this.tbResult = new System.Windows.Forms.TextBox(); this.tbResult = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.btnEncrypt = new System.Windows.Forms.Button(); this.btnEncrypt = new System.Windows.Forms.Button();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.panel1 = new System.Windows.Forms.Panel();
this.tableLayoutPanel1.SuspendLayout();
this.panel1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// tbSrcString // tbSrcString
// //
this.tbSrcString.Location = new System.Drawing.Point(116, 51); this.tbSrcString.Dock = System.Windows.Forms.DockStyle.Fill;
this.tbSrcString.Location = new System.Drawing.Point(113, 53);
this.tbSrcString.Multiline = true;
this.tbSrcString.Name = "tbSrcString"; this.tbSrcString.Name = "tbSrcString";
this.tbSrcString.Size = new System.Drawing.Size(171, 21); this.tbSrcString.Size = new System.Drawing.Size(194, 54);
this.tbSrcString.TabIndex = 0; this.tbSrcString.TabIndex = 0;
// //
// label1 // label1
// //
this.label1.AutoSize = true; this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
this.label1.Location = new System.Drawing.Point(81, 54); this.label1.Location = new System.Drawing.Point(53, 50);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(29, 12); this.label1.Size = new System.Drawing.Size(54, 60);
this.label1.TabIndex = 1; this.label1.TabIndex = 1;
this.label1.Text = "文本"; this.label1.Text = "文本";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
// //
// btnDecrypt // btnDecrypt
// //
this.btnDecrypt.Location = new System.Drawing.Point(116, 78); this.btnDecrypt.Location = new System.Drawing.Point(3, 1);
this.btnDecrypt.Name = "btnDecrypt"; this.btnDecrypt.Name = "btnDecrypt";
this.btnDecrypt.Size = new System.Drawing.Size(75, 23); this.btnDecrypt.Size = new System.Drawing.Size(75, 23);
this.btnDecrypt.TabIndex = 2; this.btnDecrypt.TabIndex = 2;
...@@ -64,23 +71,27 @@ ...@@ -64,23 +71,27 @@
// //
// tbResult // tbResult
// //
this.tbResult.Location = new System.Drawing.Point(116, 107); this.tbResult.Dock = System.Windows.Forms.DockStyle.Fill;
this.tbResult.Location = new System.Drawing.Point(113, 143);
this.tbResult.Multiline = true;
this.tbResult.Name = "tbResult"; this.tbResult.Name = "tbResult";
this.tbResult.Size = new System.Drawing.Size(171, 21); this.tbResult.Size = new System.Drawing.Size(194, 54);
this.tbResult.TabIndex = 3; this.tbResult.TabIndex = 3;
// //
// label2 // label2
// //
this.label2.AutoSize = true; this.label2.Dock = System.Windows.Forms.DockStyle.Fill;
this.label2.Location = new System.Drawing.Point(81, 110); this.label2.Location = new System.Drawing.Point(53, 140);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(29, 12); this.label2.Size = new System.Drawing.Size(54, 60);
this.label2.TabIndex = 4; this.label2.TabIndex = 4;
this.label2.Text = "结果"; this.label2.Text = "结果";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
// //
// btnEncrypt // btnEncrypt
// //
this.btnEncrypt.Location = new System.Drawing.Point(212, 78); this.btnEncrypt.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnEncrypt.Location = new System.Drawing.Point(116, 1);
this.btnEncrypt.Name = "btnEncrypt"; this.btnEncrypt.Name = "btnEncrypt";
this.btnEncrypt.Size = new System.Drawing.Size(75, 23); this.btnEncrypt.Size = new System.Drawing.Size(75, 23);
this.btnEncrypt.TabIndex = 5; this.btnEncrypt.TabIndex = 5;
...@@ -88,22 +99,53 @@ ...@@ -88,22 +99,53 @@
this.btnEncrypt.UseVisualStyleBackColor = true; this.btnEncrypt.UseVisualStyleBackColor = true;
this.btnEncrypt.Click += new System.EventHandler(this.btnEncrypt_Click); this.btnEncrypt.Click += new System.EventHandler(this.btnEncrypt_Click);
// //
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 4;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 50F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 60F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 200F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Controls.Add(this.label1, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.label2, 1, 3);
this.tableLayoutPanel1.Controls.Add(this.tbResult, 2, 3);
this.tableLayoutPanel1.Controls.Add(this.tbSrcString, 2, 1);
this.tableLayoutPanel1.Controls.Add(this.panel1, 2, 2);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 5;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 60F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 60F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(481, 324);
this.tableLayoutPanel1.TabIndex = 6;
//
// panel1
//
this.panel1.Controls.Add(this.btnEncrypt);
this.panel1.Controls.Add(this.btnDecrypt);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(113, 113);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(194, 24);
this.panel1.TabIndex = 5;
//
// wLoginPwd // wLoginPwd
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(377, 213); this.ClientSize = new System.Drawing.Size(481, 324);
this.Controls.Add(this.btnEncrypt); this.Controls.Add(this.tableLayoutPanel1);
this.Controls.Add(this.label2);
this.Controls.Add(this.tbResult);
this.Controls.Add(this.btnDecrypt);
this.Controls.Add(this.label1);
this.Controls.Add(this.tbSrcString);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "wLoginPwd"; this.Name = "wLoginPwd";
this.Text = "wLoginPwd"; this.Text = "wLoginPwd";
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.panel1.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout();
} }
...@@ -115,5 +157,7 @@ ...@@ -115,5 +157,7 @@
private System.Windows.Forms.TextBox tbResult; private System.Windows.Forms.TextBox tbResult;
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button btnEncrypt; private System.Windows.Forms.Button btnEncrypt;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Panel panel1;
} }
} }
\ No newline at end of file
...@@ -114,7 +114,7 @@ namespace Tools.UI ...@@ -114,7 +114,7 @@ namespace Tools.UI
this.EndEdit(); this.EndEdit();
//保存配置信息 //保存配置信息
bool b = false; bool b = false;
if (this._ds.HasChanges()) if (this._ds != null && this._ds.HasChanges())
{ {
b = this._db.SaveData(this._ds, this.tableList); b = this._db.SaveData(this._ds, this.tableList);
} }
......
...@@ -3,6 +3,7 @@ using System.Collections.Generic; ...@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
using System.Drawing; using System.Drawing;
using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
...@@ -10,6 +11,7 @@ using System.Windows.Forms; ...@@ -10,6 +11,7 @@ using System.Windows.Forms;
// //
using Tools.MyCommon; using Tools.MyCommon;
using Tools.MyData; using Tools.MyData;
using Tools.MyUtils;
namespace Tools.UI namespace Tools.UI
{ {
...@@ -18,12 +20,15 @@ namespace Tools.UI ...@@ -18,12 +20,15 @@ namespace Tools.UI
DBHelper _db = null; DBHelper _db = null;
DataTable _dt = null; DataTable _dt = null;
wBasic frmView = null;
WebBrowser _browser = null;
string _html = "";
string ProjectName => this.cbProjectName.Text; string ProjectName => this.cbProjectName.Text;
string InChargeUser => this.cbInChargeUser.Text; string InChargeUser => this.cbInChargeUser.Text;
string TaskState => this.cbTaskState.Text; string TaskState => this.cbTaskState.Text;
string ColorColumn = ""; string ColorColumn = "";
string TaskColumn = "";
public wTaskBoard() public wTaskBoard()
{ {
...@@ -42,7 +47,16 @@ namespace Tools.UI ...@@ -42,7 +47,16 @@ namespace Tools.UI
} }
private void wTaskBoard_Shown(object sender, EventArgs e) private void wTaskBoard_Shown(object sender, EventArgs e)
{ {
//初始化单元格背景
this.SetGridForeColor(); 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> /// <summary>
...@@ -62,11 +76,6 @@ namespace Tools.UI ...@@ -62,11 +76,6 @@ namespace Tools.UI
this.ColorColumn = colName; this.ColorColumn = colName;
continue; continue;
} }
if (colName.Contains("Task"))
{
this.TaskColumn = colName;
continue;
}
dc.ColumnName = colName.Split('_')[0]; dc.ColumnName = colName.Split('_')[0];
} }
...@@ -131,7 +140,44 @@ namespace Tools.UI ...@@ -131,7 +140,44 @@ namespace Tools.UI
//附加过滤条件 //附加过滤条件
this.cb_SelectedIndexChanged(null, null); 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();
}
} }
} }
...@@ -69,9 +69,7 @@ namespace Tools.UI ...@@ -69,9 +69,7 @@ namespace Tools.UI
public override void InitUI() public override void InitUI()
{ {
//表格初始化 //表格初始化
this.dgvDetail.AllowUserToAddRows = false; this.InitGridView(this.dgvDetail, false, false);
this.dgvDetail.AutoGenerateColumns = false;
this.dgvDetail.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
//事件 //事件
this.dgvDetail.CellFormatting += DgvDetail_CellFormatting; this.dgvDetail.CellFormatting += DgvDetail_CellFormatting;
this.dgvDetail.DataError += DgvDetail_DataError; this.dgvDetail.DataError += DgvDetail_DataError;
......
...@@ -9,11 +9,26 @@ namespace Tools ...@@ -9,11 +9,26 @@ namespace Tools
{ {
//预定义分类:统一采用四字说明 //预定义分类:统一采用四字说明
string Tools_uni = "通用工具"; /// <summary>
string Tools_imp = "实施工具"; /// 通用工具
string Tools_dev = "开发工具"; /// </summary>
string Tools_human = "行政工具"; public readonly string Tools_uni = "通用工具";
string Tools_demos = "示例程序"; /// <summary>
/// 实施工具
/// </summary>
public readonly string Tools_imp = "实施工具";
/// <summary>
/// 开发工具
/// </summary>
public readonly string Tools_dev = "开发工具";
/// <summary>
/// 行政工具
/// </summary>
public readonly string Tools_human = "行政工具";
/// <summary>
/// 示例程序
/// </summary>
public readonly string Tools_demos = "示例程序";
/// <summary> /// <summary>
/// 获取模块列表 /// 获取模块列表
...@@ -25,14 +40,15 @@ namespace Tools ...@@ -25,14 +40,15 @@ namespace Tools
return new List<ModuleInfo> return new List<ModuleInfo>
{ {
//------------------------------- //-------------------------------
this.CreateModule(Tools_uni, typeof(UI.wFlowShare), "流程共享", "tr:助力业务沉淀与流程共享"), this.CreateModule(Tools_uni, typeof(UI.wFlowShare), "共享文件", "tr:助力业务沉淀与流程共享"),
this.CreateModule(Tools_uni, typeof(UI.wDbLinkMngr), "共享信息", "tr:客户数据库及远程桌面信息"),
this.CreateModule(Tools_uni, typeof(UI.wTaskBoard), "任务看板", "tr:任务看板的简易化工具,免除翻页困扰"), this.CreateModule(Tools_uni, typeof(UI.wTaskBoard), "任务看板", "tr:任务看板的简易化工具,免除翻页困扰"),
this.CreateModule(Tools_uni, typeof(UI.wLoginPwd), "密码解析", "tr:用于登陆密码的解密加密"), this.CreateModule(Tools_uni, typeof(UI.wLoginPwd), "密码解析", "tr:用于登陆密码的解密加密"),
this.CreateModule(Tools_uni, typeof(UI.wDbLinkMngr), "客户信息", "tr:客户数据库及远程桌面信息"),
//------------------------------- //-------------------------------
this.CreateModule(Tools_imp, typeof(UpdateExecuter.frmMain), "更新执行工具", "xj:用于客户更新和执行SQL脚本"), this.CreateModule(Tools_imp, typeof(UpdateExecuter.frmMain), "更新执行工具", "xj:用于客户更新和执行SQL脚本"),
this.CreateModule(Tools_imp, typeof(UI.wEmptyTable), "清空表", "tr:输入主表、自动清空关联表的工具"), this.CreateModule(Tools_imp, typeof(UI.wEmptyTable), "清空表", "tr:输入主表、自动清空关联表的工具"),
this.CreateModule(Tools_imp, typeof(UI.wExcelExportSetting), "Excel导出设置", "tr:Excel导出配置图形化版本"), this.CreateModule(Tools_imp, typeof(UI.wExcelExportSetting), "Excel导出设置", "tr:Excel导出配置图形化版本"),
this.CreateModule(Tools_imp, typeof(UI.wLogViewer), "日志查看器", "tr:可以方便的查看系统日志"),
//------------------------------- //-------------------------------
this.CreateModule(Tools_dev, typeof(Ftt.PatchPack.FrmMain), "自动打包工具", "xj:用于CS后端程序自动打包成压缩包"), this.CreateModule(Tools_dev, typeof(Ftt.PatchPack.FrmMain), "自动打包工具", "xj:用于CS后端程序自动打包成压缩包"),
this.CreateModule(Tools_dev, typeof(UI.wSysModule), "功能模块管理", "xj:管理功能模块和代码窗体的映射"), this.CreateModule(Tools_dev, typeof(UI.wSysModule), "功能模块管理", "xj:管理功能模块和代码窗体的映射"),
......
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