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
6e4a4d9e
Commit
6e4a4d9e
authored
Sep 01, 2020
by
tr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、数据表操作新增包含列和生成列列表
parent
75f5cc42
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
105 additions
and
9 deletions
+105
-9
EasyDataTable.cs
FunnyPick/FunnyPick/EasyDataTable.cs
+94
-0
ExcelExportHelper.cs
FunnyPick/FunnyPick/ExcelExportHelper.cs
+6
-8
FunnyPick.csprojAssemblyReference.cache
...bug/netcoreapp3.0/FunnyPick.csprojAssemblyReference.cache
+0
-0
FunnyPick.csproj.nuget.cache
FunnyPick/FunnyPick/obj/FunnyPick.csproj.nuget.cache
+1
-1
FunnyPick.csproj.nuget.dgspec.json
FunnyPick/FunnyPick/obj/FunnyPick.csproj.nuget.dgspec.json
+2
-0
project.assets.json
FunnyPick/FunnyPick/obj/project.assets.json
+2
-0
No files found.
FunnyPick/FunnyPick/EasyDataTable.cs
View file @
6e4a4d9e
...
...
@@ -141,5 +141,99 @@ namespace FunnyPick
||
dr
.
RowState
==
DataRowState
.
Deleted
||
dr
.
RowState
==
DataRowState
.
Detached
;
}
/// <summary>
/// 是否包含指定列
/// </summary>
/// <param name="dt"></param>
/// <param name="col"></param>
/// <returns></returns>
public
static
bool
IsContainsColumn
(
DataTable
dt
,
string
col
)
{
return
dt
==
null
?
false
:
dt
.
Columns
.
Contains
(
col
);
}
/// <summary>
/// 是否包含指定列
/// </summary>
/// <param name="dv"></param>
/// <param name="col"></param>
/// <returns></returns>
public
static
bool
IsContainsColumn
(
DataView
dv
,
string
col
)
{
return
dv
==
null
?
false
:
IsContainsColumn
(
dv
.
Table
,
col
);
}
/// <summary>
/// 是否包含指定列
/// </summary>
/// <param name="dr"></param>
/// <param name="col"></param>
/// <returns></returns>
public
static
bool
IsContainsColumn
(
DataRow
dr
,
string
col
)
{
return
dr
==
null
?
false
:
IsContainsColumn
(
dr
.
Table
,
col
);
}
/// <summary>
/// 是否包含指定列
/// </summary>
/// <param name="drv"></param>
/// <param name="col"></param>
/// <returns></returns>
public
static
bool
IsContainsColumn
(
DataRowView
drv
,
string
col
)
{
return
drv
==
null
?
false
:
IsContainsColumn
(
drv
.
Row
,
col
);
}
/// <summary>
/// 将指定列转为列表返回
/// </summary>
/// <param name="ds"></param>
/// <returns></returns>
public
static
List
<
string
>
GetColumnList
(
DataSet
ds
,
string
ColumnName
)
{
List
<
string
>
ResultList
=
new
List
<
string
>();
if
(
ds
!=
null
&&
ds
.
Tables
.
Count
>
0
)
{
ResultList
=
GetColumnList
(
ds
.
Tables
[
0
],
ColumnName
);
}
return
ResultList
;
}
/// <summary>
/// 将制定列转为列表返回
/// </summary>
/// <param name="dt"></param>
/// <param name="ColumnName"></param>
/// <returns></returns>
public
static
List
<
string
>
GetColumnList
(
DataTable
dt
,
string
ColumnName
)
{
List
<
string
>
ResultList
=
new
List
<
string
>();
if
(
dt
!=
null
&&
dt
.
Columns
.
Contains
(
ColumnName
))
{
ResultList
=
dt
.
Select
().
AsEnumerable
()
.
Select
(
r
=>
r
[
ColumnName
].
ToString
())
.
Distinct
()
//去重
.
ToList
();
}
return
ResultList
;
}
/// <summary>
/// 将制定列转为列表返回
/// </summary>
/// <param name="dt"></param>
/// <param name="ColumnName"></param>
/// <returns></returns>
public
static
List
<
string
>
GetColumnList
(
DataRow
[]
rows
,
string
ColumnName
)
{
List
<
string
>
ResultList
=
new
List
<
string
>();
if
(
rows
!=
null
&&
rows
.
Length
>
0
&&
IsContainsColumn
(
rows
[
0
],
ColumnName
))
{
ResultList
=
rows
.
AsEnumerable
()
.
Select
(
r
=>
r
[
ColumnName
].
ToString
())
.
Distinct
()
//去重
.
ToList
();
}
return
ResultList
;
}
}
}
FunnyPick/FunnyPick/ExcelExportHelper.cs
View file @
6e4a4d9e
using
HtmlAgilityPack
;
using
NPOI.HSSF.UserModel
;
using
NPOI.SS.UserModel
;
using
NPOI.SS.Util
;
using
RtfPipe
;
using
System
;
using
System
;
using
System.Collections.Generic
;
//
using
System.Data
;
...
...
@@ -11,6 +6,11 @@ using System.Drawing;
using
System.IO
;
using
System.Linq
;
using
System.Xml.Linq
;
using
HtmlAgilityPack
;
using
NPOI.HSSF.UserModel
;
using
NPOI.SS.UserModel
;
using
NPOI.SS.Util
;
using
RtfPipe
;
//
using
System.Data.SqlClient
;
...
...
@@ -665,8 +665,6 @@ namespace FunnyPick
#
endregion
}
#
region
数据源处理
/// <summary>
...
...
FunnyPick/FunnyPick/obj/Debug/netcoreapp3.0/FunnyPick.csprojAssemblyReference.cache
View file @
6e4a4d9e
No preview for this file type
FunnyPick/FunnyPick/obj/FunnyPick.csproj.nuget.cache
View file @
6e4a4d9e
{
"version": 1,
"dgSpecHash": "
U/yfLlYhboZkdycMmaL/82PW85/BYUR9MtNXES706SvOVrkKFO3vUNrQkMMe0XE1mYt+wbTPHZrL1Nd1ZRdjU
A==",
"dgSpecHash": "
1azbZp7rWCnVZa8IfZp+B8l7DfdoOrb7BxwJt+Cyl9mV73qMJEotpCLF8C+6j59sA7NjUZn1OZAR+SF5R66g1
A==",
"success": true
}
\ No newline at end of file
FunnyPick/FunnyPick/obj/FunnyPick.csproj.nuget.dgspec.json
View file @
6e4a4d9e
...
...
@@ -18,12 +18,14 @@
],
"configFilePaths"
:
[
"C:
\\
Users
\\
Feteto
\\
AppData
\\
Roaming
\\
NuGet
\\
NuGet.Config"
,
"C:
\\
Program Files (x86)
\\
NuGet
\\
Config
\\
DevExpress 18.1.config"
,
"C:
\\
Program Files (x86)
\\
NuGet
\\
Config
\\
Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks"
:
[
"netcoreapp3.0"
],
"sources"
:
{
"C:
\\
Program Files (x86)
\\
DevExpress 18.1
\\
Components
\\
System
\\
Components
\\
Packages"
:
{},
"C:
\\
Program Files (x86)
\\
Microsoft SDKs
\\
NuGetPackages
\\
"
:
{},
"https://api.nuget.org/v3/index.json"
:
{}
},
...
...
FunnyPick/FunnyPick/obj/project.assets.json
View file @
6e4a4d9e
...
...
@@ -5334,12 +5334,14 @@
],
"configFilePaths"
:
[
"C:
\\
Users
\\
Feteto
\\
AppData
\\
Roaming
\\
NuGet
\\
NuGet.Config"
,
"C:
\\
Program Files (x86)
\\
NuGet
\\
Config
\\
DevExpress 18.1.config"
,
"C:
\\
Program Files (x86)
\\
NuGet
\\
Config
\\
Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks"
:
[
"netcoreapp3.0"
],
"sources"
:
{
"C:
\\
Program Files (x86)
\\
DevExpress 18.1
\\
Components
\\
System
\\
Components
\\
Packages"
:
{},
"C:
\\
Program Files (x86)
\\
Microsoft SDKs
\\
NuGetPackages
\\
"
:
{},
"https://api.nuget.org/v3/index.json"
:
{}
},
...
...
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