Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
UFTest
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
datdiep
UFTest
Commits
cd3fa7af
Commit
cd3fa7af
authored
Sep 19, 2022
by
dutdut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
19bbb662
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
6 deletions
+26
-6
Program.cs
testImport/Program.cs
+26
-6
No files found.
testImport/Program.cs
View file @
cd3fa7af
...
...
@@ -43,6 +43,7 @@ namespace testImport
public
string
value
{
get
;
set
;
}
public
DateTime
Time
{
get
;
set
;
}
public
DateTime
created
{
get
;
set
;
}
public
string
tmp
{
get
;
set
;
}
}
public
class
Program
...
...
@@ -71,7 +72,7 @@ namespace testImport
var
filePath
=
@"C:\Users\Admin\Downloads\HR_SK.xlsx"
;
byte
[]
file
=
File
.
ReadAllBytes
(
filePath
);
//
List<saved> XX = new List<saved>();
List
<
saved
>
XX
=
new
List
<
saved
>();
using
(
MemoryStream
stream
=
new
MemoryStream
(
file
))
{
using
(
ExcelPackage
excelPackage
=
new
ExcelPackage
(
stream
))
...
...
@@ -80,15 +81,25 @@ namespace testImport
while
(
firstSheet
==
_MAXSHEET
)
{
var
DataSheet
=
excelPackage
.
Workbook
.
Worksheets
[
firstSheet
];
for
(
int
i
=
0
;
i
<=
DataSheet
.
Dimension
.
End
.
Row
-
Convert
.
ToInt32
(
BODY
);
i
+=
SEED
)
//i+=seed
for
(
int
i
=
108
;
i
<=
DataSheet
.
Dimension
.
End
.
Row
-
Convert
.
ToInt32
(
BODY
);
i
+=
SEED
)
//i+=seed
{
//check last: if STT is not number => stop
var
testLast
=
DataSheet
.
Cells
[
"A"
+
(
Convert
.
ToInt32
(
BODY
)
+
i
).
ToString
()].
Value
is
null
?
" "
:
DataSheet
.
Cells
[
"A"
+
(
Convert
.
ToInt32
(
BODY
)
+
i
).
ToString
()].
Value
.
ToString
();
if
(!
int
.
TryParse
(
testLast
,
out
_
))
//https://stackoverflow.com/questions/894263/identify-if-a-string-is-a-number
break
;
foreach
(
var
value
in
customer_Templates
.
Where
(
c
=>
c
.
sheet
==
firstSheet
).
ToList
())
{
var
Address
=
value
.
coordinate
as
String
+
(
Convert
.
ToInt32
(
BODY
)
+
i
).
ToString
();
if
(!
value
.
coordinate
.
Contains
(
":"
))
{
string
xxxxx
=
DataSheet
.
Cells
[
Address
].
Value
.
ToString
();
string
xxxxx
=
DataSheet
.
Cells
[
Address
].
Value
is
null
?
""
:
DataSheet
.
Cells
[
Address
].
Value
.
ToString
();
saved
save
=
new
saved
();
save
.
value
=
xxxxx
;
save
.
id_excel_template
=
value
.
id_excel_template
;
XX
.
Add
(
save
);
}
else
{
...
...
@@ -98,24 +109,33 @@ namespace testImport
for
(
int
ii
=
0
;
ii
<
countsub
;
ii
++)
{
Address
=
split
[
0
]
+
(
Convert
.
ToInt32
(
BODY
)
+
i
+
ii
).
ToString
()
+
":"
+
split
[
1
]
+
(
Convert
.
ToInt32
(
BODY
)
+
i
+
ii
).
ToString
();
var
range
=
DataSheet
.
Cells
[
Address
];
foreach
(
var
rangeBasse
in
range
)
{
saved
save
=
new
saved
();
string
xxx
=
rangeBasse
.
Value
is
null
?
""
:
rangeBasse
.
Value
.
ToString
();
save
.
value
=
xxx
;
save
.
id_excel_template
=
value
.
id_excel_template
;
var
tmpx
=
new
[]
{
"vào"
,
"ra"
,
"tăng ca"
,
"tông công"
};
save
.
tmp
=
tmpx
[
ii
];
XX
.
Add
(
save
);
}
}
}
}
}
firstSheet
++;
}
}
}
Console
.
WriteLine
(
"xxx"
);
}
}
...
...
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