Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
Kivii.Client.Test
Project
Overview
Details
Activity
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
示例代码
Kivii.Client.Test
Commits
76fe86c3
Commit
76fe86c3
authored
Mar 18, 2019
by
施晓雨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加入同步标记
parent
190f69a8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
FrmMain.Designer.cs
Src/Kivii.Client.Test/Forms/FrmMain.Designer.cs
+14
-0
FrmMain.cs
Src/Kivii.Client.Test/Forms/FrmMain.cs
+16
-0
No files found.
Src/Kivii.Client.Test/Forms/FrmMain.Designer.cs
View file @
76fe86c3
...
@@ -52,6 +52,7 @@
...
@@ -52,6 +52,7 @@
this
.
groupBox3
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
groupBox3
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
btnSave
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnSave
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnLoadData
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnLoadData
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnClearData
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
panel1
.
SuspendLayout
();
this
.
panel1
.
SuspendLayout
();
this
.
groupBox2
.
SuspendLayout
();
this
.
groupBox2
.
SuspendLayout
();
this
.
groupBox1
.
SuspendLayout
();
this
.
groupBox1
.
SuspendLayout
();
...
@@ -270,6 +271,7 @@
...
@@ -270,6 +271,7 @@
//
//
// groupBox3
// groupBox3
//
//
this
.
groupBox3
.
Controls
.
Add
(
this
.
btnClearData
);
this
.
groupBox3
.
Controls
.
Add
(
this
.
btnLoadData
);
this
.
groupBox3
.
Controls
.
Add
(
this
.
btnLoadData
);
this
.
groupBox3
.
Controls
.
Add
(
this
.
btnSave
);
this
.
groupBox3
.
Controls
.
Add
(
this
.
btnSave
);
this
.
groupBox3
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Bottom
;
this
.
groupBox3
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Bottom
;
...
@@ -300,6 +302,16 @@
...
@@ -300,6 +302,16 @@
this
.
btnLoadData
.
UseVisualStyleBackColor
=
true
;
this
.
btnLoadData
.
UseVisualStyleBackColor
=
true
;
this
.
btnLoadData
.
Click
+=
new
System
.
EventHandler
(
this
.
btnLoadData_Click
);
this
.
btnLoadData
.
Click
+=
new
System
.
EventHandler
(
this
.
btnLoadData_Click
);
//
//
// btnClearData
//
this
.
btnClearData
.
Location
=
new
System
.
Drawing
.
Point
(
151
,
34
);
this
.
btnClearData
.
Name
=
"btnClearData"
;
this
.
btnClearData
.
Size
=
new
System
.
Drawing
.
Size
(
110
,
23
);
this
.
btnClearData
.
TabIndex
=
2
;
this
.
btnClearData
.
Text
=
"清空本地数据"
;
this
.
btnClearData
.
UseVisualStyleBackColor
=
true
;
this
.
btnClearData
.
Click
+=
new
System
.
EventHandler
(
this
.
btnClearData_Click
);
//
// FrmMain
// FrmMain
//
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
6F
,
12F
);
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
6F
,
12F
);
...
@@ -348,5 +360,6 @@
...
@@ -348,5 +360,6 @@
private
System
.
Windows
.
Forms
.
GroupBox
groupBox3
;
private
System
.
Windows
.
Forms
.
GroupBox
groupBox3
;
private
System
.
Windows
.
Forms
.
Button
btnSave
;
private
System
.
Windows
.
Forms
.
Button
btnSave
;
private
System
.
Windows
.
Forms
.
Button
btnLoadData
;
private
System
.
Windows
.
Forms
.
Button
btnLoadData
;
private
System
.
Windows
.
Forms
.
Button
btnClearData
;
}
}
}
}
\ No newline at end of file
Src/Kivii.Client.Test/Forms/FrmMain.cs
View file @
76fe86c3
...
@@ -94,6 +94,7 @@ namespace Kivii.Client.Test.Forms
...
@@ -94,6 +94,7 @@ namespace Kivii.Client.Test.Forms
foreach
(
var
member
in
results
)
foreach
(
var
member
in
results
)
{
{
if
(
conn
.
Exists
<
Member
>(
o
=>
o
.
Kvid
==
member
.
Kvid
))
continue
;
if
(
conn
.
Exists
<
Member
>(
o
=>
o
.
Kvid
==
member
.
Kvid
))
continue
;
member
.
Tag
=
KiviiContext
.
EntityTagForDbSync
;
//加入这个标记,代表数据本身的一些CurrentTime的标记不会被执行,完全按现有数据存入数据库
conn
.
Insert
(
member
);
conn
.
Insert
(
member
);
}
}
}
}
...
@@ -116,5 +117,20 @@ namespace Kivii.Client.Test.Forms
...
@@ -116,5 +117,20 @@ namespace Kivii.Client.Test.Forms
if
(
conn
!=
null
)
conn
.
Dispose
();
if
(
conn
!=
null
)
conn
.
Dispose
();
}
}
}
}
private
void
btnClearData_Click
(
object
sender
,
EventArgs
e
)
{
IDbConnection
conn
=
null
;
try
{
conn
=
KiviiContext
.
GetOpenedDbConnection
<
Member
>();
//和服务器上的用法一样,只是连接的数据库在本地的Config文件中指定了
conn
.
Delete
<
Member
>(
o
=>
o
.
Status
>=
0
);
dgvResults
.
DataSource
=
null
;
}
finally
//这个方法不管try中有没有catch,都会最后执行,方便释放数据库连接,在客户端模式下,所有的连接不会自己自动释放,需要人为的释放,切记。
{
if
(
conn
!=
null
)
conn
.
Dispose
();
}
}
}
}
}
}
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