Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
Ftt_Common
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Ftt_Common
Commits
0cd39660
Commit
0cd39660
authored
Oct 11, 2021
by
tr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、增加系统权限和登录功能
parent
d761b63c
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
578 additions
and
87 deletions
+578
-87
Newtonsoft.Json.dll
AppHome/Newtonsoft.Json.dll
+0
-0
Tools.exe.config
AppHome/Tools.exe.config
+2
-1
Common.cs
Tools/MyCommon/Common.cs
+39
-0
Utils.cs
Tools/MyUtils/Utils.cs
+25
-1
Tools.csproj
Tools/Tools.csproj
+10
-0
wLogin.Designer.cs
Tools/UI/sys/wLogin.Designer.cs
+169
-0
wLogin.cs
Tools/UI/sys/wLogin.cs
+67
-0
wLogin.resx
Tools/UI/sys/wLogin.resx
+120
-0
wMain.Designer.cs
Tools/wMain.Designer.cs
+19
-17
wMain.cs
Tools/wMain.cs
+70
-14
wMain.resx
Tools/wMain.resx
+57
-54
No files found.
AppHome/Newtonsoft.Json.dll
View file @
0cd39660
No preview for this file type
AppHome/Tools.exe.config
View file @
0cd39660
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
configuration
>
<
appSettings
>
<
add
key
=
"UpdateTime"
value
=
"2021-09-16 14:39:31.333"
/>
<
add
key
=
"UpdateTime"
value
=
"2021-09-29 16:51:27.897"
/>
<
add
key
=
"LoginInfo"
value
=
"wwF/xpBzWek="
/>
</
appSettings
>
<
startup
>
<
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.8"
/>
...
...
Tools/MyCommon/Common.cs
View file @
0cd39660
...
...
@@ -6,10 +6,49 @@ using System.Threading.Tasks;
namespace
Tools.MyCommon
{
/*
* Global Readonly Feilds : 全局只读字段
*/
/// <summary>
/// 应用静态字段
/// </summary>
public
class
APP
{
/// <summary>
/// 登录信息
/// </summary>
public
static
string
LOGIN_INFO
=>
"LoginInfo"
;
/// <summary>
/// 更新时间
/// </summary>
public
static
string
UPDATE_TIME
=>
"UpdateTime"
;
}
/*
* Info : 全局的基础信息
*/
/// <summary>
/// 用户信息
/// </summary>
public
static
class
LoginInfo
{
/// <summary>
/// 用户名
/// </summary>
public
static
string
UserName
{
get
;
set
;
}
=
"访客"
;
/// <summary>
/// 密码
/// </summary>
public
static
string
Password
{
get
;
set
;
}
/// <summary>
/// 是否部门负责人
/// </summary>
public
static
bool
IsPrincipal
{
get
;
set
;
}
=
false
;
}
/// <summary>
/// 模块信息:菜单渲染时使用
/// </summary>
...
...
Tools/MyUtils/Utils.cs
View file @
0cd39660
using
System
;
using
Newtonsoft.Json
;
using
System
;
using
System.Collections.Generic
;
using
System.Configuration
;
using
System.Data
;
...
...
@@ -534,6 +535,29 @@ namespace Tools.MyUtils
return
a
<=
high
&&
a
>=
low
;
}
#
endregion
#
region
(
扩展
)
JSON
序列化
/// <summary>
/// JSON序列化
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public
static
string
ToJson
(
this
object
obj
)
{
return
JsonConvert
.
SerializeObject
(
obj
);
}
/// <summary>
/// JSON反序列化
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="json">JSON字符串</param>
/// <returns></returns>
public
static
T
ToEntity
<
T
>(
this
string
json
)
{
return
JsonConvert
.
DeserializeObject
<
T
>(
json
);
}
#
endregion
#
region
图片分离
...
...
Tools/Tools.csproj
View file @
0cd39660
...
...
@@ -47,6 +47,7 @@
<Reference
Include=
"ICSharpCode.SharpZipLib, Version=1.3.2.10, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL"
>
<HintPath>
..\packages\SharpZipLib.1.3.2\lib\net45\ICSharpCode.SharpZipLib.dll
</HintPath>
</Reference>
<Reference
Include=
"Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"
/>
<Reference
Include=
"NPOI, Version=2.5.1.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL"
>
<HintPath>
..\FunnyPick\packages\NPOI.2.5.1\lib\net45\NPOI.dll
</HintPath>
</Reference>
...
...
@@ -105,6 +106,12 @@
<Compile
Include=
"MyUtils\DrawHelper.cs"
/>
<Compile
Include=
"MyUtils\InputtingService.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\wCefDemo.cs"
>
<SubType>
Form
</SubType>
</Compile>
...
...
@@ -331,6 +338,9 @@
<DependentUpon>
Resources.resx
</DependentUpon>
<DesignTime>
True
</DesignTime>
</Compile>
<EmbeddedResource
Include=
"UI\sys\wLogin.resx"
>
<DependentUpon>
wLogin.cs
</DependentUpon>
</EmbeddedResource>
<EmbeddedResource
Include=
"UI\wCefDemo.resx"
>
<DependentUpon>
wCefDemo.cs
</DependentUpon>
</EmbeddedResource>
...
...
Tools/UI/sys/wLogin.Designer.cs
0 → 100644
View file @
0cd39660
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
.
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
.
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
);
//
// 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
;
}
}
\ No newline at end of file
Tools/UI/sys/wLogin.cs
0 → 100644
View file @
0cd39660
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
;
public
wLogin
()
{
InitializeComponent
();
//
this
.
DialogResult
=
DialogResult
.
None
;
}
private
void
wLogin_Load
(
object
sender
,
EventArgs
e
)
{
this
.
tbUserName
.
Text
=
LoginInfo
.
UserName
;
}
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
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
());
//保存登录信息
Utils
.
AppSettings
(
APP
.
LOGIN_INFO
,
Utils
.
Encryptor
(
dt
.
DefaultView
[
0
][
"ID"
].
ToString
()));
//关闭窗口
this
.
DialogResult
=
DialogResult
.
OK
;
this
.
Close
();
}
}
}
}
Tools/UI/sys/wLogin.resx
0 → 100644
View file @
0cd39660
<?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
Tools/wMain.Designer.cs
View file @
0cd39660
...
...
@@ -36,7 +36,7 @@
this
.
imageList1
=
new
System
.
Windows
.
Forms
.
ImageList
(
this
.
components
);
this
.
tabControl1
=
new
System
.
Windows
.
Forms
.
TabControl
();
this
.
HomePage
=
new
System
.
Windows
.
Forms
.
TabPage
();
this
.
webBrowser1
=
new
System
.
Windows
.
Forms
.
WebBrowser
();
this
.
label5
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
menuStrip1
=
new
System
.
Windows
.
Forms
.
MenuStrip
();
this
.
toolStripMenuItem1
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
tsmiSysUpload
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
...
...
@@ -148,7 +148,7 @@
//
// HomePage
//
this
.
HomePage
.
Controls
.
Add
(
this
.
webBrowser1
);
this
.
HomePage
.
Controls
.
Add
(
this
.
label5
);
this
.
HomePage
.
Location
=
new
System
.
Drawing
.
Point
(
4
,
26
);
this
.
HomePage
.
Name
=
"HomePage"
;
this
.
HomePage
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
3
);
...
...
@@ -157,16 +157,17 @@
this
.
HomePage
.
Text
=
"首页"
;
this
.
HomePage
.
UseVisualStyleBackColor
=
true
;
//
//
webBrowser1
//
label5
//
this
.
webBrowser1
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
webBrowser1
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
3
);
this
.
webBrowser1
.
MinimumSize
=
new
System
.
Drawing
.
Size
(
20
,
20
);
this
.
webBrowser1
.
Name
=
"webBrowser1"
;
this
.
webBrowser1
.
Size
=
new
System
.
Drawing
.
Size
(
480
,
333
);
this
.
webBrowser1
.
TabIndex
=
0
;
this
.
webBrowser1
.
Url
=
new
System
.
Uri
(
""
,
System
.
UriKind
.
Relative
);
this
.
webBrowser1
.
Visible
=
false
;
this
.
label5
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
label5
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
18F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
label5
.
ForeColor
=
System
.
Drawing
.
SystemColors
.
AppWorkspace
;
this
.
label5
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
3
);
this
.
label5
.
Name
=
"label5"
;
this
.
label5
.
Size
=
new
System
.
Drawing
.
Size
(
480
,
333
);
this
.
label5
.
TabIndex
=
0
;
this
.
label5
.
Text
=
"欢迎使用飞天兔工具平台"
;
this
.
label5
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleCenter
;
//
// menuStrip1
//
...
...
@@ -196,31 +197,31 @@
// tsmiSysUpload
//
this
.
tsmiSysUpload
.
Name
=
"tsmiSysUpload"
;
this
.
tsmiSysUpload
.
Size
=
new
System
.
Drawing
.
Size
(
1
24
,
22
);
this
.
tsmiSysUpload
.
Size
=
new
System
.
Drawing
.
Size
(
1
80
,
22
);
this
.
tsmiSysUpload
.
Text
=
"上传更新"
;
//
// tsmiSysUpdate
//
this
.
tsmiSysUpdate
.
Name
=
"tsmiSysUpdate"
;
this
.
tsmiSysUpdate
.
Size
=
new
System
.
Drawing
.
Size
(
1
24
,
22
);
this
.
tsmiSysUpdate
.
Size
=
new
System
.
Drawing
.
Size
(
1
80
,
22
);
this
.
tsmiSysUpdate
.
Text
=
"检查更新"
;
//
// tsmiSysUpdateLog
//
this
.
tsmiSysUpdateLog
.
Name
=
"tsmiSysUpdateLog"
;
this
.
tsmiSysUpdateLog
.
Size
=
new
System
.
Drawing
.
Size
(
1
24
,
22
);
this
.
tsmiSysUpdateLog
.
Size
=
new
System
.
Drawing
.
Size
(
1
80
,
22
);
this
.
tsmiSysUpdateLog
.
Text
=
"更新记录"
;
//
// tsmiSysReLogin
//
this
.
tsmiSysReLogin
.
Name
=
"tsmiSysReLogin"
;
this
.
tsmiSysReLogin
.
Size
=
new
System
.
Drawing
.
Size
(
1
24
,
22
);
this
.
tsmiSysReLogin
.
Size
=
new
System
.
Drawing
.
Size
(
1
80
,
22
);
this
.
tsmiSysReLogin
.
Text
=
"重新登录"
;
//
// tsmiSysExit
//
this
.
tsmiSysExit
.
Name
=
"tsmiSysExit"
;
this
.
tsmiSysExit
.
Size
=
new
System
.
Drawing
.
Size
(
1
24
,
22
);
this
.
tsmiSysExit
.
Size
=
new
System
.
Drawing
.
Size
(
1
80
,
22
);
this
.
tsmiSysExit
.
Text
=
"退出系统"
;
//
// toolStripMenuItem2
...
...
@@ -439,6 +440,7 @@
this
.
lbSysLoginUser
.
TabIndex
=
6
;
this
.
lbSysLoginUser
.
Text
=
"飞天兔开放平台"
;
this
.
lbSysLoginUser
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleLeft
;
this
.
toolTip1
.
SetToolTip
(
this
.
lbSysLoginUser
,
"点击登录"
);
//
// label2
//
...
...
@@ -523,7 +525,7 @@
private
System
.
Windows
.
Forms
.
Label
lbSysMemery
;
private
System
.
Windows
.
Forms
.
Label
label3
;
private
System
.
Windows
.
Forms
.
Timer
timer1
;
private
System
.
Windows
.
Forms
.
WebBrowser
webBrowser1
;
private
System
.
Windows
.
Forms
.
ToolStripMenuItem
tsmiSysUpdateLog
;
private
System
.
Windows
.
Forms
.
Label
label5
;
}
}
\ No newline at end of file
Tools/wMain.cs
View file @
0cd39660
...
...
@@ -14,12 +14,12 @@ using System.Windows.Forms;
using
Tools.MyCommon
;
using
Tools.MyData
;
using
Tools.MyUtils
;
using
Tools.UI.sys
;
namespace
Tools
{
public
partial
class
wMain
:
Form
{
/// <summary>
/// 窗体扩展类
/// </summary>
...
...
@@ -47,7 +47,15 @@ namespace Tools
private
void
WMainView_Load
(
object
sender
,
EventArgs
e
)
{
//初始化数据库链接
var
link
=
Utils
.
GetDbLinkString204
(
"FTT_Work"
);
this
.
_db
=
new
DBHelper
(
link
);
//检查权限
this
.
CheckPower
();
//渲染菜单
this
.
RenderMenu
();
//非部门管理员,禁用上传更新
this
.
tsmiSysUpload
.
Enabled
=
LoginInfo
.
IsPrincipal
;
}
private
void
WMainView_Shown
(
object
sender
,
EventArgs
e
)
{
...
...
@@ -67,17 +75,16 @@ namespace Tools
//用TabControl模拟MDI效果
this
.
tabControl1
.
SelectedIndexChanged
+=
TabControl1_SelectedIndexChanged
;
this
.
tabControl1
.
MouseDoubleClick
+=
TabControl1_MouseDoubleClick
;
//用户登录
this
.
lbSysLoginUser
.
Click
+=
LbSysLoginUser_Click
;
//初始化数据库链接
var
link
=
Utils
.
GetDbLinkString204
(
"FTT_Work"
);
this
.
_db
=
new
DBHelper
(
link
);
//检查更新
Task
.
Run
(()
=>
this
.
CheckUpdate
(
true
));
//加载首页
Task
.
Run
(()
=>
this
.
AsyncUI
(()
=>
{
this
.
webBrowser1
.
Url
=
new
Uri
(
"http://www.feteto.cn/#/"
);
this
.
webBrowser1
.
Show
();
}));
//
Task.Run(() => this.AsyncUI(() => {
//
this.webBrowser1.Url = new Uri("http://www.feteto.cn/#/");
//
this.webBrowser1.Show();
//
}));
//版本号处理
Task
.
Run
(()
=>
this
.
AsyncUI
(()
=>
{
var
dt
=
this
.
_db
.
GetDataTable
(
$@"
...
...
@@ -88,11 +95,12 @@ namespace Tools
this
.
lbSysVersion
.
Text
=
dt
.
DefaultView
.
Count
==
0
?
$"2021.1"
:
$"
{
dt
.
DefaultView
[
0
][
0
]}
"
;
}));
}
private
void
wMain_FormClosing
(
object
sender
,
FormClosingEventArgs
e
)
{
this
.
_db
=
null
;
this
.
webBrowser1
.
Hide
();
this
.
webBrowser1
.
Dispose
();
//
this.webBrowser1.Hide();
//
this.webBrowser1.Dispose();
}
#
region
基础:关闭、最大化、最小化
...
...
@@ -248,7 +256,7 @@ namespace Tools
/// </summary>
private
void
CheckUpdate
(
bool
IsSilentWhenNotFound
=
false
)
{
var
updateTime
=
Utils
.
AppSettings
(
"UpdateTime"
);
var
updateTime
=
Utils
.
AppSettings
(
APP
.
UPDATE_TIME
);
var
dt
=
this
.
_db
.
GetDataTable
(
$"SELECT TOP 1 UDate, URemark FROM dbo.FTT_AutoUpdate WHERE UDate > '
{
updateTime
}
' ORDER BY UDate DESC"
,
"FTT_AutoUpdate"
);
if
(
dt
.
DefaultView
.
Count
>
0
)
{
...
...
@@ -257,7 +265,7 @@ namespace Tools
return
;
//记录更新时间
var
date
=
Convert
.
ToDateTime
(
drv
[
"UDate"
]);
Utils
.
AppSettings
(
"UpdateTime"
,
date
.
ToString
(
"yyyy-MM-dd HH:mm:ss.fff"
));
Utils
.
AppSettings
(
APP
.
UPDATE_TIME
,
date
.
ToString
(
"yyyy-MM-dd HH:mm:ss.fff"
));
//启动自动更新
var
info
=
new
ProcessStartInfo
()
{
...
...
@@ -425,6 +433,19 @@ namespace Tools
});
}
#
endregion
#
region
扩展:登录功能
//登录人员点击
private
void
LbSysLoginUser_Click
(
object
sender
,
EventArgs
e
)
{
wLogin
login
=
new
wLogin
();
if
(
login
.
ShowDialog
()
==
DialogResult
.
OK
)
{
this
.
SetLoginUserName
();
}
}
#
endregion
#
region
本地:菜单渲染
...
...
@@ -440,7 +461,8 @@ namespace Tools
this
.
listView1
.
View
=
View
.
SmallIcon
;
this
.
listView1
.
DoubleClick
+=
ListView1_DoubleClick
;
//装载目录
var
mList
=
this
.
Extend
.
GetModuleList
();
var
limitGroupName
=
LoginInfo
.
IsPrincipal
?
""
:
"行政工具"
;
//行政工具,只有部门负责人可以使用
var
mList
=
this
.
Extend
.
GetModuleList
().
Where
(
m
=>
m
.
GroupName
!=
limitGroupName
);
foreach
(
ModuleInfo
m
in
mList
)
{
//获取分组
...
...
@@ -513,7 +535,41 @@ namespace Tools
}
}
#
endregion
/// <summary>
/// 检查权限
/// </summary>
private
void
CheckPower
()
{
//获取登录信息
var
loginInfo
=
Utils
.
AppSettings
(
APP
.
LOGIN_INFO
);
if
(!
string
.
IsNullOrEmpty
(
loginInfo
))
{
var
sql
=
$@"
SELECT Name as UserName, LoginPassword as Password, ISNULL(IsPrincipal, 0) AS IsPrincipal
FROM dbo.AC_User
WHERE ISNULL(IsStop, 0) = 0 and ID =
{
Utils
.
Decryptor
(
loginInfo
)}
"
;
var
dt
=
this
.
_db
.
GetDataTable
(
sql
,
"user"
,
false
);
if
(
dt
.
DefaultView
.
Count
>
0
)
{
var
userName
=
dt
.
DefaultView
[
0
][
"UserName"
].
ToString
();
//初始化登录人员信息
LoginInfo
.
UserName
=
userName
;
LoginInfo
.
Password
=
dt
.
DefaultView
[
0
][
"Password"
].
ToString
();
LoginInfo
.
IsPrincipal
=
Convert
.
ToBoolean
(
dt
.
DefaultView
[
0
][
"IsPrincipal"
].
ToString
());
}
}
//
this
.
SetLoginUserName
();
}
/// <summary>
/// 设置登录人员名称
/// </summary>
/// <param name="userName"></param>
private
void
SetLoginUserName
()
{
this
.
lbSysLoginUser
.
Text
=
LoginInfo
.
UserName
;
}
#
endregion
}
}
Tools/wMain.resx
View file @
0cd39660
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment