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
49d1305d
Commit
49d1305d
authored
Mar 31, 2021
by
tr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、数据库配置:增加粘贴时自动解析填充功能
parent
0b5c1657
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
9 deletions
+40
-9
Utils.cs
Tools/MyUtils/Utils.cs
+3
-3
wDbSetting.Designer.cs
Tools/MyUtils/wDbSetting.Designer.cs
+1
-0
wDbSetting.cs
Tools/MyUtils/wDbSetting.cs
+35
-5
wAuditDemo.cs
Tools/UI/wAuditDemo.cs
+1
-1
No files found.
Tools/MyUtils/Utils.cs
View file @
49d1305d
...
...
@@ -216,7 +216,7 @@ namespace Tools.MyUtils
/// <param name="userId"></param>
/// <param name="pwd"></param>
/// <returns></returns>
public
static
string
GetLinkString
(
string
link
,
string
userId
,
string
pwd
,
string
dbName
)
public
static
string
Get
Db
LinkString
(
string
link
,
string
userId
,
string
pwd
,
string
dbName
)
{
return
$"Password=
{
pwd
}
;Persist Security Info=True;User ID=
{
userId
}
;Initial Catalog=
{
dbName
}
;Data Source=
{
link
}
"
;
}
...
...
@@ -225,9 +225,9 @@ namespace Tools.MyUtils
/// </summary>
/// <param name="m"></param>
/// <returns></returns>
public
static
string
GetLinkString
(
DbItemModel
m
)
public
static
string
Get
Db
LinkString
(
DbItemModel
m
)
{
return
GetLinkString
(
m
.
Link
,
m
.
UserId
,
m
.
Pwd
,
m
.
DbName
);
return
Get
Db
LinkString
(
m
.
Link
,
m
.
UserId
,
m
.
Pwd
,
m
.
DbName
);
}
/// <summary>
/// 链接转为模型对象
...
...
Tools/MyUtils/wDbSetting.Designer.cs
View file @
49d1305d
...
...
@@ -82,6 +82,7 @@
this
.
tbLink
.
Name
=
"tbLink"
;
this
.
tbLink
.
Size
=
new
System
.
Drawing
.
Size
(
168
,
21
);
this
.
tbLink
.
TabIndex
=
4
;
this
.
tbLink
.
KeyUp
+=
new
System
.
Windows
.
Forms
.
KeyEventHandler
(
this
.
tbLink_KeyUp
);
//
// tbDbName
//
...
...
Tools/MyUtils/wDbSetting.cs
View file @
49d1305d
...
...
@@ -37,10 +37,10 @@ namespace Tools.MyUtils
DataTable
_dt
=
null
;
string
link_cfg
=
$@"
{
Utils
.
ConfigPath
}
\links.xml"
;
string
Link
=>
this
.
tbLink
.
Text
.
Trim
();
string
DbName
=>
this
.
tbDbName
.
Text
.
Trim
();
string
UserId
=>
this
.
tbUserId
.
Text
.
Trim
();
string
Pwd
=>
this
.
tbPwd
.
Text
.
Trim
();
string
Link
{
get
=>
this
.
tbLink
.
Text
.
Trim
();
set
=>
this
.
tbLink
.
Text
=
value
;
}
string
DbName
{
get
=>
this
.
tbDbName
.
Text
.
Trim
();
set
=>
this
.
tbDbName
.
Text
=
value
;
}
string
UserId
{
get
=>
this
.
tbUserId
.
Text
.
Trim
();
set
=>
this
.
tbUserId
.
Text
=
value
;
}
string
Pwd
{
get
=>
this
.
tbPwd
.
Text
.
Trim
();
set
=>
this
.
tbPwd
.
Text
=
value
;
}
public
wDbSetting
(
object
control
=
null
)
{
...
...
@@ -139,6 +139,36 @@ namespace Tools.MyUtils
{
this
.
EchoControl
?.
GetType
().
GetProperty
(
"Text"
)?.
SetValue
(
this
.
EchoControl
,
m
.
ToString
());
}
/// <summary>
/// 链接粘贴时,自动解析
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private
void
tbLink_KeyUp
(
object
sender
,
KeyEventArgs
e
)
{
if
(
e
.
KeyData
==
(
Keys
.
Control
|
Keys
.
V
))
{
var
item
=
Utils
.
GetDbItemModel
(
this
.
tbLink
.
Text
);
if
(!
string
.
IsNullOrEmpty
(
item
.
Link
))
{
this
.
Display
(
item
);
}
}
}
/// <summary>
/// 链接展示
/// </summary>
/// <param name="item"></param>
private
void
Display
(
DbItemModel
item
)
{
this
.
Link
=
item
.
Link
;
this
.
DbName
=
item
.
DbName
;
this
.
UserId
=
item
.
UserId
;
this
.
Pwd
=
item
.
Pwd
;
}
}
...
...
@@ -148,7 +178,7 @@ namespace Tools.MyUtils
public
string
DbName
{
get
;
set
;
}
public
string
UserId
{
get
;
set
;
}
public
string
Pwd
{
get
;
set
;
}
public
string
LinkString
=>
Utils
.
GetLinkString
(
this
);
public
string
LinkString
=>
Utils
.
Get
Db
LinkString
(
this
);
public
override
string
ToString
()
{
return
$"
{
this
.
DbName
}
(
{
this
.
Link
}
)"
;
...
...
Tools/UI/wAuditDemo.cs
View file @
49d1305d
...
...
@@ -55,7 +55,7 @@ namespace Tools.UI
{
#
region
初始化数据库对象
string
link
=
Utils
.
GetLinkString
(
"192.168.1.204"
,
"sa"
,
"sa"
,
"FTT_PDM"
);
string
link
=
Utils
.
Get
Db
LinkString
(
"192.168.1.204"
,
"sa"
,
"sa"
,
"FTT_PDM"
);
this
.
InitDBHelper
(
link
);
#
endregion
...
...
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