Compare commits
822 commits
command-1.
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a2fe424b87 | ||
|
|
5021c00dd3 | ||
|
|
bf5dc2cf19 | ||
|
|
f6c8b4f754 | ||
|
|
65ca175f98 | ||
|
|
5f678b2898 | ||
|
|
ae417e4777 | ||
|
|
a2dc4b5b82 | ||
|
|
c55648a3cc | ||
|
|
bc29952e83 | ||
|
|
f4f56b1c21 | ||
|
|
baf828ac85 | ||
|
|
be1f6dd84e | ||
|
|
fcea84bdb8 | ||
|
|
5d090fa7bd | ||
|
|
030098c0b9 | ||
|
|
6843e3ff3f | ||
|
|
2cdae3578e | ||
|
|
71966eb4e9 | ||
|
|
e926866918 | ||
|
|
35179d8cfc | ||
|
|
4a8d349415 | ||
|
|
7d2be029b6 | ||
|
|
d75cf39d7b | ||
|
|
db3d531aa9 | ||
|
|
e17895de81 | ||
|
|
e09a6d0ea6 | ||
|
|
4c44bdf237 | ||
| 6f1ca58f04 | |||
| a956f0b0dd | |||
|
|
f0c493a026 | ||
|
|
fe5c2cd7c1 | ||
|
|
c4209400ff | ||
|
|
d6a7f1a5ca | ||
|
|
f50efc632b | ||
| 5f9c49f479 | |||
| 48aab28e04 | |||
| 1f7951dc4c | |||
|
|
d3a174faa0 | ||
|
|
afa5c85393 | ||
| 077b60b1c3 | |||
| efc96dfb6d | |||
|
|
4827906d1d | ||
|
|
8ae822d05b | ||
|
|
71a4748d39 | ||
|
|
ad70043264 | ||
|
|
513956c861 | ||
|
|
a48f3fa804 | ||
|
|
dc5ac329e2 | ||
|
|
3f98e07419 | ||
| ce4558c240 | |||
| 6a38f000ba | |||
|
|
f50ad38503 | ||
| aeb2ceea6f | |||
| e96f606c85 | |||
|
|
81dc7f4544 | ||
|
|
a16ef7ac55 | ||
|
|
f6bf1ab026 | ||
|
|
caa01088c6 | ||
|
|
782d1526b5 | ||
|
|
04ac35c10b | ||
|
|
02abedc973 | ||
| 8415ffc92d | |||
| 64c75cd9d5 | |||
|
|
22e04d90fe | ||
|
|
2146e0e0ca | ||
|
|
3f8ae1ede9 | ||
|
|
c2795d6891 | ||
|
|
6e5284b3c7 | ||
|
|
76697c4f63 | ||
|
|
e5f6a44f5f | ||
|
|
583569682d | ||
|
|
9f756771cd | ||
|
|
219b172073 | ||
|
|
ecf660e4cf | ||
|
|
0365fad723 | ||
|
|
20e8dfddd6 | ||
|
|
91c479ef9e | ||
|
|
80fcda61cf | ||
|
|
f02413f2b2 | ||
|
|
1739aa8057 | ||
|
|
bc3bba547f | ||
|
|
4161fcc1cf | ||
|
|
6d0921a76a | ||
|
|
df7bebe0ba | ||
|
|
82a45b6811 | ||
|
|
63d983f831 | ||
|
|
e326e43ae6 | ||
|
|
4dab3c5cd9 | ||
|
|
4bd46d13e5 | ||
|
|
132a59b946 | ||
|
|
740a9984c9 | ||
|
|
5b0fcd0680 | ||
|
|
2bdb8bb733 | ||
|
|
aed1e8a58d | ||
|
|
fb3cb2aa94 | ||
|
|
b5025c382f | ||
|
|
4e2113eef2 | ||
|
|
ffcf95c210 | ||
|
|
e4bcfee80c | ||
|
|
a173a7dc3c | ||
|
|
361ded2078 | ||
|
|
1379dab556 | ||
|
|
d8039379ad | ||
|
|
2d4116d79a | ||
|
|
c65a4a04ac | ||
|
|
d58c7dc07e | ||
|
|
bb329f86de | ||
|
|
b3298e88c6 | ||
|
|
04d0067ee8 | ||
|
|
c035c13405 | ||
|
|
2e9db2d42c | ||
|
|
1389df0225 | ||
|
|
058027ea29 | ||
|
|
ee2d16925a | ||
|
|
42f3813a7a | ||
|
|
7bafbf5001 | ||
|
|
db99630e0d | ||
|
|
34ec9bb77c | ||
|
|
5606e8b50a | ||
|
|
ee4e9c3699 | ||
|
|
6efeec3f1f | ||
|
|
c34fe35506 | ||
|
|
678329b5df | ||
|
|
057b51390e | ||
|
|
8950073485 | ||
|
|
bf92f6933e | ||
|
|
cea1c4b64e | ||
|
|
cef41506a8 | ||
| bceb4d3096 | |||
|
|
06956284d7 | ||
|
|
6b8eddcbc0 | ||
|
|
a4a5d13203 | ||
|
|
69b89dfc90 | ||
|
|
ea694bfda2 | ||
|
|
6691303ea7 | ||
|
|
8ea572d46c | ||
|
|
2ecef0792c | ||
|
|
1cf780ecd0 | ||
|
|
bf6ea555fc | ||
|
|
8fa105606b | ||
|
|
47c0cfc62a | ||
|
|
932d5e75c7 | ||
|
|
a50153f32c | ||
|
|
d85bab11b2 | ||
|
|
82c31a0f57 | ||
|
|
2cd7798dd9 | ||
|
|
759a51ab58 | ||
|
|
3dee5f7166 | ||
|
|
8732c34564 | ||
|
|
91e6b1b35b | ||
|
|
c1ac687101 | ||
|
|
de1773880b | ||
|
|
c91e6c8030 | ||
|
|
d8f1126764 | ||
|
|
7ba429bb64 | ||
|
|
3e3bfff7ba | ||
|
|
19b79a162d | ||
|
|
a09d5937f9 | ||
|
|
aef81e9f4e | ||
|
|
6427cb4344 | ||
|
|
252d8b5fa3 | ||
|
|
58aca3a328 | ||
|
|
818ff38e99 | ||
|
|
23bbd9791e | ||
|
|
7e0f0485fd | ||
|
|
b1df33dc20 | ||
|
|
6902236f48 | ||
|
|
4562029e6e | ||
|
|
4650f7a2ab | ||
|
|
f866435897 | ||
|
|
006cea048d | ||
|
|
9a74b690cd | ||
|
|
2ee36af763 | ||
|
|
cd99179621 | ||
|
|
c20e1b48bd | ||
|
|
5b054f9948 | ||
|
|
3e34aaa178 | ||
|
|
ddb35f525a | ||
|
|
ecca345407 | ||
|
|
7e613ab2e6 | ||
|
|
7eade164e9 | ||
|
|
256da24caf | ||
|
|
869defcc7e | ||
|
|
65feb994ee | ||
|
|
d748308419 | ||
|
|
b8df2d4024 | ||
|
|
c42aaa38f6 | ||
|
|
ddaa339e9f | ||
|
|
d70ed254c0 | ||
|
|
de91fd0fa2 | ||
|
|
7d3ec6c74e | ||
| 1b7bdd82e6 | |||
|
|
a8271c8d79 | ||
|
|
14fd9d5262 | ||
|
|
c81220a049 | ||
|
|
e5e7c77880 | ||
|
|
a2ac05ed61 | ||
|
|
2410574d42 | ||
|
|
682c88c2db | ||
|
|
05ec0cccce | ||
|
|
35310f7854 | ||
|
|
1d8ef79373 | ||
|
|
c693364fe1 | ||
|
|
4f18a97d0b | ||
|
|
d3cc0781cf | ||
|
|
639d41649c | ||
|
|
358fd47b99 | ||
|
|
970319e8c2 | ||
|
|
09a7208074 | ||
|
|
7775ea85c3 | ||
|
|
19000b2e42 | ||
|
|
1a0e712a1c | ||
|
|
c25bef0672 | ||
|
|
659e06a08d | ||
|
|
0a170fd259 | ||
|
|
5c05f1123a | ||
|
|
06b53ddeaa | ||
|
|
46504c9e30 | ||
|
|
e80f89117c | ||
|
|
4c189fdc4a | ||
|
|
90eb94cee3 | ||
|
|
b10ff45d07 | ||
|
|
02487d91ff | ||
|
|
839c357842 | ||
|
|
cbc2a1a88d | ||
|
|
e8ffb82ead | ||
|
|
54c8152752 | ||
|
|
4f28b4e9e0 | ||
|
|
982dfc33d1 | ||
|
|
2e6a81ff31 | ||
|
|
22a7a8c17c | ||
|
|
c1d689ebfa | ||
|
|
ecf5ada7ed | ||
|
|
9bd6017ded | ||
|
|
e1c7688913 | ||
|
|
4e4eec3d84 | ||
|
|
2f366374fa | ||
|
|
2b737de23b | ||
|
|
d945deae4f | ||
|
|
d3501e831c | ||
|
|
c3901d56b3 | ||
|
|
27b3773c79 | ||
|
|
5219934e05 | ||
|
|
15f5d7cae7 | ||
|
|
d7b257f0ce | ||
|
|
e3a228773e | ||
|
|
90eea1ac7f | ||
|
|
a463df5716 | ||
|
|
60602d99c4 | ||
|
|
9442d3b29f | ||
|
|
3532df32fd | ||
|
|
6c8e79b1bc | ||
|
|
0ab75b2a19 | ||
|
|
1aab307f6a | ||
|
|
93a83b34e6 | ||
|
|
79e0fe7f1b | ||
|
|
21f82d69e1 | ||
|
|
b5c82f4243 | ||
|
|
b0715e3da6 | ||
|
|
510f1cd78a | ||
|
|
83a915f92c | ||
|
|
094789bfb1 | ||
|
|
64c1021c52 | ||
|
|
5ec7933b3c | ||
|
|
9e529ed19b | ||
|
|
3e8c3d998e | ||
|
|
3a6e4501fd | ||
|
|
5415019b3c | ||
|
|
86790cf9f3 | ||
|
|
127909d29d | ||
|
|
6907607a06 | ||
|
|
0233d92931 | ||
|
|
90ea986831 | ||
|
|
1c3ce46bcb | ||
| 398679cbcc | |||
| d831b208de | |||
|
|
49cb60dee7 | ||
|
|
5cdef791f3 | ||
|
|
7b97cd09a3 | ||
|
|
3f13557b31 | ||
|
|
95cd49ecbc | ||
|
|
6e531e4d16 | ||
|
|
99accd44e3 | ||
| a540912202 | |||
| 0690337422 | |||
| 8c1a219084 | |||
| 9dfd5efafc | |||
| 98adc74792 | |||
|
|
14eb80a30e | ||
|
|
e8dfe976a2 | ||
| 8f491c1b12 | |||
| a6de2791c4 | |||
| a739d52c46 | |||
| 4865bab7e2 | |||
| f9ca9b52af | |||
|
|
be57524f1b | ||
|
|
517755d758 | ||
|
|
05689b5338 | ||
|
|
a381ff1528 | ||
|
|
ed04bf8258 | ||
|
|
909042445c | ||
|
|
cb074e3e25 | ||
|
|
7e71f528ab | ||
|
|
adb8e31308 | ||
|
|
0b0cc53e07 | ||
| 72b9c6e31e | |||
| 9fe3c82a9b | |||
|
|
8973e1b78f | ||
|
|
4a94aae6e3 | ||
|
|
7caf1cc8d6 | ||
| c87e467a6e | |||
| d10c86e0cb | |||
| 2b1d6852c9 | |||
| bde1aa21c9 | |||
| 8bb31b4e73 | |||
| 804a4cf85f | |||
|
|
b03be82f7c | ||
|
|
b2fcc4a5b9 | ||
| ed26d8443c | |||
| b55e1d1f63 | |||
|
|
99838ba1ff | ||
|
|
fd8e0e78b6 | ||
| 37281fc036 | |||
| fb282915d1 | |||
|
|
80dca3dfac | ||
|
|
3b58d38eb1 | ||
| 121e605699 | |||
| 97c9064ab5 | |||
|
|
e0d253cc68 | ||
|
|
d5c2c54eaa | ||
| 90cb343941 | |||
| d6497a5d51 | |||
|
|
9becd892f5 | ||
|
|
cc8cd77560 | ||
|
|
7e039b798d | ||
|
|
795502a93c | ||
|
|
d703337b4b | ||
|
|
18ab28e335 | ||
|
|
ff66aebdfa | ||
|
|
e023ed65f7 | ||
|
|
d7ebe9cdca | ||
|
|
02a5eacd0f | ||
|
|
199d0c90e3 | ||
|
|
328f54b4e3 | ||
|
|
0e21e10d24 | ||
|
|
88a48577e9 | ||
|
|
23a6058eba | ||
|
|
07dd715e16 | ||
|
|
ec04665f39 | ||
|
|
0a58075428 | ||
| b6862b93bf | |||
| b51cf9a919 | |||
|
|
14cc614864 | ||
|
|
59fd20c879 | ||
|
|
fc68cb0101 | ||
|
|
6b9767449c | ||
|
|
51f1a4c563 | ||
|
|
2981f865b3 | ||
|
|
b4e303e0a7 | ||
|
|
08fb06ca84 | ||
| ec3b267a6c | |||
| a047787fb4 | |||
|
|
21c10d66f5 | ||
|
|
7778f6cccd | ||
|
|
436370312e | ||
|
|
5451c49dbe | ||
|
|
27112a060c | ||
|
|
f78d188979 | ||
|
|
f2d17c3a38 | ||
|
|
48792f0d31 | ||
|
|
d2569d8cef | ||
|
|
db7626ce69 | ||
| e9d48d1930 | |||
| 62aa25793b | |||
|
|
a9bacdc6ae | ||
|
|
cf9ae391a5 | ||
|
|
c1416a2a33 | ||
|
|
84df3d4b86 | ||
|
|
079641c7ad | ||
|
|
287c11dfd5 | ||
|
|
b1afbe53ef | ||
|
|
17259598c9 | ||
|
|
d1bda77fa9 | ||
|
|
14fd93ae95 | ||
|
|
842ed531f5 | ||
|
|
223a78ce9e | ||
|
|
65e85b7194 | ||
|
|
16cc6b5111 | ||
|
|
7ee1477ee2 | ||
|
|
0065468568 | ||
|
|
ee0bb692ec | ||
|
|
b4cc522fef | ||
|
|
b478b9eded | ||
| 5dab116166 | |||
| a85749010a | |||
| b345091905 | |||
| b1c0ab8266 | |||
| 3fd9d05cd2 | |||
|
|
87c4f85bf6 | ||
|
|
f081034e36 | ||
|
|
998ca38da8 | ||
|
|
2187142668 | ||
|
|
36aea81d54 | ||
|
|
5fc3cfa3b4 | ||
|
|
4375ca0da8 | ||
| 2295aedc3a | |||
|
|
54358ac845 | ||
|
|
d65107ad40 | ||
|
|
755dd9d06e | ||
| 5007b6f10d | |||
|
|
0f45792e74 | ||
|
|
451757be65 | ||
|
|
503805b194 | ||
|
|
720027b26c | ||
|
|
cd3c356d02 | ||
|
|
55f0dc6876 | ||
|
|
4fb82bf25a | ||
|
|
c0f4cd3bdf | ||
|
|
f8a71f6624 | ||
|
|
85e1c95f97 | ||
| 7d9c3fa46b | |||
| d6e4426e08 | |||
| 821c4614c3 | |||
| fbcd1b6984 | |||
|
|
81658054f8 | ||
|
|
f97e643ac1 | ||
|
|
84ab5e79d6 | ||
| 51962eea16 | |||
|
|
ed1bb838ce | ||
|
|
8ba9d349db | ||
|
|
559765dd86 | ||
|
|
4ba48d0e70 | ||
|
|
5f0a0b1a46 | ||
|
|
3d9f922fc9 | ||
|
|
fe4a174bf7 | ||
|
|
f784205412 | ||
|
|
0dcabaa25d | ||
|
|
4494939c5f | ||
|
|
7ddc1debfc | ||
|
|
9e8fe1b30a | ||
| 1ec8e51c37 | |||
| 12c8bc5014 | |||
|
|
ad6a458973 | ||
|
|
f9d1dd9f38 | ||
|
|
5efb1c99c6 | ||
|
|
946721ffb2 | ||
|
|
8529c3d801 | ||
|
|
97dd104429 | ||
|
|
d0599aedea | ||
|
|
ddf899ce5d | ||
|
|
1e275748a0 | ||
|
|
389adeec2f | ||
|
|
faf62f1985 | ||
|
|
8d37024b6c | ||
|
|
1f3632744d | ||
|
|
9de97f9d90 | ||
|
|
2aa66acfd0 | ||
| 95c62accef | |||
|
|
e51ca439f9 | ||
|
|
edbd337ab6 | ||
|
|
373e2a06d8 | ||
|
|
777f4d0930 | ||
|
|
be45cf58b8 | ||
|
|
081260a83b | ||
|
|
77eaca72b3 | ||
| 6fb574f9de | |||
| 0dcd76c302 | |||
| 33e8bf5ab7 | |||
| 6d42484297 | |||
| f1c3163116 | |||
| 9a4e49eb88 | |||
| 69af557f95 | |||
| e52d6430b0 | |||
| 45f6c5626e | |||
| 063e54c4e0 | |||
| 7254b1ed87 | |||
| a892fe9ee3 | |||
| 0fe60d3212 | |||
| cd7ac8de17 | |||
| aa1708474b | |||
| 87e6f88cf6 | |||
| d0c5bafdba | |||
| 643b6903d9 | |||
| 5c0f8877a4 | |||
| f1540de911 | |||
| 2a02bdf9f7 | |||
|
|
463d439a1a | ||
|
|
e08dc350fe | ||
|
|
aa904079a2 | ||
| c6c49ffaff | |||
| 51fc5c6395 | |||
|
|
a0cfb23350 | ||
|
|
9eae970ff3 | ||
| 6bba1b19ce | |||
| 777c9563ca | |||
| 62867d54c3 | |||
| 3c34245d1c | |||
| 5561817fa4 | |||
| ba7dae2bd8 | |||
| 829149a091 | |||
| d4e0661964 | |||
| 2abb32f74b | |||
| 7d680658e4 | |||
| d0cad2de8b | |||
| b01031e919 | |||
| 57a6d9a6c6 | |||
| 0516b289fe | |||
| fc26ab4064 | |||
| 223c891782 | |||
| 83926c534f | |||
| bfe1caa984 | |||
| 91a3aef5d7 | |||
| cbd1e8029d | |||
| bdd613b40f | |||
| 507d50dfe3 | |||
| fb6a82be14 | |||
| 8001dd0c11 | |||
|
|
348edeff85 | ||
| 3ae9be5869 | |||
|
|
75ddebba37 | ||
| 2d9f546023 | |||
| 29b161bf76 | |||
|
|
f65dd53cec | ||
| 8c2e4be638 | |||
| 711a8eeff6 | |||
|
|
0da5907eba | ||
|
|
ef9fafecfc | ||
|
|
0ee17ef586 | ||
|
|
b89f394f1e | ||
|
|
af45365920 | ||
|
|
59a3aaa2d8 | ||
|
|
8be20b1365 | ||
|
|
f72d705101 | ||
|
|
4130604ca8 | ||
|
|
7af3618287 | ||
|
|
a781de2499 | ||
| 14b15a9816 | |||
|
|
0c9ec3dd43 | ||
|
|
f6594f9773 | ||
|
|
009de80c3f | ||
|
|
593e5a3f57 | ||
|
|
71dc9f05d3 | ||
|
|
23d86f632e | ||
| e3a57b0159 | |||
| 7016df503a | |||
|
|
708ef29ebe | ||
|
|
1f41b96844 | ||
| ce8736b083 | |||
| 0223ff5d9b | |||
|
|
b40d4e2765 | ||
|
|
b548d8fea6 | ||
|
|
ac037aff4b | ||
|
|
d3be22cfbd | ||
|
|
757035a4b0 | ||
|
|
3384c520d7 | ||
|
|
aef2d3381a | ||
|
|
ac6e4f5c1f | ||
|
|
0b9d3b16ac | ||
|
|
1b861c1a65 | ||
|
|
6b73a0aa47 | ||
|
|
6d90951000 | ||
|
|
8b3eaf0664 | ||
|
|
53e547f168 | ||
|
|
e58bda8e9e | ||
|
|
c348dae155 | ||
| f2d01b8505 | |||
|
|
0e74ad730c | ||
|
|
7d431d7882 | ||
|
|
8e890af48f | ||
|
|
d6a3bdc8ba | ||
|
|
18be7bee37 | ||
|
|
94446fe6fd | ||
|
|
c657398e72 | ||
|
|
015d2ea956 | ||
|
|
8f9b40c303 | ||
| 419866bb70 | |||
| 6308ffbc8f | |||
|
|
89a90099a7 | ||
|
|
2e77371316 | ||
|
|
f4b3eeac76 | ||
|
|
298b61fc67 | ||
|
|
2a0e1f7623 | ||
|
|
1887c62e18 | ||
|
|
6d3d14445f | ||
|
|
c6fee999eb | ||
|
|
0baa85e857 | ||
|
|
f9d8fa285f | ||
|
|
b9931ce2e4 | ||
|
|
1038d2e894 | ||
|
|
1624b2f365 | ||
|
|
ba6bfdaedf | ||
|
|
27acadbb07 | ||
|
|
3e8e461ebe | ||
|
|
8870139cbe | ||
|
|
058c762eb2 | ||
|
|
065fafc3d7 | ||
|
|
1e5676e8ab | ||
|
|
30ff1ae15c | ||
|
|
1ef8544833 | ||
|
|
ea25f5252b | ||
|
|
826aa8db19 | ||
|
|
b1ad88c37b | ||
|
|
9e84bddb65 | ||
|
|
ea55d21f51 | ||
|
|
e790b50f58 | ||
|
|
360580535a | ||
|
|
9070378060 | ||
|
|
2d7459da25 | ||
|
|
326a258e2b | ||
| bc8b681900 | |||
| 706edbd0f0 | |||
|
|
b528f0a81d | ||
|
|
afb2cfa189 | ||
|
|
61407c342b | ||
|
|
588e13c3f5 | ||
| 4bf0593b0e | |||
| b0cfc2eee9 | |||
| fdae099855 | |||
| 9bde6a9895 | |||
|
|
b747e3ae68 | ||
|
|
40babdf1a7 | ||
|
|
7e3ae58b33 | ||
|
|
dff98272dd | ||
|
|
237567e5ab | ||
|
|
a494020d37 | ||
|
|
78a47bc735 | ||
|
|
13709c65ef | ||
|
|
d539f6fa4a | ||
|
|
ffecbf7df2 | ||
|
|
b260e4067f | ||
|
|
6ad83ecc53 | ||
|
|
175232148b | ||
|
|
be9545f37c | ||
|
|
75d8434935 | ||
|
|
22304e7186 | ||
|
|
fb76f5737a | ||
|
|
c49375718d | ||
|
|
db84cdbf29 | ||
|
|
96246d5853 | ||
| e0ed1fc240 | |||
| 25f6ebcdd7 | |||
|
|
ad72bc7ff6 | ||
|
|
cf6f0feef5 | ||
|
|
97b5bd1176 | ||
|
|
88270a230f | ||
|
|
7b55e16e7d | ||
|
|
c3c9c85d30 | ||
|
|
d0e39e385b | ||
|
|
de72adc3ae | ||
|
|
87715ff7cc | ||
|
|
dc2603d107 | ||
|
|
9483d537ce | ||
|
|
216d7c02fb | ||
|
|
2547590ce8 | ||
|
|
fd25873348 | ||
|
|
d9be2426c4 | ||
|
|
22a3914072 | ||
|
|
355f5b9591 | ||
|
|
513eb223be | ||
|
|
afef4fde9f | ||
|
|
4b43104400 | ||
|
|
28f8971e7f | ||
|
|
2f37334444 | ||
|
|
b1380d4a2f | ||
|
|
c832465e71 | ||
|
|
a2efb8d9af | ||
|
|
7bfa69e19e | ||
|
|
dc3c5a82a1 | ||
|
|
5c789232f1 | ||
|
|
164ed56671 | ||
|
|
51b849f882 | ||
|
|
851c024171 | ||
|
|
3beba561fc | ||
| 6e1965ba79 | |||
| 5df7a9e20f | |||
| 3e58fd1339 | |||
|
|
852e4ee03d | ||
|
|
3a09367e88 | ||
|
|
afb7b60a19 | ||
|
|
a32c12460a | ||
|
|
9af97134f4 | ||
|
|
5a33e4690d | ||
|
|
a81b8d50fb | ||
|
|
c7dd897909 | ||
|
|
741eccd933 | ||
|
|
3f31f68c60 | ||
|
|
2f1cd53493 | ||
|
|
9e953cd5d6 | ||
|
|
e653b0e40a | ||
|
|
847b89da23 | ||
|
|
af9ae3e763 | ||
|
|
f09cea096f | ||
|
|
4cc57322c0 | ||
|
|
496917c34c | ||
|
|
41bcc2a1ef | ||
|
|
0367e33768 | ||
|
|
f71cb56a40 | ||
|
|
0451b9e3e1 | ||
|
|
c1597c4a5c | ||
|
|
e277279f78 | ||
|
|
4815b43864 | ||
|
|
d43d151e75 | ||
|
|
d3b22ecf48 | ||
|
|
e452bd9255 | ||
|
|
64eb77674a | ||
|
|
2d0475246a | ||
|
|
e351adb5fa | ||
|
|
47e5df9ba9 | ||
|
|
eeb82dcbe1 | ||
|
|
f3d74681f3 | ||
|
|
f2a0b754b3 | ||
|
|
9f3388eb20 | ||
|
|
95513f0e10 | ||
|
|
37bd6cf6ee | ||
|
|
48baf99adf | ||
|
|
4da9dc6946 | ||
|
|
2b8713cbe0 | ||
|
|
0b407f3c68 | ||
|
|
8ce58201e9 | ||
|
|
3880ce6985 | ||
|
|
e55001e234 | ||
|
|
8f8bcd9cc8 | ||
|
|
01590c4894 | ||
|
|
e345331381 | ||
|
|
089e70c7c7 | ||
|
|
4d500fcdcd | ||
|
|
fffa6bc374 | ||
|
|
21029ca9ce | ||
|
|
ed0bde9780 | ||
| 06a6019e97 | |||
| 23b6070785 | |||
|
|
2240c383c7 | ||
|
|
505df8e8b1 | ||
|
|
5ba93feb52 | ||
|
|
ae3d5dab70 | ||
|
|
4382e779d7 | ||
|
|
42bdb66440 | ||
| f96aa09cc7 | |||
| ff89c2c791 | |||
|
|
249911b931 | ||
|
|
66d4a08f3c | ||
|
|
9bf7ee2e9a | ||
|
|
b5c967c5fc | ||
|
|
665e861303 | ||
|
|
c1a0a8c2b5 | ||
|
|
05e56ff6f7 | ||
|
|
10571679f1 | ||
|
|
a931dad4d9 | ||
|
|
a5404cef72 | ||
|
|
c25cb43720 | ||
|
|
34f0499986 | ||
|
|
7d39720121 | ||
|
|
91fc939b6d | ||
|
|
ca1a2c05c3 | ||
|
|
6f9116ead5 | ||
|
|
749b2b68a1 | ||
|
|
746f435ca8 | ||
|
|
16f6eb7b50 | ||
|
|
9d2dd44549 | ||
|
|
a710ebd297 | ||
|
|
124109bf57 | ||
|
|
414dae40cc | ||
|
|
ae2112f23a | ||
| c0383da15d | |||
|
|
28544df284 | ||
|
|
d54db7b58f | ||
|
|
04b17729e0 | ||
|
|
a7b8c2786c | ||
|
|
db483ce18d | ||
|
|
b90a0ad489 | ||
|
|
4ca6b7d842 | ||
|
|
16b0990454 | ||
|
|
92847e6be2 | ||
|
|
19c30e69df | ||
|
|
b4c169be75 | ||
|
|
e39c6f62c8 | ||
|
|
dd3c614679 | ||
|
|
e635e4ff61 | ||
|
|
ddc3d268be | ||
|
|
193cffa7c4 | ||
|
|
56501b5bcd | ||
|
|
0f705431d4 | ||
|
|
2730ac9174 | ||
|
|
b61e36e532 | ||
|
|
7b6e5635ea | ||
|
|
15385286da | ||
|
|
6b453b8bdf | ||
|
|
bec082a554 | ||
|
|
3659d03d94 | ||
|
|
d0b8c4ee35 | ||
|
|
cd54079a47 | ||
|
|
d408d875db | ||
|
|
58f52cbb84 | ||
|
|
1552225e9c | ||
|
|
5c215b9213 | ||
|
|
ed98f171ba | ||
|
|
e57274d446 | ||
|
|
bfc49ee9a6 | ||
|
|
0697cdd3ee | ||
|
|
4340454e41 | ||
|
|
c89ecf8cda | ||
|
|
864c348531 | ||
|
|
7db251aea9 | ||
|
|
ccb183dc95 | ||
|
|
28b573bfb8 | ||
|
|
885478f672 | ||
|
|
59be7ac619 | ||
|
|
50f3d22090 | ||
|
|
6fd3fff0c8 | ||
|
|
c6663b35c3 | ||
|
|
a4d2e5dc15 | ||
|
|
db20be6e50 | ||
|
|
221f700722 | ||
|
|
0bc0fb2c99 | ||
|
|
887d015276 | ||
|
|
179d61cc16 | ||
|
|
f68eae8120 | ||
|
|
d0a6f21e05 | ||
|
|
928df2d62c | ||
|
|
24d9da8412 | ||
|
|
e51ab03a5c |
382 changed files with 465081 additions and 6761 deletions
|
|
@ -23,3 +23,11 @@
|
||||||
**/values.dev.yaml
|
**/values.dev.yaml
|
||||||
LICENSE
|
LICENSE
|
||||||
README.md
|
README.md
|
||||||
|
.git
|
||||||
|
**/bin/
|
||||||
|
**/obj/
|
||||||
|
.vscode/
|
||||||
|
.dockerignore
|
||||||
|
.gitignore
|
||||||
|
README.md
|
||||||
|
*.md
|
||||||
83
.forgejo/workflows/build-checkin.yml
Normal file
83
.forgejo/workflows/build-checkin.yml
Normal file
|
|
@ -0,0 +1,83 @@
|
||||||
|
name: Build & Deploy Checkin Service
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "checkin-dev[0-9]+.[0-9]+.[0-9]+"
|
||||||
|
- "checkin-dev[0-9]+.[0-9]+.[0-9]+*"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: ${{ vars.CONTAINER_REGISTRY }}
|
||||||
|
REGISTRY_USERNAME: ${{ vars.CONTAINER_REGISTRY_USERNAME }}
|
||||||
|
REGISTRY_PASSWORD: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
|
||||||
|
CONTAINER_IMAGE_NAME: ${{ vars.CONTAINER_REGISTRY }}/${{ vars.CONTAINER_IMAGE_OWNER }}
|
||||||
|
IMAGE_VERSION: latest
|
||||||
|
SERVICE_NAME: hrms-api-checkin
|
||||||
|
DISCORD_WEBHOOK: ${{ vars.DISCORD_WEBHOOK }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Tag Version
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if [[ "${{ github.event_name }}" == "push" ]]; then
|
||||||
|
VERSION=$(echo "${{ github.ref_name }}" | sed 's/checkin-dev//g')
|
||||||
|
echo "IMAGE_VERSION=${VERSION}" >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo "IMAGE_VERSION=${{ env.IMAGE_VERSION }}-${{ github.run_number }}" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
- name: Login in to registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ env.REGISTRY_USERNAME }}
|
||||||
|
password: ${{ env.REGISTRY_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Build and push docker image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
platforms: linux/amd64
|
||||||
|
context: .
|
||||||
|
file: ./BMA.EHR.CheckInConsumer/Dockerfile
|
||||||
|
tags: ${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}:latest,${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}:${{ env.IMAGE_VERSION }}
|
||||||
|
push: true
|
||||||
|
|
||||||
|
- name: Remote Deploy
|
||||||
|
uses: appleboy/ssh-action@v1.2.1
|
||||||
|
with:
|
||||||
|
host: ${{ vars.SSH_DEPLOY_HOST }}
|
||||||
|
port: ${{ vars.SSH_DEPLOY_PORT }}
|
||||||
|
username: ${{ secrets.SSH_DEPLOY_USER }}
|
||||||
|
password: ${{ secrets.SSH_DEPLOY_PASSWORD }}
|
||||||
|
script: |
|
||||||
|
cd ~/repo
|
||||||
|
./replace-env.sh API_CHECKIN "${{ env.IMAGE_VERSION }}"
|
||||||
|
./deploy.sh ${{ env.SERVICE_NAME }}
|
||||||
|
|
||||||
|
- name: Discord Notification
|
||||||
|
if: always()
|
||||||
|
run: |
|
||||||
|
STATUS="${{ job.status == 'success' && '✅ Success' || '❌ Failed' }}"
|
||||||
|
COLOR="${{ job.status == 'success' && '3066993' || '15158332' }}"
|
||||||
|
TIMESTAMP=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
||||||
|
curl -H "Content-Type: application/json" \
|
||||||
|
-X POST \
|
||||||
|
-d "{
|
||||||
|
\"embeds\": [{
|
||||||
|
\"title\": \"$STATUS\",
|
||||||
|
\"description\": \"**Build & Deploy**\\n- Image: \`${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}\`\\n- Version: \`${{ env.IMAGE_VERSION }}\`\\n- By: \`${{ gitea.actor }}\`\",
|
||||||
|
\"color\": $COLOR,
|
||||||
|
\"footer\": {
|
||||||
|
\"text\": \"Release Notification\",
|
||||||
|
\"icon_url\": \"https://example.com/success-icon.png\"
|
||||||
|
},
|
||||||
|
\"timestamp\": \"$TIMESTAMP\"
|
||||||
|
}]
|
||||||
|
}" \
|
||||||
|
${{ env.DISCORD_WEBHOOK }}
|
||||||
83
.forgejo/workflows/build-discipline.yml
Normal file
83
.forgejo/workflows/build-discipline.yml
Normal file
|
|
@ -0,0 +1,83 @@
|
||||||
|
name: Build & Deploy Discipline Service
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "discipline-dev[0-9]+.[0-9]+.[0-9]+"
|
||||||
|
- "discipline-dev[0-9]+.[0-9]+.[0-9]+*"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: ${{ vars.CONTAINER_REGISTRY }}
|
||||||
|
REGISTRY_USERNAME: ${{ vars.CONTAINER_REGISTRY_USERNAME }}
|
||||||
|
REGISTRY_PASSWORD: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
|
||||||
|
CONTAINER_IMAGE_NAME: ${{ vars.CONTAINER_REGISTRY }}/${{ vars.CONTAINER_IMAGE_OWNER }}
|
||||||
|
IMAGE_VERSION: latest
|
||||||
|
SERVICE_NAME: hrms-api-discipline
|
||||||
|
DISCORD_WEBHOOK: ${{ vars.DISCORD_WEBHOOK }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Tag Version
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if [[ "${{ github.event_name }}" == "push" ]]; then
|
||||||
|
VERSION=$(echo "${{ github.ref_name }}" | sed 's/discipline-dev//g')
|
||||||
|
echo "IMAGE_VERSION=${VERSION}" >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo "IMAGE_VERSION=${{ env.IMAGE_VERSION }}-${{ github.run_number }}" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
- name: Login in to registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ env.REGISTRY_USERNAME }}
|
||||||
|
password: ${{ env.REGISTRY_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Build and push docker image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
platforms: linux/amd64
|
||||||
|
context: .
|
||||||
|
file: ./BMA.EHR.Discipline.Service/Dockerfile
|
||||||
|
tags: ${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}:latest,${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}:${{ env.IMAGE_VERSION }}
|
||||||
|
push: true
|
||||||
|
|
||||||
|
- name: Remote Deploy
|
||||||
|
uses: appleboy/ssh-action@v1.2.1
|
||||||
|
with:
|
||||||
|
host: ${{ vars.SSH_DEPLOY_HOST }}
|
||||||
|
port: ${{ vars.SSH_DEPLOY_PORT }}
|
||||||
|
username: ${{ secrets.SSH_DEPLOY_USER }}
|
||||||
|
password: ${{ secrets.SSH_DEPLOY_PASSWORD }}
|
||||||
|
script: |
|
||||||
|
cd ~/repo
|
||||||
|
./replace-env.sh API_DISCIPLINE "${{ env.IMAGE_VERSION }}"
|
||||||
|
./deploy.sh ${{ env.SERVICE_NAME }}
|
||||||
|
|
||||||
|
- name: Discord Notification
|
||||||
|
if: always()
|
||||||
|
run: |
|
||||||
|
STATUS="${{ job.status == 'success' && '✅ Success' || '❌ Failed' }}"
|
||||||
|
COLOR="${{ job.status == 'success' && '3066993' || '15158332' }}"
|
||||||
|
TIMESTAMP=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
||||||
|
curl -H "Content-Type: application/json" \
|
||||||
|
-X POST \
|
||||||
|
-d "{
|
||||||
|
\"embeds\": [{
|
||||||
|
\"title\": \"$STATUS\",
|
||||||
|
\"description\": \"**Build & Deploy**\\n- Image: \`${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}\`\\n- Version: \`${{ env.IMAGE_VERSION }}\`\\n- By: \`${{ gitea.actor }}\`\",
|
||||||
|
\"color\": $COLOR,
|
||||||
|
\"footer\": {
|
||||||
|
\"text\": \"Release Notification\",
|
||||||
|
\"icon_url\": \"https://example.com/success-icon.png\"
|
||||||
|
},
|
||||||
|
\"timestamp\": \"$TIMESTAMP\"
|
||||||
|
}]
|
||||||
|
}" \
|
||||||
|
${{ env.DISCORD_WEBHOOK }}
|
||||||
83
.forgejo/workflows/build-insignia.yml
Normal file
83
.forgejo/workflows/build-insignia.yml
Normal file
|
|
@ -0,0 +1,83 @@
|
||||||
|
name: Build & Deploy Insignia Service
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "insignia-dev[0-9]+.[0-9]+.[0-9]+"
|
||||||
|
- "insignia-dev[0-9]+.[0-9]+.[0-9]+*"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: ${{ vars.CONTAINER_REGISTRY }}
|
||||||
|
REGISTRY_USERNAME: ${{ vars.CONTAINER_REGISTRY_USERNAME }}
|
||||||
|
REGISTRY_PASSWORD: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
|
||||||
|
CONTAINER_IMAGE_NAME: ${{ vars.CONTAINER_REGISTRY }}/${{ vars.CONTAINER_IMAGE_OWNER }}
|
||||||
|
IMAGE_VERSION: latest
|
||||||
|
SERVICE_NAME: hrms-api-insignia
|
||||||
|
DISCORD_WEBHOOK: ${{ vars.DISCORD_WEBHOOK }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Tag Version
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if [[ "${{ github.event_name }}" == "push" ]]; then
|
||||||
|
VERSION=$(echo "${{ github.ref_name }}" | sed 's/insignia-dev//g')
|
||||||
|
echo "IMAGE_VERSION=${VERSION}" >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo "IMAGE_VERSION=${{ env.IMAGE_VERSION }}-${{ github.run_number }}" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
- name: Login in to registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ env.REGISTRY_USERNAME }}
|
||||||
|
password: ${{ env.REGISTRY_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Build and push docker image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
platforms: linux/amd64
|
||||||
|
context: .
|
||||||
|
file: ./BMA.EHR.Insignia/Dockerfile
|
||||||
|
tags: ${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}:latest,${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}:${{ env.IMAGE_VERSION }}
|
||||||
|
push: true
|
||||||
|
|
||||||
|
- name: Remote Deploy
|
||||||
|
uses: appleboy/ssh-action@v1.2.1
|
||||||
|
with:
|
||||||
|
host: ${{ vars.SSH_DEPLOY_HOST }}
|
||||||
|
port: ${{ vars.SSH_DEPLOY_PORT }}
|
||||||
|
username: ${{ secrets.SSH_DEPLOY_USER }}
|
||||||
|
password: ${{ secrets.SSH_DEPLOY_PASSWORD }}
|
||||||
|
script: |
|
||||||
|
cd ~/repo
|
||||||
|
./replace-env.sh API_INSIGNIA "${{ env.IMAGE_VERSION }}"
|
||||||
|
./deploy.sh ${{ env.SERVICE_NAME }}
|
||||||
|
|
||||||
|
- name: Discord Notification
|
||||||
|
if: always()
|
||||||
|
run: |
|
||||||
|
STATUS="${{ job.status == 'success' && '✅ Success' || '❌ Failed' }}"
|
||||||
|
COLOR="${{ job.status == 'success' && '3066993' || '15158332' }}"
|
||||||
|
TIMESTAMP=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
||||||
|
curl -H "Content-Type: application/json" \
|
||||||
|
-X POST \
|
||||||
|
-d "{
|
||||||
|
\"embeds\": [{
|
||||||
|
\"title\": \"$STATUS\",
|
||||||
|
\"description\": \"**Build & Deploy**\\n- Image: \`${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}\`\\n- Version: \`${{ env.IMAGE_VERSION }}\`\\n- By: \`${{ gitea.actor }}\`\",
|
||||||
|
\"color\": $COLOR,
|
||||||
|
\"footer\": {
|
||||||
|
\"text\": \"Release Notification\",
|
||||||
|
\"icon_url\": \"https://example.com/success-icon.png\"
|
||||||
|
},
|
||||||
|
\"timestamp\": \"$TIMESTAMP\"
|
||||||
|
}]
|
||||||
|
}" \
|
||||||
|
${{ env.DISCORD_WEBHOOK }}
|
||||||
83
.forgejo/workflows/build-leave.yml
Normal file
83
.forgejo/workflows/build-leave.yml
Normal file
|
|
@ -0,0 +1,83 @@
|
||||||
|
name: Build & Deploy Leave Service
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "leave-dev[0-9]+.[0-9]+.[0-9]+"
|
||||||
|
- "leave-dev[0-9]+.[0-9]+.[0-9]+*"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: ${{ vars.CONTAINER_REGISTRY }}
|
||||||
|
REGISTRY_USERNAME: ${{ vars.CONTAINER_REGISTRY_USERNAME }}
|
||||||
|
REGISTRY_PASSWORD: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
|
||||||
|
CONTAINER_IMAGE_NAME: ${{ vars.CONTAINER_REGISTRY }}/${{ vars.CONTAINER_IMAGE_OWNER }}
|
||||||
|
IMAGE_VERSION: latest
|
||||||
|
SERVICE_NAME: hrms-api-leave
|
||||||
|
DISCORD_WEBHOOK: ${{ vars.DISCORD_WEBHOOK }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Tag Version
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if [[ "${{ github.event_name }}" == "push" ]]; then
|
||||||
|
VERSION=$(echo "${{ github.ref_name }}" | sed 's/leave-dev//g')
|
||||||
|
echo "IMAGE_VERSION=${VERSION}" >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo "IMAGE_VERSION=${{ env.IMAGE_VERSION }}-${{ github.run_number }}" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
- name: Login in to registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ env.REGISTRY_USERNAME }}
|
||||||
|
password: ${{ env.REGISTRY_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Build and push docker image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
platforms: linux/amd64
|
||||||
|
context: .
|
||||||
|
file: ./BMA.EHR.Leave/Dockerfile
|
||||||
|
tags: ${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}:latest,${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}:${{ env.IMAGE_VERSION }}
|
||||||
|
push: true
|
||||||
|
|
||||||
|
- name: Remote Deploy
|
||||||
|
uses: appleboy/ssh-action@v1.2.1
|
||||||
|
with:
|
||||||
|
host: ${{ vars.SSH_DEPLOY_HOST }}
|
||||||
|
port: ${{ vars.SSH_DEPLOY_PORT }}
|
||||||
|
username: ${{ secrets.SSH_DEPLOY_USER }}
|
||||||
|
password: ${{ secrets.SSH_DEPLOY_PASSWORD }}
|
||||||
|
script: |
|
||||||
|
cd ~/repo
|
||||||
|
./replace-env.sh API_LEAVE "${{ env.IMAGE_VERSION }}"
|
||||||
|
./deploy.sh ${{ env.SERVICE_NAME }}
|
||||||
|
|
||||||
|
- name: Discord Notification
|
||||||
|
if: always()
|
||||||
|
run: |
|
||||||
|
STATUS="${{ job.status == 'success' && '✅ Success' || '❌ Failed' }}"
|
||||||
|
COLOR="${{ job.status == 'success' && '3066993' || '15158332' }}"
|
||||||
|
TIMESTAMP=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
||||||
|
curl -H "Content-Type: application/json" \
|
||||||
|
-X POST \
|
||||||
|
-d "{
|
||||||
|
\"embeds\": [{
|
||||||
|
\"title\": \"$STATUS\",
|
||||||
|
\"description\": \"**Build & Deploy**\\n- Image: \`${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}\`\\n- Version: \`${{ env.IMAGE_VERSION }}\`\\n- By: \`${{ gitea.actor }}\`\",
|
||||||
|
\"color\": $COLOR,
|
||||||
|
\"footer\": {
|
||||||
|
\"text\": \"Release Notification\",
|
||||||
|
\"icon_url\": \"https://example.com/success-icon.png\"
|
||||||
|
},
|
||||||
|
\"timestamp\": \"$TIMESTAMP\"
|
||||||
|
}]
|
||||||
|
}" \
|
||||||
|
${{ env.DISCORD_WEBHOOK }}
|
||||||
83
.forgejo/workflows/build-placement.yml
Normal file
83
.forgejo/workflows/build-placement.yml
Normal file
|
|
@ -0,0 +1,83 @@
|
||||||
|
name: Build & Deploy Placement Service
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "placement-dev[0-9]+.[0-9]+.[0-9]+"
|
||||||
|
- "placement-dev[0-9]+.[0-9]+.[0-9]+*"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: ${{ vars.CONTAINER_REGISTRY }}
|
||||||
|
REGISTRY_USERNAME: ${{ vars.CONTAINER_REGISTRY_USERNAME }}
|
||||||
|
REGISTRY_PASSWORD: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
|
||||||
|
CONTAINER_IMAGE_NAME: ${{ vars.CONTAINER_REGISTRY }}/${{ vars.CONTAINER_IMAGE_OWNER }}
|
||||||
|
IMAGE_VERSION: latest
|
||||||
|
SERVICE_NAME: hrms-api-placement
|
||||||
|
DISCORD_WEBHOOK: ${{ vars.DISCORD_WEBHOOK }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Tag Version
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if [[ "${{ github.event_name }}" == "push" ]]; then
|
||||||
|
VERSION=$(echo "${{ github.ref_name }}" | sed 's/placement-dev//g')
|
||||||
|
echo "IMAGE_VERSION=${VERSION}" >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo "IMAGE_VERSION=${{ env.IMAGE_VERSION }}-${{ github.run_number }}" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
- name: Login in to registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ env.REGISTRY_USERNAME }}
|
||||||
|
password: ${{ env.REGISTRY_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Build and push docker image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
platforms: linux/amd64
|
||||||
|
context: .
|
||||||
|
file: ./BMA.EHR.Placement.Service/Dockerfile
|
||||||
|
tags: ${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}:latest,${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}:${{ env.IMAGE_VERSION }}
|
||||||
|
push: true
|
||||||
|
|
||||||
|
- name: Remote Deploy
|
||||||
|
uses: appleboy/ssh-action@v1.2.1
|
||||||
|
with:
|
||||||
|
host: ${{ vars.SSH_DEPLOY_HOST }}
|
||||||
|
port: ${{ vars.SSH_DEPLOY_PORT }}
|
||||||
|
username: ${{ secrets.SSH_DEPLOY_USER }}
|
||||||
|
password: ${{ secrets.SSH_DEPLOY_PASSWORD }}
|
||||||
|
script: |
|
||||||
|
cd ~/repo
|
||||||
|
./replace-env.sh API_PLACEMENT "${{ env.IMAGE_VERSION }}"
|
||||||
|
./deploy.sh ${{ env.SERVICE_NAME }}
|
||||||
|
|
||||||
|
- name: Discord Notification
|
||||||
|
if: always()
|
||||||
|
run: |
|
||||||
|
STATUS="${{ job.status == 'success' && '✅ Success' || '❌ Failed' }}"
|
||||||
|
COLOR="${{ job.status == 'success' && '3066993' || '15158332' }}"
|
||||||
|
TIMESTAMP=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
||||||
|
curl -H "Content-Type: application/json" \
|
||||||
|
-X POST \
|
||||||
|
-d "{
|
||||||
|
\"embeds\": [{
|
||||||
|
\"title\": \"$STATUS\",
|
||||||
|
\"description\": \"**Build & Deploy**\\n- Image: \`${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}\`\\n- Version: \`${{ env.IMAGE_VERSION }}\`\\n- By: \`${{ gitea.actor }}\`\",
|
||||||
|
\"color\": $COLOR,
|
||||||
|
\"footer\": {
|
||||||
|
\"text\": \"Release Notification\",
|
||||||
|
\"icon_url\": \"https://example.com/success-icon.png\"
|
||||||
|
},
|
||||||
|
\"timestamp\": \"$TIMESTAMP\"
|
||||||
|
}]
|
||||||
|
}" \
|
||||||
|
${{ env.DISCORD_WEBHOOK }}
|
||||||
83
.forgejo/workflows/build-retirement.yml
Normal file
83
.forgejo/workflows/build-retirement.yml
Normal file
|
|
@ -0,0 +1,83 @@
|
||||||
|
name: Build & Deploy Retirement Service
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "retirement-dev[0-9]+.[0-9]+.[0-9]+"
|
||||||
|
- "retirement-dev[0-9]+.[0-9]+.[0-9]+*"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: ${{ vars.CONTAINER_REGISTRY }}
|
||||||
|
REGISTRY_USERNAME: ${{ vars.CONTAINER_REGISTRY_USERNAME }}
|
||||||
|
REGISTRY_PASSWORD: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
|
||||||
|
CONTAINER_IMAGE_NAME: ${{ vars.CONTAINER_REGISTRY }}/${{ vars.CONTAINER_IMAGE_OWNER }}
|
||||||
|
IMAGE_VERSION: latest
|
||||||
|
SERVICE_NAME: hrms-api-retirement
|
||||||
|
DISCORD_WEBHOOK: ${{ vars.DISCORD_WEBHOOK }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Tag Version
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if [[ "${{ github.event_name }}" == "push" ]]; then
|
||||||
|
VERSION=$(echo "${{ github.ref_name }}" | sed 's/retirement-dev//g')
|
||||||
|
echo "IMAGE_VERSION=${VERSION}" >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo "IMAGE_VERSION=${{ env.IMAGE_VERSION }}-${{ github.run_number }}" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
- name: Login in to registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ env.REGISTRY_USERNAME }}
|
||||||
|
password: ${{ env.REGISTRY_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Build and push docker image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
platforms: linux/amd64
|
||||||
|
context: .
|
||||||
|
file: ./BMA.EHR.Retirement.Service/Dockerfile
|
||||||
|
tags: ${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}:latest,${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}:${{ env.IMAGE_VERSION }}
|
||||||
|
push: true
|
||||||
|
|
||||||
|
- name: Remote Deploy
|
||||||
|
uses: appleboy/ssh-action@v1.2.1
|
||||||
|
with:
|
||||||
|
host: ${{ vars.SSH_DEPLOY_HOST }}
|
||||||
|
port: ${{ vars.SSH_DEPLOY_PORT }}
|
||||||
|
username: ${{ secrets.SSH_DEPLOY_USER }}
|
||||||
|
password: ${{ secrets.SSH_DEPLOY_PASSWORD }}
|
||||||
|
script: |
|
||||||
|
cd ~/repo
|
||||||
|
./replace-env.sh API_RETIREMENT "${{ env.IMAGE_VERSION }}"
|
||||||
|
./deploy.sh ${{ env.SERVICE_NAME }}
|
||||||
|
|
||||||
|
- name: Discord Notification
|
||||||
|
if: always()
|
||||||
|
run: |
|
||||||
|
STATUS="${{ job.status == 'success' && '✅ Success' || '❌ Failed' }}"
|
||||||
|
COLOR="${{ job.status == 'success' && '3066993' || '15158332' }}"
|
||||||
|
TIMESTAMP=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
||||||
|
curl -H "Content-Type: application/json" \
|
||||||
|
-X POST \
|
||||||
|
-d "{
|
||||||
|
\"embeds\": [{
|
||||||
|
\"title\": \"$STATUS\",
|
||||||
|
\"description\": \"**Build & Deploy**\\n- Image: \`${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}\`\\n- Version: \`${{ env.IMAGE_VERSION }}\`\\n- By: \`${{ gitea.actor }}\`\",
|
||||||
|
\"color\": $COLOR,
|
||||||
|
\"footer\": {
|
||||||
|
\"text\": \"Release Notification\",
|
||||||
|
\"icon_url\": \"https://example.com/success-icon.png\"
|
||||||
|
},
|
||||||
|
\"timestamp\": \"$TIMESTAMP\"
|
||||||
|
}]
|
||||||
|
}" \
|
||||||
|
${{ env.DISCORD_WEBHOOK }}
|
||||||
22
.github/workflows/discord-notify.yml
vendored
Normal file
22
.github/workflows/discord-notify.yml
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
name: Discord PR Notify
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [opened]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
discord:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Send Discord
|
||||||
|
run: |
|
||||||
|
curl -X POST "${{ secrets.DISCORD_WEBHOOK_PULLREQUEST }}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d '{
|
||||||
|
"embeds": [{
|
||||||
|
"title": "🔔 **Service:** ${{ github.repository }}",
|
||||||
|
"description": "👤 **Author:** ${{ github.event.pull_request.user.login }}\n🌿 **Branch:** ${{ github.event.pull_request.head.ref }} → ${{ github.event.pull_request.base.ref }}\n📦 **Pull Request:** [#${{ github.event.pull_request.number }} - ${{ github.event.pull_request.title }}](${{ github.event.pull_request.html_url }})",
|
||||||
|
"color": 5814783,
|
||||||
|
"timestamp": "${{ github.event.pull_request.created_at }}"
|
||||||
|
}]
|
||||||
|
}'
|
||||||
101
.github/workflows/dockerhub-release-checkin.yaml
vendored
Normal file
101
.github/workflows/dockerhub-release-checkin.yaml
vendored
Normal file
|
|
@ -0,0 +1,101 @@
|
||||||
|
name: DockerHub Release - CheckIn Consumer
|
||||||
|
run-name: DockerHub Release - CheckIn Consumer by ${{ github.actor }}
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "checkin-[0-9]+.[0-9]+.[0-9]+"
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
IMAGE_VER:
|
||||||
|
description: "Image version (e.g., latest, v1.0.0)"
|
||||||
|
required: false
|
||||||
|
default: "latest"
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOCKERHUB_REGISTRY: docker.io
|
||||||
|
IMAGE_NAME: hrms-api-checkin
|
||||||
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release-to-dockerhub:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set output tags
|
||||||
|
id: vars
|
||||||
|
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Generate version
|
||||||
|
id: gen_ver
|
||||||
|
run: |
|
||||||
|
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||||
|
IMAGE_VER=${{ steps.vars.outputs.tag }}
|
||||||
|
else
|
||||||
|
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||||
|
fi
|
||||||
|
if [[ $IMAGE_VER == '' ]]; then
|
||||||
|
IMAGE_VER='test-vBeta'
|
||||||
|
fi
|
||||||
|
echo "image_ver=${IMAGE_VER}" >> $GITHUB_OUTPUT
|
||||||
|
echo "Generated version: ${IMAGE_VER}"
|
||||||
|
|
||||||
|
- name: Display version
|
||||||
|
run: |
|
||||||
|
echo "Git Ref: $GITHUB_REF"
|
||||||
|
echo "Image Version: ${{ steps.gen_ver.outputs.image_ver }}"
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{env.DOCKERHUB_REGISTRY}}
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: BMA.EHR.CheckInConsumer/Dockerfile
|
||||||
|
platforms: linux/amd64
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ steps.gen_ver.outputs.image_ver }}
|
||||||
|
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest
|
||||||
|
labels: |
|
||||||
|
org.opencontainers.image.title=BMA EHR CheckIn Consumer
|
||||||
|
org.opencontainers.image.description=HRMS CheckIn Consumer Service
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
|
- name: Notify Discord on success
|
||||||
|
if: success()
|
||||||
|
env:
|
||||||
|
IMAGE_VER: ${{ steps.gen_ver.outputs.image_ver }}
|
||||||
|
run: |
|
||||||
|
TAG_INFO="Tag: ${IMAGE_VER:-unknown}"
|
||||||
|
REF_INFO="Ref: ${GITHUB_REF}"
|
||||||
|
ACTOR_INFO="Actor: ${GITHUB_ACTOR}"
|
||||||
|
MSG="✅ DockerHub release succeeded\n${TAG_INFO}\n${REF_INFO}\n${ACTOR_INFO}"
|
||||||
|
curl -s -H "Content-Type: application/json" \
|
||||||
|
-X POST \
|
||||||
|
-d "{\"content\":\"${MSG}\"}" \
|
||||||
|
"$DISCORD_WEBHOOK"
|
||||||
|
|
||||||
|
- name: Notify Discord on failure
|
||||||
|
if: failure()
|
||||||
|
env:
|
||||||
|
IMAGE_VER: ${{ steps.gen_ver.outputs.image_ver }}
|
||||||
|
run: |
|
||||||
|
TAG_INFO="Tag: ${IMAGE_VER:-unknown}"
|
||||||
|
REF_INFO="Ref: ${GITHUB_REF}"
|
||||||
|
ACTOR_INFO="Actor: ${GITHUB_ACTOR}"
|
||||||
|
MSG="❌ DockerHub release failed\n${TAG_INFO}\n${REF_INFO}\n${ACTOR_INFO}"
|
||||||
|
curl -s -H "Content-Type: application/json" \
|
||||||
|
-X POST \
|
||||||
|
-d "{\"content\":\"${MSG}\"}" \
|
||||||
|
"$DISCORD_WEBHOOK"
|
||||||
101
.github/workflows/dockerhub-release-command.yaml
vendored
Normal file
101
.github/workflows/dockerhub-release-command.yaml
vendored
Normal file
|
|
@ -0,0 +1,101 @@
|
||||||
|
name: DockerHub Release - Command Service
|
||||||
|
run-name: DockerHub Release - Command Service by ${{ github.actor }}
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "command-[0-9]+.[0-9]+.[0-9]+"
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
IMAGE_VER:
|
||||||
|
description: "Image version (e.g., latest, v1.0.0)"
|
||||||
|
required: false
|
||||||
|
default: "latest"
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOCKERHUB_REGISTRY: docker.io
|
||||||
|
IMAGE_NAME: hrms-api-command
|
||||||
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release-to-dockerhub:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set output tags
|
||||||
|
id: vars
|
||||||
|
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Generate version
|
||||||
|
id: gen_ver
|
||||||
|
run: |
|
||||||
|
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||||
|
IMAGE_VER=${{ steps.vars.outputs.tag }}
|
||||||
|
else
|
||||||
|
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||||
|
fi
|
||||||
|
if [[ $IMAGE_VER == '' ]]; then
|
||||||
|
IMAGE_VER='test-vBeta'
|
||||||
|
fi
|
||||||
|
echo "image_ver=${IMAGE_VER}" >> $GITHUB_OUTPUT
|
||||||
|
echo "Generated version: ${IMAGE_VER}"
|
||||||
|
|
||||||
|
- name: Display version
|
||||||
|
run: |
|
||||||
|
echo "Git Ref: $GITHUB_REF"
|
||||||
|
echo "Image Version: ${{ steps.gen_ver.outputs.image_ver }}"
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{env.DOCKERHUB_REGISTRY}}
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: BMA.EHR.Command.Service/Dockerfile
|
||||||
|
platforms: linux/amd64
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ steps.gen_ver.outputs.image_ver }}
|
||||||
|
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest
|
||||||
|
labels: |
|
||||||
|
org.opencontainers.image.title=BMA EHR Command Service
|
||||||
|
org.opencontainers.image.description=HRMS Command API Service
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
|
- name: Notify Discord on success
|
||||||
|
if: success()
|
||||||
|
env:
|
||||||
|
IMAGE_VER: ${{ steps.gen_ver.outputs.image_ver }}
|
||||||
|
run: |
|
||||||
|
TAG_INFO="Tag: ${IMAGE_VER:-unknown}"
|
||||||
|
REF_INFO="Ref: ${GITHUB_REF}"
|
||||||
|
ACTOR_INFO="Actor: ${GITHUB_ACTOR}"
|
||||||
|
MSG="✅ DockerHub release succeeded\n${TAG_INFO}\n${REF_INFO}\n${ACTOR_INFO}"
|
||||||
|
curl -s -H "Content-Type: application/json" \
|
||||||
|
-X POST \
|
||||||
|
-d "{\"content\":\"${MSG}\"}" \
|
||||||
|
"$DISCORD_WEBHOOK"
|
||||||
|
|
||||||
|
- name: Notify Discord on failure
|
||||||
|
if: failure()
|
||||||
|
env:
|
||||||
|
IMAGE_VER: ${{ steps.gen_ver.outputs.image_ver }}
|
||||||
|
run: |
|
||||||
|
TAG_INFO="Tag: ${IMAGE_VER:-unknown}"
|
||||||
|
REF_INFO="Ref: ${GITHUB_REF}"
|
||||||
|
ACTOR_INFO="Actor: ${GITHUB_ACTOR}"
|
||||||
|
MSG="❌ DockerHub release failed\n${TAG_INFO}\n${REF_INFO}\n${ACTOR_INFO}"
|
||||||
|
curl -s -H "Content-Type: application/json" \
|
||||||
|
-X POST \
|
||||||
|
-d "{\"content\":\"${MSG}\"}" \
|
||||||
|
"$DISCORD_WEBHOOK"
|
||||||
101
.github/workflows/dockerhub-release-discipline.yaml
vendored
Normal file
101
.github/workflows/dockerhub-release-discipline.yaml
vendored
Normal file
|
|
@ -0,0 +1,101 @@
|
||||||
|
name: DockerHub Release - Discipline Service
|
||||||
|
run-name: DockerHub Release - Discipline Service by ${{ github.actor }}
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "discipline-[0-9]+.[0-9]+.[0-9]+"
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
IMAGE_VER:
|
||||||
|
description: "Image version (e.g., latest, v1.0.0)"
|
||||||
|
required: false
|
||||||
|
default: "latest"
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOCKERHUB_REGISTRY: docker.io
|
||||||
|
IMAGE_NAME: hrms-api-discipline
|
||||||
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release-to-dockerhub:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set output tags
|
||||||
|
id: vars
|
||||||
|
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Generate version
|
||||||
|
id: gen_ver
|
||||||
|
run: |
|
||||||
|
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||||
|
IMAGE_VER=${{ steps.vars.outputs.tag }}
|
||||||
|
else
|
||||||
|
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||||
|
fi
|
||||||
|
if [[ $IMAGE_VER == '' ]]; then
|
||||||
|
IMAGE_VER='test-vBeta'
|
||||||
|
fi
|
||||||
|
echo "image_ver=${IMAGE_VER}" >> $GITHUB_OUTPUT
|
||||||
|
echo "Generated version: ${IMAGE_VER}"
|
||||||
|
|
||||||
|
- name: Display version
|
||||||
|
run: |
|
||||||
|
echo "Git Ref: $GITHUB_REF"
|
||||||
|
echo "Image Version: ${{ steps.gen_ver.outputs.image_ver }}"
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{env.DOCKERHUB_REGISTRY}}
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: BMA.EHR.Discipline.Service/Dockerfile
|
||||||
|
platforms: linux/amd64
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ steps.gen_ver.outputs.image_ver }}
|
||||||
|
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest
|
||||||
|
labels: |
|
||||||
|
org.opencontainers.image.title=BMA EHR Discipline Service
|
||||||
|
org.opencontainers.image.description=HRMS Discipline API Service
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
|
- name: Notify Discord on success
|
||||||
|
if: success()
|
||||||
|
env:
|
||||||
|
IMAGE_VER: ${{ steps.gen_ver.outputs.image_ver }}
|
||||||
|
run: |
|
||||||
|
TAG_INFO="Tag: ${IMAGE_VER:-unknown}"
|
||||||
|
REF_INFO="Ref: ${GITHUB_REF}"
|
||||||
|
ACTOR_INFO="Actor: ${GITHUB_ACTOR}"
|
||||||
|
MSG="✅ DockerHub release succeeded\n${TAG_INFO}\n${REF_INFO}\n${ACTOR_INFO}"
|
||||||
|
curl -s -H "Content-Type: application/json" \
|
||||||
|
-X POST \
|
||||||
|
-d "{\"content\":\"${MSG}\"}" \
|
||||||
|
"$DISCORD_WEBHOOK"
|
||||||
|
|
||||||
|
- name: Notify Discord on failure
|
||||||
|
if: failure()
|
||||||
|
env:
|
||||||
|
IMAGE_VER: ${{ steps.gen_ver.outputs.image_ver }}
|
||||||
|
run: |
|
||||||
|
TAG_INFO="Tag: ${IMAGE_VER:-unknown}"
|
||||||
|
REF_INFO="Ref: ${GITHUB_REF}"
|
||||||
|
ACTOR_INFO="Actor: ${GITHUB_ACTOR}"
|
||||||
|
MSG="❌ DockerHub release failed\n${TAG_INFO}\n${REF_INFO}\n${ACTOR_INFO}"
|
||||||
|
curl -s -H "Content-Type: application/json" \
|
||||||
|
-X POST \
|
||||||
|
-d "{\"content\":\"${MSG}\"}" \
|
||||||
|
"$DISCORD_WEBHOOK"
|
||||||
101
.github/workflows/dockerhub-release-insignia.yaml
vendored
Normal file
101
.github/workflows/dockerhub-release-insignia.yaml
vendored
Normal file
|
|
@ -0,0 +1,101 @@
|
||||||
|
name: DockerHub Release - Insignia Service
|
||||||
|
run-name: DockerHub Release - Insignia Service by ${{ github.actor }}
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "insignia-[0-9]+.[0-9]+.[0-9]+"
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
IMAGE_VER:
|
||||||
|
description: "Image version (e.g., latest, v1.0.0)"
|
||||||
|
required: false
|
||||||
|
default: "latest"
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOCKERHUB_REGISTRY: docker.io
|
||||||
|
IMAGE_NAME: hrms-api-insignia
|
||||||
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release-to-dockerhub:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set output tags
|
||||||
|
id: vars
|
||||||
|
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Generate version
|
||||||
|
id: gen_ver
|
||||||
|
run: |
|
||||||
|
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||||
|
IMAGE_VER=${{ steps.vars.outputs.tag }}
|
||||||
|
else
|
||||||
|
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||||
|
fi
|
||||||
|
if [[ $IMAGE_VER == '' ]]; then
|
||||||
|
IMAGE_VER='test-vBeta'
|
||||||
|
fi
|
||||||
|
echo "image_ver=${IMAGE_VER}" >> $GITHUB_OUTPUT
|
||||||
|
echo "Generated version: ${IMAGE_VER}"
|
||||||
|
|
||||||
|
- name: Display version
|
||||||
|
run: |
|
||||||
|
echo "Git Ref: $GITHUB_REF"
|
||||||
|
echo "Image Version: ${{ steps.gen_ver.outputs.image_ver }}"
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{env.DOCKERHUB_REGISTRY}}
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: BMA.EHR.Insignia/Dockerfile
|
||||||
|
platforms: linux/amd64
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ steps.gen_ver.outputs.image_ver }}
|
||||||
|
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest
|
||||||
|
labels: |
|
||||||
|
org.opencontainers.image.title=BMA EHR Insignia Service
|
||||||
|
org.opencontainers.image.description=HRMS Insignia API Service
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
|
- name: Notify Discord on success
|
||||||
|
if: success()
|
||||||
|
env:
|
||||||
|
IMAGE_VER: ${{ steps.gen_ver.outputs.image_ver }}
|
||||||
|
run: |
|
||||||
|
TAG_INFO="Tag: ${IMAGE_VER:-unknown}"
|
||||||
|
REF_INFO="Ref: ${GITHUB_REF}"
|
||||||
|
ACTOR_INFO="Actor: ${GITHUB_ACTOR}"
|
||||||
|
MSG="✅ DockerHub release succeeded\n${TAG_INFO}\n${REF_INFO}\n${ACTOR_INFO}"
|
||||||
|
curl -s -H "Content-Type: application/json" \
|
||||||
|
-X POST \
|
||||||
|
-d "{\"content\":\"${MSG}\"}" \
|
||||||
|
"$DISCORD_WEBHOOK"
|
||||||
|
|
||||||
|
- name: Notify Discord on failure
|
||||||
|
if: failure()
|
||||||
|
env:
|
||||||
|
IMAGE_VER: ${{ steps.gen_ver.outputs.image_ver }}
|
||||||
|
run: |
|
||||||
|
TAG_INFO="Tag: ${IMAGE_VER:-unknown}"
|
||||||
|
REF_INFO="Ref: ${GITHUB_REF}"
|
||||||
|
ACTOR_INFO="Actor: ${GITHUB_ACTOR}"
|
||||||
|
MSG="❌ DockerHub release failed\n${TAG_INFO}\n${REF_INFO}\n${ACTOR_INFO}"
|
||||||
|
curl -s -H "Content-Type: application/json" \
|
||||||
|
-X POST \
|
||||||
|
-d "{\"content\":\"${MSG}\"}" \
|
||||||
|
"$DISCORD_WEBHOOK"
|
||||||
119
.github/workflows/dockerhub-release-leave.yaml
vendored
Normal file
119
.github/workflows/dockerhub-release-leave.yaml
vendored
Normal file
|
|
@ -0,0 +1,119 @@
|
||||||
|
name: DockerHub Release - Leave Service
|
||||||
|
run-name: DockerHub Release - Leave Service by ${{ github.actor }}
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "leave-[0-9]+.[0-9]+.[0-9]+"
|
||||||
|
# branches:
|
||||||
|
# - main
|
||||||
|
# - develop
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
IMAGE_VER:
|
||||||
|
description: "Image version (e.g., latest, v1.0.0)"
|
||||||
|
required: false
|
||||||
|
default: "latest"
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOCKERHUB_REGISTRY: docker.io
|
||||||
|
IMAGE_NAME: hrms-api-leave
|
||||||
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release-to-dockerhub:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set output tags
|
||||||
|
id: vars
|
||||||
|
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Generate version
|
||||||
|
id: gen_ver
|
||||||
|
run: |
|
||||||
|
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||||
|
IMAGE_VER=${{ steps.vars.outputs.tag }}
|
||||||
|
elif [[ $GITHUB_REF == 'refs/heads/'* ]]; then
|
||||||
|
BRANCH_NAME=${GITHUB_REF#refs/heads/}
|
||||||
|
IMAGE_VER="${BRANCH_NAME}-latest"
|
||||||
|
else
|
||||||
|
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||||
|
fi
|
||||||
|
if [[ $IMAGE_VER == '' ]]; then
|
||||||
|
IMAGE_VER='test-vBeta'
|
||||||
|
fi
|
||||||
|
echo "image_ver=${IMAGE_VER}" >> $GITHUB_OUTPUT
|
||||||
|
echo "Generated version: ${IMAGE_VER}"
|
||||||
|
|
||||||
|
- name: Display version
|
||||||
|
run: |
|
||||||
|
echo "Git Ref: $GITHUB_REF"
|
||||||
|
echo "Image Version: ${{ steps.gen_ver.outputs.image_ver }}"
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{env.DOCKERHUB_REGISTRY}}
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Extract metadata for Docker
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}
|
||||||
|
tags: |
|
||||||
|
type=ref,event=tag
|
||||||
|
type=ref,event=branch
|
||||||
|
type=raw,value=${{ steps.gen_ver.outputs.image_ver }}
|
||||||
|
type=raw,value=latest,enable={{is_default_branch}}
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: BMA.EHR.Leave/Dockerfile
|
||||||
|
platforms: linux/amd64
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ steps.gen_ver.outputs.image_ver }}
|
||||||
|
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
|
- name: Image digest
|
||||||
|
run: echo "Image pushed with digest ${{ steps.build.outputs.digest }}"
|
||||||
|
|
||||||
|
- name: Notify Discord on success
|
||||||
|
if: success()
|
||||||
|
env:
|
||||||
|
IMAGE_VER: ${{ steps.gen_ver.outputs.image_ver }}
|
||||||
|
run: |
|
||||||
|
TAG_INFO="Tag: ${IMAGE_VER:-unknown}"
|
||||||
|
REF_INFO="Ref: ${GITHUB_REF}"
|
||||||
|
ACTOR_INFO="Actor: ${GITHUB_ACTOR}"
|
||||||
|
MSG="✅ DockerHub release succeeded\n${TAG_INFO}\n${REF_INFO}\n${ACTOR_INFO}"
|
||||||
|
curl -s -H "Content-Type: application/json" \
|
||||||
|
-X POST \
|
||||||
|
-d "{\"content\":\"${MSG}\"}" \
|
||||||
|
"$DISCORD_WEBHOOK"
|
||||||
|
|
||||||
|
- name: Notify Discord on failure
|
||||||
|
if: failure()
|
||||||
|
env:
|
||||||
|
IMAGE_VER: ${{ steps.gen_ver.outputs.image_ver }}
|
||||||
|
run: |
|
||||||
|
TAG_INFO="Tag: ${IMAGE_VER:-unknown}"
|
||||||
|
REF_INFO="Ref: ${GITHUB_REF}"
|
||||||
|
ACTOR_INFO="Actor: ${GITHUB_ACTOR}"
|
||||||
|
MSG="❌ DockerHub release failed\n${TAG_INFO}\n${REF_INFO}\n${ACTOR_INFO}"
|
||||||
|
curl -s -H "Content-Type: application/json" \
|
||||||
|
-X POST \
|
||||||
|
-d "{\"content\":\"${MSG}\"}" \
|
||||||
|
"$DISCORD_WEBHOOK"
|
||||||
101
.github/workflows/dockerhub-release-placement.yaml
vendored
Normal file
101
.github/workflows/dockerhub-release-placement.yaml
vendored
Normal file
|
|
@ -0,0 +1,101 @@
|
||||||
|
name: DockerHub Release - Placement Service
|
||||||
|
run-name: DockerHub Release - Placement Service by ${{ github.actor }}
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "placement-[0-9]+.[0-9]+.[0-9]+"
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
IMAGE_VER:
|
||||||
|
description: "Image version (e.g., latest, v1.0.0)"
|
||||||
|
required: false
|
||||||
|
default: "latest"
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOCKERHUB_REGISTRY: docker.io
|
||||||
|
IMAGE_NAME: hrms-api-placement
|
||||||
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release-to-dockerhub:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set output tags
|
||||||
|
id: vars
|
||||||
|
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Generate version
|
||||||
|
id: gen_ver
|
||||||
|
run: |
|
||||||
|
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||||
|
IMAGE_VER=${{ steps.vars.outputs.tag }}
|
||||||
|
else
|
||||||
|
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||||
|
fi
|
||||||
|
if [[ $IMAGE_VER == '' ]]; then
|
||||||
|
IMAGE_VER='test-vBeta'
|
||||||
|
fi
|
||||||
|
echo "image_ver=${IMAGE_VER}" >> $GITHUB_OUTPUT
|
||||||
|
echo "Generated version: ${IMAGE_VER}"
|
||||||
|
|
||||||
|
- name: Display version
|
||||||
|
run: |
|
||||||
|
echo "Git Ref: $GITHUB_REF"
|
||||||
|
echo "Image Version: ${{ steps.gen_ver.outputs.image_ver }}"
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{env.DOCKERHUB_REGISTRY}}
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: BMA.EHR.Placement.Service/Dockerfile
|
||||||
|
platforms: linux/amd64
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ steps.gen_ver.outputs.image_ver }}
|
||||||
|
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest
|
||||||
|
labels: |
|
||||||
|
org.opencontainers.image.title=BMA EHR Placement Service
|
||||||
|
org.opencontainers.image.description=HRMS Placement API Service
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
|
- name: Notify Discord on success
|
||||||
|
if: success()
|
||||||
|
env:
|
||||||
|
IMAGE_VER: ${{ steps.gen_ver.outputs.image_ver }}
|
||||||
|
run: |
|
||||||
|
TAG_INFO="Tag: ${IMAGE_VER:-unknown}"
|
||||||
|
REF_INFO="Ref: ${GITHUB_REF}"
|
||||||
|
ACTOR_INFO="Actor: ${GITHUB_ACTOR}"
|
||||||
|
MSG="✅ DockerHub release succeeded\n${TAG_INFO}\n${REF_INFO}\n${ACTOR_INFO}"
|
||||||
|
curl -s -H "Content-Type: application/json" \
|
||||||
|
-X POST \
|
||||||
|
-d "{\"content\":\"${MSG}\"}" \
|
||||||
|
"$DISCORD_WEBHOOK"
|
||||||
|
|
||||||
|
- name: Notify Discord on failure
|
||||||
|
if: failure()
|
||||||
|
env:
|
||||||
|
IMAGE_VER: ${{ steps.gen_ver.outputs.image_ver }}
|
||||||
|
run: |
|
||||||
|
TAG_INFO="Tag: ${IMAGE_VER:-unknown}"
|
||||||
|
REF_INFO="Ref: ${GITHUB_REF}"
|
||||||
|
ACTOR_INFO="Actor: ${GITHUB_ACTOR}"
|
||||||
|
MSG="❌ DockerHub release failed\n${TAG_INFO}\n${REF_INFO}\n${ACTOR_INFO}"
|
||||||
|
curl -s -H "Content-Type: application/json" \
|
||||||
|
-X POST \
|
||||||
|
-d "{\"content\":\"${MSG}\"}" \
|
||||||
|
"$DISCORD_WEBHOOK"
|
||||||
101
.github/workflows/dockerhub-release-reportv2.yaml
vendored
Normal file
101
.github/workflows/dockerhub-release-reportv2.yaml
vendored
Normal file
|
|
@ -0,0 +1,101 @@
|
||||||
|
name: DockerHub Release - Report Service
|
||||||
|
run-name: DockerHub Release - Report Service by ${{ github.actor }}
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "reportv2-[0-9]+.[0-9]+.[0-9]+"
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
IMAGE_VER:
|
||||||
|
description: "Image version (e.g., latest, v1.0.0)"
|
||||||
|
required: false
|
||||||
|
default: "latest"
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOCKERHUB_REGISTRY: docker.io
|
||||||
|
IMAGE_NAME: hrms-api-reportv2
|
||||||
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release-to-dockerhub:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set output tags
|
||||||
|
id: vars
|
||||||
|
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Generate version
|
||||||
|
id: gen_ver
|
||||||
|
run: |
|
||||||
|
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||||
|
IMAGE_VER=${{ steps.vars.outputs.tag }}
|
||||||
|
else
|
||||||
|
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||||
|
fi
|
||||||
|
if [[ $IMAGE_VER == '' ]]; then
|
||||||
|
IMAGE_VER='test-vBeta'
|
||||||
|
fi
|
||||||
|
echo "image_ver=${IMAGE_VER}" >> $GITHUB_OUTPUT
|
||||||
|
echo "Generated version: ${IMAGE_VER}"
|
||||||
|
|
||||||
|
- name: Display version
|
||||||
|
run: |
|
||||||
|
echo "Git Ref: $GITHUB_REF"
|
||||||
|
echo "Image Version: ${{ steps.gen_ver.outputs.image_ver }}"
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{env.DOCKERHUB_REGISTRY}}
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: BMA.EHR.Report.Service/Dockerfile
|
||||||
|
platforms: linux/amd64
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ steps.gen_ver.outputs.image_ver }}
|
||||||
|
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest
|
||||||
|
labels: |
|
||||||
|
org.opencontainers.image.title=BMA EHR Report Service
|
||||||
|
org.opencontainers.image.description=HRMS Report API Service
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
|
- name: Notify Discord on success
|
||||||
|
if: success()
|
||||||
|
env:
|
||||||
|
IMAGE_VER: ${{ steps.gen_ver.outputs.image_ver }}
|
||||||
|
run: |
|
||||||
|
TAG_INFO="Tag: ${IMAGE_VER:-unknown}"
|
||||||
|
REF_INFO="Ref: ${GITHUB_REF}"
|
||||||
|
ACTOR_INFO="Actor: ${GITHUB_ACTOR}"
|
||||||
|
MSG="✅ DockerHub release succeeded\n${TAG_INFO}\n${REF_INFO}\n${ACTOR_INFO}"
|
||||||
|
curl -s -H "Content-Type: application/json" \
|
||||||
|
-X POST \
|
||||||
|
-d "{\"content\":\"${MSG}\"}" \
|
||||||
|
"$DISCORD_WEBHOOK"
|
||||||
|
|
||||||
|
- name: Notify Discord on failure
|
||||||
|
if: failure()
|
||||||
|
env:
|
||||||
|
IMAGE_VER: ${{ steps.gen_ver.outputs.image_ver }}
|
||||||
|
run: |
|
||||||
|
TAG_INFO="Tag: ${IMAGE_VER:-unknown}"
|
||||||
|
REF_INFO="Ref: ${GITHUB_REF}"
|
||||||
|
ACTOR_INFO="Actor: ${GITHUB_ACTOR}"
|
||||||
|
MSG="❌ DockerHub release failed\n${TAG_INFO}\n${REF_INFO}\n${ACTOR_INFO}"
|
||||||
|
curl -s -H "Content-Type: application/json" \
|
||||||
|
-X POST \
|
||||||
|
-d "{\"content\":\"${MSG}\"}" \
|
||||||
|
"$DISCORD_WEBHOOK"
|
||||||
101
.github/workflows/dockerhub-release-retirement.yaml
vendored
Normal file
101
.github/workflows/dockerhub-release-retirement.yaml
vendored
Normal file
|
|
@ -0,0 +1,101 @@
|
||||||
|
name: DockerHub Release - Retirement Service
|
||||||
|
run-name: DockerHub Release - Retirement Service by ${{ github.actor }}
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "retirement-[0-9]+.[0-9]+.[0-9]+"
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
IMAGE_VER:
|
||||||
|
description: "Image version (e.g., latest, v1.0.0)"
|
||||||
|
required: false
|
||||||
|
default: "latest"
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOCKERHUB_REGISTRY: docker.io
|
||||||
|
IMAGE_NAME: hrms-api-retirement
|
||||||
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release-to-dockerhub:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set output tags
|
||||||
|
id: vars
|
||||||
|
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Generate version
|
||||||
|
id: gen_ver
|
||||||
|
run: |
|
||||||
|
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||||
|
IMAGE_VER=${{ steps.vars.outputs.tag }}
|
||||||
|
else
|
||||||
|
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||||
|
fi
|
||||||
|
if [[ $IMAGE_VER == '' ]]; then
|
||||||
|
IMAGE_VER='test-vBeta'
|
||||||
|
fi
|
||||||
|
echo "image_ver=${IMAGE_VER}" >> $GITHUB_OUTPUT
|
||||||
|
echo "Generated version: ${IMAGE_VER}"
|
||||||
|
|
||||||
|
- name: Display version
|
||||||
|
run: |
|
||||||
|
echo "Git Ref: $GITHUB_REF"
|
||||||
|
echo "Image Version: ${{ steps.gen_ver.outputs.image_ver }}"
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{env.DOCKERHUB_REGISTRY}}
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: BMA.EHR.Retirement.Service/Dockerfile
|
||||||
|
platforms: linux/amd64
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ steps.gen_ver.outputs.image_ver }}
|
||||||
|
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest
|
||||||
|
labels: |
|
||||||
|
org.opencontainers.image.title=BMA EHR Retirement Service
|
||||||
|
org.opencontainers.image.description=HRMS Retirement API Service
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
|
- name: Notify Discord on success
|
||||||
|
if: success()
|
||||||
|
env:
|
||||||
|
IMAGE_VER: ${{ steps.gen_ver.outputs.image_ver }}
|
||||||
|
run: |
|
||||||
|
TAG_INFO="Tag: ${IMAGE_VER:-unknown}"
|
||||||
|
REF_INFO="Ref: ${GITHUB_REF}"
|
||||||
|
ACTOR_INFO="Actor: ${GITHUB_ACTOR}"
|
||||||
|
MSG="✅ DockerHub release succeeded\n${TAG_INFO}\n${REF_INFO}\n${ACTOR_INFO}"
|
||||||
|
curl -s -H "Content-Type: application/json" \
|
||||||
|
-X POST \
|
||||||
|
-d "{\"content\":\"${MSG}\"}" \
|
||||||
|
"$DISCORD_WEBHOOK"
|
||||||
|
|
||||||
|
- name: Notify Discord on failure
|
||||||
|
if: failure()
|
||||||
|
env:
|
||||||
|
IMAGE_VER: ${{ steps.gen_ver.outputs.image_ver }}
|
||||||
|
run: |
|
||||||
|
TAG_INFO="Tag: ${IMAGE_VER:-unknown}"
|
||||||
|
REF_INFO="Ref: ${GITHUB_REF}"
|
||||||
|
ACTOR_INFO="Actor: ${GITHUB_ACTOR}"
|
||||||
|
MSG="❌ DockerHub release failed\n${TAG_INFO}\n${REF_INFO}\n${ACTOR_INFO}"
|
||||||
|
curl -s -H "Content-Type: application/json" \
|
||||||
|
-X POST \
|
||||||
|
-d "{\"content\":\"${MSG}\"}" \
|
||||||
|
"$DISCORD_WEBHOOK"
|
||||||
6
.github/workflows/release_Retirement.yaml
vendored
6
.github/workflows/release_Retirement.yaml
vendored
|
|
@ -1,9 +1,9 @@
|
||||||
name: release-dev
|
name: release-dev
|
||||||
run-name: release-dev ${{ github.actor }}
|
run-name: release-dev ${{ github.actor }}
|
||||||
on:
|
on:
|
||||||
push:
|
# push:
|
||||||
tags:
|
# tags:
|
||||||
- "retirement-[0-9]+.[0-9]+.[0-9]+"
|
# - "retirement-[0-9]+.[0-9]+.[0-9]+"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
env:
|
env:
|
||||||
REGISTRY: docker.frappet.com
|
REGISTRY: docker.frappet.com
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
name: release-dev
|
name: release-dev
|
||||||
run-name: release-dev ${{ github.actor }}
|
run-name: release-dev ${{ github.actor }}
|
||||||
on:
|
on:
|
||||||
push:
|
# push:
|
||||||
tags:
|
# tags:
|
||||||
- "consumer-[0-9]+.[0-9]+.[0-9]+"
|
# - "consumer-[0-9]+.[0-9]+.[0-9]+"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
env:
|
env:
|
||||||
REGISTRY: docker.frappet.com
|
REGISTRY: docker.frappet.com
|
||||||
|
|
|
||||||
64
.github/workflows/release_command.yaml
vendored
64
.github/workflows/release_command.yaml
vendored
|
|
@ -3,10 +3,7 @@ run-name: release-dev ${{ github.actor }}
|
||||||
on:
|
on:
|
||||||
# push:
|
# push:
|
||||||
# tags:
|
# tags:
|
||||||
# - 'v[0-9]+.[0-9]+.[0-9]+'
|
# - "command-[0-9]+.[0-9]+.[0-9]+"
|
||||||
# tags-ignore:
|
|
||||||
# - '2.*'
|
|
||||||
# Allow run workflow manually from Action tab
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
env:
|
env:
|
||||||
REGISTRY: docker.frappet.com
|
REGISTRY: docker.frappet.com
|
||||||
|
|
@ -23,12 +20,14 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
# skip Set up QEMU because it fail on act and container
|
- name: Set output tags
|
||||||
|
id: vars
|
||||||
|
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
|
||||||
- name: Gen Version
|
- name: Gen Version
|
||||||
id: gen_ver
|
id: gen_ver
|
||||||
run: |
|
run: |
|
||||||
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||||
IMAGE_VER='${GITHUB_REF/refs\/tags\//}'
|
IMAGE_VER=${{ steps.vars.outputs.tag }}
|
||||||
else
|
else
|
||||||
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||||
fi
|
fi
|
||||||
|
|
@ -36,7 +35,7 @@ jobs:
|
||||||
IMAGE_VER='test-vBeta'
|
IMAGE_VER='test-vBeta'
|
||||||
fi
|
fi
|
||||||
echo '::set-output name=image_ver::'$IMAGE_VER
|
echo '::set-output name=image_ver::'$IMAGE_VER
|
||||||
- name: Test Version
|
- name: Check Version
|
||||||
run: |
|
run: |
|
||||||
echo $GITHUB_REF
|
echo $GITHUB_REF
|
||||||
echo ${{ steps.gen_ver.outputs.image_ver }}
|
echo ${{ steps.gen_ver.outputs.image_ver }}
|
||||||
|
|
@ -69,21 +68,40 @@ jobs:
|
||||||
docker compose pull
|
docker compose pull
|
||||||
docker compose up -d
|
docker compose up -d
|
||||||
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
||||||
- uses: snow-actions/line-notify@v1.1.0
|
- name: Notify Discord Success
|
||||||
if: success()
|
if: success()
|
||||||
with:
|
run: |
|
||||||
access_token: ${{ env.TOKEN_LINE }}
|
curl -H "Content-Type: application/json" \
|
||||||
message: |
|
-X POST \
|
||||||
-Success✅✅✅
|
-d '{
|
||||||
Image: ${{env.IMAGE_NAME}}
|
"embeds": [{
|
||||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
"title": "✅ Deployment Success!",
|
||||||
By: ${{secrets.DOCKER_USER}}
|
"description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Deployed by: `${{github.actor}}`",
|
||||||
- uses: snow-actions/line-notify@v1.1.0
|
"color": 3066993,
|
||||||
|
"footer": {
|
||||||
|
"text": "Release Notification",
|
||||||
|
"icon_url": "https://example.com/success-icon.png"
|
||||||
|
},
|
||||||
|
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
|
||||||
|
}]
|
||||||
|
}' \
|
||||||
|
${{ secrets.DISCORD_WEBHOOK }}
|
||||||
|
|
||||||
|
- name: Notify Discord Failure
|
||||||
if: failure()
|
if: failure()
|
||||||
with:
|
run: |
|
||||||
access_token: ${{ env.TOKEN_LINE }}
|
curl -H "Content-Type: application/json" \
|
||||||
message: |
|
-X POST \
|
||||||
-Failure❌❌❌
|
-d '{
|
||||||
Image: ${{env.IMAGE_NAME}}
|
"embeds": [{
|
||||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
"title": "❌ Deployment Failed!",
|
||||||
By: ${{secrets.DOCKER_USER}}
|
"description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Attempted by: `${{github.actor}}`",
|
||||||
|
"color": 15158332,
|
||||||
|
"footer": {
|
||||||
|
"text": "Release Notification",
|
||||||
|
"icon_url": "https://example.com/failure-icon.png"
|
||||||
|
},
|
||||||
|
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
|
||||||
|
}]
|
||||||
|
}' \
|
||||||
|
${{ secrets.DISCORD_WEBHOOK }}
|
||||||
|
|
|
||||||
6
.github/workflows/release_discipline.yaml
vendored
6
.github/workflows/release_discipline.yaml
vendored
|
|
@ -1,9 +1,9 @@
|
||||||
name: release-dev
|
name: release-dev
|
||||||
run-name: release-dev ${{ github.actor }}
|
run-name: release-dev ${{ github.actor }}
|
||||||
on:
|
on:
|
||||||
push:
|
# push:
|
||||||
tags:
|
# tags:
|
||||||
- "discipline-[0-9]+.[0-9]+.[0-9]+"
|
# - "discipline-[0-9]+.[0-9]+.[0-9]+"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
env:
|
env:
|
||||||
REGISTRY: docker.frappet.com
|
REGISTRY: docker.frappet.com
|
||||||
|
|
|
||||||
6
.github/workflows/release_insignia.yaml
vendored
6
.github/workflows/release_insignia.yaml
vendored
|
|
@ -1,9 +1,9 @@
|
||||||
name: release-dev
|
name: release-dev
|
||||||
run-name: release-dev ${{ github.actor }}
|
run-name: release-dev ${{ github.actor }}
|
||||||
on:
|
on:
|
||||||
push:
|
# push:
|
||||||
tags:
|
# tags:
|
||||||
- "insignia-[0-9]+.[0-9]+.[0-9]+"
|
# - "insignia-[0-9]+.[0-9]+.[0-9]+"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
env:
|
env:
|
||||||
REGISTRY: docker.frappet.com
|
REGISTRY: docker.frappet.com
|
||||||
|
|
|
||||||
8
.github/workflows/release_leave.yaml
vendored
8
.github/workflows/release_leave.yaml
vendored
|
|
@ -1,9 +1,9 @@
|
||||||
name: release-dev
|
name: release-dev
|
||||||
run-name: release-dev ${{ github.actor }}
|
run-name: release-dev ${{ github.actor }}
|
||||||
on:
|
on:
|
||||||
push:
|
# push:
|
||||||
tags:
|
# tags:
|
||||||
- "leave-[0-9]+.[0-9]+.[0-9]+"
|
# - "leave-[0-9]+.[0-9]+.[0-9]+"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
env:
|
env:
|
||||||
REGISTRY: docker.frappet.com
|
REGISTRY: docker.frappet.com
|
||||||
|
|
@ -57,7 +57,7 @@ jobs:
|
||||||
push: true
|
push: true
|
||||||
tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest
|
tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest
|
||||||
- name: Remote Deployment
|
- name: Remote Deployment
|
||||||
uses: appleboy/ssh-action@v0.1.8
|
uses: appleboy/ssh-action@v1
|
||||||
with:
|
with:
|
||||||
host: ${{env.DEPLOY_HOST}}
|
host: ${{env.DEPLOY_HOST}}
|
||||||
username: frappet
|
username: frappet
|
||||||
|
|
|
||||||
6
.github/workflows/release_placement.yaml
vendored
6
.github/workflows/release_placement.yaml
vendored
|
|
@ -1,9 +1,9 @@
|
||||||
name: release-dev
|
name: release-dev
|
||||||
run-name: release-dev ${{ github.actor }}
|
run-name: release-dev ${{ github.actor }}
|
||||||
on:
|
on:
|
||||||
push:
|
# push:
|
||||||
tags:
|
# tags:
|
||||||
- "placement-[0-9]+.[0-9]+.[0-9]+"
|
# - "placement-[0-9]+.[0-9]+.[0-9]+"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
env:
|
env:
|
||||||
REGISTRY: docker.frappet.com
|
REGISTRY: docker.frappet.com
|
||||||
|
|
|
||||||
6
.github/workflows/release_report.yaml
vendored
6
.github/workflows/release_report.yaml
vendored
|
|
@ -1,9 +1,9 @@
|
||||||
name: release-dev
|
name: release-dev
|
||||||
run-name: release-dev ${{ github.actor }}
|
run-name: release-dev ${{ github.actor }}
|
||||||
on:
|
on:
|
||||||
push:
|
# push:
|
||||||
tags:
|
# tags:
|
||||||
- "reportv2-[0-9]+.[0-9]+.[0-9]+"
|
# - "reportv2-[0-9]+.[0-9]+.[0-9]+"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
env:
|
env:
|
||||||
REGISTRY: docker.frappet.com
|
REGISTRY: docker.frappet.com
|
||||||
|
|
|
||||||
19
.gitignore
vendored
19
.gitignore
vendored
|
|
@ -16,6 +16,19 @@
|
||||||
# Mono auto generated files
|
# Mono auto generated files
|
||||||
mono_crash.*
|
mono_crash.*
|
||||||
|
|
||||||
|
# JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||||
|
.idea/
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
*.iws
|
||||||
|
out/
|
||||||
|
.idea_modules/
|
||||||
|
atlassian-ide-plugin.xml
|
||||||
|
com_crashlytics_export_strings.xml
|
||||||
|
crashlytics.properties
|
||||||
|
crashlytics-build.properties
|
||||||
|
fabric.properties
|
||||||
|
|
||||||
# Build results
|
# Build results
|
||||||
[Dd]ebug/
|
[Dd]ebug/
|
||||||
[Dd]ebugPublic/
|
[Dd]ebugPublic/
|
||||||
|
|
@ -361,3 +374,9 @@ MigrationBackup/
|
||||||
|
|
||||||
# Fody - auto-generated XML schema
|
# Fody - auto-generated XML schema
|
||||||
FodyWeavers.xsd
|
FodyWeavers.xsd
|
||||||
|
|
||||||
|
# VS Code C# Dev Kit cache
|
||||||
|
*.lscache
|
||||||
|
|
||||||
|
# Claude Code
|
||||||
|
.claude/
|
||||||
1
.idea/.idea.BMA.EHR.Solution/.idea/.name
generated
1
.idea/.idea.BMA.EHR.Solution/.idea/.name
generated
|
|
@ -1 +0,0 @@
|
||||||
BMA.EHR.Solution
|
|
||||||
|
Before Width: | Height: | Size: 16 B |
4
.idea/.idea.BMA.EHR.Solution/.idea/encodings.xml
generated
4
.idea/.idea.BMA.EHR.Solution/.idea/encodings.xml
generated
|
|
@ -1,4 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
|
|
||||||
</project>
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="UserContentModel">
|
|
||||||
<attachedFolders />
|
|
||||||
<explicitIncludes />
|
|
||||||
<explicitExcludes />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="RiderProjectSettingsUpdater">
|
|
||||||
<option name="vcsConfiguration" value="2" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
6
.idea/.idea.BMA.EHR.Solution/.idea/vcs.xml
generated
6
.idea/.idea.BMA.EHR.Solution/.idea/vcs.xml
generated
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="" vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
552
.idea/.idea.BMA.EHR.Solution/.idea/workspace.xml
generated
552
.idea/.idea.BMA.EHR.Solution/.idea/workspace.xml
generated
|
|
@ -1,552 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="AutoGeneratedRunConfigurationManager">
|
|
||||||
<projectFile kind="Docker">BMA.EHR.CheckInConsumer/BMA.EHR.CheckInConsumer.csproj</projectFile>
|
|
||||||
<projectFile profileName="BMA.EHR.CheckInConsumer">BMA.EHR.CheckInConsumer/BMA.EHR.CheckInConsumer.csproj</projectFile>
|
|
||||||
<projectFile kind="Docker">BMA.EHR.Command.Service/BMA.EHR.Command.Service.csproj</projectFile>
|
|
||||||
<projectFile profileName="http">BMA.EHR.Command.Service/BMA.EHR.Command.Service.csproj</projectFile>
|
|
||||||
<projectFile profileName="https">BMA.EHR.Command.Service/BMA.EHR.Command.Service.csproj</projectFile>
|
|
||||||
<projectFile profileName="http">BMA.EHR.Discipline.Service/BMA.EHR.Discipline.Service.csproj</projectFile>
|
|
||||||
<projectFile profileName="https">BMA.EHR.Discipline.Service/BMA.EHR.Discipline.Service.csproj</projectFile>
|
|
||||||
<projectFile kind="Docker">BMA.EHR.Insignia/BMA.EHR.Insignia.csproj</projectFile>
|
|
||||||
<projectFile profileName="http">BMA.EHR.Insignia/BMA.EHR.Insignia.csproj</projectFile>
|
|
||||||
<projectFile profileName="https">BMA.EHR.Insignia/BMA.EHR.Insignia.csproj</projectFile>
|
|
||||||
<projectFile kind="Docker">BMA.EHR.Leave/BMA.EHR.Leave.csproj</projectFile>
|
|
||||||
<projectFile profileName="http">BMA.EHR.Leave/BMA.EHR.Leave.csproj</projectFile>
|
|
||||||
<projectFile profileName="https">BMA.EHR.Leave/BMA.EHR.Leave.csproj</projectFile>
|
|
||||||
<projectFile kind="Docker">BMA.EHR.MetaData.Service/BMA.EHR.MetaData.Service.csproj</projectFile>
|
|
||||||
<projectFile profileName="http">BMA.EHR.MetaData.Service/BMA.EHR.MetaData.Service.csproj</projectFile>
|
|
||||||
<projectFile profileName="https">BMA.EHR.MetaData.Service/BMA.EHR.MetaData.Service.csproj</projectFile>
|
|
||||||
<projectFile kind="Docker">BMA.EHR.OrganizationEmployee.Service/BMA.EHR.OrganizationEmployee.Service.csproj</projectFile>
|
|
||||||
<projectFile profileName="http">BMA.EHR.OrganizationEmployee.Service/BMA.EHR.OrganizationEmployee.Service.csproj</projectFile>
|
|
||||||
<projectFile profileName="https">BMA.EHR.OrganizationEmployee.Service/BMA.EHR.OrganizationEmployee.Service.csproj</projectFile>
|
|
||||||
<projectFile kind="Docker">BMA.EHR.Placement.Service/BMA.EHR.Placement.Service.csproj</projectFile>
|
|
||||||
<projectFile profileName="http">BMA.EHR.Placement.Service/BMA.EHR.Placement.Service.csproj</projectFile>
|
|
||||||
<projectFile profileName="https">BMA.EHR.Placement.Service/BMA.EHR.Placement.Service.csproj</projectFile>
|
|
||||||
<projectFile kind="Docker">BMA.EHR.Report.Service/BMA.EHR.Report.Service.csproj</projectFile>
|
|
||||||
<projectFile profileName="dotnet">BMA.EHR.Report.Service/BMA.EHR.Report.Service.csproj</projectFile>
|
|
||||||
<projectFile profileName="http">BMA.EHR.Report.Service/BMA.EHR.Report.Service.csproj</projectFile>
|
|
||||||
<projectFile profileName="https">BMA.EHR.Report.Service/BMA.EHR.Report.Service.csproj</projectFile>
|
|
||||||
<projectFile profileName="report-designer">BMA.EHR.Report.Service/BMA.EHR.Report.Service.csproj</projectFile>
|
|
||||||
<projectFile kind="Docker">BMA.EHR.Retirement.Service/BMA.EHR.Retirement.Service.csproj</projectFile>
|
|
||||||
<projectFile profileName="http">BMA.EHR.Retirement.Service/BMA.EHR.Retirement.Service.csproj</projectFile>
|
|
||||||
<projectFile profileName="https">BMA.EHR.Retirement.Service/BMA.EHR.Retirement.Service.csproj</projectFile>
|
|
||||||
</component>
|
|
||||||
<component name="AutoImportSettings">
|
|
||||||
<option name="autoReloadType" value="SELECTIVE" />
|
|
||||||
</component>
|
|
||||||
<component name="ChangeListManager">
|
|
||||||
<list default="true" id="85fddeb6-44fd-40a4-864f-89daec07db75" name="Changes" comment="">
|
|
||||||
<change beforePath="$PROJECT_DIR$/BMA.EHR.Insignia/Controllers/InsigniaRequestController.cs" beforeDir="false" afterPath="$PROJECT_DIR$/BMA.EHR.Insignia/Controllers/InsigniaRequestController.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/BMA.EHR.Insignia/appsettings.json" beforeDir="false" afterPath="$PROJECT_DIR$/BMA.EHR.Insignia/appsettings.json" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/BMA.EHR.Leave/Controllers/LeaveController.cs" beforeDir="false" afterPath="$PROJECT_DIR$/BMA.EHR.Leave/Controllers/LeaveController.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/BMA.EHR.Leave/appsettings.json" beforeDir="false" afterPath="$PROJECT_DIR$/BMA.EHR.Leave/appsettings.json" afterDir="false" />
|
|
||||||
</list>
|
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
||||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
||||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
||||||
</component>
|
|
||||||
<component name="DpaMonitoringSettings">
|
|
||||||
<option name="autoShow" value="false" />
|
|
||||||
</component>
|
|
||||||
<component name="Git.Settings">
|
|
||||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectColorInfo"><![CDATA[{
|
|
||||||
"customColor": "",
|
|
||||||
"associatedIndex": 2
|
|
||||||
}]]></component>
|
|
||||||
<component name="ProjectId" id="2lB1pnEIkATarPnZkJ5vo5hUlwn" />
|
|
||||||
<component name="ProjectViewState">
|
|
||||||
<option name="hideEmptyMiddlePackages" value="true" />
|
|
||||||
<option name="showLibraryContents" value="true" />
|
|
||||||
</component>
|
|
||||||
<component name="PropertiesComponent"><![CDATA[{
|
|
||||||
"keyToString": {
|
|
||||||
".NET Launch Settings Profile.BMA.EHR.Leave: https.executor": "Debug",
|
|
||||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
|
||||||
"git-widget-placeholder": "working",
|
|
||||||
"node.js.detected.package.eslint": "true",
|
|
||||||
"node.js.detected.package.tslint": "true",
|
|
||||||
"node.js.selected.package.eslint": "(autodetect)",
|
|
||||||
"node.js.selected.package.tslint": "(autodetect)",
|
|
||||||
"nodejs_package_manager_path": "npm",
|
|
||||||
"settings.editor.selected.configurable": "preferences.lookFeel",
|
|
||||||
"vue.rearranger.settings.migration": "true"
|
|
||||||
},
|
|
||||||
"keyToStringList": {
|
|
||||||
"rider.external.source.directories": [
|
|
||||||
"/Users/suphonchai/Library/Application Support/JetBrains/Rider2024.1/resharper-host/DecompilerCache",
|
|
||||||
"/Users/suphonchai/Library/Application Support/JetBrains/Rider2024.1/resharper-host/SourcesCache",
|
|
||||||
"/Users/suphonchai/Library/Application Support/Symbols/src"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}]]></component>
|
|
||||||
<component name="RunManager" selected=".NET Launch Settings Profile.BMA.EHR.Leave: https">
|
|
||||||
<configuration name="BMA.EHR.CheckInConsumer" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
|
||||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.CheckInConsumer/BMA.EHR.CheckInConsumer.csproj" />
|
|
||||||
<option name="LAUNCH_PROFILE_TFM" value="net8.0" />
|
|
||||||
<option name="LAUNCH_PROFILE_NAME" value="BMA.EHR.CheckInConsumer" />
|
|
||||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
|
||||||
<option name="USE_MONO" value="0" />
|
|
||||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
|
||||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
|
||||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
|
||||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
|
||||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
|
||||||
<method v="2">
|
|
||||||
<option name="Build" />
|
|
||||||
</method>
|
|
||||||
</configuration>
|
|
||||||
<configuration name="BMA.EHR.Command.Service: http" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
|
||||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.Command.Service/BMA.EHR.Command.Service.csproj" />
|
|
||||||
<option name="LAUNCH_PROFILE_TFM" value="net7.0" />
|
|
||||||
<option name="LAUNCH_PROFILE_NAME" value="http" />
|
|
||||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
|
||||||
<option name="USE_MONO" value="0" />
|
|
||||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
|
||||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
|
||||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
|
||||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
|
||||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
|
||||||
<method v="2">
|
|
||||||
<option name="Build" />
|
|
||||||
</method>
|
|
||||||
</configuration>
|
|
||||||
<configuration name="BMA.EHR.Command.Service: https" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
|
||||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.Command.Service/BMA.EHR.Command.Service.csproj" />
|
|
||||||
<option name="LAUNCH_PROFILE_TFM" value="net7.0" />
|
|
||||||
<option name="LAUNCH_PROFILE_NAME" value="https" />
|
|
||||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
|
||||||
<option name="USE_MONO" value="0" />
|
|
||||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
|
||||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
|
||||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
|
||||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
|
||||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
|
||||||
<method v="2">
|
|
||||||
<option name="Build" />
|
|
||||||
</method>
|
|
||||||
</configuration>
|
|
||||||
<configuration name="BMA.EHR.Discipline.Service: http" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
|
||||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.Discipline.Service/BMA.EHR.Discipline.Service.csproj" />
|
|
||||||
<option name="LAUNCH_PROFILE_TFM" value="net7.0" />
|
|
||||||
<option name="LAUNCH_PROFILE_NAME" value="http" />
|
|
||||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
|
||||||
<option name="USE_MONO" value="0" />
|
|
||||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
|
||||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
|
||||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
|
||||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
|
||||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
|
||||||
<method v="2">
|
|
||||||
<option name="Build" />
|
|
||||||
</method>
|
|
||||||
</configuration>
|
|
||||||
<configuration name="BMA.EHR.Discipline.Service: https" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
|
||||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.Discipline.Service/BMA.EHR.Discipline.Service.csproj" />
|
|
||||||
<option name="LAUNCH_PROFILE_TFM" value="net7.0" />
|
|
||||||
<option name="LAUNCH_PROFILE_NAME" value="https" />
|
|
||||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
|
||||||
<option name="USE_MONO" value="0" />
|
|
||||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
|
||||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
|
||||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
|
||||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
|
||||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
|
||||||
<method v="2">
|
|
||||||
<option name="Build" />
|
|
||||||
</method>
|
|
||||||
</configuration>
|
|
||||||
<configuration name="BMA.EHR.Insignia: http" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
|
||||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.Insignia/BMA.EHR.Insignia.csproj" />
|
|
||||||
<option name="LAUNCH_PROFILE_TFM" value="net7.0" />
|
|
||||||
<option name="LAUNCH_PROFILE_NAME" value="http" />
|
|
||||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
|
||||||
<option name="USE_MONO" value="0" />
|
|
||||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
|
||||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
|
||||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
|
||||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
|
||||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
|
||||||
<method v="2">
|
|
||||||
<option name="Build" />
|
|
||||||
</method>
|
|
||||||
</configuration>
|
|
||||||
<configuration name="BMA.EHR.Insignia: https" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
|
||||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.Insignia/BMA.EHR.Insignia.csproj" />
|
|
||||||
<option name="LAUNCH_PROFILE_TFM" value="net7.0" />
|
|
||||||
<option name="LAUNCH_PROFILE_NAME" value="https" />
|
|
||||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
|
||||||
<option name="USE_MONO" value="0" />
|
|
||||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
|
||||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
|
||||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
|
||||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
|
||||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
|
||||||
<method v="2">
|
|
||||||
<option name="Build" />
|
|
||||||
</method>
|
|
||||||
</configuration>
|
|
||||||
<configuration name="BMA.EHR.Leave: http" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
|
||||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.Leave/BMA.EHR.Leave.csproj" />
|
|
||||||
<option name="LAUNCH_PROFILE_TFM" value="net7.0" />
|
|
||||||
<option name="LAUNCH_PROFILE_NAME" value="http" />
|
|
||||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
|
||||||
<option name="USE_MONO" value="0" />
|
|
||||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
|
||||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
|
||||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
|
||||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
|
||||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
|
||||||
<method v="2">
|
|
||||||
<option name="Build" />
|
|
||||||
</method>
|
|
||||||
</configuration>
|
|
||||||
<configuration name="BMA.EHR.Leave: https" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
|
||||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.Leave/BMA.EHR.Leave.csproj" />
|
|
||||||
<option name="LAUNCH_PROFILE_TFM" value="net7.0" />
|
|
||||||
<option name="LAUNCH_PROFILE_NAME" value="https" />
|
|
||||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
|
||||||
<option name="USE_MONO" value="0" />
|
|
||||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
|
||||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
|
||||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
|
||||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
|
||||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
|
||||||
<method v="2">
|
|
||||||
<option name="Build" />
|
|
||||||
</method>
|
|
||||||
</configuration>
|
|
||||||
<configuration name="BMA.EHR.MetaData.Service: http" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
|
||||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.MetaData.Service/BMA.EHR.MetaData.Service.csproj" />
|
|
||||||
<option name="LAUNCH_PROFILE_TFM" value="net7.0" />
|
|
||||||
<option name="LAUNCH_PROFILE_NAME" value="http" />
|
|
||||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
|
||||||
<option name="USE_MONO" value="0" />
|
|
||||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
|
||||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
|
||||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
|
||||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
|
||||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
|
||||||
<method v="2">
|
|
||||||
<option name="Build" />
|
|
||||||
</method>
|
|
||||||
</configuration>
|
|
||||||
<configuration name="BMA.EHR.MetaData.Service: https" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
|
||||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.MetaData.Service/BMA.EHR.MetaData.Service.csproj" />
|
|
||||||
<option name="LAUNCH_PROFILE_TFM" value="net7.0" />
|
|
||||||
<option name="LAUNCH_PROFILE_NAME" value="https" />
|
|
||||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
|
||||||
<option name="USE_MONO" value="0" />
|
|
||||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
|
||||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
|
||||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
|
||||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
|
||||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
|
||||||
<method v="2">
|
|
||||||
<option name="Build" />
|
|
||||||
</method>
|
|
||||||
</configuration>
|
|
||||||
<configuration name="BMA.EHR.OrganizationEmployee.Service: http" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
|
||||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.OrganizationEmployee.Service/BMA.EHR.OrganizationEmployee.Service.csproj" />
|
|
||||||
<option name="LAUNCH_PROFILE_TFM" value="net7.0" />
|
|
||||||
<option name="LAUNCH_PROFILE_NAME" value="http" />
|
|
||||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
|
||||||
<option name="USE_MONO" value="0" />
|
|
||||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
|
||||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
|
||||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
|
||||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
|
||||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
|
||||||
<method v="2">
|
|
||||||
<option name="Build" />
|
|
||||||
</method>
|
|
||||||
</configuration>
|
|
||||||
<configuration name="BMA.EHR.OrganizationEmployee.Service: https" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
|
||||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.OrganizationEmployee.Service/BMA.EHR.OrganizationEmployee.Service.csproj" />
|
|
||||||
<option name="LAUNCH_PROFILE_TFM" value="net7.0" />
|
|
||||||
<option name="LAUNCH_PROFILE_NAME" value="https" />
|
|
||||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
|
||||||
<option name="USE_MONO" value="0" />
|
|
||||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
|
||||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
|
||||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
|
||||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
|
||||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
|
||||||
<method v="2">
|
|
||||||
<option name="Build" />
|
|
||||||
</method>
|
|
||||||
</configuration>
|
|
||||||
<configuration name="BMA.EHR.Placement.Service: http" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
|
||||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.Placement.Service/BMA.EHR.Placement.Service.csproj" />
|
|
||||||
<option name="LAUNCH_PROFILE_TFM" value="net7.0" />
|
|
||||||
<option name="LAUNCH_PROFILE_NAME" value="http" />
|
|
||||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
|
||||||
<option name="USE_MONO" value="0" />
|
|
||||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
|
||||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
|
||||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
|
||||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
|
||||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
|
||||||
<method v="2">
|
|
||||||
<option name="Build" />
|
|
||||||
</method>
|
|
||||||
</configuration>
|
|
||||||
<configuration name="BMA.EHR.Placement.Service: https" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
|
||||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.Placement.Service/BMA.EHR.Placement.Service.csproj" />
|
|
||||||
<option name="LAUNCH_PROFILE_TFM" value="net7.0" />
|
|
||||||
<option name="LAUNCH_PROFILE_NAME" value="https" />
|
|
||||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
|
||||||
<option name="USE_MONO" value="0" />
|
|
||||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
|
||||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
|
||||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
|
||||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
|
||||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
|
||||||
<method v="2">
|
|
||||||
<option name="Build" />
|
|
||||||
</method>
|
|
||||||
</configuration>
|
|
||||||
<configuration name="BMA.EHR.Report.Service: dotnet" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
|
||||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.Report.Service/BMA.EHR.Report.Service.csproj" />
|
|
||||||
<option name="LAUNCH_PROFILE_TFM" value="net6.0" />
|
|
||||||
<option name="LAUNCH_PROFILE_NAME" value="dotnet" />
|
|
||||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
|
||||||
<option name="USE_MONO" value="0" />
|
|
||||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
|
||||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
|
||||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
|
||||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
|
||||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
|
||||||
<method v="2">
|
|
||||||
<option name="Build" />
|
|
||||||
</method>
|
|
||||||
</configuration>
|
|
||||||
<configuration name="BMA.EHR.Report.Service: http" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
|
||||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.Report.Service/BMA.EHR.Report.Service.csproj" />
|
|
||||||
<option name="LAUNCH_PROFILE_TFM" value="net6.0" />
|
|
||||||
<option name="LAUNCH_PROFILE_NAME" value="http" />
|
|
||||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
|
||||||
<option name="USE_MONO" value="0" />
|
|
||||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
|
||||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
|
||||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
|
||||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
|
||||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
|
||||||
<method v="2">
|
|
||||||
<option name="Build" />
|
|
||||||
</method>
|
|
||||||
</configuration>
|
|
||||||
<configuration name="BMA.EHR.Report.Service: https" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
|
||||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.Report.Service/BMA.EHR.Report.Service.csproj" />
|
|
||||||
<option name="LAUNCH_PROFILE_TFM" value="net6.0" />
|
|
||||||
<option name="LAUNCH_PROFILE_NAME" value="https" />
|
|
||||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
|
||||||
<option name="USE_MONO" value="0" />
|
|
||||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
|
||||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
|
||||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
|
||||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
|
||||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
|
||||||
<method v="2">
|
|
||||||
<option name="Build" />
|
|
||||||
</method>
|
|
||||||
</configuration>
|
|
||||||
<configuration name="BMA.EHR.Report.Service: report-designer" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
|
||||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.Report.Service/BMA.EHR.Report.Service.csproj" />
|
|
||||||
<option name="LAUNCH_PROFILE_TFM" value="net6.0" />
|
|
||||||
<option name="LAUNCH_PROFILE_NAME" value="report-designer" />
|
|
||||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
|
||||||
<option name="USE_MONO" value="0" />
|
|
||||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
|
||||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
|
||||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
|
||||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
|
||||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
|
||||||
<method v="2">
|
|
||||||
<option name="Build" />
|
|
||||||
</method>
|
|
||||||
</configuration>
|
|
||||||
<configuration name="BMA.EHR.Retirement.Service: http" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
|
||||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.Retirement.Service/BMA.EHR.Retirement.Service.csproj" />
|
|
||||||
<option name="LAUNCH_PROFILE_TFM" value="net7.0" />
|
|
||||||
<option name="LAUNCH_PROFILE_NAME" value="http" />
|
|
||||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
|
||||||
<option name="USE_MONO" value="0" />
|
|
||||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
|
||||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
|
||||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
|
||||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
|
||||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
|
||||||
<method v="2">
|
|
||||||
<option name="Build" />
|
|
||||||
</method>
|
|
||||||
</configuration>
|
|
||||||
<configuration name="BMA.EHR.Retirement.Service: https" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
|
||||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.Retirement.Service/BMA.EHR.Retirement.Service.csproj" />
|
|
||||||
<option name="LAUNCH_PROFILE_TFM" value="net7.0" />
|
|
||||||
<option name="LAUNCH_PROFILE_NAME" value="https" />
|
|
||||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
|
||||||
<option name="USE_MONO" value="0" />
|
|
||||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
|
||||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
|
||||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
|
||||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
|
||||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
|
||||||
<method v="2">
|
|
||||||
<option name="Build" />
|
|
||||||
</method>
|
|
||||||
</configuration>
|
|
||||||
<configuration name="BMA.EHR.CheckInConsumer/Dockerfile" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
|
|
||||||
<deployment type="dockerfile">
|
|
||||||
<settings>
|
|
||||||
<option name="containerName" value="bma.ehr.checkinconsumer" />
|
|
||||||
<option name="contextFolderPath" value="$PROJECT_DIR$" />
|
|
||||||
<option name="sourceFilePath" value="BMA.EHR.CheckInConsumer/Dockerfile" />
|
|
||||||
</settings>
|
|
||||||
</deployment>
|
|
||||||
<EXTENSION ID="com.jetbrains.rider.docker.debug" isFastModeEnabled="true" isSslEnabled="false" />
|
|
||||||
<method v="2" />
|
|
||||||
</configuration>
|
|
||||||
<configuration name="BMA.EHR.Command.Service/Dockerfile" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
|
|
||||||
<deployment type="dockerfile">
|
|
||||||
<settings>
|
|
||||||
<option name="containerName" value="bma.ehr.command.service" />
|
|
||||||
<option name="contextFolderPath" value="$PROJECT_DIR$" />
|
|
||||||
<option name="publishAllPorts" value="true" />
|
|
||||||
<option name="sourceFilePath" value="BMA.EHR.Command.Service/Dockerfile" />
|
|
||||||
</settings>
|
|
||||||
</deployment>
|
|
||||||
<EXTENSION ID="com.jetbrains.rider.docker.debug" isFastModeEnabled="true" isSslEnabled="true" />
|
|
||||||
<method v="2" />
|
|
||||||
</configuration>
|
|
||||||
<configuration name="BMA.EHR.Insignia/Dockerfile" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
|
|
||||||
<deployment type="dockerfile">
|
|
||||||
<settings>
|
|
||||||
<option name="containerName" value="bma.ehr.insignia" />
|
|
||||||
<option name="contextFolderPath" value="$PROJECT_DIR$" />
|
|
||||||
<option name="publishAllPorts" value="true" />
|
|
||||||
<option name="sourceFilePath" value="BMA.EHR.Insignia/Dockerfile" />
|
|
||||||
</settings>
|
|
||||||
</deployment>
|
|
||||||
<EXTENSION ID="com.jetbrains.rider.docker.debug" isFastModeEnabled="true" isSslEnabled="true" />
|
|
||||||
<method v="2" />
|
|
||||||
</configuration>
|
|
||||||
<configuration name="BMA.EHR.Leave/Dockerfile" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
|
|
||||||
<deployment type="dockerfile">
|
|
||||||
<settings>
|
|
||||||
<option name="containerName" value="bma.ehr.leave" />
|
|
||||||
<option name="contextFolderPath" value="$PROJECT_DIR$" />
|
|
||||||
<option name="publishAllPorts" value="true" />
|
|
||||||
<option name="sourceFilePath" value="BMA.EHR.Leave/Dockerfile" />
|
|
||||||
</settings>
|
|
||||||
</deployment>
|
|
||||||
<EXTENSION ID="com.jetbrains.rider.docker.debug" isFastModeEnabled="true" isSslEnabled="true" />
|
|
||||||
<method v="2" />
|
|
||||||
</configuration>
|
|
||||||
<configuration name="BMA.EHR.MetaData.Service/Dockerfile" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
|
|
||||||
<deployment type="dockerfile">
|
|
||||||
<settings>
|
|
||||||
<option name="containerName" value="bma.ehr.metadata.service" />
|
|
||||||
<option name="contextFolderPath" value="$PROJECT_DIR$" />
|
|
||||||
<option name="publishAllPorts" value="true" />
|
|
||||||
<option name="sourceFilePath" value="BMA.EHR.MetaData.Service/Dockerfile" />
|
|
||||||
</settings>
|
|
||||||
</deployment>
|
|
||||||
<EXTENSION ID="com.jetbrains.rider.docker.debug" isFastModeEnabled="true" isSslEnabled="true" />
|
|
||||||
<method v="2" />
|
|
||||||
</configuration>
|
|
||||||
<configuration name="BMA.EHR.OrganizationEmployee.Service/Dockerfile" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
|
|
||||||
<deployment type="dockerfile">
|
|
||||||
<settings>
|
|
||||||
<option name="containerName" value="bma.ehr.organizationemployee.service" />
|
|
||||||
<option name="contextFolderPath" value="$PROJECT_DIR$" />
|
|
||||||
<option name="publishAllPorts" value="true" />
|
|
||||||
<option name="sourceFilePath" value="BMA.EHR.OrganizationEmployee.Service/Dockerfile" />
|
|
||||||
</settings>
|
|
||||||
</deployment>
|
|
||||||
<EXTENSION ID="com.jetbrains.rider.docker.debug" isFastModeEnabled="true" isSslEnabled="true" />
|
|
||||||
<method v="2" />
|
|
||||||
</configuration>
|
|
||||||
<configuration name="BMA.EHR.Placement.Service/Dockerfile" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
|
|
||||||
<deployment type="dockerfile">
|
|
||||||
<settings>
|
|
||||||
<option name="containerName" value="bma.ehr.placement.service" />
|
|
||||||
<option name="contextFolderPath" value="$PROJECT_DIR$" />
|
|
||||||
<option name="publishAllPorts" value="true" />
|
|
||||||
<option name="sourceFilePath" value="BMA.EHR.Placement.Service/Dockerfile" />
|
|
||||||
</settings>
|
|
||||||
</deployment>
|
|
||||||
<EXTENSION ID="com.jetbrains.rider.docker.debug" isFastModeEnabled="true" isSslEnabled="true" />
|
|
||||||
<method v="2" />
|
|
||||||
</configuration>
|
|
||||||
<configuration name="BMA.EHR.Report.Service/Dockerfile" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
|
|
||||||
<deployment type="dockerfile">
|
|
||||||
<settings>
|
|
||||||
<option name="containerName" value="bma.ehr.report.service" />
|
|
||||||
<option name="contextFolderPath" value="$PROJECT_DIR$" />
|
|
||||||
<option name="publishAllPorts" value="true" />
|
|
||||||
<option name="sourceFilePath" value="BMA.EHR.Report.Service/Dockerfile" />
|
|
||||||
</settings>
|
|
||||||
</deployment>
|
|
||||||
<EXTENSION ID="com.jetbrains.rider.docker.debug" isFastModeEnabled="true" isSslEnabled="true" />
|
|
||||||
<method v="2" />
|
|
||||||
</configuration>
|
|
||||||
<configuration name="BMA.EHR.Retirement.Service/Dockerfile" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
|
|
||||||
<deployment type="dockerfile">
|
|
||||||
<settings>
|
|
||||||
<option name="containerName" value="bma.ehr.retirement.service" />
|
|
||||||
<option name="contextFolderPath" value="$PROJECT_DIR$" />
|
|
||||||
<option name="publishAllPorts" value="true" />
|
|
||||||
<option name="sourceFilePath" value="BMA.EHR.Retirement.Service/Dockerfile" />
|
|
||||||
</settings>
|
|
||||||
</deployment>
|
|
||||||
<EXTENSION ID="com.jetbrains.rider.docker.debug" isFastModeEnabled="true" isSslEnabled="true" />
|
|
||||||
<method v="2" />
|
|
||||||
</configuration>
|
|
||||||
<configuration default="true" type="docker-deploy" factoryName="dockerfile" temporary="true">
|
|
||||||
<deployment type="dockerfile" />
|
|
||||||
<method v="2" />
|
|
||||||
</configuration>
|
|
||||||
</component>
|
|
||||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
|
||||||
<component name="TaskManager">
|
|
||||||
<task active="true" id="Default" summary="Default task">
|
|
||||||
<changelist id="85fddeb6-44fd-40a4-864f-89daec07db75" name="Changes" comment="" />
|
|
||||||
<created>1724638841465</created>
|
|
||||||
<option name="number" value="Default" />
|
|
||||||
<option name="presentableId" value="Default" />
|
|
||||||
<updated>1724638841465</updated>
|
|
||||||
<workItem from="1724638842250" duration="4068000" />
|
|
||||||
</task>
|
|
||||||
<servers />
|
|
||||||
</component>
|
|
||||||
<component name="TypeScriptGeneratedFilesManager">
|
|
||||||
<option name="version" value="3" />
|
|
||||||
</component>
|
|
||||||
<component name="UnityProjectConfiguration" hasMinimizedUI="false" />
|
|
||||||
<component name="VcsManagerConfiguration">
|
|
||||||
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="true" />
|
|
||||||
</component>
|
|
||||||
<component name="XDebuggerManager">
|
|
||||||
<breakpoint-manager>
|
|
||||||
<breakpoints>
|
|
||||||
<line-breakpoint enabled="true" type="DotNet Breakpoints">
|
|
||||||
<url>file://$PROJECT_DIR$/BMA.EHR.Leave/Controllers/LeaveController.cs</url>
|
|
||||||
<line>1152</line>
|
|
||||||
<properties documentPath="$PROJECT_DIR$/BMA.EHR.Leave/Controllers/LeaveController.cs" containingFunctionPresentation="Method 'GetTimeRecordAsync'">
|
|
||||||
<startOffsets>
|
|
||||||
<option value="52378" />
|
|
||||||
</startOffsets>
|
|
||||||
<endOffsets>
|
|
||||||
<option value="52431" />
|
|
||||||
</endOffsets>
|
|
||||||
</properties>
|
|
||||||
<option name="timeStamp" value="1" />
|
|
||||||
</line-breakpoint>
|
|
||||||
</breakpoints>
|
|
||||||
</breakpoint-manager>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
29
.vscode/launch.json
vendored
29
.vscode/launch.json
vendored
|
|
@ -10,9 +10,34 @@
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"preLaunchTask": "build",
|
"preLaunchTask": "build",
|
||||||
// If you have changed target frameworks, make sure to update the program path.
|
// If you have changed target frameworks, make sure to update the program path.
|
||||||
"program": "${workspaceFolder}/BMA.EHR.Leave.Service/bin/Debug/net7.0/BMA.EHR.Leave.Service.dll",
|
"program": "${workspaceFolder}/BMA.EHR.Leave/bin/Debug/net7.0/BMA.EHR.Leave.dll",
|
||||||
"args": [],
|
"args": [],
|
||||||
"cwd": "${workspaceFolder}/BMA.EHR.Leave.Service",
|
"cwd": "${workspaceFolder}/BMA.EHR.Leave",
|
||||||
|
"stopAtEntry": false,
|
||||||
|
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
|
||||||
|
"serverReadyAction": {
|
||||||
|
"action": "openExternally",
|
||||||
|
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
|
||||||
|
},
|
||||||
|
"env": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
},
|
||||||
|
"sourceFileMap": {
|
||||||
|
"/Views": "${workspaceFolder}/Views"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// Use IntelliSense to find out which attributes exist for C# debugging
|
||||||
|
// Use hover for the description of the existing attributes
|
||||||
|
// For further information visit https://github.com/dotnet/vscode-csharp/blob/main/debugger-launchjson.md.
|
||||||
|
"name": ".NET Core Launch (web) - Insignia",
|
||||||
|
"type": "coreclr",
|
||||||
|
"request": "launch",
|
||||||
|
"preLaunchTask": "build",
|
||||||
|
// If you have changed target frameworks, make sure to update the program path.
|
||||||
|
"program": "${workspaceFolder}/BMA.EHR.Insignia/bin/Debug/net7.0/BMA.EHR.Insignia.dll",
|
||||||
|
"args": [],
|
||||||
|
"cwd": "${workspaceFolder}/BMA.EHR.Insignia",
|
||||||
"stopAtEntry": false,
|
"stopAtEntry": false,
|
||||||
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
|
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
|
||||||
"serverReadyAction": {
|
"serverReadyAction": {
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ namespace BMA.EHR.Application
|
||||||
services.AddTransient<CommandStatusRepository>();
|
services.AddTransient<CommandStatusRepository>();
|
||||||
services.AddTransient<InsigniaPeriodsRepository>();
|
services.AddTransient<InsigniaPeriodsRepository>();
|
||||||
services.AddTransient<RetirementRepository>();
|
services.AddTransient<RetirementRepository>();
|
||||||
|
services.AddTransient<RetirementEmployeeRepository>();
|
||||||
services.AddTransient<UserProfileRepository>();
|
services.AddTransient<UserProfileRepository>();
|
||||||
services.AddTransient<OrganizationCommonRepository>();
|
services.AddTransient<OrganizationCommonRepository>();
|
||||||
services.AddTransient<InboxRepository>();
|
services.AddTransient<InboxRepository>();
|
||||||
|
|
@ -52,12 +53,16 @@ namespace BMA.EHR.Application
|
||||||
services.AddTransient<UserDutyTimeRepository>();
|
services.AddTransient<UserDutyTimeRepository>();
|
||||||
services.AddTransient<AdditionalCheckRequestRepository>();
|
services.AddTransient<AdditionalCheckRequestRepository>();
|
||||||
services.AddTransient<UserCalendarRepository>();
|
services.AddTransient<UserCalendarRepository>();
|
||||||
|
services.AddTransient<CheckInJobStatusRepository>();
|
||||||
|
|
||||||
services.AddTransient<LeaveTypeRepository>();
|
services.AddTransient<LeaveTypeRepository>();
|
||||||
services.AddTransient<LeaveRequestRepository>();
|
services.AddTransient<LeaveRequestRepository>();
|
||||||
|
services.AddTransient<LeaveBeginningRepository>();
|
||||||
|
|
||||||
services.AddTransient<MinIOLeaveService>();
|
services.AddTransient<MinIOLeaveService>();
|
||||||
|
|
||||||
|
services.AddTransient<LeaveProcessJobStatusRepository>();
|
||||||
|
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,9 @@
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||||
|
<NoWarn>$(NoWarn);$(WarningsNotAsErrors)</NoWarn>
|
||||||
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -99,11 +99,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
PositionLevel = p.posLevelName == null ? "" : p.posLevelName,
|
PositionLevel = p.posLevelName == null ? "" : p.posLevelName,
|
||||||
PositionType = p.posTypeName == null ? "" : p.posTypeName,
|
PositionType = p.posTypeName == null ? "" : p.posTypeName,
|
||||||
PositionNumber = p.posMasterNo == null ? "" :
|
PositionNumber = p.posMasterNo == null ? "" :
|
||||||
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 4 ? $"{p.child4ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 3 ? $"{p.child3ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 2 ? $"{p.child2ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 1 ? $"{p.child1ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
|
p.node == 0 ? $"{p.rootShortName} {p.posMasterNo}".ToThaiNumber() : "",
|
||||||
Salary = p.Amount == null ? "0" : p.Amount.Value.ToNumericNoDecimalText().ToThaiNumber().ToThaiNumber(),
|
Salary = p.Amount == null ? "0" : p.Amount.Value.ToNumericNoDecimalText().ToThaiNumber().ToThaiNumber(),
|
||||||
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
||||||
ExamNumber = p.ExamNumber == null ? "0" : p.ExamNumber.Value.ToString().ToThaiNumber(),
|
ExamNumber = p.ExamNumber == null ? "0" : p.ExamNumber.Value.ToString().ToThaiNumber(),
|
||||||
|
|
@ -152,11 +152,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
PositionLevel = p.posLevelName == null ? "" : p.posLevelName,
|
PositionLevel = p.posLevelName == null ? "" : p.posLevelName,
|
||||||
PositionType = p.posTypeName == null ? "" : p.posTypeName,
|
PositionType = p.posTypeName == null ? "" : p.posTypeName,
|
||||||
PositionNumber = p.posMasterNo == null ? "" :
|
PositionNumber = p.posMasterNo == null ? "" :
|
||||||
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 4 ? $"{p.child4ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 3 ? $"{p.child3ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 2 ? $"{p.child2ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 1 ? $"{p.child1ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
|
p.node == 0 ? $"{p.rootShortName} {p.posMasterNo}".ToThaiNumber() : "",
|
||||||
Salary = p.Amount == null ? "" : p.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
Salary = p.Amount == null ? "" : p.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
||||||
ExamNumber = p.ExamNumber == null ? "" : p.ExamNumber.Value.ToString().ToThaiNumber(),
|
ExamNumber = p.ExamNumber == null ? "" : p.ExamNumber.Value.ToString().ToThaiNumber(),
|
||||||
|
|
@ -206,11 +206,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
OldPositionLevel = p.posLevelNameOld == null ? "" : p.posLevelNameOld,
|
OldPositionLevel = p.posLevelNameOld == null ? "" : p.posLevelNameOld,
|
||||||
OldPositionType = p.posTypeNameOld == null ? "" : p.posTypeNameOld,
|
OldPositionType = p.posTypeNameOld == null ? "" : p.posTypeNameOld,
|
||||||
OldPositionNumber = p.posMasterNoOld == null ? "" :
|
OldPositionNumber = p.posMasterNoOld == null ? "" :
|
||||||
p.nodeOld == "4" ? $"{p.child4ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
|
p.nodeOld == "4" ? $"{p.child4ShortNameOld} {p.posMasterNoOld}".ToThaiNumber() :
|
||||||
p.nodeOld == "3" ? $"{p.child3ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
|
p.nodeOld == "3" ? $"{p.child3ShortNameOld} {p.posMasterNoOld}".ToThaiNumber() :
|
||||||
p.nodeOld == "2" ? $"{p.child2ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
|
p.nodeOld == "2" ? $"{p.child2ShortNameOld} {p.posMasterNoOld}".ToThaiNumber() :
|
||||||
p.nodeOld == "1" ? $"{p.child1ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
|
p.nodeOld == "1" ? $"{p.child1ShortNameOld} {p.posMasterNoOld}".ToThaiNumber() :
|
||||||
p.nodeOld == "0" ? $"{p.rootShortNameOld}{p.posMasterNoOld}".ToThaiNumber() : "",
|
p.nodeOld == "0" ? $"{p.rootShortNameOld} {p.posMasterNoOld}".ToThaiNumber() : "",
|
||||||
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
|
|
||||||
NewOc = p.root == null ? "" : p.root,
|
NewOc = p.root == null ? "" : p.root,
|
||||||
|
|
@ -218,11 +218,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
|
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
|
||||||
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
|
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
|
||||||
NewPositionNumber = p.posMasterNo == null ? "" :
|
NewPositionNumber = p.posMasterNo == null ? "" :
|
||||||
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 4 ? $"{p.child4ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 3 ? $"{p.child3ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 2 ? $"{p.child2ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 1 ? $"{p.child1ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
|
p.node == 0 ? $"{p.rootShortName} {p.posMasterNo}".ToThaiNumber() : "",
|
||||||
NewSalary = p.Amount == null ? "" : p.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
NewSalary = p.Amount == null ? "" : p.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
||||||
RemarkHorizontal = p.RemarkHorizontal,
|
RemarkHorizontal = p.RemarkHorizontal,
|
||||||
|
|
@ -269,22 +269,22 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
OldPositionLevel = p.posLevelNameOld == null ? "" : p.posLevelNameOld,
|
OldPositionLevel = p.posLevelNameOld == null ? "" : p.posLevelNameOld,
|
||||||
OldPositionType = p.posTypeNameOld == null ? "" : p.posTypeNameOld,
|
OldPositionType = p.posTypeNameOld == null ? "" : p.posTypeNameOld,
|
||||||
OldPositionNumber = p.posMasterNoOld == null ? "" :
|
OldPositionNumber = p.posMasterNoOld == null ? "" :
|
||||||
p.nodeOld == "4" ? $"{p.child4ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
|
p.nodeOld == "4" ? $"{p.child4ShortNameOld} {p.posMasterNoOld}".ToThaiNumber() :
|
||||||
p.nodeOld == "3" ? $"{p.child3ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
|
p.nodeOld == "3" ? $"{p.child3ShortNameOld} {p.posMasterNoOld}".ToThaiNumber() :
|
||||||
p.nodeOld == "2" ? $"{p.child2ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
|
p.nodeOld == "2" ? $"{p.child2ShortNameOld} {p.posMasterNoOld}".ToThaiNumber() :
|
||||||
p.nodeOld == "1" ? $"{p.child1ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
|
p.nodeOld == "1" ? $"{p.child1ShortNameOld} {p.posMasterNoOld}".ToThaiNumber() :
|
||||||
p.nodeOld == "0" ? $"{p.rootShortNameOld}{p.posMasterNoOld}".ToThaiNumber() : "",
|
p.nodeOld == "0" ? $"{p.rootShortNameOld} {p.posMasterNoOld}".ToThaiNumber() : "",
|
||||||
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
NewOc = p.root == null ? "" : p.root,
|
NewOc = p.root == null ? "" : p.root,
|
||||||
NewPositionName = p.positionName == null ? "" : p.positionName,
|
NewPositionName = p.positionName == null ? "" : p.positionName,
|
||||||
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
|
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
|
||||||
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
|
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
|
||||||
NewPositionNumber = p.posMasterNo == null ? "" :
|
NewPositionNumber = p.posMasterNo == null ? "" :
|
||||||
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 4 ? $"{p.child4ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 3 ? $"{p.child3ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 2 ? $"{p.child2ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 1 ? $"{p.child1ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
|
p.node == 0 ? $"{p.rootShortName} {p.posMasterNo}".ToThaiNumber() : "",
|
||||||
NewSalary = p.Amount == null ? "" : p.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
NewSalary = p.Amount == null ? "" : p.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber()
|
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber()
|
||||||
})
|
})
|
||||||
|
|
@ -329,22 +329,22 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
OldPositionLevel = p.posLevelNameOld == null ? "" : p.posLevelNameOld,
|
OldPositionLevel = p.posLevelNameOld == null ? "" : p.posLevelNameOld,
|
||||||
OldPositionType = p.posTypeNameOld == null ? "" : p.posTypeNameOld,
|
OldPositionType = p.posTypeNameOld == null ? "" : p.posTypeNameOld,
|
||||||
OldPositionNumber = p.posMasterNoOld == null ? "" :
|
OldPositionNumber = p.posMasterNoOld == null ? "" :
|
||||||
p.nodeOld == "4" ? $"{p.child4ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
|
p.nodeOld == "4" ? $"{p.child4ShortNameOld} {p.posMasterNoOld}".ToThaiNumber() :
|
||||||
p.nodeOld == "3" ? $"{p.child3ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
|
p.nodeOld == "3" ? $"{p.child3ShortNameOld} {p.posMasterNoOld}".ToThaiNumber() :
|
||||||
p.nodeOld == "2" ? $"{p.child2ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
|
p.nodeOld == "2" ? $"{p.child2ShortNameOld} {p.posMasterNoOld}".ToThaiNumber() :
|
||||||
p.nodeOld == "1" ? $"{p.child1ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
|
p.nodeOld == "1" ? $"{p.child1ShortNameOld} {p.posMasterNoOld}".ToThaiNumber() :
|
||||||
p.nodeOld == "0" ? $"{p.rootShortNameOld}{p.posMasterNoOld}".ToThaiNumber() : "",
|
p.nodeOld == "0" ? $"{p.rootShortNameOld} {p.posMasterNoOld}".ToThaiNumber() : "",
|
||||||
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
NewOc = p.root == null ? "" : p.root,
|
NewOc = p.root == null ? "" : p.root,
|
||||||
NewPositionName = p.positionName == null ? "" : p.positionName,
|
NewPositionName = p.positionName == null ? "" : p.positionName,
|
||||||
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
|
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
|
||||||
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
|
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
|
||||||
NewPositionNumber = p.posMasterNo == null ? "" :
|
NewPositionNumber = p.posMasterNo == null ? "" :
|
||||||
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 4 ? $"{p.child4ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 3 ? $"{p.child3ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 2 ? $"{p.child2ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 1 ? $"{p.child1ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
|
p.node == 0 ? $"{p.rootShortName} {p.posMasterNo}".ToThaiNumber() : "",
|
||||||
NewSalary = p.Amount == null ? "" : p.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
NewSalary = p.Amount == null ? "" : p.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber()
|
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber()
|
||||||
})
|
})
|
||||||
|
|
@ -407,11 +407,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
|
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
|
||||||
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
|
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
|
||||||
NewPositionNumber = p.posMasterNo == null ? "" :
|
NewPositionNumber = p.posMasterNo == null ? "" :
|
||||||
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 4 ? $"{p.child4ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 3 ? $"{p.child3ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 2 ? $"{p.child2ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 1 ? $"{p.child1ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
|
p.node == 0 ? $"{p.rootShortName} {p.posMasterNo}".ToThaiNumber() : "",
|
||||||
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
||||||
Reason = p.Reason == null ? "-" : p.Reason,
|
Reason = p.Reason == null ? "-" : p.Reason,
|
||||||
|
|
@ -477,11 +477,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
|
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
|
||||||
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
|
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
|
||||||
NewPositionNumber = p.posMasterNo == null ? "" :
|
NewPositionNumber = p.posMasterNo == null ? "" :
|
||||||
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 4 ? $"{p.child4ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 3 ? $"{p.child3ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 2 ? $"{p.child2ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 1 ? $"{p.child1ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
|
p.node == 0 ? $"{p.rootShortName} {p.posMasterNo}".ToThaiNumber() : "",
|
||||||
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
||||||
Reason = p.Reason == null ? "-" : p.Reason,
|
Reason = p.Reason == null ? "-" : p.Reason,
|
||||||
|
|
@ -750,11 +750,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
|
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
|
||||||
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
|
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
|
||||||
NewPositionNumber = p.posMasterNo == null ? "" :
|
NewPositionNumber = p.posMasterNo == null ? "" :
|
||||||
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 4 ? $"{p.child4ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 3 ? $"{p.child3ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 2 ? $"{p.child2ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 1 ? $"{p.child1ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
|
p.node == 0 ? $"{p.rootShortName} {p.posMasterNo}".ToThaiNumber() : "",
|
||||||
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
||||||
Reason = p.Reason == null ? "-" : p.Reason,
|
Reason = p.Reason == null ? "-" : p.Reason,
|
||||||
|
|
@ -1173,11 +1173,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName.ToThaiNumber(),
|
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName.ToThaiNumber(),
|
||||||
// NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
|
// NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
|
||||||
NewPositionNumber = p.posMasterNo == null ? "" :
|
NewPositionNumber = p.posMasterNo == null ? "" :
|
||||||
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 4 ? $"{p.child4ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 3 ? $"{p.child3ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 2 ? $"{p.child2ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 1 ? $"{p.child1ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
|
p.node == 0 ? $"{p.rootShortName} {p.posMasterNo}".ToThaiNumber() : "",
|
||||||
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
Reason = p.Reason == null ? "-" : p.Reason,
|
Reason = p.Reason == null ? "-" : p.Reason,
|
||||||
})
|
})
|
||||||
|
|
@ -1307,11 +1307,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
|
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
|
||||||
// NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
|
// NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
|
||||||
NewPositionNumber = p.posMasterNo == null ? "" :
|
NewPositionNumber = p.posMasterNo == null ? "" :
|
||||||
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 4 ? $"{p.child4ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 3 ? $"{p.child3ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 2 ? $"{p.child2ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
|
p.node == 1 ? $"{p.child1ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||||
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
|
p.node == 0 ? $"{p.rootShortName} {p.posMasterNo}".ToThaiNumber() : "",
|
||||||
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
Reason = p.Reason == null ? "-" : p.Reason,
|
Reason = p.Reason == null ? "-" : p.Reason,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -919,7 +919,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
var res = await client.SendAsync(req);
|
var res = await client.SendAsync(req);
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -934,7 +934,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var _client = new HttpClient())
|
using (var _client = new HttpClient())
|
||||||
{
|
{
|
||||||
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
_client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
_client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Get, _apiUrl);
|
var _req = new HttpRequestMessage(HttpMethod.Get, _apiUrl);
|
||||||
var _res = await _client.SendAsync(_req);
|
var _res = await _client.SendAsync(_req);
|
||||||
var _result = await _res.Content.ReadAsStringAsync();
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -986,7 +986,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
var res = await client.SendAsync(req);
|
var res = await client.SendAsync(req);
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -1001,7 +1001,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var _client = new HttpClient())
|
using (var _client = new HttpClient())
|
||||||
{
|
{
|
||||||
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
_client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
_client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Get, _apiUrl);
|
var _req = new HttpRequestMessage(HttpMethod.Get, _apiUrl);
|
||||||
var _res = await _client.SendAsync(_req);
|
var _res = await _client.SendAsync(_req);
|
||||||
var _result = await _res.Content.ReadAsStringAsync();
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -1423,7 +1423,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
var res = await client.SendAsync(req);
|
var res = await client.SendAsync(req);
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -1440,7 +1440,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var _client = new HttpClient())
|
using (var _client = new HttpClient())
|
||||||
{
|
{
|
||||||
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
_client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
_client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Get, _apiUrl);
|
var _req = new HttpRequestMessage(HttpMethod.Get, _apiUrl);
|
||||||
var _res = await _client.SendAsync(_req);
|
var _res = await _client.SendAsync(_req);
|
||||||
var _result = await _res.Content.ReadAsStringAsync();
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -1534,7 +1534,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
var res = await client.SendAsync(req);
|
var res = await client.SendAsync(req);
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -1550,7 +1550,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var _client = new HttpClient())
|
using (var _client = new HttpClient())
|
||||||
{
|
{
|
||||||
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
_client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
_client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Get, _apiUrl);
|
var _req = new HttpRequestMessage(HttpMethod.Get, _apiUrl);
|
||||||
var _res = await _client.SendAsync(_req);
|
var _res = await _client.SendAsync(_req);
|
||||||
var _result = await _res.Content.ReadAsStringAsync();
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -1603,7 +1603,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
var res = await client.SendAsync(req);
|
var res = await client.SendAsync(req);
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -1832,7 +1832,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
var res = await client.SendAsync(req);
|
var res = await client.SendAsync(req);
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -1849,7 +1849,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var _client = new HttpClient())
|
using (var _client = new HttpClient())
|
||||||
{
|
{
|
||||||
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
_client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
_client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Get, _apiUrl);
|
var _req = new HttpRequestMessage(HttpMethod.Get, _apiUrl);
|
||||||
var _res = await _client.SendAsync(_req);
|
var _res = await _client.SendAsync(_req);
|
||||||
var _result = await _res.Content.ReadAsStringAsync();
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -1905,7 +1905,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
var res = await client.SendAsync(req);
|
var res = await client.SendAsync(req);
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -1922,7 +1922,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var _client = new HttpClient())
|
using (var _client = new HttpClient())
|
||||||
{
|
{
|
||||||
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
_client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
_client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Get, _apiUrl);
|
var _req = new HttpRequestMessage(HttpMethod.Get, _apiUrl);
|
||||||
var _res = await _client.SendAsync(_req);
|
var _res = await _client.SendAsync(_req);
|
||||||
var _result = await _res.Content.ReadAsStringAsync();
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -1978,7 +1978,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
var res = await client.SendAsync(req);
|
var res = await client.SendAsync(req);
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -1995,7 +1995,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var _client = new HttpClient())
|
using (var _client = new HttpClient())
|
||||||
{
|
{
|
||||||
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
_client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
_client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Get, _apiUrl);
|
var _req = new HttpRequestMessage(HttpMethod.Get, _apiUrl);
|
||||||
var _res = await _client.SendAsync(_req);
|
var _res = await _client.SendAsync(_req);
|
||||||
var _result = await _res.Content.ReadAsStringAsync();
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -2051,7 +2051,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
var res = await client.SendAsync(req);
|
var res = await client.SendAsync(req);
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -2068,7 +2068,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var _client = new HttpClient())
|
using (var _client = new HttpClient())
|
||||||
{
|
{
|
||||||
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
_client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
_client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Get, _apiUrl);
|
var _req = new HttpRequestMessage(HttpMethod.Get, _apiUrl);
|
||||||
var _res = await _client.SendAsync(_req);
|
var _res = await _client.SendAsync(_req);
|
||||||
var _result = await _res.Content.ReadAsStringAsync();
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -2124,7 +2124,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
var res = await client.SendAsync(req);
|
var res = await client.SendAsync(req);
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -2141,7 +2141,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var _client = new HttpClient())
|
using (var _client = new HttpClient())
|
||||||
{
|
{
|
||||||
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
_client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
_client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Get, _apiUrl);
|
var _req = new HttpRequestMessage(HttpMethod.Get, _apiUrl);
|
||||||
var _res = await _client.SendAsync(_req);
|
var _res = await _client.SendAsync(_req);
|
||||||
var _result = await _res.Content.ReadAsStringAsync();
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -2197,7 +2197,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
var res = await client.SendAsync(req);
|
var res = await client.SendAsync(req);
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -2214,7 +2214,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var _client = new HttpClient())
|
using (var _client = new HttpClient())
|
||||||
{
|
{
|
||||||
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
_client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
_client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Get, _apiUrl);
|
var _req = new HttpRequestMessage(HttpMethod.Get, _apiUrl);
|
||||||
var _res = await _client.SendAsync(_req);
|
var _res = await _client.SendAsync(_req);
|
||||||
var _result = await _res.Content.ReadAsStringAsync();
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -2270,7 +2270,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
var res = await client.SendAsync(req);
|
var res = await client.SendAsync(req);
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -2287,7 +2287,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var _client = new HttpClient())
|
using (var _client = new HttpClient())
|
||||||
{
|
{
|
||||||
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
_client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
_client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Get, _apiUrl);
|
var _req = new HttpRequestMessage(HttpMethod.Get, _apiUrl);
|
||||||
var _res = await _client.SendAsync(_req);
|
var _res = await _client.SendAsync(_req);
|
||||||
var _result = await _res.Content.ReadAsStringAsync();
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -2340,7 +2340,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
var res = await client.SendAsync(req);
|
var res = await client.SendAsync(req);
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -2355,7 +2355,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var _client = new HttpClient())
|
using (var _client = new HttpClient())
|
||||||
{
|
{
|
||||||
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
_client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
_client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Get, _apiUrl);
|
var _req = new HttpRequestMessage(HttpMethod.Get, _apiUrl);
|
||||||
var _res = await _client.SendAsync(_req);
|
var _res = await _client.SendAsync(_req);
|
||||||
var _result = await _res.Content.ReadAsStringAsync();
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -2409,7 +2409,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
var res = await client.SendAsync(req);
|
var res = await client.SendAsync(req);
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -2462,7 +2462,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
var res = await client.SendAsync(req);
|
var res = await client.SendAsync(req);
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -2515,7 +2515,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
var res = await client.SendAsync(req);
|
var res = await client.SendAsync(req);
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -2568,7 +2568,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
var res = await client.SendAsync(req);
|
var res = await client.SendAsync(req);
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -2621,7 +2621,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
var res = await client.SendAsync(req);
|
var res = await client.SendAsync(req);
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -2673,7 +2673,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
var res = await client.SendAsync(req);
|
var res = await client.SendAsync(req);
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -2725,7 +2725,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
var res = await client.SendAsync(req);
|
var res = await client.SendAsync(req);
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -2994,7 +2994,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrl, new
|
var _res = await client.PostAsJsonAsync(apiUrl, new
|
||||||
{
|
{
|
||||||
|
|
@ -3046,7 +3046,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
foreach (var edu in placementProfile.PlacementEducations)
|
foreach (var edu in placementProfile.PlacementEducations)
|
||||||
{
|
{
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlEdu, new
|
var _res = await client.PostAsJsonAsync(apiUrlEdu, new
|
||||||
|
|
@ -3083,7 +3083,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
foreach (var cer in placementProfile.PlacementCertificates)
|
foreach (var cer in placementProfile.PlacementCertificates)
|
||||||
{
|
{
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlCer, new
|
var _res = await client.PostAsJsonAsync(apiUrlCer, new
|
||||||
|
|
@ -3104,7 +3104,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
||||||
{
|
{
|
||||||
profileId = profileId,
|
profileId = profileId,
|
||||||
|
|
@ -3113,11 +3113,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
positionSalaryAmount = placementProfile.PositionSalaryAmount,
|
positionSalaryAmount = placementProfile.PositionSalaryAmount,
|
||||||
mouthSalaryAmount = placementProfile.MouthSalaryAmount,
|
mouthSalaryAmount = placementProfile.MouthSalaryAmount,
|
||||||
posNo = placementProfile.posMasterNo == null ? "" :
|
posNo = placementProfile.posMasterNo == null ? "" :
|
||||||
placementProfile.node == 4 ? $"{placementProfile.child4ShortName}{placementProfile.posMasterNo}" :
|
placementProfile.node == 4 ? $"{placementProfile.child4ShortName} {placementProfile.posMasterNo}" :
|
||||||
placementProfile.node == 3 ? $"{placementProfile.child3ShortName}{placementProfile.posMasterNo}" :
|
placementProfile.node == 3 ? $"{placementProfile.child3ShortName} {placementProfile.posMasterNo}" :
|
||||||
placementProfile.node == 2 ? $"{placementProfile.child2ShortName}{placementProfile.posMasterNo}" :
|
placementProfile.node == 2 ? $"{placementProfile.child2ShortName} {placementProfile.posMasterNo}" :
|
||||||
placementProfile.node == 1 ? $"{placementProfile.child1ShortName}{placementProfile.posMasterNo}" :
|
placementProfile.node == 1 ? $"{placementProfile.child1ShortName} {placementProfile.posMasterNo}" :
|
||||||
placementProfile.node == 0 ? $"{placementProfile.rootShortName}{placementProfile.posMasterNo}" : "",
|
placementProfile.node == 0 ? $"{placementProfile.rootShortName} {placementProfile.posMasterNo}" : "",
|
||||||
position = placementProfile.positionName == null ? string.Empty : placementProfile.positionName,
|
position = placementProfile.positionName == null ? string.Empty : placementProfile.positionName,
|
||||||
positionLine = string.Empty,
|
positionLine = string.Empty,
|
||||||
positionPathSide = string.Empty,
|
positionPathSide = string.Empty,
|
||||||
|
|
@ -3135,7 +3135,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlOrg);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlOrg);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||||
{
|
{
|
||||||
|
|
@ -3287,7 +3287,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
||||||
{
|
{
|
||||||
|
|
@ -3297,11 +3297,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
positionSalaryAmount = recv.PositionSalaryAmount,
|
positionSalaryAmount = recv.PositionSalaryAmount,
|
||||||
mouthSalaryAmount = recv.MouthSalaryAmount,
|
mouthSalaryAmount = recv.MouthSalaryAmount,
|
||||||
posNo = placementProfile.posMasterNo == null ? "" :
|
posNo = placementProfile.posMasterNo == null ? "" :
|
||||||
placementProfile.node == 4 ? $"{placementProfile.child4ShortName}{placementProfile.posMasterNo}" :
|
placementProfile.node == 4 ? $"{placementProfile.child4ShortName} {placementProfile.posMasterNo}" :
|
||||||
placementProfile.node == 3 ? $"{placementProfile.child3ShortName}{placementProfile.posMasterNo}" :
|
placementProfile.node == 3 ? $"{placementProfile.child3ShortName} {placementProfile.posMasterNo}" :
|
||||||
placementProfile.node == 2 ? $"{placementProfile.child2ShortName}{placementProfile.posMasterNo}" :
|
placementProfile.node == 2 ? $"{placementProfile.child2ShortName} {placementProfile.posMasterNo}" :
|
||||||
placementProfile.node == 1 ? $"{placementProfile.child1ShortName}{placementProfile.posMasterNo}" :
|
placementProfile.node == 1 ? $"{placementProfile.child1ShortName} {placementProfile.posMasterNo}" :
|
||||||
placementProfile.node == 0 ? $"{placementProfile.rootShortName}{placementProfile.posMasterNo}" : "",
|
placementProfile.node == 0 ? $"{placementProfile.rootShortName} {placementProfile.posMasterNo}" : "",
|
||||||
position = placementProfile.positionName,
|
position = placementProfile.positionName,
|
||||||
positionLine = "",
|
positionLine = "",
|
||||||
positionPathSide = "",
|
positionPathSide = "",
|
||||||
|
|
@ -3319,7 +3319,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlOrg);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlOrg);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||||
{
|
{
|
||||||
|
|
@ -3468,7 +3468,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
||||||
{
|
{
|
||||||
|
|
@ -3478,11 +3478,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
positionSalaryAmount = recv.PositionSalaryAmount,
|
positionSalaryAmount = recv.PositionSalaryAmount,
|
||||||
mouthSalaryAmount = recv.MouthSalaryAmount,
|
mouthSalaryAmount = recv.MouthSalaryAmount,
|
||||||
posNo = placementProfile.posMasterNo == null ? "" :
|
posNo = placementProfile.posMasterNo == null ? "" :
|
||||||
placementProfile.node == 4 ? $"{placementProfile.child4ShortName}{placementProfile.posMasterNo}" :
|
placementProfile.node == 4 ? $"{placementProfile.child4ShortName} {placementProfile.posMasterNo}" :
|
||||||
placementProfile.node == 3 ? $"{placementProfile.child3ShortName}{placementProfile.posMasterNo}" :
|
placementProfile.node == 3 ? $"{placementProfile.child3ShortName} {placementProfile.posMasterNo}" :
|
||||||
placementProfile.node == 2 ? $"{placementProfile.child2ShortName}{placementProfile.posMasterNo}" :
|
placementProfile.node == 2 ? $"{placementProfile.child2ShortName} {placementProfile.posMasterNo}" :
|
||||||
placementProfile.node == 1 ? $"{placementProfile.child1ShortName}{placementProfile.posMasterNo}" :
|
placementProfile.node == 1 ? $"{placementProfile.child1ShortName} {placementProfile.posMasterNo}" :
|
||||||
placementProfile.node == 0 ? $"{placementProfile.rootShortName}{placementProfile.posMasterNo}" : "",
|
placementProfile.node == 0 ? $"{placementProfile.rootShortName} {placementProfile.posMasterNo}" : "",
|
||||||
position = placementProfile.positionName,
|
position = placementProfile.positionName,
|
||||||
positionLine = "",
|
positionLine = "",
|
||||||
positionPathSide = "",
|
positionPathSide = "",
|
||||||
|
|
@ -3500,7 +3500,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlOrg);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlOrg);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||||
{
|
{
|
||||||
|
|
@ -3649,7 +3649,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
||||||
{
|
{
|
||||||
|
|
@ -3659,11 +3659,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
positionSalaryAmount = recv.PositionSalaryAmount,
|
positionSalaryAmount = recv.PositionSalaryAmount,
|
||||||
mouthSalaryAmount = recv.MouthSalaryAmount,
|
mouthSalaryAmount = recv.MouthSalaryAmount,
|
||||||
posNo = placementProfile.posMasterNo == null ? "" :
|
posNo = placementProfile.posMasterNo == null ? "" :
|
||||||
placementProfile.node == 4 ? $"{placementProfile.child4ShortName}{placementProfile.posMasterNo}" :
|
placementProfile.node == 4 ? $"{placementProfile.child4ShortName} {placementProfile.posMasterNo}" :
|
||||||
placementProfile.node == 3 ? $"{placementProfile.child3ShortName}{placementProfile.posMasterNo}" :
|
placementProfile.node == 3 ? $"{placementProfile.child3ShortName} {placementProfile.posMasterNo}" :
|
||||||
placementProfile.node == 2 ? $"{placementProfile.child2ShortName}{placementProfile.posMasterNo}" :
|
placementProfile.node == 2 ? $"{placementProfile.child2ShortName} {placementProfile.posMasterNo}" :
|
||||||
placementProfile.node == 1 ? $"{placementProfile.child1ShortName}{placementProfile.posMasterNo}" :
|
placementProfile.node == 1 ? $"{placementProfile.child1ShortName} {placementProfile.posMasterNo}" :
|
||||||
placementProfile.node == 0 ? $"{placementProfile.rootShortName}{placementProfile.posMasterNo}" : "",
|
placementProfile.node == 0 ? $"{placementProfile.rootShortName} {placementProfile.posMasterNo}" : "",
|
||||||
position = placementProfile.positionName,
|
position = placementProfile.positionName,
|
||||||
positionLine = "",
|
positionLine = "",
|
||||||
positionPathSide = "",
|
positionPathSide = "",
|
||||||
|
|
@ -3681,7 +3681,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlOrg);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlOrg);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||||
{
|
{
|
||||||
|
|
@ -3832,7 +3832,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
||||||
{
|
{
|
||||||
|
|
@ -3842,11 +3842,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
positionSalaryAmount = recv.PositionSalaryAmount,
|
positionSalaryAmount = recv.PositionSalaryAmount,
|
||||||
mouthSalaryAmount = recv.MouthSalaryAmount,
|
mouthSalaryAmount = recv.MouthSalaryAmount,
|
||||||
posNo = placementProfile.posMasterNo == null ? "" :
|
posNo = placementProfile.posMasterNo == null ? "" :
|
||||||
placementProfile.node == 4 ? $"{placementProfile.child4ShortName}{placementProfile.posMasterNo}" :
|
placementProfile.node == 4 ? $"{placementProfile.child4ShortName} {placementProfile.posMasterNo}" :
|
||||||
placementProfile.node == 3 ? $"{placementProfile.child3ShortName}{placementProfile.posMasterNo}" :
|
placementProfile.node == 3 ? $"{placementProfile.child3ShortName} {placementProfile.posMasterNo}" :
|
||||||
placementProfile.node == 2 ? $"{placementProfile.child2ShortName}{placementProfile.posMasterNo}" :
|
placementProfile.node == 2 ? $"{placementProfile.child2ShortName} {placementProfile.posMasterNo}" :
|
||||||
placementProfile.node == 1 ? $"{placementProfile.child1ShortName}{placementProfile.posMasterNo}" :
|
placementProfile.node == 1 ? $"{placementProfile.child1ShortName} {placementProfile.posMasterNo}" :
|
||||||
placementProfile.node == 0 ? $"{placementProfile.rootShortName}{placementProfile.posMasterNo}" : "",
|
placementProfile.node == 0 ? $"{placementProfile.rootShortName} {placementProfile.posMasterNo}" : "",
|
||||||
position = placementProfile.position,
|
position = placementProfile.position,
|
||||||
positionLine = "",
|
positionLine = "",
|
||||||
positionPathSide = "",
|
positionPathSide = "",
|
||||||
|
|
@ -3864,7 +3864,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlOrg);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlOrg);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||||
{
|
{
|
||||||
|
|
@ -4017,7 +4017,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
||||||
{
|
{
|
||||||
|
|
@ -4027,11 +4027,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
positionSalaryAmount = recv.PositionSalaryAmount,
|
positionSalaryAmount = recv.PositionSalaryAmount,
|
||||||
mouthSalaryAmount = recv.MouthSalaryAmount,
|
mouthSalaryAmount = recv.MouthSalaryAmount,
|
||||||
posNo = placementProfile.posMasterNo == null ? "" :
|
posNo = placementProfile.posMasterNo == null ? "" :
|
||||||
placementProfile.node == 4 ? $"{placementProfile.child4ShortName}{placementProfile.posMasterNo}" :
|
placementProfile.node == 4 ? $"{placementProfile.child4ShortName} {placementProfile.posMasterNo}" :
|
||||||
placementProfile.node == 3 ? $"{placementProfile.child3ShortName}{placementProfile.posMasterNo}" :
|
placementProfile.node == 3 ? $"{placementProfile.child3ShortName} {placementProfile.posMasterNo}" :
|
||||||
placementProfile.node == 2 ? $"{placementProfile.child2ShortName}{placementProfile.posMasterNo}" :
|
placementProfile.node == 2 ? $"{placementProfile.child2ShortName} {placementProfile.posMasterNo}" :
|
||||||
placementProfile.node == 1 ? $"{placementProfile.child1ShortName}{placementProfile.posMasterNo}" :
|
placementProfile.node == 1 ? $"{placementProfile.child1ShortName} {placementProfile.posMasterNo}" :
|
||||||
placementProfile.node == 0 ? $"{placementProfile.rootShortName}{placementProfile.posMasterNo}" : "",
|
placementProfile.node == 0 ? $"{placementProfile.rootShortName} {placementProfile.posMasterNo}" : "",
|
||||||
position = placementProfile.position,
|
position = placementProfile.position,
|
||||||
positionLine = "",
|
positionLine = "",
|
||||||
positionPathSide = "",
|
positionPathSide = "",
|
||||||
|
|
@ -4049,7 +4049,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlOrg);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlOrg);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||||
{
|
{
|
||||||
|
|
@ -4199,7 +4199,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
||||||
{
|
{
|
||||||
|
|
@ -4209,11 +4209,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
positionSalaryAmount = recv.PositionSalaryAmount,
|
positionSalaryAmount = recv.PositionSalaryAmount,
|
||||||
mouthSalaryAmount = recv.MouthSalaryAmount,
|
mouthSalaryAmount = recv.MouthSalaryAmount,
|
||||||
posNo = placementProfile.posMasterNo == null ? "" :
|
posNo = placementProfile.posMasterNo == null ? "" :
|
||||||
placementProfile.node == 4 ? $"{placementProfile.child4ShortName}{placementProfile.posMasterNo}" :
|
placementProfile.node == 4 ? $"{placementProfile.child4ShortName} {placementProfile.posMasterNo}" :
|
||||||
placementProfile.node == 3 ? $"{placementProfile.child3ShortName}{placementProfile.posMasterNo}" :
|
placementProfile.node == 3 ? $"{placementProfile.child3ShortName} {placementProfile.posMasterNo}" :
|
||||||
placementProfile.node == 2 ? $"{placementProfile.child2ShortName}{placementProfile.posMasterNo}" :
|
placementProfile.node == 2 ? $"{placementProfile.child2ShortName} {placementProfile.posMasterNo}" :
|
||||||
placementProfile.node == 1 ? $"{placementProfile.child1ShortName}{placementProfile.posMasterNo}" :
|
placementProfile.node == 1 ? $"{placementProfile.child1ShortName} {placementProfile.posMasterNo}" :
|
||||||
placementProfile.node == 0 ? $"{placementProfile.rootShortName}{placementProfile.posMasterNo}" : "",
|
placementProfile.node == 0 ? $"{placementProfile.rootShortName} {placementProfile.posMasterNo}" : "",
|
||||||
position = placementProfile.position,
|
position = placementProfile.position,
|
||||||
positionLine = "",
|
positionLine = "",
|
||||||
positionPathSide = "",
|
positionPathSide = "",
|
||||||
|
|
@ -4231,7 +4231,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlOrg);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlOrg);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||||
{
|
{
|
||||||
|
|
@ -4382,7 +4382,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
||||||
{
|
{
|
||||||
|
|
@ -4409,7 +4409,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlLeave);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlLeave);
|
||||||
string? _null = null;
|
string? _null = null;
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlLeave, new
|
var _res = await client.PostAsJsonAsync(apiUrlLeave, new
|
||||||
|
|
@ -4560,7 +4560,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
||||||
{
|
{
|
||||||
|
|
@ -4587,7 +4587,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlLeave);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlLeave);
|
||||||
string? _null = null;
|
string? _null = null;
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlLeave, new
|
var _res = await client.PostAsJsonAsync(apiUrlLeave, new
|
||||||
|
|
@ -4928,7 +4928,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrl, new
|
var _res = await client.PostAsJsonAsync(apiUrl, new
|
||||||
{
|
{
|
||||||
|
|
@ -5085,7 +5085,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrl, new
|
var _res = await client.PostAsJsonAsync(apiUrl, new
|
||||||
{
|
{
|
||||||
|
|
@ -5262,7 +5262,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
||||||
{
|
{
|
||||||
|
|
@ -5440,7 +5440,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
||||||
{
|
{
|
||||||
|
|
@ -5450,11 +5450,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
positionSalaryAmount = recv.PositionSalaryAmount,
|
positionSalaryAmount = recv.PositionSalaryAmount,
|
||||||
mouthSalaryAmount = recv.MouthSalaryAmount,
|
mouthSalaryAmount = recv.MouthSalaryAmount,
|
||||||
posNo = placementProfile.posMasterNo == null ? "" :
|
posNo = placementProfile.posMasterNo == null ? "" :
|
||||||
placementProfile.node == 4 ? $"{placementProfile.child4ShortName}{placementProfile.posMasterNo}" :
|
placementProfile.node == 4 ? $"{placementProfile.child4ShortName} {placementProfile.posMasterNo}" :
|
||||||
placementProfile.node == 3 ? $"{placementProfile.child3ShortName}{placementProfile.posMasterNo}" :
|
placementProfile.node == 3 ? $"{placementProfile.child3ShortName} {placementProfile.posMasterNo}" :
|
||||||
placementProfile.node == 2 ? $"{placementProfile.child2ShortName}{placementProfile.posMasterNo}" :
|
placementProfile.node == 2 ? $"{placementProfile.child2ShortName} {placementProfile.posMasterNo}" :
|
||||||
placementProfile.node == 1 ? $"{placementProfile.child1ShortName}{placementProfile.posMasterNo}" :
|
placementProfile.node == 1 ? $"{placementProfile.child1ShortName} {placementProfile.posMasterNo}" :
|
||||||
placementProfile.node == 0 ? $"{placementProfile.rootShortName}{placementProfile.posMasterNo}" : "",
|
placementProfile.node == 0 ? $"{placementProfile.rootShortName} {placementProfile.posMasterNo}" : "",
|
||||||
position = placementProfile.position,
|
position = placementProfile.position,
|
||||||
positionLine = "",
|
positionLine = "",
|
||||||
positionPathSide = "",
|
positionPathSide = "",
|
||||||
|
|
@ -5472,7 +5472,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlOrg);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlOrg);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||||
{
|
{
|
||||||
|
|
@ -5626,7 +5626,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
||||||
{
|
{
|
||||||
|
|
@ -5805,7 +5805,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
||||||
{
|
{
|
||||||
|
|
@ -5986,7 +5986,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrl, new
|
var _res = await client.PostAsJsonAsync(apiUrl, new
|
||||||
{
|
{
|
||||||
|
|
@ -6001,7 +6001,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
||||||
{
|
{
|
||||||
|
|
@ -6182,7 +6182,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrl, new
|
var _res = await client.PostAsJsonAsync(apiUrl, new
|
||||||
{
|
{
|
||||||
|
|
@ -6197,7 +6197,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
||||||
{
|
{
|
||||||
|
|
@ -6371,7 +6371,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrl, new
|
var _res = await client.PostAsJsonAsync(apiUrl, new
|
||||||
{
|
{
|
||||||
|
|
@ -6452,7 +6452,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Post, _apiUrl);
|
var req = new HttpRequestMessage(HttpMethod.Post, _apiUrl);
|
||||||
var res = await client.PostAsJsonAsync(_apiUrl, new { result = dataSend });
|
var res = await client.PostAsJsonAsync(_apiUrl, new { result = dataSend });
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -6549,7 +6549,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrl, new
|
var _res = await client.PostAsJsonAsync(apiUrl, new
|
||||||
{
|
{
|
||||||
|
|
@ -6630,7 +6630,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Post, _apiUrl);
|
var req = new HttpRequestMessage(HttpMethod.Post, _apiUrl);
|
||||||
var res = await client.PostAsJsonAsync(_apiUrl, new { result = dataSend });
|
var res = await client.PostAsJsonAsync(_apiUrl, new { result = dataSend });
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -6719,7 +6719,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||||
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -6877,7 +6877,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
||||||
{
|
{
|
||||||
|
|
@ -6887,11 +6887,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
positionSalaryAmount = recv.PositionSalaryAmount,
|
positionSalaryAmount = recv.PositionSalaryAmount,
|
||||||
mouthSalaryAmount = recv.MouthSalaryAmount,
|
mouthSalaryAmount = recv.MouthSalaryAmount,
|
||||||
posNo = data.posMasterNo == null ? "" :
|
posNo = data.posMasterNo == null ? "" :
|
||||||
data.node == 4 ? $"{data.child4ShortName}{data.posMasterNo}" :
|
data.node == 4 ? $"{data.child4ShortName} {data.posMasterNo}" :
|
||||||
data.node == 3 ? $"{data.child3ShortName}{data.posMasterNo}" :
|
data.node == 3 ? $"{data.child3ShortName} {data.posMasterNo}" :
|
||||||
data.node == 2 ? $"{data.child2ShortName}{data.posMasterNo}" :
|
data.node == 2 ? $"{data.child2ShortName} {data.posMasterNo}" :
|
||||||
data.node == 1 ? $"{data.child1ShortName}{data.posMasterNo}" :
|
data.node == 1 ? $"{data.child1ShortName} {data.posMasterNo}" :
|
||||||
data.node == 0 ? $"{data.rootShortName}{data.posMasterNo}" : "",
|
data.node == 0 ? $"{data.rootShortName} {data.posMasterNo}" : "",
|
||||||
position = data.position,
|
position = data.position,
|
||||||
positionType = data.posTypeName,
|
positionType = data.posTypeName,
|
||||||
positionLevel = data.posLevelName,
|
positionLevel = data.posLevelName,
|
||||||
|
|
@ -6906,7 +6906,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlOrg);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlOrg);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||||
{
|
{
|
||||||
|
|
@ -7062,7 +7062,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Put, apiUrl);
|
var _req = new HttpRequestMessage(HttpMethod.Put, apiUrl);
|
||||||
var _res = await client.PutAsJsonAsync(apiUrl, new
|
var _res = await client.PutAsJsonAsync(apiUrl, new
|
||||||
{
|
{
|
||||||
|
|
@ -7215,7 +7215,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
||||||
{
|
{
|
||||||
|
|
@ -7225,11 +7225,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
positionSalaryAmount = recv.PositionSalaryAmount,
|
positionSalaryAmount = recv.PositionSalaryAmount,
|
||||||
mouthSalaryAmount = recv.MouthSalaryAmount,
|
mouthSalaryAmount = recv.MouthSalaryAmount,
|
||||||
posNo = data.posMasterNo == null ? "" :
|
posNo = data.posMasterNo == null ? "" :
|
||||||
data.node == 4 ? $"{data.child4ShortName}{data.posMasterNo}" :
|
data.node == 4 ? $"{data.child4ShortName} {data.posMasterNo}" :
|
||||||
data.node == 3 ? $"{data.child3ShortName}{data.posMasterNo}" :
|
data.node == 3 ? $"{data.child3ShortName} {data.posMasterNo}" :
|
||||||
data.node == 2 ? $"{data.child2ShortName}{data.posMasterNo}" :
|
data.node == 2 ? $"{data.child2ShortName} {data.posMasterNo}" :
|
||||||
data.node == 1 ? $"{data.child1ShortName}{data.posMasterNo}" :
|
data.node == 1 ? $"{data.child1ShortName} {data.posMasterNo}" :
|
||||||
data.node == 0 ? $"{data.rootShortName}{data.posMasterNo}" : "",
|
data.node == 0 ? $"{data.rootShortName} {data.posMasterNo}" : "",
|
||||||
position = data.position,
|
position = data.position,
|
||||||
positionType = data.posTypeName,
|
positionType = data.posTypeName,
|
||||||
positionLevel = data.posLevelName,
|
positionLevel = data.posLevelName,
|
||||||
|
|
@ -7244,7 +7244,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlOrg);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlOrg);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||||
{
|
{
|
||||||
|
|
@ -7385,7 +7385,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||||
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -7411,7 +7411,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl2);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl2);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrl2, new
|
var _res = await client.PostAsJsonAsync(apiUrl2, new
|
||||||
{
|
{
|
||||||
|
|
@ -7544,7 +7544,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||||
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -7570,7 +7570,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl2);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl2);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrl2, new
|
var _res = await client.PostAsJsonAsync(apiUrl2, new
|
||||||
{
|
{
|
||||||
|
|
@ -7704,7 +7704,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||||
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -7730,7 +7730,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl2);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl2);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrl2, new
|
var _res = await client.PostAsJsonAsync(apiUrl2, new
|
||||||
{
|
{
|
||||||
|
|
@ -7864,7 +7864,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||||
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -7890,7 +7890,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl2);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl2);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrl2, new
|
var _res = await client.PostAsJsonAsync(apiUrl2, new
|
||||||
{
|
{
|
||||||
|
|
@ -8024,7 +8024,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||||
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -8050,7 +8050,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl2);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl2);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrl2, new
|
var _res = await client.PostAsJsonAsync(apiUrl2, new
|
||||||
{
|
{
|
||||||
|
|
@ -8184,7 +8184,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||||
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -8210,7 +8210,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl2);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl2);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrl2, new
|
var _res = await client.PostAsJsonAsync(apiUrl2, new
|
||||||
{
|
{
|
||||||
|
|
@ -8344,7 +8344,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||||
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -8370,7 +8370,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl2);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl2);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrl2, new
|
var _res = await client.PostAsJsonAsync(apiUrl2, new
|
||||||
{
|
{
|
||||||
|
|
@ -8504,7 +8504,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||||
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -8530,7 +8530,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl2);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl2);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrl2, new
|
var _res = await client.PostAsJsonAsync(apiUrl2, new
|
||||||
{
|
{
|
||||||
|
|
@ -8663,7 +8663,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||||
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -8806,7 +8806,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||||
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -8949,7 +8949,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||||
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -9091,7 +9091,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||||
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -9234,7 +9234,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||||
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -9612,7 +9612,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||||
string? _null = null;
|
string? _null = null;
|
||||||
var _res = await client.PostAsJsonAsync(apiUrl, new
|
var _res = await client.PostAsJsonAsync(apiUrl, new
|
||||||
|
|
@ -9628,7 +9628,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
||||||
{
|
{
|
||||||
|
|
@ -11388,7 +11388,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
foreach (var insignia in Insignias)
|
foreach (var insignia in Insignias)
|
||||||
{
|
{
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlInsig, new
|
var _res = await client.PostAsJsonAsync(apiUrlInsig, new
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ namespace BMA.EHR.Application.Repositories
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||||
{
|
{
|
||||||
refId = cronjobNoti.DisciplineComplaint_Profiles.Select(x => x.PersonId),
|
refId = cronjobNoti.DisciplineComplaint_Profiles.Select(x => x.PersonId),
|
||||||
|
|
@ -91,7 +91,7 @@ namespace BMA.EHR.Application.Repositories
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||||
{
|
{
|
||||||
refId = cronjobNoti.DisciplineInvestigate_ProfileComplaints.Select(x => x.PersonId),
|
refId = cronjobNoti.DisciplineInvestigate_ProfileComplaints.Select(x => x.PersonId),
|
||||||
|
|
@ -132,7 +132,7 @@ namespace BMA.EHR.Application.Repositories
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||||
{
|
{
|
||||||
refId = cronjobNoti.DisciplineDisciplinary_ProfileComplaintInvestigates.Select(x => x.PersonId),
|
refId = cronjobNoti.DisciplineDisciplinary_ProfileComplaintInvestigates.Select(x => x.PersonId),
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,16 @@
|
||||||
using Amazon.S3.Model.Internal.MarshallTransformations;
|
using Amazon.Runtime.Internal.Endpoints.StandardLibrary;
|
||||||
|
using Amazon.S3.Model.Internal.MarshallTransformations;
|
||||||
using BMA.EHR.Application.Common.Interfaces;
|
using BMA.EHR.Application.Common.Interfaces;
|
||||||
using BMA.EHR.Domain.Models.Base;
|
using BMA.EHR.Domain.Models.Base;
|
||||||
using BMA.EHR.Domain.Models.HR;
|
using BMA.EHR.Domain.Models.HR;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Newtonsoft.Json.Linq;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Microsoft.Extensions.Configuration;
|
|
||||||
|
|
||||||
namespace BMA.EHR.Application.Repositories
|
namespace BMA.EHR.Application.Repositories
|
||||||
{
|
{
|
||||||
|
|
@ -52,15 +53,18 @@ namespace BMA.EHR.Application.Repositories
|
||||||
|
|
||||||
#region " For Call External API "
|
#region " For Call External API "
|
||||||
|
|
||||||
protected async Task<string> GetExternalAPIAsync(string apiPath, string accessToken, string apiKey)
|
protected async Task<string> GetExternalAPIAsync(string apiPath, string accessToken, string apiKey, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// กำหนด timeout เป็น 30 นาที
|
||||||
|
using var timeoutCts = new CancellationTokenSource(TimeSpan.FromMinutes(30));
|
||||||
|
using var combinedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token);
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", apiKey);
|
client.DefaultRequestHeaders.Add("api-key", apiKey);
|
||||||
var _res = await client.GetAsync(apiPath);
|
var _res = await client.GetAsync(apiPath,cancellationToken: combinedCts.Token);
|
||||||
if (_res.IsSuccessStatusCode)
|
if (_res.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
var _result = await _res.Content.ReadAsStringAsync();
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -76,19 +80,25 @@ namespace BMA.EHR.Application.Repositories
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async Task<string> PostExternalAPIAsync(string apiPath, string accessToken, object? body, string apiKey)
|
protected async Task<string> SendExternalAPIAsync(HttpMethod method, string apiPath, string accessToken, object? body, string apiKey, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// กำหนด timeout เป็น 30 นาที
|
||||||
|
using var timeoutCts = new CancellationTokenSource(TimeSpan.FromMinutes(30));
|
||||||
|
using var combinedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token);
|
||||||
|
// สร้าง request message
|
||||||
|
var request = new HttpRequestMessage(method, apiPath);
|
||||||
|
|
||||||
|
|
||||||
var json = JsonConvert.SerializeObject(body);
|
var json = JsonConvert.SerializeObject(body);
|
||||||
var stringContent = new StringContent(json, UnicodeEncoding.UTF8, "application/json");
|
request.Content = new StringContent(json, Encoding.UTF8, "application/json");
|
||||||
stringContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
|
|
||||||
|
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", apiKey);
|
client.DefaultRequestHeaders.Add("api-key", apiKey);
|
||||||
var _res = await client.PostAsync(apiPath, stringContent);
|
var _res = await client.SendAsync(request, combinedCts.Token);
|
||||||
if (_res.IsSuccessStatusCode)
|
if (_res.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
var _result = await _res.Content.ReadAsStringAsync();
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -104,10 +114,45 @@ namespace BMA.EHR.Application.Repositories
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async Task<bool> PostExternalAPIBooleanAsync(string apiPath, string accessToken, object? body, string apiKey)
|
|
||||||
|
public async Task<string> PostExternalAPIAsync(string apiPath, string accessToken, object? body, string apiKey, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// กำหนด timeout เป็น 30 นาที
|
||||||
|
using var timeoutCts = new CancellationTokenSource(TimeSpan.FromMinutes(30));
|
||||||
|
using var combinedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token);
|
||||||
|
var json = JsonConvert.SerializeObject(body);
|
||||||
|
var stringContent = new StringContent(json, Encoding.UTF8, "application/json");
|
||||||
|
//stringContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
|
||||||
|
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken.Replace("Bearer ", ""));
|
||||||
|
client.DefaultRequestHeaders.Add("api-key", apiKey);
|
||||||
|
var _res = await client.PostAsync(apiPath, stringContent, combinedCts.Token);
|
||||||
|
if (_res.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
return _result;
|
||||||
|
}
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async Task<bool> PostExternalAPIBooleanAsync(string apiPath, string accessToken, object? body, string apiKey, CancellationToken cancellationToken = default)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// กำหนด timeout เป็น 30 นาที
|
||||||
|
using var timeoutCts = new CancellationTokenSource(TimeSpan.FromMinutes(30));
|
||||||
|
using var combinedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token);
|
||||||
var json = JsonConvert.SerializeObject(body);
|
var json = JsonConvert.SerializeObject(body);
|
||||||
var stringContent = new StringContent(json, UnicodeEncoding.UTF8, "application/json");
|
var stringContent = new StringContent(json, UnicodeEncoding.UTF8, "application/json");
|
||||||
stringContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
|
stringContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
|
||||||
|
|
@ -115,8 +160,8 @@ namespace BMA.EHR.Application.Repositories
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", apiKey);
|
client.DefaultRequestHeaders.Add("api-key", apiKey);
|
||||||
var _res = await client.PostAsync(apiPath, stringContent);
|
var _res = await client.PostAsync(apiPath, stringContent, combinedCts.Token);
|
||||||
return _res.IsSuccessStatusCode;
|
return _res.IsSuccessStatusCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -2,8 +2,11 @@
|
||||||
using BMA.EHR.Domain.Models.Base;
|
using BMA.EHR.Domain.Models.Base;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using System.IO.Pipes;
|
using System.IO.Pipes;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace BMA.EHR.Application.Repositories.Leaves
|
namespace BMA.EHR.Application.Repositories.Leaves
|
||||||
{
|
{
|
||||||
|
|
@ -43,6 +46,38 @@ namespace BMA.EHR.Application.Repositories.Leaves
|
||||||
|
|
||||||
#region " Methods "
|
#region " Methods "
|
||||||
|
|
||||||
|
public async Task<string> PostExternalAPIAsync(string apiPath, string accessToken, object? body, string apiKey, CancellationToken cancellationToken = default)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// กำหนด timeout เป็น 30 นาที
|
||||||
|
using var timeoutCts = new CancellationTokenSource(TimeSpan.FromMinutes(30));
|
||||||
|
using var combinedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token);
|
||||||
|
var json = JsonConvert.SerializeObject(body);
|
||||||
|
var stringContent = new StringContent(json, Encoding.UTF8, "application/json");
|
||||||
|
//stringContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
|
||||||
|
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken.Replace("Bearer ", ""));
|
||||||
|
client.DefaultRequestHeaders.Add("api-key", apiKey);
|
||||||
|
var _res = await client.PostAsync(apiPath, stringContent, combinedCts.Token);
|
||||||
|
if (_res.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
return _result;
|
||||||
|
}
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public virtual async Task<IReadOnlyList<T>> GetAllAsync()
|
public virtual async Task<IReadOnlyList<T>> GetAllAsync()
|
||||||
{
|
{
|
||||||
return await _dbSet.ToListAsync();
|
return await _dbSet.ToListAsync();
|
||||||
|
|
@ -68,6 +103,24 @@ namespace BMA.EHR.Application.Repositories.Leaves
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual async Task<IReadOnlyList<T>> AddRangeAsync(List<T> entities)
|
||||||
|
{
|
||||||
|
foreach (var entity in entities)
|
||||||
|
{
|
||||||
|
if (entity is EntityBase)
|
||||||
|
{
|
||||||
|
(entity as EntityBase).CreatedUserId = UserId ?? "";
|
||||||
|
(entity as EntityBase).CreatedFullName = FullName ?? "System Administrator";
|
||||||
|
(entity as EntityBase).CreatedAt = DateTime.Now;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await _dbSet.AddRangeAsync(entities);
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
|
||||||
|
return entities;
|
||||||
|
}
|
||||||
|
|
||||||
public virtual async Task<T> UpdateAsync(T entity)
|
public virtual async Task<T> UpdateAsync(T entity)
|
||||||
{
|
{
|
||||||
if (entity is EntityBase)
|
if (entity is EntityBase)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,587 @@
|
||||||
|
using Amazon.S3.Model;
|
||||||
|
using BMA.EHR.Application.Common.Interfaces;
|
||||||
|
using BMA.EHR.Application.Messaging;
|
||||||
|
using BMA.EHR.Application.Responses.Profiles;
|
||||||
|
using BMA.EHR.Domain.Extensions;
|
||||||
|
using BMA.EHR.Domain.Models.Leave.Commons;
|
||||||
|
using BMA.EHR.Domain.Models.Leave.Requests;
|
||||||
|
using BMA.EHR.Domain.Shared;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
||||||
|
{
|
||||||
|
public class LeaveBeginningRepository : GenericLeaveRepository<Guid, LeaveBeginning>
|
||||||
|
{
|
||||||
|
#region " Fields "
|
||||||
|
|
||||||
|
private readonly ILeaveDbContext _dbContext;
|
||||||
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
private readonly OrganizationCommonRepository _organizationCommonRepository;
|
||||||
|
private readonly UserProfileRepository _userProfileRepository;
|
||||||
|
private readonly IConfiguration _configuration;
|
||||||
|
private readonly EmailSenderService _emailSenderService;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Keyed locks to serialize get-or-create for LeaveBeginning rows by (ProfileId, LeaveYear, LeaveTypeId).
|
||||||
|
/// Prevents duplicate inserts when concurrent requests (e.g. UI calling /user/check twice) hit the same key.
|
||||||
|
/// </summary>
|
||||||
|
private static readonly ConcurrentDictionary<string, SemaphoreSlim> _getOrAddLocks = new();
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region " Constructor and Destuctor "
|
||||||
|
|
||||||
|
public LeaveBeginningRepository(ILeaveDbContext dbContext,
|
||||||
|
IHttpContextAccessor httpContextAccessor,
|
||||||
|
OrganizationCommonRepository organizationCommonRepository,
|
||||||
|
UserProfileRepository userProfileRepository,
|
||||||
|
IConfiguration configuration,
|
||||||
|
EmailSenderService emailSenderService) : base(dbContext, httpContextAccessor)
|
||||||
|
{
|
||||||
|
_dbContext = dbContext;
|
||||||
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
_organizationCommonRepository = organizationCommonRepository;
|
||||||
|
_userProfileRepository = userProfileRepository;
|
||||||
|
_configuration = configuration;
|
||||||
|
_emailSenderService = emailSenderService;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region " Properties "
|
||||||
|
|
||||||
|
protected Guid UserOrganizationId
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (UserId != null || UserId != "")
|
||||||
|
return _userProfileRepository.GetUserOCId(Guid.Parse(UserId!), AccessToken);
|
||||||
|
else
|
||||||
|
return Guid.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public async Task<List<LeaveBeginning>> GetAllByYearAsync(int year)
|
||||||
|
{
|
||||||
|
return await _dbContext.Set<LeaveBeginning>()
|
||||||
|
.Include(x => x.LeaveType)
|
||||||
|
.Where(x => x.LeaveYear == year)
|
||||||
|
.ToListAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<LeaveBeginning?> GetByYearAndTypeIdAsync(int year, Guid typeId)
|
||||||
|
{
|
||||||
|
var data = await _dbContext.Set<LeaveBeginning>()
|
||||||
|
.Include(x => x.LeaveType)
|
||||||
|
.FirstOrDefaultAsync(x => x.LeaveYear == year && x.LeaveTypeId == typeId);
|
||||||
|
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task UpdateLeaveUsageAsync(int year, Guid typeId, Guid userId, double day)
|
||||||
|
{
|
||||||
|
// var pf = await _userProfileRepository.GetProfileByKeycloakIdAsync(userId, AccessToken);
|
||||||
|
var pf = await _userProfileRepository.GetProfileByKeycloakIdNew2Async(userId, AccessToken);
|
||||||
|
if (pf == null)
|
||||||
|
{
|
||||||
|
throw new Exception(GlobalMessages.DataNotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
var data = await _dbContext.Set<LeaveBeginning>()
|
||||||
|
.Include(x => x.LeaveType)
|
||||||
|
.FirstOrDefaultAsync(x => x.LeaveYear == year && x.LeaveTypeId == typeId && x.ProfileId == pf.Id);
|
||||||
|
|
||||||
|
if (data == null)
|
||||||
|
{
|
||||||
|
throw new Exception(GlobalMessages.DataNotFound);
|
||||||
|
}
|
||||||
|
data.LeaveDaysUsed += day;
|
||||||
|
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task UpdateLeaveCountAsync(int year, Guid typeId, Guid userId, int count)
|
||||||
|
{
|
||||||
|
// var pf = await _userProfileRepository.GetProfileByKeycloakIdAsync(userId, AccessToken);
|
||||||
|
var pf = await _userProfileRepository.GetProfileByKeycloakIdNew2Async(userId, AccessToken);
|
||||||
|
if (pf == null)
|
||||||
|
{
|
||||||
|
throw new Exception(GlobalMessages.DataNotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
var data = await _dbContext.Set<LeaveBeginning>()
|
||||||
|
.Include(x => x.LeaveType)
|
||||||
|
.FirstOrDefaultAsync(x => x.LeaveYear == year && x.LeaveTypeId == typeId && x.ProfileId == pf.Id);
|
||||||
|
|
||||||
|
if (data == null)
|
||||||
|
{
|
||||||
|
throw new Exception(GlobalMessages.DataNotFound);
|
||||||
|
}
|
||||||
|
data.LeaveCount += count;
|
||||||
|
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task ProcessEarlyLeaveRequest(int year)
|
||||||
|
{
|
||||||
|
// Get Early Leave Request (กรองตามปีงบประมาณ: 1 ต.ค. (year-1) – 30 ก.ย. (year))
|
||||||
|
var fiscalStart = new DateTime(year - 1, 10, 1);
|
||||||
|
var fiscalEnd = new DateTime(year, 9, 30);
|
||||||
|
|
||||||
|
var leaveReq = await _dbContext.Set<LeaveRequest>()
|
||||||
|
.Include(x => x.Type)
|
||||||
|
.Where(x => x.LeaveStatus == "APPROVE")
|
||||||
|
.Where(x => x.LeaveStartDate.Date <= fiscalEnd && x.LeaveEndDate.Date >= fiscalStart)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
foreach (var leave in leaveReq)
|
||||||
|
{
|
||||||
|
await GetByYearAndTypeIdForUserWithUpdateAsync(year, leave.Type.Id, leave.KeycloakUserId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task ProcessEarlyLeaveRequestSchedule()
|
||||||
|
{
|
||||||
|
int year = DateTime.Now.Year;
|
||||||
|
await ProcessEarlyLeaveRequest(year);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<LeaveBeginning?> GetByYearAndTypeIdForUserAsync(int year, Guid typeId, Guid userId)
|
||||||
|
{
|
||||||
|
// var pf = await _userProfileRepository.GetProfileByKeycloakIdAsync(userId, AccessToken);
|
||||||
|
var pf = await _userProfileRepository.GetProfileByKeycloakIdNew2Async(userId, AccessToken);
|
||||||
|
if (pf == null)
|
||||||
|
{
|
||||||
|
throw new Exception(GlobalMessages.DataNotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
var govAge = (pf?.DateStart?.Date ?? DateTime.Now.Date).DiffDay(DateTime.Now.Date);
|
||||||
|
|
||||||
|
var leaveType = await _dbContext.Set<LeaveType>().FirstOrDefaultAsync(x => x.Id == typeId);
|
||||||
|
|
||||||
|
LeaveBeginning Factory()
|
||||||
|
{
|
||||||
|
var limit = 0.0;
|
||||||
|
|
||||||
|
var prev = _dbContext.Set<LeaveBeginning>()
|
||||||
|
.Include(x => x.LeaveType)
|
||||||
|
.FirstOrDefault(x => x.LeaveYear == year - 1 && x.LeaveTypeId == typeId && x.ProfileId == pf.Id);
|
||||||
|
|
||||||
|
// คำนวณปีงบประมาณจาก startDate (ปีงบประมาณเริ่ม 1 ต.ค. และสิ้นสุด 30 ก.ย.)
|
||||||
|
var isCurrentYear = DateTime.Now.Year == year;
|
||||||
|
|
||||||
|
|
||||||
|
var prevRemain = 0.0;
|
||||||
|
if (prev != null)
|
||||||
|
{
|
||||||
|
prevRemain = isCurrentYear ? prev.LeaveDays - (prev.LeaveDaysUsed ?? 0.0) : 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (govAge >= 180)
|
||||||
|
{
|
||||||
|
if (govAge >= 3650)
|
||||||
|
{
|
||||||
|
limit = 10 + prevRemain;
|
||||||
|
if (limit > 30) limit = 30;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
limit = 10 + prevRemain;
|
||||||
|
if (limit > 20) limit = 20;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
limit = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new LeaveBeginning
|
||||||
|
{
|
||||||
|
LeaveYear = year,
|
||||||
|
LeaveTypeId = typeId,
|
||||||
|
ProfileId = pf.Id,
|
||||||
|
Prefix = pf.Prefix,
|
||||||
|
FirstName = pf.FirstName,
|
||||||
|
LastName = pf.LastName,
|
||||||
|
LeaveDaysUsed = 0,
|
||||||
|
LeaveDays = leaveType?.Code == "LV-005" ? limit : 0,
|
||||||
|
RootDnaId = pf.RootDnaId,
|
||||||
|
Child1DnaId = pf.Child1DnaId,
|
||||||
|
Child2DnaId = pf.Child2DnaId,
|
||||||
|
Child3DnaId = pf.Child3DnaId,
|
||||||
|
Child4DnaId = pf.Child4DnaId
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return await GetOrAddForUserAsync(year, typeId, pf.Id, Factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<LeaveBeginning?> GetByYearAndTypeIdForUserWithUpdateAsync(int year, Guid typeId, Guid userId)
|
||||||
|
{
|
||||||
|
// var pf = await _userProfileRepository.GetProfileByKeycloakIdAsync(userId, AccessToken);
|
||||||
|
var pf = await _userProfileRepository.GetProfileByKeycloakIdNew2Async(userId, AccessToken);
|
||||||
|
if (pf == null)
|
||||||
|
{
|
||||||
|
throw new Exception(GlobalMessages.DataNotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
var govAge = (pf?.DateStart?.Date ?? DateTime.Now.Date).DiffDay(DateTime.Now.Date);
|
||||||
|
|
||||||
|
var leaveType = await _dbContext.Set<LeaveType>().FirstOrDefaultAsync(x => x.Id == typeId);
|
||||||
|
|
||||||
|
|
||||||
|
var limit = 0.0;
|
||||||
|
|
||||||
|
var prev = _dbContext.Set<LeaveBeginning>()
|
||||||
|
.Include(x => x.LeaveType)
|
||||||
|
.FirstOrDefault(x => x.LeaveYear == year - 1 && x.LeaveTypeId == typeId && x.ProfileId == pf.Id);
|
||||||
|
|
||||||
|
var prevRemain = 0.0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (prev != null)
|
||||||
|
{
|
||||||
|
prevRemain = prev.LeaveDays - (prev.LeaveDaysUsed ?? 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (govAge >= 180)
|
||||||
|
{
|
||||||
|
if (govAge >= 3650)
|
||||||
|
{
|
||||||
|
limit = 10 + prevRemain;
|
||||||
|
if (limit > 30) limit = 30;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
limit = 10 + prevRemain;
|
||||||
|
if (limit > 20) limit = 20;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
limit = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
var data = await _dbContext.Set<LeaveBeginning>()
|
||||||
|
.Where(x => x.LeaveYear == year && x.LeaveTypeId == typeId && x.ProfileId == pf.Id)
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
if (data != null)
|
||||||
|
{
|
||||||
|
data.LeaveDays = leaveType?.Code == "LV-005" ? limit : 0;
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
// return new LeaveBeginning
|
||||||
|
// {
|
||||||
|
// LeaveYear = year,
|
||||||
|
// LeaveTypeId = typeId,
|
||||||
|
// ProfileId = pf.Id,
|
||||||
|
// Prefix = pf.Prefix,
|
||||||
|
// FirstName = pf.FirstName,
|
||||||
|
// LastName = pf.LastName,
|
||||||
|
// LeaveDaysUsed = 0,
|
||||||
|
// LeaveDays = leaveType?.Code == "LV-005" ? limit : 0,
|
||||||
|
// RootDnaId = pf.RootDnaId,
|
||||||
|
// Child1DnaId = pf.Child1DnaId,
|
||||||
|
// Child2DnaId = pf.Child2DnaId,
|
||||||
|
// Child3DnaId = pf.Child3DnaId,
|
||||||
|
// Child4DnaId = pf.Child4DnaId
|
||||||
|
// };
|
||||||
|
return data;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<LeaveBeginning?> GetByYearAndTypeIdForUser(int year, Guid typeId, GetProfileByKeycloakIdDto? pf)
|
||||||
|
{
|
||||||
|
var govAge = (pf?.DateStart?.Date ?? DateTime.Now.Date).DiffDay(DateTime.Now.Date);
|
||||||
|
|
||||||
|
var leaveType = await _dbContext.Set<LeaveType>().FirstOrDefaultAsync(x => x.Id == typeId);
|
||||||
|
|
||||||
|
LeaveBeginning Factory()
|
||||||
|
{
|
||||||
|
var limit = 0.0;
|
||||||
|
|
||||||
|
var prev = _dbContext.Set<LeaveBeginning>()
|
||||||
|
.Include(x => x.LeaveType)
|
||||||
|
.FirstOrDefault(x => x.LeaveYear == year - 1 && x.LeaveTypeId == typeId && x.ProfileId == pf.Id);
|
||||||
|
|
||||||
|
// คำนวณปีงบประมาณจาก startDate (ปีงบประมาณเริ่ม 1 ต.ค. และสิ้นสุด 30 ก.ย.)
|
||||||
|
var isCurrentYear = DateTime.Now.Year == year;
|
||||||
|
|
||||||
|
var prevRemain = 0.0;
|
||||||
|
if (prev != null)
|
||||||
|
{
|
||||||
|
prevRemain = isCurrentYear ? prev.LeaveDays - (prev.LeaveDaysUsed ?? 0.0) : 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (govAge >= 180)
|
||||||
|
{
|
||||||
|
if (govAge >= 3650)
|
||||||
|
{
|
||||||
|
limit = 10 + prevRemain;
|
||||||
|
if (limit > 30) limit = 30;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
limit = 10 + prevRemain;
|
||||||
|
if (limit > 20) limit = 20;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
limit = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new LeaveBeginning
|
||||||
|
{
|
||||||
|
LeaveYear = year,
|
||||||
|
LeaveTypeId = typeId,
|
||||||
|
ProfileId = pf.Id,
|
||||||
|
Prefix = pf.Prefix,
|
||||||
|
FirstName = pf.FirstName,
|
||||||
|
LastName = pf.LastName,
|
||||||
|
LeaveDaysUsed = 0,
|
||||||
|
LeaveDays = leaveType?.Code == "LV-005" ? limit : 0,
|
||||||
|
RootDnaId = pf.RootDnaId,
|
||||||
|
Child1DnaId = pf.Child1DnaId,
|
||||||
|
Child2DnaId = pf.Child2DnaId,
|
||||||
|
Child3DnaId = pf.Child3DnaId,
|
||||||
|
Child4DnaId = pf.Child4DnaId
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return await GetOrAddForUserAsync(year, typeId, pf.Id, Factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<LeaveBeginning?> GetByYearAndTypeIdForUser2Async(int year, Guid typeId, Guid userId)
|
||||||
|
{
|
||||||
|
// var pf = await _userProfileRepository.GetProfileByKeycloakIdAsync(userId, AccessToken);
|
||||||
|
var pf = await _userProfileRepository.GetProfileByKeycloakIdNew2Async(userId, AccessToken);
|
||||||
|
if (pf == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var govAge = (pf?.DateStart?.Date ?? DateTime.Now.Date).DiffDay(DateTime.Now.Date);
|
||||||
|
|
||||||
|
var leaveType = await _dbContext.Set<LeaveType>().FirstOrDefaultAsync(x => x.Id == typeId);
|
||||||
|
|
||||||
|
LeaveBeginning Factory()
|
||||||
|
{
|
||||||
|
var limit = 0.0;
|
||||||
|
|
||||||
|
var prev = _dbContext.Set<LeaveBeginning>()
|
||||||
|
.Include(x => x.LeaveType)
|
||||||
|
.FirstOrDefault(x => x.LeaveYear == year - 1 && x.LeaveTypeId == typeId && x.ProfileId == pf.Id);
|
||||||
|
|
||||||
|
// คำนวณปีงบประมาณจาก startDate (ปีงบประมาณเริ่ม 1 ต.ค. และสิ้นสุด 30 ก.ย.)
|
||||||
|
var isCurrentYear = DateTime.Now.Year == year;
|
||||||
|
|
||||||
|
var prevRemain = 0.0;
|
||||||
|
if (prev != null)
|
||||||
|
{
|
||||||
|
prevRemain = isCurrentYear ? prev.LeaveDays - (prev.LeaveDaysUsed ?? 0.0) : 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (govAge >= 180)
|
||||||
|
{
|
||||||
|
if (govAge >= 3650)
|
||||||
|
{
|
||||||
|
limit = 10 + prevRemain;
|
||||||
|
if (limit > 30) limit = 30;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
limit = 10 + prevRemain;
|
||||||
|
if (limit > 20) limit = 20;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
limit = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new LeaveBeginning
|
||||||
|
{
|
||||||
|
LeaveYear = year,
|
||||||
|
LeaveTypeId = typeId,
|
||||||
|
ProfileId = pf.Id,
|
||||||
|
Prefix = pf.Prefix,
|
||||||
|
FirstName = pf.FirstName,
|
||||||
|
LastName = pf.LastName,
|
||||||
|
LeaveDaysUsed = 0,
|
||||||
|
LeaveDays = leaveType?.Code == "LV-005" ? limit : 0,
|
||||||
|
RootDnaId = pf.RootDnaId,
|
||||||
|
Child1DnaId = pf.Child1DnaId,
|
||||||
|
Child2DnaId = pf.Child2DnaId,
|
||||||
|
Child3DnaId = pf.Child3DnaId,
|
||||||
|
Child4DnaId = pf.Child4DnaId
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return await GetOrAddForUserAsync(year, typeId, pf.Id, Factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get-or-create a LeaveBeginning row for (ProfileId, LeaveYear, LeaveTypeId) with concurrency protection.
|
||||||
|
/// Uses a keyed SemaphoreSlim to serialize within-process requests, and re-queries after acquiring the lock.
|
||||||
|
/// If a cross-process insert wins (unique index violation), the duplicate key exception is caught and the row
|
||||||
|
/// created by the winner is returned.
|
||||||
|
/// </summary>
|
||||||
|
private async Task<LeaveBeginning?> GetOrAddForUserAsync(int year, Guid typeId, Guid profileId, Func<LeaveBeginning> factory)
|
||||||
|
{
|
||||||
|
var key = $"{profileId}_{year}_{typeId}";
|
||||||
|
var semaphore = _getOrAddLocks.GetOrAdd(key, _ => new SemaphoreSlim(1, 1));
|
||||||
|
await semaphore.WaitAsync();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Re-query inside the lock — another thread may have created it while we waited.
|
||||||
|
var existing = await _dbContext.Set<LeaveBeginning>()
|
||||||
|
.Include(x => x.LeaveType)
|
||||||
|
.FirstOrDefaultAsync(x => x.LeaveYear == year && x.LeaveTypeId == typeId && x.ProfileId == profileId);
|
||||||
|
if (existing != null)
|
||||||
|
{
|
||||||
|
return existing;
|
||||||
|
}
|
||||||
|
|
||||||
|
var entity = factory();
|
||||||
|
_dbContext.Set<LeaveBeginning>().Add(entity);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
catch (DbUpdateException)
|
||||||
|
{
|
||||||
|
// Cross-process/cross-server race hit the unique index (IX_LeaveBeginnings_ProfileId_LeaveYear_LeaveTypeId).
|
||||||
|
// Detach the failed insert and return the row created by the winner.
|
||||||
|
_dbContext.Detach(entity);
|
||||||
|
var winner = await _dbContext.Set<LeaveBeginning>()
|
||||||
|
.Include(x => x.LeaveType)
|
||||||
|
.FirstOrDefaultAsync(x => x.LeaveYear == year && x.LeaveTypeId == typeId && x.ProfileId == profileId);
|
||||||
|
return winner;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
semaphore.Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<LeaveBeginning>> GetAllByYearAndTypeAsync(int year, Guid typeId, List<ProfileData> userIdList)
|
||||||
|
{
|
||||||
|
|
||||||
|
var updateList = new List<LeaveBeginning>();
|
||||||
|
var result = new List<LeaveBeginning>();
|
||||||
|
|
||||||
|
var beginningList = await _dbContext.Set<LeaveBeginning>()
|
||||||
|
.Include(x => x.LeaveType)
|
||||||
|
.Where(x => x.LeaveYear == year && x.LeaveTypeId == typeId)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
foreach (var pf in userIdList)
|
||||||
|
{
|
||||||
|
//var pf = await _userProfileRepository.GetProfileByKeycloakIdAsync(id, AccessToken);
|
||||||
|
//if (pf == null)
|
||||||
|
//{
|
||||||
|
// continue; // Goto Next Id
|
||||||
|
//}
|
||||||
|
|
||||||
|
var profile = await _userProfileRepository.GetProfileByProfileIdAsync(pf.Id, AccessToken);
|
||||||
|
if (profile == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var govAge = (pf?.DateStart?.Date ?? DateTime.Now.Date).DiffDay(DateTime.Now.Date);
|
||||||
|
|
||||||
|
var leaveType = await _dbContext.Set<LeaveType>().FirstOrDefaultAsync(x => x.Id == typeId);
|
||||||
|
|
||||||
|
var data = beginningList.FirstOrDefault(x => x.ProfileId == pf.Id);
|
||||||
|
|
||||||
|
if (data == null)
|
||||||
|
{
|
||||||
|
var limit = 0.0;
|
||||||
|
|
||||||
|
var prev = await _dbContext.Set<LeaveBeginning>()
|
||||||
|
.Include(x => x.LeaveType)
|
||||||
|
.FirstOrDefaultAsync(x => x.LeaveYear == year - 1 && x.LeaveTypeId == typeId && x.ProfileId == pf.Id);
|
||||||
|
|
||||||
|
var prevRemain = 0.0;
|
||||||
|
if (prev != null)
|
||||||
|
{
|
||||||
|
prevRemain = prev.LeaveDays - (prev.LeaveDaysUsed ?? 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (govAge >= 180)
|
||||||
|
{
|
||||||
|
if (govAge >= 3650)
|
||||||
|
{
|
||||||
|
limit = 10 + prevRemain;
|
||||||
|
if (limit > 30) limit = 30;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
limit = 10 + prevRemain;
|
||||||
|
if (limit > 20) limit = 20;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
limit = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
data = new LeaveBeginning
|
||||||
|
{
|
||||||
|
LeaveYear = year,
|
||||||
|
LeaveTypeId = typeId,
|
||||||
|
ProfileId = pf.Id,
|
||||||
|
Prefix = pf.Prefix,
|
||||||
|
FirstName = pf.FirstName,
|
||||||
|
LastName = pf.LastName,
|
||||||
|
LeaveDaysUsed = 0,
|
||||||
|
LeaveDays = leaveType?.Code == "LV-005" ? limit : 0,
|
||||||
|
RootDnaId = profile.RootDnaId,
|
||||||
|
Child1DnaId = profile.Child1DnaId,
|
||||||
|
Child2DnaId = profile.Child2DnaId,
|
||||||
|
Child3DnaId = profile.Child3DnaId,
|
||||||
|
Child4DnaId = profile.Child4DnaId
|
||||||
|
};
|
||||||
|
|
||||||
|
updateList.Add(data);
|
||||||
|
}
|
||||||
|
result.Add(data);
|
||||||
|
}
|
||||||
|
if (!updateList.Any())
|
||||||
|
{
|
||||||
|
await _dbContext.Set<LeaveBeginning>().AddRangeAsync(updateList);
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ProfileData
|
||||||
|
{
|
||||||
|
public Guid Id { get; set; } = Guid.Empty;
|
||||||
|
|
||||||
|
public string Prefix { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string FirstName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string LastName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public DateTime? DateStart { get; set; } = null;
|
||||||
|
|
||||||
|
public DateTime? DateAppoint { get; set; } = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -9,6 +9,8 @@ using BMA.EHR.Domain.Shared;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Serilog;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
||||||
{
|
{
|
||||||
|
|
@ -72,7 +74,8 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
||||||
await base.AddAsync(entity);
|
await base.AddAsync(entity);
|
||||||
|
|
||||||
var userId = UserId != null ? Guid.Parse(UserId) : Guid.Empty;
|
var userId = UserId != null ? Guid.Parse(UserId) : Guid.Empty;
|
||||||
var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(userId, AccessToken ?? "");
|
// var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(userId, AccessToken ?? "");
|
||||||
|
var profile = await _userProfileRepository.GetProfileByKeycloakIdNew2Async(userId, AccessToken ?? "");
|
||||||
|
|
||||||
// fix issue : SIT ระบบบันทึกเวลาปฏิบัติงาน>>ลงเวลากรณีพิเศษ (ไม่มีแจ้งเตือนไปยังผู้บังคับบัญชา) #969
|
// fix issue : SIT ระบบบันทึกเวลาปฏิบัติงาน>>ลงเวลากรณีพิเศษ (ไม่มีแจ้งเตือนไปยังผู้บังคับบัญชา) #969
|
||||||
// send noti + inbox + mail
|
// send noti + inbox + mail
|
||||||
|
|
@ -142,6 +145,147 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<List<AdditionalCheckRequest>> GetAdditionalCheckRequestsByAdminRole(int year, int month, string role, string nodeId, int? node, string? keyword)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var data = await _dbContext.Set<AdditionalCheckRequest>().AsQueryable()
|
||||||
|
.Where(x => (x.CheckDate.Year == year && x.CheckDate.Month == month))
|
||||||
|
.OrderByDescending(x => x.CreatedAt.Date)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(keyword))
|
||||||
|
{
|
||||||
|
data = data.Where(x =>
|
||||||
|
(
|
||||||
|
(x.Prefix ?? "") + (x.FirstName ?? "") + " " + (x.LastName ?? "")).Contains(keyword)
|
||||||
|
|| x.Description.Contains(keyword)
|
||||||
|
|
||||||
|
).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (role == "OWNER")
|
||||||
|
{
|
||||||
|
node = null;
|
||||||
|
}
|
||||||
|
if (role == "OWNER" || role == "CHILD")
|
||||||
|
{
|
||||||
|
data = data
|
||||||
|
.Where(x => node == 4 ? x.Child4DnaId == Guid.Parse(nodeId!) : (node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) : (node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) : (node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) : (node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) : (node == null ? true : true))))))
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
else if (role == "BROTHER")
|
||||||
|
{
|
||||||
|
data = data
|
||||||
|
.Where(x => node == 4 ? x.Child3DnaId == Guid.Parse(nodeId!) : (node == 3 ? x.Child2DnaId == Guid.Parse(nodeId!) : (node == 2 ? x.Child1DnaId == Guid.Parse(nodeId!) : (node == 1 || node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) : (node == null ? true : true)))))
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
else if (role == "ROOT")
|
||||||
|
{
|
||||||
|
data = data
|
||||||
|
.Where(x => x.RootDnaId == Guid.Parse(nodeId!)).ToList();
|
||||||
|
}
|
||||||
|
// else if (role == "PARENT")
|
||||||
|
// {
|
||||||
|
// data = data
|
||||||
|
// .Where(x => x.RootDnaId == Guid.Parse(nodeId!) && x.Child1DnaId != null && x.Child1DnaId != Guid.Empty).ToList();
|
||||||
|
// }
|
||||||
|
else if (role == "NORMAL")
|
||||||
|
{
|
||||||
|
data = data.Where(x =>
|
||||||
|
node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) &&
|
||||||
|
(x.Child1DnaId == Guid.Empty || x.Child1DnaId == null) :
|
||||||
|
node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) &&
|
||||||
|
(x.Child2DnaId == Guid.Empty || x.Child2DnaId == null) :
|
||||||
|
node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) &&
|
||||||
|
(x.Child3DnaId == Guid.Empty || x.Child3DnaId == null) :
|
||||||
|
node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) &&
|
||||||
|
(x.Child4DnaId == Guid.Empty || x.Child4DnaId == null) :
|
||||||
|
node == 4 ? x.Child4DnaId == Guid.Parse(nodeId!) :
|
||||||
|
true
|
||||||
|
).ToList();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<AdditionalCheckRequest>> GetAdditionalCheckRequestsByAdminRole2(DateTime startDate, DateTime endDate, string role, string nodeId, int? node, string? keyword, string? status)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var data = await _dbContext.Set<AdditionalCheckRequest>().AsQueryable()
|
||||||
|
.Where(x => (x.CheckDate.Date >= startDate.Date && x.CheckDate.Date <= endDate.Date))
|
||||||
|
.OrderByDescending(x => x.CreatedAt.Date)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
if(!string.IsNullOrEmpty(status))
|
||||||
|
data = data.Where(x => x.Status == status).ToList();
|
||||||
|
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(keyword))
|
||||||
|
{
|
||||||
|
data = data.Where(x =>
|
||||||
|
(
|
||||||
|
(x.Prefix ?? "") + (x.FirstName ?? "") + " " + (x.LastName ?? "")).Contains(keyword)
|
||||||
|
|| x.Description.Contains(keyword)
|
||||||
|
|
||||||
|
).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (role == "OWNER")
|
||||||
|
{
|
||||||
|
node = null;
|
||||||
|
}
|
||||||
|
if (role == "OWNER" || role == "CHILD")
|
||||||
|
{
|
||||||
|
data = data
|
||||||
|
.Where(x => node == 4 ? x.Child4DnaId == Guid.Parse(nodeId!) : (node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) : (node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) : (node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) : (node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) : (node == null ? true : true))))))
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
else if (role == "BROTHER")
|
||||||
|
{
|
||||||
|
data = data
|
||||||
|
.Where(x => node == 4 ? x.Child3DnaId == Guid.Parse(nodeId!) : (node == 3 ? x.Child2DnaId == Guid.Parse(nodeId!) : (node == 2 ? x.Child1DnaId == Guid.Parse(nodeId!) : (node == 1 || node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) : (node == null ? true : true)))))
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
else if (role == "ROOT")
|
||||||
|
{
|
||||||
|
data = data
|
||||||
|
.Where(x => x.RootDnaId == Guid.Parse(nodeId!)).ToList();
|
||||||
|
}
|
||||||
|
// else if (role == "PARENT")
|
||||||
|
// {
|
||||||
|
// data = data
|
||||||
|
// .Where(x => x.RootDnaId == Guid.Parse(nodeId!) && x.Child1DnaId != null && x.Child1DnaId != Guid.Empty).ToList();
|
||||||
|
// }
|
||||||
|
else if (role == "NORMAL")
|
||||||
|
{
|
||||||
|
data = data.Where(x =>
|
||||||
|
node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) &&
|
||||||
|
(x.Child1DnaId == Guid.Empty || x.Child1DnaId == null) :
|
||||||
|
node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) &&
|
||||||
|
(x.Child2DnaId == Guid.Empty || x.Child2DnaId == null) :
|
||||||
|
node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) &&
|
||||||
|
(x.Child3DnaId == Guid.Empty || x.Child3DnaId == null) :
|
||||||
|
node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) &&
|
||||||
|
(x.Child4DnaId == Guid.Empty || x.Child4DnaId == null) :
|
||||||
|
node == 4 ? x.Child4DnaId == Guid.Parse(nodeId!) :
|
||||||
|
true
|
||||||
|
).ToList();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,191 @@
|
||||||
|
using BMA.EHR.Application.Common.Interfaces;
|
||||||
|
using BMA.EHR.Domain.Models.Leave.TimeAttendants;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
||||||
|
{
|
||||||
|
public class CheckInJobStatusRepository : GenericLeaveRepository<Guid, CheckInJobStatus>
|
||||||
|
{
|
||||||
|
#region " Fields "
|
||||||
|
|
||||||
|
private readonly ILeaveDbContext _dbContext;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region " Constructor and Destructor "
|
||||||
|
|
||||||
|
public CheckInJobStatusRepository(ILeaveDbContext dbContext,
|
||||||
|
IHttpContextAccessor httpContextAccessor) : base(dbContext, httpContextAccessor)
|
||||||
|
{
|
||||||
|
_dbContext = dbContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region " Methods "
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ดึงข้อมูล Job Status จาก TaskId
|
||||||
|
/// </summary>
|
||||||
|
public async Task<CheckInJobStatus?> GetByTaskIdAsync(Guid taskId)
|
||||||
|
{
|
||||||
|
var data = await _dbContext.Set<CheckInJobStatus>()
|
||||||
|
.Where(x => x.TaskId == taskId)
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ดึงข้อมูล Job Status จาก UserId และสถานะ
|
||||||
|
/// </summary>
|
||||||
|
public async Task<List<CheckInJobStatus>> GetByUserIdAndStatusAsync(Guid userId, string status)
|
||||||
|
{
|
||||||
|
var data = await _dbContext.Set<CheckInJobStatus>()
|
||||||
|
.Where(x => x.KeycloakUserId == userId && x.Status == status)
|
||||||
|
.OrderByDescending(x => x.CreatedDate)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ดึงข้อมูล Job Status ที่ยัง pending หรือ processing
|
||||||
|
/// </summary>
|
||||||
|
public async Task<List<CheckInJobStatus>> GetPendingOrProcessingJobsAsync(Guid userId)
|
||||||
|
{
|
||||||
|
var data = await _dbContext.Set<CheckInJobStatus>()
|
||||||
|
.Where(x => x.KeycloakUserId == userId &&
|
||||||
|
(x.Status == "PENDING" || x.Status == "PROCESSING"))
|
||||||
|
//.OrderByDescending(x => x.CreatedDate)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// อัปเดตสถานะเป็น Processing
|
||||||
|
/// </summary>
|
||||||
|
public async Task<CheckInJobStatus> UpdateToProcessingAsync(Guid taskId)
|
||||||
|
{
|
||||||
|
var job = await GetByTaskIdAsync(taskId);
|
||||||
|
if (job != null)
|
||||||
|
{
|
||||||
|
job.Status = "PROCESSING";
|
||||||
|
job.ProcessingDate = DateTime.Now;
|
||||||
|
await UpdateAsync(job);
|
||||||
|
}
|
||||||
|
return job!;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// อัปเดตสถานะเป็น Completed
|
||||||
|
/// </summary>
|
||||||
|
public async Task<CheckInJobStatus> UpdateToCompletedAsync(Guid taskId, string? additionalData = null)
|
||||||
|
{
|
||||||
|
var job = await GetByTaskIdAsync(taskId);
|
||||||
|
if (job != null)
|
||||||
|
{
|
||||||
|
job.Status = "COMPLETED";
|
||||||
|
job.CompletedDate = DateTime.Now;
|
||||||
|
if (!string.IsNullOrEmpty(additionalData))
|
||||||
|
{
|
||||||
|
job.AdditionalData = additionalData;
|
||||||
|
}
|
||||||
|
await UpdateAsync(job);
|
||||||
|
}
|
||||||
|
return job!;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// อัปเดตสถานะเป็น Failed
|
||||||
|
/// </summary>
|
||||||
|
public async Task<CheckInJobStatus> UpdateToFailedAsync(Guid taskId, string errorMessage)
|
||||||
|
{
|
||||||
|
var job = await GetByTaskIdAsync(taskId);
|
||||||
|
if (job != null)
|
||||||
|
{
|
||||||
|
job.Status = "FAILED";
|
||||||
|
job.CompletedDate = DateTime.Now;
|
||||||
|
job.ErrorMessage = errorMessage;
|
||||||
|
await UpdateAsync(job);
|
||||||
|
}
|
||||||
|
return job!;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ดึงข้อมูลงานที่ค้างอยู่ในสถานะ PENDING หรือ PROCESSING เกินเวลาที่กำหนด (นาที)
|
||||||
|
/// </summary>
|
||||||
|
public async Task<List<CheckInJobStatus>> GetStalePendingOrProcessingJobsAsync(int timeoutMinutes = 30)
|
||||||
|
{
|
||||||
|
//var cutoffDate = DateTime.Now.AddMinutes(-timeoutMinutes);
|
||||||
|
var cutoffDate = DateTime.Now.AddMinutes(-timeoutMinutes);
|
||||||
|
var staleJobs = await _dbContext.Set<CheckInJobStatus>()
|
||||||
|
.Where(x => (x.Status == "PENDING" || x.Status == "PROCESSING")
|
||||||
|
&& x.CreatedDate <= cutoffDate)
|
||||||
|
.OrderBy(x => x.CreatedDate)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
return staleJobs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ดึงข้อมูลงานที่ค้างอยู่ในสถานะ PENDING หรือ PROCESSING เกินเวลาที่กำหนด (นาที) ของ user คนใดคนหนึ่ง
|
||||||
|
/// </summary>
|
||||||
|
public async Task<List<CheckInJobStatus>> GetStalePendingOrProcessingJobsByUserAsync(Guid userId, int timeoutMinutes = 30)
|
||||||
|
{
|
||||||
|
var cutoffDate = DateTime.Now.AddMinutes(-timeoutMinutes);
|
||||||
|
//var cutoffDate = new DateTime(2026, 5, 28, 23, 59, 59);
|
||||||
|
var staleJobs = await _dbContext.Set<CheckInJobStatus>()
|
||||||
|
.Where(x => x.KeycloakUserId == userId
|
||||||
|
&& (x.Status == "PENDING" || x.Status == "PROCESSING")
|
||||||
|
&& x.CreatedDate < cutoffDate)
|
||||||
|
.OrderBy(x => x.CreatedDate)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
return staleJobs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Mark งานที่ค้างเกินเวลาที่กำหนดเป็น FAILED
|
||||||
|
/// </summary>
|
||||||
|
public async Task<int> MarkStaleJobsAsFailedAsync(int timeoutMinutes = 30)
|
||||||
|
{
|
||||||
|
var staleJobs = await GetStalePendingOrProcessingJobsAsync(timeoutMinutes);
|
||||||
|
|
||||||
|
foreach (var job in staleJobs)
|
||||||
|
{
|
||||||
|
job.Status = "FAILED";
|
||||||
|
job.CompletedDate = DateTime.Now;
|
||||||
|
job.ErrorMessage = $"งานค้างในสถานะ {job.Status} เกิน {timeoutMinutes} นาที ระบบทำเครื่องหมายเป็น FAILED อัตโนมัติ";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (staleJobs.Any())
|
||||||
|
{
|
||||||
|
_dbContext.Set<CheckInJobStatus>().UpdateRange(staleJobs);
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
return staleJobs.Count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ล้างข้อมูล Job Status ที่เก่าเกิน X วัน
|
||||||
|
/// </summary>
|
||||||
|
public async Task<int> CleanupOldJobsAsync(int daysOld = 30)
|
||||||
|
{
|
||||||
|
var cutoffDate = DateTime.Now.AddDays(-daysOld);
|
||||||
|
var oldJobs = await _dbContext.Set<CheckInJobStatus>()
|
||||||
|
.Where(x => x.CreatedDate < cutoffDate)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
_dbContext.Set<CheckInJobStatus>().RemoveRange(oldJobs);
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
|
||||||
|
return oldJobs.Count;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -61,9 +61,12 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
||||||
return await _dbContext.Set<DutyTime>().Where(x => x.IsActive).ToListAsync();
|
return await _dbContext.Set<DutyTime>().Where(x => x.IsActive).ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<DutyTime?> GetDefaultAsync()
|
public async Task<DutyTime?> GetDefaultAsync(CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
return await _dbContext.Set<DutyTime>().Where(x => x.IsDefault).FirstOrDefaultAsync();
|
// กำหนด timeout เป็น 30 นาที
|
||||||
|
using var timeoutCts = new CancellationTokenSource(TimeSpan.FromMinutes(30));
|
||||||
|
using var combinedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token);
|
||||||
|
return await _dbContext.Set<DutyTime>().Where(x => x.IsDefault).FirstOrDefaultAsync(combinedCts.Token);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,795 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.IO;
|
||||||
|
using BMA.EHR.Application.Common.Interfaces;
|
||||||
|
using BMA.EHR.Application.Repositories.Leaves.LeaveRequests;
|
||||||
|
using BMA.EHR.Application.Repositories.MetaData;
|
||||||
|
using BMA.EHR.Application.Responses.Profiles;
|
||||||
|
using BMA.EHR.Domain.Extensions;
|
||||||
|
using BMA.EHR.Domain.Models.Leave.TimeAttendants;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
||||||
|
{
|
||||||
|
public class LeaveProcessJobStatusRepository: GenericLeaveRepository<Guid, LeaveProcessJobStatus>
|
||||||
|
{
|
||||||
|
#region " Fields "
|
||||||
|
|
||||||
|
private readonly ILeaveDbContext _dbContext;
|
||||||
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
private readonly UserProfileRepository _userProfileRepository;
|
||||||
|
private readonly HolidayRepository _holidayRepository;
|
||||||
|
private readonly DutyTimeRepository _dutyTimeRepository;
|
||||||
|
private readonly UserDutyTimeRepository _userDutyTimeRepository;
|
||||||
|
private readonly ProcessUserTimeStampRepository _processUserTimeStampRepository;
|
||||||
|
private readonly LeaveRequestRepository _leaveRequestRepository;
|
||||||
|
private readonly IConfiguration _configuration;
|
||||||
|
private readonly IWebHostEnvironment _env;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region " Constructor and Destructor "
|
||||||
|
|
||||||
|
public LeaveProcessJobStatusRepository(ILeaveDbContext dbContext,
|
||||||
|
IHttpContextAccessor httpContextAccessor,
|
||||||
|
UserProfileRepository userProfileRepository,
|
||||||
|
HolidayRepository holidayRepository,
|
||||||
|
DutyTimeRepository dutyTimeRepository,
|
||||||
|
UserDutyTimeRepository userDutyTimeRepository,
|
||||||
|
ProcessUserTimeStampRepository processUserTimeStampRepository,
|
||||||
|
LeaveRequestRepository leaveRequestRepository,
|
||||||
|
IConfiguration configuration,
|
||||||
|
IWebHostEnvironment env) : base(dbContext, httpContextAccessor)
|
||||||
|
{
|
||||||
|
_dbContext = dbContext;
|
||||||
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
_userProfileRepository = userProfileRepository;
|
||||||
|
_holidayRepository = holidayRepository;
|
||||||
|
_configuration = configuration;
|
||||||
|
_leaveRequestRepository = leaveRequestRepository;
|
||||||
|
_dutyTimeRepository = dutyTimeRepository;
|
||||||
|
_userDutyTimeRepository = userDutyTimeRepository;
|
||||||
|
_processUserTimeStampRepository = processUserTimeStampRepository;
|
||||||
|
_env = env;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region " Methods "
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ดึงข้อมูล Job Status จาก TaskId
|
||||||
|
/// </summary>
|
||||||
|
public async Task<LeaveProcessJobStatus?> GetByTaskIdAsync(Guid id)
|
||||||
|
{
|
||||||
|
var data = await _dbContext.Set<LeaveProcessJobStatus>()
|
||||||
|
.Where(x => x.Id == id)
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ดึงข้อมูล Job Status จาก UserId และสถานะ
|
||||||
|
/// </summary>
|
||||||
|
public async Task<List<LeaveProcessJobStatus>> GetByUserIdAndStatusAsync(Guid userId, string status)
|
||||||
|
{
|
||||||
|
var data = await _dbContext.Set<LeaveProcessJobStatus>()
|
||||||
|
.Where(x => x.CreatedUserId == userId.ToString("D") && x.Status == status)
|
||||||
|
.OrderByDescending(x => x.CreatedDate)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ดึงข้อมูล Job Status จาก UserId
|
||||||
|
/// </summary>
|
||||||
|
public async Task<List<LeaveProcessJobStatus>> GetByUserIdAsync(Guid userId)
|
||||||
|
{
|
||||||
|
var data = await _dbContext.Set<LeaveProcessJobStatus>()
|
||||||
|
.Where(x => x.CreatedUserId == userId.ToString("D"))
|
||||||
|
.OrderByDescending(x => x.CreatedDate)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ดึงข้อมูล Job Status ที่ยัง pending หรือ processing
|
||||||
|
/// </summary>
|
||||||
|
public async Task<List<LeaveProcessJobStatus>> GetPendingOrProcessingJobsAsync(Guid userId)
|
||||||
|
{
|
||||||
|
var data = await _dbContext.Set<LeaveProcessJobStatus>()
|
||||||
|
.Where(x => x.CreatedUserId == userId.ToString("D") &&
|
||||||
|
(x.Status == "PENDING" || x.Status == "PROCESSING"))
|
||||||
|
//.OrderByDescending(x => x.CreatedDate)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<LeaveProcessJobStatus>> GetPendingJobsAsync()
|
||||||
|
{
|
||||||
|
var data = await _dbContext.Set<LeaveProcessJobStatus>()
|
||||||
|
.Where(x => x.Status == "PENDING")
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// อัปเดตสถานะเป็น Processing
|
||||||
|
/// </summary>
|
||||||
|
public async Task<LeaveProcessJobStatus> UpdateToProcessingAsync(Guid id)
|
||||||
|
{
|
||||||
|
var job = await GetByTaskIdAsync(id);
|
||||||
|
if (job != null)
|
||||||
|
{
|
||||||
|
job.Status = "PROCESSING";
|
||||||
|
job.ProcessingDate = DateTime.Now;
|
||||||
|
await UpdateAsync(job);
|
||||||
|
}
|
||||||
|
return job!;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// อัปเดตสถานะเป็น Completed
|
||||||
|
/// </summary>
|
||||||
|
public async Task<LeaveProcessJobStatus> UpdateToCompletedAsync(Guid id, string? additionalData = null)
|
||||||
|
{
|
||||||
|
var job = await GetByTaskIdAsync(id);
|
||||||
|
if (job != null)
|
||||||
|
{
|
||||||
|
job.Status = "COMPLETED";
|
||||||
|
job.CompletedDate = DateTime.Now;
|
||||||
|
await UpdateAsync(job);
|
||||||
|
}
|
||||||
|
return job!;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// อัปเดตสถานะเป็น Failed
|
||||||
|
/// </summary>
|
||||||
|
public async Task<LeaveProcessJobStatus> UpdateToFailedAsync(Guid id, string errorMessage)
|
||||||
|
{
|
||||||
|
var job = await GetByTaskIdAsync(id);
|
||||||
|
if (job != null)
|
||||||
|
{
|
||||||
|
job.Status = "FAILED";
|
||||||
|
job.CompletedDate = DateTime.Now;
|
||||||
|
job.ErrorMessage = errorMessage;
|
||||||
|
await UpdateAsync(job);
|
||||||
|
}
|
||||||
|
return job!;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task ProcessTaskAsync(Guid rootDnaId, DateTime? startDate, DateTime? endDate)
|
||||||
|
{
|
||||||
|
|
||||||
|
var profiles = new List<GetProfileByKeycloakIdRootDto>();
|
||||||
|
var dateStart = startDate?.Date ?? DateTime.Now.Date;
|
||||||
|
var dateEnd = endDate?.Date ?? DateTime.Now.Date;
|
||||||
|
|
||||||
|
var holidays = await _holidayRepository.GetHolidayAsync(dateStart, dateEnd);
|
||||||
|
var weekend = _holidayRepository.GetWeekEnd(dateStart, dateEnd);
|
||||||
|
var excludeDates = holidays.Union(weekend).ToList();
|
||||||
|
|
||||||
|
var dateList = new List<LoopDate>();
|
||||||
|
for (DateTime i = dateStart; i <= dateEnd; i = i.AddDays(1))
|
||||||
|
{
|
||||||
|
if (holidays.Contains(i))
|
||||||
|
{
|
||||||
|
var d = await _holidayRepository.GetHolidayAsync(i);
|
||||||
|
dateList.Add(new LoopDate
|
||||||
|
{
|
||||||
|
date = i,
|
||||||
|
isHoliday = true,
|
||||||
|
isWeekEnd = false,
|
||||||
|
dateRemark = d
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (weekend.Contains(i))
|
||||||
|
{
|
||||||
|
dateList.Add(new LoopDate
|
||||||
|
{
|
||||||
|
date = i,
|
||||||
|
isHoliday = true,
|
||||||
|
isWeekEnd = false,
|
||||||
|
dateRemark = "วันหยุด"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dateList.Add(new LoopDate
|
||||||
|
{
|
||||||
|
date = i,
|
||||||
|
isHoliday = false,
|
||||||
|
isWeekEnd = false,
|
||||||
|
dateRemark = ""
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var defaultRound = await _dutyTimeRepository.GetDefaultAsync();
|
||||||
|
if (defaultRound == null)
|
||||||
|
{
|
||||||
|
throw new Exception("ไม่พบรอบการลงเวลา Default");
|
||||||
|
}
|
||||||
|
|
||||||
|
var employees = new List<DateResultReport>();
|
||||||
|
|
||||||
|
foreach (var dd in dateList.Where(x => !x.isHoliday && !x.isWeekEnd))
|
||||||
|
{
|
||||||
|
profiles = await _userProfileRepository.GetAllOfficerByRootDnaId(rootDnaId.ToString(),dd.date);
|
||||||
|
foreach (var p in profiles)
|
||||||
|
{
|
||||||
|
var count = 1;
|
||||||
|
var keycloakUserId = p.Keycloak ?? Guid.Empty;
|
||||||
|
|
||||||
|
var timeStamps = await _processUserTimeStampRepository.GetTimestampByDateAsync(keycloakUserId, dd.date);
|
||||||
|
|
||||||
|
var fullName = $"{p.Prefix}{p.FirstName} {p.LastName}";
|
||||||
|
|
||||||
|
var effectiveDate = await _userDutyTimeRepository.GetLastEffectRound(p.Id, dd.date);
|
||||||
|
var roundId = effectiveDate != null ? effectiveDate.DutyTimeId : Guid.Empty;
|
||||||
|
var userRound = await _dutyTimeRepository.GetByIdAsync(roundId);
|
||||||
|
|
||||||
|
var duty = userRound ?? defaultRound;
|
||||||
|
|
||||||
|
// check วันลาของแต่ละคน
|
||||||
|
var leaveReq = await _leaveRequestRepository.GetLeavePeriodAsync(keycloakUserId, dd.date);
|
||||||
|
var remarkStr = string.Empty;
|
||||||
|
var status = string.Empty;
|
||||||
|
var stampType = string.Empty;
|
||||||
|
var stampAmount = 0.0;
|
||||||
|
|
||||||
|
if (leaveReq != null)
|
||||||
|
{
|
||||||
|
switch (leaveReq.Type.Code.ToUpper())
|
||||||
|
{
|
||||||
|
case "LV-001":
|
||||||
|
case "LV-002":
|
||||||
|
case "LV-005":
|
||||||
|
remarkStr += leaveReq.Type.Name;
|
||||||
|
var leaveRange = leaveReq.LeaveRange == null ? "" : leaveReq.LeaveRange.ToUpper();
|
||||||
|
|
||||||
|
if(leaveReq.LeaveStartDate.Date == leaveReq.LeaveEndDate.Date)
|
||||||
|
{
|
||||||
|
if (leaveRange == "MORNING")
|
||||||
|
remarkStr += "ครึ่งวันเช้า";
|
||||||
|
else if (leaveRange == "AFTERNOON")
|
||||||
|
remarkStr += "ครึ่งวันบ่าย";
|
||||||
|
|
||||||
|
|
||||||
|
// var leaveRangeEnd = leaveReq.LeaveRangeEnd == null ? "" : leaveReq.LeaveRangeEnd.ToUpper();
|
||||||
|
// if (leaveRangeEnd == "MORNING")
|
||||||
|
// remarkStr += "ครึ่งวันเช้า";
|
||||||
|
// else if (leaveRangeEnd == "AFTERNOON")
|
||||||
|
// remarkStr += "ครึ่งวันบ่าย";
|
||||||
|
|
||||||
|
var leaveRangeEnd = leaveReq.LeaveRangeEnd == null ? "" : leaveReq.LeaveRangeEnd.ToUpper();
|
||||||
|
if (leaveRange != leaveRangeEnd)
|
||||||
|
{
|
||||||
|
if (leaveRangeEnd == "MORNING")
|
||||||
|
remarkStr += " - ครึ่งวันเช้า";
|
||||||
|
else if (leaveRangeEnd == "AFTERNOON")
|
||||||
|
remarkStr += " - ครึ่งวันบ่าย";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(dd.date == leaveReq.LeaveStartDate.Date)
|
||||||
|
{
|
||||||
|
if (leaveRange == "MORNING")
|
||||||
|
remarkStr += "ครึ่งวันเช้า";
|
||||||
|
else if (leaveRange == "AFTERNOON")
|
||||||
|
remarkStr += "ครึ่งวันบ่าย";
|
||||||
|
}
|
||||||
|
else if(dd.date == leaveReq.LeaveEndDate.Date)
|
||||||
|
{
|
||||||
|
var leaveRangeEnd = leaveReq.LeaveRangeEnd == null ? "" : leaveReq.LeaveRangeEnd.ToUpper();
|
||||||
|
if (leaveRangeEnd == "MORNING")
|
||||||
|
remarkStr += "ครึ่งวันเช้า";
|
||||||
|
else if (leaveRangeEnd == "AFTERNOON")
|
||||||
|
remarkStr += "ครึ่งวันบ่าย";
|
||||||
|
else
|
||||||
|
remarkStr += "เต็มวัน";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
remarkStr += "เต็มวัน";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
remarkStr += leaveReq.Type.Name;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
status = "LEAVE";
|
||||||
|
if(leaveReq.LeaveStartDate.Date == dd.date)
|
||||||
|
{
|
||||||
|
stampType = leaveReq.LeaveRange ?? "";
|
||||||
|
stampAmount = leaveReq.LeaveRange != "ALL" ? 0.5 : 1;
|
||||||
|
}
|
||||||
|
else if(leaveReq.LeaveEndDate.Date == dd.date)
|
||||||
|
{
|
||||||
|
stampAmount = leaveReq.LeaveRangeEnd != "ALL" ? 0.5 : 1;
|
||||||
|
stampType = leaveReq.LeaveRangeEnd ?? "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
stampAmount = leaveReq.LeaveRange != "ALL" || leaveReq.LeaveRangeEnd != "ALL" ? 0.5 : 1;
|
||||||
|
if(stampType == "ALL") stampType = "FULL_DAY";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (timeStamps == null)
|
||||||
|
{
|
||||||
|
if (dd.date <= DateTime.Now.Date)
|
||||||
|
{
|
||||||
|
remarkStr = "ขาดราชการ";
|
||||||
|
status = "ABSENT";
|
||||||
|
stampType = "FULL_DAY";
|
||||||
|
stampAmount = 1;
|
||||||
|
if (dd.isHoliday == true)
|
||||||
|
{
|
||||||
|
remarkStr = $"วันหยุด ({dd.dateRemark})";
|
||||||
|
status = "HOLIDAY";
|
||||||
|
}
|
||||||
|
else if (dd.isWeekEnd)
|
||||||
|
{
|
||||||
|
remarkStr = dd.dateRemark;
|
||||||
|
status = "WEEKEND";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else remarkStr = "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// check status ของการลงเวลา
|
||||||
|
if (timeStamps.CheckOut != null)
|
||||||
|
{
|
||||||
|
if (timeStamps.CheckOutStatus == "ABSENT")
|
||||||
|
{
|
||||||
|
remarkStr = "ขาดราชการ" + (!timeStamps.IsLocationCheckOut ? $" (นอกสถานที่:{timeStamps.CheckOutLocationName})".Trim() : "");
|
||||||
|
status = "ABSENT";
|
||||||
|
stampType = "FULL_DAY";
|
||||||
|
stampAmount = 1;
|
||||||
|
}
|
||||||
|
else if (timeStamps.CheckInStatus == "ABSENT")
|
||||||
|
{
|
||||||
|
remarkStr = "ขาดราชการ" + (!timeStamps.IsLocationCheckIn ? $" (นอกสถานที่:{timeStamps.CheckInLocationName})".Trim() : "");
|
||||||
|
status = "ABSENT";
|
||||||
|
stampType = "FULL_DAY";
|
||||||
|
stampAmount = 1;
|
||||||
|
}
|
||||||
|
else if (timeStamps.CheckInStatus == "LATE")
|
||||||
|
{
|
||||||
|
remarkStr = "สาย" + (!timeStamps.IsLocationCheckIn ? $" (นอกสถานที่:{timeStamps.CheckInLocationName})".Trim() : "");
|
||||||
|
status = "LATE";
|
||||||
|
stampType = "FULL_DAY";
|
||||||
|
stampAmount = 1;
|
||||||
|
//lateTotal += 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
remarkStr = !timeStamps.IsLocationCheckIn ? $" นอกสถานที่:{timeStamps.CheckInLocationName}".Trim() : "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (timeStamps.CheckInStatus == "ABSENT")
|
||||||
|
{
|
||||||
|
status = "ABSENT";
|
||||||
|
stampType = "FULL_DAY";
|
||||||
|
stampAmount = 1;
|
||||||
|
remarkStr = "ขาดราชการ" + (!timeStamps.IsLocationCheckIn ? $" (นอกสถานที่:{timeStamps.CheckInLocationName})".Trim() : "");
|
||||||
|
}
|
||||||
|
else if (timeStamps.CheckInStatus == "LATE")
|
||||||
|
{
|
||||||
|
status = "LATE";
|
||||||
|
stampType = "FULL_DAY";
|
||||||
|
stampAmount = 1;
|
||||||
|
remarkStr = "สาย" + (!timeStamps.IsLocationCheckIn ? $" (นอกสถานที่:{timeStamps.CheckInLocationName})".Trim() : "");
|
||||||
|
//lateTotal += 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
remarkStr = !timeStamps.IsLocationCheckIn ? $" นอกสถานที่:{timeStamps.CheckInLocationName}".Trim() : "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var emp = new DateResultReport
|
||||||
|
{
|
||||||
|
profileId = p.Id.ToString(),
|
||||||
|
stampDate = dd.date,
|
||||||
|
stampType = stampType,
|
||||||
|
stampAmount = stampAmount,
|
||||||
|
remark = remarkStr,
|
||||||
|
status = status
|
||||||
|
};
|
||||||
|
|
||||||
|
employees.Add(emp);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write employees to JSON file
|
||||||
|
// var fileName = $"employees_{DateTime.Now:yyyyMMdd_HHmmss}.txt";
|
||||||
|
// var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Exports", fileName);
|
||||||
|
|
||||||
|
// // Ensure directory exists
|
||||||
|
// var directory = Path.GetDirectoryName(filePath);
|
||||||
|
// if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory))
|
||||||
|
// {
|
||||||
|
// Directory.CreateDirectory(directory);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// var jsonOptions = new JsonSerializerOptions
|
||||||
|
// {
|
||||||
|
// WriteIndented = true,
|
||||||
|
// Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping
|
||||||
|
// };
|
||||||
|
|
||||||
|
// var jsonContent = JsonSerializer.Serialize(employees, jsonOptions);
|
||||||
|
// await File.WriteAllTextAsync(filePath, jsonContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
//call api
|
||||||
|
var apiPath = $"{_configuration["API"]}/org/unauthorize/profile/absent-late/batch";
|
||||||
|
var apiKey = _configuration["API_KEY"];
|
||||||
|
var body = new
|
||||||
|
{
|
||||||
|
records = employees.Where(x => x.status == "ABSENT" || x.status == "LATE").ToList()
|
||||||
|
};
|
||||||
|
|
||||||
|
var apiResult = await PostExternalAPIAsync(apiPath, AccessToken ?? "", body, apiKey);
|
||||||
|
if(apiResult == "")
|
||||||
|
{
|
||||||
|
throw new Exception($"เรียก API {apiPath} ไม่สำเร็จ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task ProcessEmpTaskAsync(Guid rootDnaId, DateTime? startDate, DateTime? endDate)
|
||||||
|
{
|
||||||
|
|
||||||
|
var profiles = new List<GetProfileByKeycloakIdRootDto>();
|
||||||
|
var dateStart = startDate?.Date ?? DateTime.Now.Date;
|
||||||
|
var dateEnd = endDate?.Date ?? DateTime.Now.Date;
|
||||||
|
|
||||||
|
var holidays = await _holidayRepository.GetHolidayAsync(dateStart, dateEnd);
|
||||||
|
var weekend = _holidayRepository.GetWeekEnd(dateStart, dateEnd);
|
||||||
|
var excludeDates = holidays.Union(weekend).ToList();
|
||||||
|
|
||||||
|
var dateList = new List<LoopDate>();
|
||||||
|
for (DateTime i = dateStart; i <= dateEnd; i = i.AddDays(1))
|
||||||
|
{
|
||||||
|
if (holidays.Contains(i))
|
||||||
|
{
|
||||||
|
var d = await _holidayRepository.GetHolidayAsync(i);
|
||||||
|
dateList.Add(new LoopDate
|
||||||
|
{
|
||||||
|
date = i,
|
||||||
|
isHoliday = true,
|
||||||
|
isWeekEnd = false,
|
||||||
|
dateRemark = d
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (weekend.Contains(i))
|
||||||
|
{
|
||||||
|
dateList.Add(new LoopDate
|
||||||
|
{
|
||||||
|
date = i,
|
||||||
|
isHoliday = true,
|
||||||
|
isWeekEnd = false,
|
||||||
|
dateRemark = "วันหยุด"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dateList.Add(new LoopDate
|
||||||
|
{
|
||||||
|
date = i,
|
||||||
|
isHoliday = false,
|
||||||
|
isWeekEnd = false,
|
||||||
|
dateRemark = ""
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var defaultRound = await _dutyTimeRepository.GetDefaultAsync();
|
||||||
|
if (defaultRound == null)
|
||||||
|
{
|
||||||
|
throw new Exception("ไม่พบรอบการลงเวลา Default");
|
||||||
|
}
|
||||||
|
|
||||||
|
var employees = new List<DateResultReport>();
|
||||||
|
|
||||||
|
foreach (var dd in dateList.Where(x => !x.isHoliday && !x.isWeekEnd))
|
||||||
|
{
|
||||||
|
profiles = await _userProfileRepository.GetAllEmployeeByRootDnaId(rootDnaId.ToString(),dd.date);
|
||||||
|
foreach (var p in profiles)
|
||||||
|
{
|
||||||
|
var count = 1;
|
||||||
|
var keycloakUserId = p.Keycloak ?? Guid.Empty;
|
||||||
|
|
||||||
|
var timeStamps = await _processUserTimeStampRepository.GetTimestampByDateAsync(keycloakUserId, dd.date);
|
||||||
|
|
||||||
|
var fullName = $"{p.Prefix}{p.FirstName} {p.LastName}";
|
||||||
|
|
||||||
|
var effectiveDate = await _userDutyTimeRepository.GetLastEffectRound(p.Id, dd.date);
|
||||||
|
var roundId = effectiveDate != null ? effectiveDate.DutyTimeId : Guid.Empty;
|
||||||
|
var userRound = await _dutyTimeRepository.GetByIdAsync(roundId);
|
||||||
|
|
||||||
|
var duty = userRound ?? defaultRound;
|
||||||
|
|
||||||
|
// check วันลาของแต่ละคน
|
||||||
|
var leaveReq = await _leaveRequestRepository.GetLeavePeriodAsync(keycloakUserId, dd.date);
|
||||||
|
var remarkStr = string.Empty;
|
||||||
|
var status = string.Empty;
|
||||||
|
var stampType = string.Empty;
|
||||||
|
var stampAmount = 0.0;
|
||||||
|
|
||||||
|
if (leaveReq != null)
|
||||||
|
{
|
||||||
|
switch (leaveReq.Type.Code.ToUpper())
|
||||||
|
{
|
||||||
|
case "LV-001":
|
||||||
|
case "LV-002":
|
||||||
|
case "LV-005":
|
||||||
|
remarkStr += leaveReq.Type.Name;
|
||||||
|
var leaveRange = leaveReq.LeaveRange == null ? "" : leaveReq.LeaveRange.ToUpper();
|
||||||
|
|
||||||
|
if(leaveReq.LeaveStartDate.Date == leaveReq.LeaveEndDate.Date)
|
||||||
|
{
|
||||||
|
if (leaveRange == "MORNING")
|
||||||
|
remarkStr += "ครึ่งวันเช้า";
|
||||||
|
else if (leaveRange == "AFTERNOON")
|
||||||
|
remarkStr += "ครึ่งวันบ่าย";
|
||||||
|
|
||||||
|
|
||||||
|
// var leaveRangeEnd = leaveReq.LeaveRangeEnd == null ? "" : leaveReq.LeaveRangeEnd.ToUpper();
|
||||||
|
// if (leaveRangeEnd == "MORNING")
|
||||||
|
// remarkStr += "ครึ่งวันเช้า";
|
||||||
|
// else if (leaveRangeEnd == "AFTERNOON")
|
||||||
|
// remarkStr += "ครึ่งวันบ่าย";
|
||||||
|
|
||||||
|
var leaveRangeEnd = leaveReq.LeaveRangeEnd == null ? "" : leaveReq.LeaveRangeEnd.ToUpper();
|
||||||
|
if (leaveRange != leaveRangeEnd)
|
||||||
|
{
|
||||||
|
if (leaveRangeEnd == "MORNING")
|
||||||
|
remarkStr += " - ครึ่งวันเช้า";
|
||||||
|
else if (leaveRangeEnd == "AFTERNOON")
|
||||||
|
remarkStr += " - ครึ่งวันบ่าย";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(dd.date == leaveReq.LeaveStartDate.Date)
|
||||||
|
{
|
||||||
|
if (leaveRange == "MORNING")
|
||||||
|
remarkStr += "ครึ่งวันเช้า";
|
||||||
|
else if (leaveRange == "AFTERNOON")
|
||||||
|
remarkStr += "ครึ่งวันบ่าย";
|
||||||
|
}
|
||||||
|
else if(dd.date == leaveReq.LeaveEndDate.Date)
|
||||||
|
{
|
||||||
|
var leaveRangeEnd = leaveReq.LeaveRangeEnd == null ? "" : leaveReq.LeaveRangeEnd.ToUpper();
|
||||||
|
if (leaveRangeEnd == "MORNING")
|
||||||
|
remarkStr += "ครึ่งวันเช้า";
|
||||||
|
else if (leaveRangeEnd == "AFTERNOON")
|
||||||
|
remarkStr += "ครึ่งวันบ่าย";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
remarkStr += "เต็มวัน";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
remarkStr += leaveReq.Type.Name;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
status = "LEAVE";
|
||||||
|
if(leaveReq.LeaveStartDate.Date == dd.date)
|
||||||
|
{
|
||||||
|
stampType = leaveReq.LeaveRange ?? "";
|
||||||
|
stampAmount = leaveReq.LeaveRange != "ALL" ? 0.5 : 1;
|
||||||
|
}
|
||||||
|
else if(leaveReq.LeaveEndDate.Date == dd.date)
|
||||||
|
{
|
||||||
|
stampAmount = leaveReq.LeaveRangeEnd != "ALL" ? 0.5 : 1;
|
||||||
|
stampType = leaveReq.LeaveRangeEnd ?? "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
stampAmount = leaveReq.LeaveRange != "ALL" || leaveReq.LeaveRangeEnd != "ALL" ? 0.5 : 1;
|
||||||
|
if(stampType == "ALL") stampType = "FULL_DAY";
|
||||||
|
//stampAmount = leaveReq.LeaveRange != "ALL" || leaveReq.LeaveRangeEnd != "ALL" ? 0.5 : 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (timeStamps == null)
|
||||||
|
{
|
||||||
|
if (dd.date <= DateTime.Now.Date)
|
||||||
|
{
|
||||||
|
remarkStr = "ขาดราชการ";
|
||||||
|
status = "ABSENT";
|
||||||
|
stampType = "FULL_DAY";
|
||||||
|
stampAmount = 1;
|
||||||
|
if (dd.isHoliday == true)
|
||||||
|
{
|
||||||
|
remarkStr = $"วันหยุด ({dd.dateRemark})";
|
||||||
|
status = "HOLIDAY";
|
||||||
|
}
|
||||||
|
else if (dd.isWeekEnd)
|
||||||
|
{
|
||||||
|
remarkStr = dd.dateRemark;
|
||||||
|
status = "WEEKEND";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else remarkStr = "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// check status ของการลงเวลา
|
||||||
|
if (timeStamps.CheckOut != null)
|
||||||
|
{
|
||||||
|
if (timeStamps.CheckOutStatus == "ABSENT")
|
||||||
|
{
|
||||||
|
remarkStr = "ขาดราชการ" + (!timeStamps.IsLocationCheckOut ? $" (นอกสถานที่:{timeStamps.CheckOutLocationName})".Trim() : "");
|
||||||
|
status = "ABSENT";
|
||||||
|
stampType = "FULL_DAY";
|
||||||
|
stampAmount = 1;
|
||||||
|
}
|
||||||
|
else if (timeStamps.CheckInStatus == "ABSENT")
|
||||||
|
{
|
||||||
|
remarkStr = "ขาดราชการ" + (!timeStamps.IsLocationCheckIn ? $" (นอกสถานที่:{timeStamps.CheckInLocationName})".Trim() : "");
|
||||||
|
status = "ABSENT";
|
||||||
|
stampType = "FULL_DAY";
|
||||||
|
stampAmount = 1;
|
||||||
|
}
|
||||||
|
else if (timeStamps.CheckInStatus == "LATE")
|
||||||
|
{
|
||||||
|
remarkStr = "สาย" + (!timeStamps.IsLocationCheckIn ? $" (นอกสถานที่:{timeStamps.CheckInLocationName})".Trim() : "");
|
||||||
|
status = "LATE";
|
||||||
|
stampType = "FULL_DAY";
|
||||||
|
stampAmount = 1;
|
||||||
|
//lateTotal += 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
remarkStr = !timeStamps.IsLocationCheckIn ? $" นอกสถานที่:{timeStamps.CheckInLocationName}".Trim() : "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (timeStamps.CheckInStatus == "ABSENT")
|
||||||
|
{
|
||||||
|
status = "ABSENT";
|
||||||
|
stampType = "FULL_DAY";
|
||||||
|
stampAmount = 1;
|
||||||
|
remarkStr = "ขาดราชการ" + (!timeStamps.IsLocationCheckIn ? $" (นอกสถานที่:{timeStamps.CheckInLocationName})".Trim() : "");
|
||||||
|
}
|
||||||
|
else if (timeStamps.CheckInStatus == "LATE")
|
||||||
|
{
|
||||||
|
status = "LATE";
|
||||||
|
stampType = "FULL_DAY";
|
||||||
|
stampAmount = 1;
|
||||||
|
remarkStr = "สาย" + (!timeStamps.IsLocationCheckIn ? $" (นอกสถานที่:{timeStamps.CheckInLocationName})".Trim() : "");
|
||||||
|
//lateTotal += 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
remarkStr = !timeStamps.IsLocationCheckIn ? $" นอกสถานที่:{timeStamps.CheckInLocationName}".Trim() : "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var emp = new DateResultReport
|
||||||
|
{
|
||||||
|
profileId = p.Id.ToString(),
|
||||||
|
stampDate = dd.date,
|
||||||
|
stampType = stampType,
|
||||||
|
stampAmount = stampAmount,
|
||||||
|
remark = remarkStr,
|
||||||
|
status = status
|
||||||
|
};
|
||||||
|
|
||||||
|
employees.Add(emp);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write employees to JSON file
|
||||||
|
// var fileName = $"employees_{DateTime.Now:yyyyMMdd_HHmmss}.txt";
|
||||||
|
// var filePath = Path.Combine(_env.ContentRootPath, "Exports", fileName);
|
||||||
|
|
||||||
|
// // Ensure directory exists
|
||||||
|
// var directory = Path.GetDirectoryName(filePath);
|
||||||
|
// if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory))
|
||||||
|
// {
|
||||||
|
// Directory.CreateDirectory(directory);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// var jsonOptions = new JsonSerializerOptions
|
||||||
|
// {
|
||||||
|
// WriteIndented = true,
|
||||||
|
// Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping
|
||||||
|
// };
|
||||||
|
|
||||||
|
// var jsonContent = JsonSerializer.Serialize(employees, jsonOptions);
|
||||||
|
// Console.WriteLine($"Writing file to: {filePath}");
|
||||||
|
// await File.WriteAllTextAsync(filePath, jsonContent);
|
||||||
|
// Console.WriteLine($"File written successfully: {fileName}");
|
||||||
|
}
|
||||||
|
|
||||||
|
// call api
|
||||||
|
var apiPath = $"{_configuration["API"]}/org/unauthorize/profile-employee/absent-late/batch";
|
||||||
|
var apiKey = _configuration["API_KEY"];
|
||||||
|
var body = new
|
||||||
|
{
|
||||||
|
records = employees.Where(x => x.status == "ABSENT" || x.status == "LATE").ToList()
|
||||||
|
};
|
||||||
|
|
||||||
|
var apiResult = await PostExternalAPIAsync(apiPath, AccessToken ?? "", body, apiKey);
|
||||||
|
if(apiResult == "")
|
||||||
|
{
|
||||||
|
throw new Exception($"เรียก API {apiPath} ไม่สำเร็จ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async Task ProcessPendingJobsAsync()
|
||||||
|
{
|
||||||
|
var pendingJobs = await GetPendingJobsAsync();
|
||||||
|
Console.WriteLine($"พบงานที่ค้างอยู่ในสถานะ PENDING จำนวน {pendingJobs.Count} งาน");
|
||||||
|
|
||||||
|
foreach (var job in pendingJobs)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// อัปเดตสถานะเป็น Processing
|
||||||
|
await UpdateToProcessingAsync(job.Id);
|
||||||
|
|
||||||
|
// ทำงานที่ต้องการที่นี่ (เช่น เรียก API, ประมวลผลข้อมูล ฯลฯ)
|
||||||
|
await ProcessTaskAsync(job.RootDnaId,job.StartDate, job.EndDate);
|
||||||
|
await ProcessEmpTaskAsync(job.RootDnaId,job.StartDate, job.EndDate);
|
||||||
|
|
||||||
|
// อัปเดตสถานะเป็น Completed
|
||||||
|
await UpdateToCompletedAsync(job.Id);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// หากเกิดข้อผิดพลาด อัปเดตสถานะเป็น Failed พร้อมข้อความแสดงข้อผิดพลาด
|
||||||
|
await UpdateToFailedAsync(job.Id, ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoopDate
|
||||||
|
{
|
||||||
|
public DateTime date { get; set; }
|
||||||
|
|
||||||
|
public bool isHoliday { get; set; }
|
||||||
|
|
||||||
|
public bool isWeekEnd { get; set; }
|
||||||
|
|
||||||
|
public string dateRemark { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class DateResultReport
|
||||||
|
{
|
||||||
|
public string? profileId { get; set; }
|
||||||
|
public DateTime stampDate { get; set; }
|
||||||
|
public string stampType { get; set; }
|
||||||
|
public double stampAmount { get; set; }
|
||||||
|
public string remark { get; set; }
|
||||||
|
public string status { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -139,26 +139,64 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<ProcessUserTimeStamp>> GetTimestampByDateLateAsync(string type, string role, string nodeId, int node)
|
public async Task<List<ProcessUserTimeStamp>> GetTimestampByDateLateAsync(string type, string role, string nodeId, int? node, string nodeIdByReq, int? nodeByReq, DateTime StartDate, DateTime EndDate)
|
||||||
{
|
{
|
||||||
var _nodeId = Guid.Parse(nodeId);
|
|
||||||
var data = new List<ProcessUserTimeStamp>();
|
var data = new List<ProcessUserTimeStamp>();
|
||||||
if (role == "OWNER" || role == "CHILD")
|
|
||||||
{
|
|
||||||
data = await _dbContext.Set<ProcessUserTimeStamp>().AsQueryable()
|
data = await _dbContext.Set<ProcessUserTimeStamp>().AsQueryable()
|
||||||
.Where(x => x.CheckInStatus == "LATE")
|
.Where(x => x.CheckInStatus == "LATE")
|
||||||
.Where(x => x.ProfileType == type.Trim().ToUpper())
|
.Where(u => u.CheckIn.Date >= StartDate && u.CheckIn.Date <= EndDate)
|
||||||
.Where(x => node == 4 ? x.Child4Id == _nodeId : (node == 3 ? x.Child3Id == _nodeId : (node == 2 ? x.Child2Id == _nodeId : (node == 1 ? x.Child1Id == _nodeId : (node == 0 ? x.RootId == _nodeId : true)))))
|
.Where(x => x.ProfileType == type.Trim().ToUpper()).ToListAsync();
|
||||||
.ToListAsync();
|
// กรองตามสิทธิ์ admin ก่อน
|
||||||
|
if (role == "CHILD")
|
||||||
|
{
|
||||||
|
data = data.Where(x =>
|
||||||
|
node == 4 ? x.Child4DnaId == Guid.Parse(nodeId) :
|
||||||
|
node == 3 ? x.Child3DnaId == Guid.Parse(nodeId) :
|
||||||
|
node == 2 ? x.Child2DnaId == Guid.Parse(nodeId) :
|
||||||
|
node == 1 ? x.Child1DnaId == Guid.Parse(nodeId) :
|
||||||
|
node == 0 ? x.RootDnaId == Guid.Parse(nodeId) :
|
||||||
|
node == null ? true : true
|
||||||
|
).ToList();
|
||||||
}
|
}
|
||||||
else
|
else if (role == "BROTHER")
|
||||||
{
|
{
|
||||||
data = await _dbContext.Set<ProcessUserTimeStamp>().AsQueryable()
|
data = data.Where(x =>
|
||||||
.Where(x => x.CheckInStatus == "LATE")
|
node == 4 ? x.Child3DnaId == Guid.Parse(nodeId) :
|
||||||
.Where(x => x.ProfileType == type.Trim().ToUpper())
|
node == 3 ? x.Child2DnaId == Guid.Parse(nodeId) :
|
||||||
.Where(x => node == 4 ? x.Child4Id == _nodeId : (node == 3 ? x.Child3Id == _nodeId : (node == 2 ? x.Child2Id == _nodeId : (node == 1 ? x.Child1Id == _nodeId : (node == 0 ? x.RootId == _nodeId : true)))))
|
node == 2 ? x.Child1DnaId == Guid.Parse(nodeId) :
|
||||||
.Where(x => node == 0 ? x.Child1Id == null : (node == 1 ? x.Child2Id == null : (node == 2 ? x.Child3Id == null : (node == 3 ? x.Child4Id == null : true))))
|
node == 1 || node == 0 ? x.RootDnaId == Guid.Parse(nodeId) :
|
||||||
.ToListAsync();
|
node == null ? true : true
|
||||||
|
).ToList();
|
||||||
|
}
|
||||||
|
else if (role == "ROOT")
|
||||||
|
{
|
||||||
|
data = data.Where(x => x.RootDnaId == Guid.Parse(nodeId)).ToList();
|
||||||
|
}
|
||||||
|
// else if (role == "PARENT")
|
||||||
|
// {
|
||||||
|
// data = data.Where(x => x.RootDnaId == Guid.Parse(nodeId) && x.Child1DnaId != null).ToList();
|
||||||
|
// }
|
||||||
|
else if (role == "NORMAL")
|
||||||
|
{
|
||||||
|
data = data.Where(x =>
|
||||||
|
node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) && x.Child1DnaId == null :
|
||||||
|
node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) && x.Child2DnaId == null :
|
||||||
|
node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) && x.Child3DnaId == null :
|
||||||
|
node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) && x.Child4DnaId == null :
|
||||||
|
node == 4 ? x.Child4DnaId == Guid.Parse(nodeId!) :
|
||||||
|
true
|
||||||
|
).ToList();
|
||||||
|
}
|
||||||
|
// กรองตามที่ fe ส่งมา
|
||||||
|
if (role == "ROOT" || role == "OWNER" || role == "CHILD" || role == "BROTHER" || role == "PARENT")
|
||||||
|
{
|
||||||
|
data = data.Where(x =>
|
||||||
|
nodeByReq == 4 ? x.Child4DnaId == Guid.Parse(nodeIdByReq) :
|
||||||
|
nodeByReq == 3 ? x.Child3DnaId == Guid.Parse(nodeIdByReq) :
|
||||||
|
nodeByReq == 2 ? x.Child2DnaId == Guid.Parse(nodeIdByReq) :
|
||||||
|
nodeByReq == 1 ? x.Child1DnaId == Guid.Parse(nodeIdByReq) :
|
||||||
|
nodeByReq == 0 ? x.RootDnaId == Guid.Parse(nodeIdByReq) : true
|
||||||
|
).ToList();
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
@ -175,9 +213,12 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
||||||
|
|
||||||
public async Task<List<ProcessUserTimeStamp>> GetTimeStampHistoryAsync(Guid keycloakId, int year, int page = 1, int pageSize = 10, string keyword = "")
|
public async Task<List<ProcessUserTimeStamp>> GetTimeStampHistoryAsync(Guid keycloakId, int year, int page = 1, int pageSize = 10, string keyword = "")
|
||||||
{
|
{
|
||||||
|
var fiscalDateStart = new DateTime(year - 1, 10, 1);
|
||||||
|
var fiscalDateEnd = new DateTime(year, 9, 30);
|
||||||
|
|
||||||
var data = await _dbContext.Set<ProcessUserTimeStamp>()
|
var data = await _dbContext.Set<ProcessUserTimeStamp>()
|
||||||
.Where(u => u.KeycloakUserId == keycloakId)
|
.Where(u => u.KeycloakUserId == keycloakId)
|
||||||
.Where(u => u.CheckIn.Year == year)
|
.Where(u => u.CheckIn.Date >= fiscalDateStart && u.CheckIn.Date <= fiscalDateEnd)
|
||||||
.OrderByDescending(u => u.CheckIn.Date)
|
.OrderByDescending(u => u.CheckIn.Date)
|
||||||
.Skip((page - 1) * pageSize)
|
.Skip((page - 1) * pageSize)
|
||||||
.Take(pageSize)
|
.Take(pageSize)
|
||||||
|
|
@ -186,6 +227,19 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<List<ProcessUserTimeStamp>> GetTimeStampHistoryAsync2(Guid keycloakId, int year)
|
||||||
|
{
|
||||||
|
var fiscalDateStart = new DateTime(year - 1, 10, 1);
|
||||||
|
var fiscalDateEnd = new DateTime(year, 9, 30);
|
||||||
|
|
||||||
|
var data = await _dbContext.Set<ProcessUserTimeStamp>()
|
||||||
|
.Where(u => u.KeycloakUserId == keycloakId)
|
||||||
|
.Where(u => u.CheckIn.Date >= fiscalDateStart && u.CheckIn.Date <= fiscalDateEnd)
|
||||||
|
.OrderByDescending(u => u.CheckIn.Date)
|
||||||
|
.ToListAsync();
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<int> GetTimeStampHistoryForAdminCountAsync(DateTime startDate, DateTime endDate)
|
public async Task<int> GetTimeStampHistoryForAdminCountAsync(DateTime startDate, DateTime endDate)
|
||||||
{
|
{
|
||||||
var data = await _dbContext.Set<ProcessUserTimeStamp>()
|
var data = await _dbContext.Set<ProcessUserTimeStamp>()
|
||||||
|
|
@ -218,6 +272,55 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<List<ProcessUserTimeStamp>> GetTimeStampHistoryForAdminRoleAsync(DateTime startDate, DateTime endDate, string role, string nodeId, int? node)
|
||||||
|
{
|
||||||
|
var data = await _dbContext.Set<ProcessUserTimeStamp>()
|
||||||
|
.Where(u => u.CheckIn.Date >= startDate.Date && u.CheckIn.Date <= endDate.Date)
|
||||||
|
.OrderBy(u => u.CheckIn)
|
||||||
|
|
||||||
|
.ToListAsync();
|
||||||
|
if (role == "OWNER")
|
||||||
|
{
|
||||||
|
node = null;
|
||||||
|
}
|
||||||
|
if (role == "OWNER" || role == "CHILD")
|
||||||
|
{
|
||||||
|
data = data
|
||||||
|
.Where(x => node == 4 ? x.Child4DnaId == Guid.Parse(nodeId!) : (node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) : (node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) : (node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) : (node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) : (node == null ? true : true))))))
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
else if (role == "BROTHER")
|
||||||
|
{
|
||||||
|
data = data
|
||||||
|
.Where(x => node == 4 ? x.Child3DnaId == Guid.Parse(nodeId!) : (node == 3 ? x.Child2DnaId == Guid.Parse(nodeId!) : (node == 2 ? x.Child1DnaId == Guid.Parse(nodeId!) : (node == 1 || node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) : (node == null ? true : true)))))
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
else if (role == "ROOT")
|
||||||
|
{
|
||||||
|
data = data
|
||||||
|
.Where(x => x.RootDnaId == Guid.Parse(nodeId!))
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
// else if (role == "PARENT")
|
||||||
|
// {
|
||||||
|
// data = data
|
||||||
|
// .Where(x => x.RootDnaId == Guid.Parse(nodeId!) && x.Child1DnaId != null)
|
||||||
|
// .ToList();
|
||||||
|
// }
|
||||||
|
else if (role == "NORMAL")
|
||||||
|
{
|
||||||
|
data = data.Where(x =>
|
||||||
|
node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) && x.Child1DnaId == null :
|
||||||
|
node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) && x.Child2DnaId == null :
|
||||||
|
node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) && x.Child3DnaId == null :
|
||||||
|
node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) && x.Child4DnaId == null :
|
||||||
|
node == 4 ? x.Child4DnaId == Guid.Parse(nodeId!) :
|
||||||
|
true
|
||||||
|
).ToList();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<ProcessUserTimeStamp?> GetTimeStampById(Guid id)
|
public async Task<ProcessUserTimeStamp?> GetTimeStampById(Guid id)
|
||||||
{
|
{
|
||||||
var data = await _dbContext.Set<ProcessUserTimeStamp>()
|
var data = await _dbContext.Set<ProcessUserTimeStamp>()
|
||||||
|
|
|
||||||
|
|
@ -101,14 +101,17 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<UserDutyTime?> GetLastEffectRound(Guid profileId)
|
public async Task<UserDutyTime?> GetLastEffectRound(Guid profileId, DateTime? effectiveDate = null, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
|
// กำหนด timeout เป็น 30 นาที
|
||||||
|
using var timeoutCts = new CancellationTokenSource(TimeSpan.FromMinutes(30));
|
||||||
|
using var combinedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token);
|
||||||
|
effectiveDate ??= DateTime.Now;
|
||||||
var data = await _dbContext.Set<UserDutyTime>()
|
var data = await _dbContext.Set<UserDutyTime>()
|
||||||
.Where(x => x.ProfileId == profileId)
|
.Where(x => x.ProfileId == profileId)
|
||||||
.Where(x => x.IsProcess)
|
.Where(x => x.EffectiveDate.Value.Date <= effectiveDate.Value.Date)
|
||||||
.Where(x => x.EffectiveDate.Value.Date <= DateTime.Now.Date)
|
|
||||||
.OrderByDescending(x => x.EffectiveDate)
|
.OrderByDescending(x => x.EffectiveDate)
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync(combinedCts.Token);
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,12 +74,16 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<UserTimeStamp?> GetLastRecord(Guid keycloakId)
|
public async Task<UserTimeStamp?> GetLastRecord(Guid keycloakId, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
|
// กำหนด timeout เป็น 30 นาที
|
||||||
|
using var timeoutCts = new CancellationTokenSource(TimeSpan.FromMinutes(30));
|
||||||
|
using var combinedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token);
|
||||||
|
|
||||||
var data = await _dbContext.Set<UserTimeStamp>()
|
var data = await _dbContext.Set<UserTimeStamp>()
|
||||||
.Where(u => u.KeycloakUserId == keycloakId)
|
.Where(u => u.KeycloakUserId == keycloakId)
|
||||||
.OrderByDescending(u => u.CheckIn)
|
.OrderByDescending(u => u.CheckIn)
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync(combinedCts.Token);
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
@ -107,6 +111,55 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<List<UserTimeStamp>> GetTimeStampHistoryForAdminRoleAsync(DateTime startDate, DateTime endDate, string role, string nodeId, int? node)
|
||||||
|
{
|
||||||
|
var data = await _dbContext.Set<UserTimeStamp>()
|
||||||
|
.Where(u => u.CheckIn.Date >= startDate.Date && u.CheckIn.Date <= endDate.Date)
|
||||||
|
.OrderBy(u => u.CheckIn)
|
||||||
|
|
||||||
|
.ToListAsync();
|
||||||
|
if (role == "OWNER")
|
||||||
|
{
|
||||||
|
node = null;
|
||||||
|
}
|
||||||
|
if (role == "OWNER" || role == "CHILD")
|
||||||
|
{
|
||||||
|
data = data
|
||||||
|
.Where(x => node == 4 ? x.Child4DnaId == Guid.Parse(nodeId!) : (node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) : (node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) : (node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) : (node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) : (node == null ? true : true))))))
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
else if (role == "BROTHER")
|
||||||
|
{
|
||||||
|
data = data
|
||||||
|
.Where(x => node == 4 ? x.Child3DnaId == Guid.Parse(nodeId!) : (node == 3 ? x.Child2DnaId == Guid.Parse(nodeId!) : (node == 2 ? x.Child1DnaId == Guid.Parse(nodeId!) : (node == 1 || node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) : (node == null ? true : true)))))
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
else if (role == "ROOT")
|
||||||
|
{
|
||||||
|
data = data
|
||||||
|
.Where(x => x.RootDnaId == Guid.Parse(nodeId!))
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
// else if (role == "PARENT")
|
||||||
|
// {
|
||||||
|
// data = data
|
||||||
|
// .Where(x => x.RootDnaId == Guid.Parse(nodeId!) && x.Child1DnaId != null)
|
||||||
|
// .ToList();
|
||||||
|
// }
|
||||||
|
else if (role == "NORMAL")
|
||||||
|
{
|
||||||
|
data = data.Where(x =>
|
||||||
|
node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) && x.Child1DnaId == null :
|
||||||
|
node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) && x.Child2DnaId == null :
|
||||||
|
node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) && x.Child3DnaId == null :
|
||||||
|
node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) && x.Child4DnaId == null :
|
||||||
|
node == 4 ? x.Child4DnaId == Guid.Parse(nodeId!) :
|
||||||
|
true
|
||||||
|
).ToList();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<UserTimeStamp?> GetTimeStampById(Guid id)
|
public async Task<UserTimeStamp?> GetTimeStampById(Guid id)
|
||||||
{
|
{
|
||||||
var data = await _dbContext.Set<UserTimeStamp>()
|
var data = await _dbContext.Set<UserTimeStamp>()
|
||||||
|
|
|
||||||
|
|
@ -51,12 +51,13 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
||||||
// // throw new Exception(GlobalMessages.DataNotFound);
|
// // throw new Exception(GlobalMessages.DataNotFound);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
var apiUrl = $"{_configuration["API"]}/org/profile/keycloak/position";
|
//var apiUrl = $"{_configuration["API"]}/org/profile/keycloak/position";
|
||||||
|
var apiUrl = $"{_configuration["API"]}/org/dotnet/get-profileId";
|
||||||
var profileId = "";
|
var profileId = "";
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
var _res = await client.SendAsync(_req);
|
var _res = await client.SendAsync(_req);
|
||||||
var _result = await _res.Content.ReadAsStringAsync();
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
|
||||||
|
|
@ -55,12 +55,13 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
||||||
// // throw new Exception(GlobalMessages.DataNotFound);
|
// // throw new Exception(GlobalMessages.DataNotFound);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
var apiUrl = $"{_configuration["API"]}/org/profile/keycloak/position";
|
//var apiUrl = $"{_configuration["API"]}/org/profile/keycloak/position";
|
||||||
|
var apiUrl = $"{_configuration["API"]}/org/dotnet/get-profileId";
|
||||||
var profileId = "";
|
var profileId = "";
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
var _res = await client.SendAsync(_req);
|
var _res = await client.SendAsync(_req);
|
||||||
var _result = await _res.Content.ReadAsStringAsync();
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -131,12 +132,13 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
||||||
// {
|
// {
|
||||||
// return 0;
|
// return 0;
|
||||||
// }
|
// }
|
||||||
var apiUrl = $"{_configuration["API"]}/org/profile/keycloak/position";
|
//var apiUrl = $"{_configuration["API"]}/org/profile/keycloak/position";
|
||||||
|
var apiUrl = $"{_configuration["API"]}/org/dotnet/get-profileId";
|
||||||
var profileId = "";
|
var profileId = "";
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
var _res = await client.SendAsync(_req);
|
var _res = await client.SendAsync(_req);
|
||||||
var _result = await _res.Content.ReadAsStringAsync();
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -185,6 +187,44 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task<string> GetMyProfileIdAsync()
|
||||||
|
{
|
||||||
|
var apiUrl = $"{_configuration["API"]}/org/dotnet/get-profileId";
|
||||||
|
var response = await GetExternalAPIAsync(apiUrl, AccessToken!, _configuration["API_KEY"]!);
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(response))
|
||||||
|
return string.Empty;
|
||||||
|
|
||||||
|
var org = JsonConvert.DeserializeObject<OrgRequest>(response);
|
||||||
|
if (org == null || org.result == null)
|
||||||
|
return string.Empty;
|
||||||
|
|
||||||
|
return org.result.profileId ?? string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<int> DeleteAllMyNotificationsAsync()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var profileId = await GetMyProfileIdAsync();
|
||||||
|
if (string.IsNullOrEmpty(profileId))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
var notifications = await _dbContext.Set<Notification>()
|
||||||
|
.Where(x => x.ReceiverUserId == Guid.Parse(profileId))
|
||||||
|
.Where(x => x.DeleteDate == null)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
_dbContext.Set<Notification>().RemoveRange(notifications);
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
return notifications.Count;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async Task PushNotificationAsync(Guid ReceiverUserId, string Subject, string Body, string Payload = "", string NotiLink = "", bool IsSendInbox = false, bool IsSendMail = false)
|
public async Task PushNotificationAsync(Guid ReceiverUserId, string Subject, string Body, string Payload = "", string NotiLink = "", bool IsSendInbox = false, bool IsSendMail = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -227,7 +267,7 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
var _res = await client.SendAsync(_req);
|
var _res = await client.SendAsync(_req);
|
||||||
var _result = await _res.Content.ReadAsStringAsync();
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -287,7 +327,7 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
var _res = await client.SendAsync(_req);
|
var _res = await client.SendAsync(_req);
|
||||||
var _result = await _res.Content.ReadAsStringAsync();
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -361,7 +401,7 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
var _res = await client.SendAsync(_req);
|
var _res = await client.SendAsync(_req);
|
||||||
var _result = await _res.Content.ReadAsStringAsync();
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -434,7 +474,7 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
var _res = await client.SendAsync(_req);
|
var _res = await client.SendAsync(_req);
|
||||||
var _result = await _res.Content.ReadAsStringAsync();
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -504,7 +544,7 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
var _res = await client.SendAsync(_req);
|
var _res = await client.SendAsync(_req);
|
||||||
var _result = await _res.Content.ReadAsStringAsync();
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -566,7 +606,7 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
var _res = await client.SendAsync(_req);
|
var _res = await client.SendAsync(_req);
|
||||||
var _result = await _res.Content.ReadAsStringAsync();
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,16 @@ namespace BMA.EHR.Application.Repositories.MetaData
|
||||||
|
|
||||||
#region " Methods "
|
#region " Methods "
|
||||||
|
|
||||||
|
public async Task<string> GetHolidayAsync(DateTime date, string category = "NORMAL")
|
||||||
|
{
|
||||||
|
var data = await _dbContext.Set<Holiday>().AsQueryable()
|
||||||
|
.Where(x => x.Category == category)
|
||||||
|
.Where(x => x.HolidayDate.Date == date.Date)
|
||||||
|
.Select(x => x.Name)
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
return data ?? string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<List<DateTime>> GetHolidayAsync(DateTime startDate, DateTime endDate, string category = "NORMAL")
|
public async Task<List<DateTime>> GetHolidayAsync(DateTime startDate, DateTime endDate, string category = "NORMAL")
|
||||||
{
|
{
|
||||||
var data = await _dbContext.Set<Holiday>().AsQueryable()
|
var data = await _dbContext.Set<Holiday>().AsQueryable()
|
||||||
|
|
@ -39,12 +49,16 @@ namespace BMA.EHR.Application.Repositories.MetaData
|
||||||
|
|
||||||
public async Task<int> GetHolidayCountAsync(DateTime startDate, DateTime endDate, string category = "NORMAL")
|
public async Task<int> GetHolidayCountAsync(DateTime startDate, DateTime endDate, string category = "NORMAL")
|
||||||
{
|
{
|
||||||
var data = await _dbContext.Set<Holiday>().AsQueryable()
|
var query = _dbContext.Set<Holiday>().AsQueryable()
|
||||||
.Where(x => x.Category == category)
|
.Where(x => x.Category == category)
|
||||||
.Where(x => x.HolidayDate.Date >= startDate && x.HolidayDate.Date <= endDate)
|
.Where(x => x.HolidayDate.Date >= startDate && x.HolidayDate.Date <= endDate);
|
||||||
.CountAsync();
|
|
||||||
|
|
||||||
return data;
|
if (category == "NORMAL")
|
||||||
|
query = query.Where(x => x.HolidayDate.DayOfWeek != DayOfWeek.Saturday && x.HolidayDate.DayOfWeek != DayOfWeek.Sunday);
|
||||||
|
else
|
||||||
|
query = query.Where(x => x.HolidayDate.DayOfWeek != DayOfWeek.Sunday);
|
||||||
|
|
||||||
|
return await query.CountAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DateTime> GetWeekEnd(DateTime startDate, DateTime endDate, string category = "NORMAL")
|
public List<DateTime> GetWeekEnd(DateTime startDate, DateTime endDate, string category = "NORMAL")
|
||||||
|
|
|
||||||
|
|
@ -155,6 +155,40 @@ namespace BMA.EHR.Application.Repositories
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<FormFile> GetImageToFormFileAsync(string refId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var memoryStream = new MemoryStream();
|
||||||
|
var request = new GetObjectRequest
|
||||||
|
{
|
||||||
|
BucketName = _bucketName,
|
||||||
|
Key = refId
|
||||||
|
};
|
||||||
|
|
||||||
|
using var response = await _s3Client.GetObjectAsync(request);
|
||||||
|
using var responseStream = response.ResponseStream;
|
||||||
|
|
||||||
|
await responseStream.CopyToAsync(memoryStream);
|
||||||
|
|
||||||
|
var finalBytes = memoryStream.ToArray();
|
||||||
|
|
||||||
|
var finalStream = new MemoryStream(finalBytes);
|
||||||
|
var fileName = Path.GetFileName(refId);
|
||||||
|
var contentType = response.Headers.ContentType ?? "image/jpeg";
|
||||||
|
|
||||||
|
return new FormFile(finalStream, 0, finalStream.Length, "file", fileName)
|
||||||
|
{
|
||||||
|
Headers = new HeaderDictionary(),
|
||||||
|
ContentType = contentType
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async Task DeleteFileAsync(Guid fileId)
|
public async Task DeleteFileAsync(Guid fileId)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ using System.Net.Http.Headers;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using System.Net.Http.Json;
|
using System.Net.Http.Json;
|
||||||
|
using BMA.EHR.Application.Responses.Leaves;
|
||||||
|
|
||||||
namespace BMA.EHR.Application.Repositories
|
namespace BMA.EHR.Application.Repositories
|
||||||
{
|
{
|
||||||
|
|
@ -58,9 +59,14 @@ namespace BMA.EHR.Application.Repositories
|
||||||
|
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization =
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||||
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = await client.GetAsync(apiPath);
|
var req = await client.GetAsync(apiPath);
|
||||||
|
if (!req.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
throw new Exception("Error calling permission API");
|
||||||
|
}
|
||||||
var res = await req.Content.ReadAsStringAsync();
|
var res = await req.Content.ReadAsStringAsync();
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
@ -71,6 +77,39 @@ namespace BMA.EHR.Application.Repositories
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<GetPermissionWithActingResultDto?> GetPermissionWithActingAPIAsync(string action, string system)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var apiPath = $"{_configuration["API"]}/org/permission/dotnet-acting/{action}/{system}";
|
||||||
|
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
client.DefaultRequestHeaders.Authorization =
|
||||||
|
new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||||
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
|
var req = await client.GetAsync(apiPath);
|
||||||
|
if (!req.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
throw new Exception("Error calling permission API");
|
||||||
|
}
|
||||||
|
var apiResult = await req.Content.ReadAsStringAsync();
|
||||||
|
//return res;
|
||||||
|
|
||||||
|
if (apiResult != null)
|
||||||
|
{
|
||||||
|
var raw = JsonConvert.DeserializeObject<GetPermissionWithActingResultDto>(apiResult);
|
||||||
|
return raw;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<dynamic> GetPermissionOrgAPIAsync(string action, string system, string profileId)
|
public async Task<dynamic> GetPermissionOrgAPIAsync(string action, string system, string profileId)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -80,7 +119,7 @@ namespace BMA.EHR.Application.Repositories
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = await client.GetAsync(apiPath);
|
var req = await client.GetAsync(apiPath);
|
||||||
var res = await req.Content.ReadAsStringAsync();
|
var res = await req.Content.ReadAsStringAsync();
|
||||||
return res;
|
return res;
|
||||||
|
|
|
||||||
|
|
@ -2,24 +2,40 @@
|
||||||
using BMA.EHR.Domain.Models.Placement;
|
using BMA.EHR.Domain.Models.Placement;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace BMA.EHR.Application.Repositories
|
namespace BMA.EHR.Application.Repositories
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Response model จาก Org API (check-isLeave)
|
||||||
|
/// </summary>
|
||||||
|
public class OrgProfileResult
|
||||||
|
{
|
||||||
|
public string citizenId { get; set; } = "";
|
||||||
|
public string? profileId { get; set; }
|
||||||
|
public bool isLeave { get; set; }
|
||||||
|
public bool isActive { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
public class PlacementRepository : GenericRepository<Guid, Placement>
|
public class PlacementRepository : GenericRepository<Guid, Placement>
|
||||||
{
|
{
|
||||||
#region " Fields "
|
#region " Fields "
|
||||||
|
|
||||||
private readonly IApplicationDBContext _dbContext;
|
private readonly IApplicationDBContext _dbContext;
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
private readonly IConfiguration _configuration;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region " Constructor and Destructor "
|
#region " Constructor and Destructor "
|
||||||
|
|
||||||
public PlacementRepository(IApplicationDBContext dbContext, IHttpContextAccessor httpContextAccessor) : base(dbContext, httpContextAccessor)
|
public PlacementRepository(IApplicationDBContext dbContext, IHttpContextAccessor httpContextAccessor, IConfiguration configuration) : base(dbContext, httpContextAccessor)
|
||||||
{
|
{
|
||||||
_dbContext = dbContext;
|
_dbContext = dbContext;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
_configuration = configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
@ -76,6 +92,148 @@ namespace BMA.EHR.Application.Repositories
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Job อัพเดทสถานะผู้สอบผ่านที่ลาออกไปแล้วแต่ยังไม่ส่งไปออกคำสั่ง
|
||||||
|
/// และอัพเดทบุคคลภายนอกที่เข้ามาอยู่ในระบบแล้ว
|
||||||
|
/// ทำงานทุกวันเวลา 05:00 น.
|
||||||
|
/// </summary>
|
||||||
|
public async Task UpdateStatusPlacementProfiles()
|
||||||
|
{
|
||||||
|
Console.WriteLine("[Job:UpdateStatusPlacementProfiles] === STARTED ===");
|
||||||
|
|
||||||
|
// 1. Query ทั้ง 2 กรณี: ทุกคนที่ยังไม่ DONE
|
||||||
|
var allCitizenIds = await _dbContext.Set<PlacementProfile>()
|
||||||
|
.Where(p => !string.IsNullOrEmpty(p.CitizenId)
|
||||||
|
&& p.PlacementStatus != "DONE"
|
||||||
|
// && p.CitizenId == "2536721883131"
|
||||||
|
)
|
||||||
|
.Select(p => new { p.CitizenId, p.IsOfficer })
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
if (!allCitizenIds.Any())
|
||||||
|
{
|
||||||
|
Console.WriteLine("[Job:UpdateStatusPlacementProfiles] No profiles to process");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var officerCount = allCitizenIds.Count(x => x.IsOfficer == true);
|
||||||
|
var notOfficerCount = allCitizenIds.Count(x => x.IsOfficer == false);
|
||||||
|
Console.WriteLine($"[Job:UpdateStatusPlacementProfiles] พบข้าราชการ {officerCount} คน, บุคคลภายนอก {notOfficerCount} คน");
|
||||||
|
|
||||||
|
// 2. ส่ง citizenIds ทั้งหมดไป Org API ครั้งเดียว
|
||||||
|
var citizenIds = allCitizenIds.Select(x => x.CitizenId).Distinct().ToList();
|
||||||
|
var apiUrl = $"{_configuration["API"]}/org/dotnet/check-isLeave";
|
||||||
|
|
||||||
|
List<OrgProfileResult> orgResults = new();
|
||||||
|
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
|
|
||||||
|
var payload = new { citizenIds };
|
||||||
|
var jsonPayload = JsonConvert.SerializeObject(payload);
|
||||||
|
var content = new StringContent(jsonPayload, System.Text.Encoding.UTF8, "application/json");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var response = await client.PostAsync(apiUrl, content);
|
||||||
|
var result = await response.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
var responseObj = JsonConvert.DeserializeAnonymousType(result, new
|
||||||
|
{
|
||||||
|
status = 0,
|
||||||
|
message = "",
|
||||||
|
result = new List<OrgProfileResult>()
|
||||||
|
});
|
||||||
|
|
||||||
|
orgResults = responseObj?.result ?? new();
|
||||||
|
Console.WriteLine($"[Job:UpdateStatusPlacementProfiles] Org API ตอบกลับ {orgResults.Count} รายการ");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"[Job:UpdateStatusPlacementProfiles] Call API failed: {ex.Message}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!orgResults.Any())
|
||||||
|
{
|
||||||
|
Console.WriteLine("[Job:UpdateStatusPlacementProfiles] ไม่มีรายการต้องอัปเดต");
|
||||||
|
Console.WriteLine("[Job:UpdateStatusPlacementProfiles] === COMPLETED ===");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. แยกข้อมูลตามเงื่อนไข
|
||||||
|
var leaveCitizenIds = orgResults.Where(x => x.isLeave).Select(x => x.citizenId).ToList();
|
||||||
|
var inSystemProfiles = orgResults.Where(x => x.isActive && !x.isLeave && !string.IsNullOrEmpty(x.profileId)).ToList();
|
||||||
|
|
||||||
|
Console.WriteLine($"[Job:UpdateStatusPlacementProfiles] ลาออก {leaveCitizenIds.Count} รายการ, อยู่ที่ทะเบียนประวัติ {inSystemProfiles.Count} รายการ");
|
||||||
|
|
||||||
|
// 4. Split Batch Update (500 รายการ/batch)
|
||||||
|
var batchSize = 500;
|
||||||
|
var totalUpdated = 0;
|
||||||
|
|
||||||
|
// 4.1 Update คนลาออก → IsOfficer = false
|
||||||
|
if (leaveCitizenIds.Any())
|
||||||
|
{
|
||||||
|
var totalBatches = (int)Math.Ceiling((double)leaveCitizenIds.Count / batchSize);
|
||||||
|
for (int i = 0; i < totalBatches; i++)
|
||||||
|
{
|
||||||
|
var batch = leaveCitizenIds.Skip(i * batchSize).Take(batchSize).ToList();
|
||||||
|
|
||||||
|
var profilesToUpdate = await _dbContext.Set<PlacementProfile>()
|
||||||
|
.Where(p => !string.IsNullOrEmpty(p.CitizenId)
|
||||||
|
&& batch.Contains(p.CitizenId)
|
||||||
|
&& p.IsOfficer == true)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
foreach (var profile in profilesToUpdate)
|
||||||
|
{
|
||||||
|
profile.profileId = null;
|
||||||
|
profile.IsOfficer = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
totalUpdated += profilesToUpdate.Count;
|
||||||
|
Console.WriteLine($"[Job:UpdateStatusPlacementProfiles] [ลาออก] Batch {i + 1}/{totalBatches} → อัปเดต {profilesToUpdate.Count} รายการ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4.2 Update คนที่อยู่ในทะเบียนประวัติ → profileId + IsOfficer = true
|
||||||
|
if (inSystemProfiles.Any())
|
||||||
|
{
|
||||||
|
var totalBatches = (int)Math.Ceiling((double)inSystemProfiles.Count / batchSize);
|
||||||
|
for (int i = 0; i < totalBatches; i++)
|
||||||
|
{
|
||||||
|
var batch = inSystemProfiles.Skip(i * batchSize).Take(batchSize).ToList();
|
||||||
|
var batchCitizenIds = batch.Select(x => x.citizenId).ToList();
|
||||||
|
|
||||||
|
var profilesToUpdate = await _dbContext.Set<PlacementProfile>()
|
||||||
|
.Where(p => !string.IsNullOrEmpty(p.CitizenId)
|
||||||
|
&& batchCitizenIds.Contains(p.CitizenId)
|
||||||
|
&& p.IsOfficer == false)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
foreach (var profile in profilesToUpdate)
|
||||||
|
{
|
||||||
|
var orgProfile = batch.FirstOrDefault(x => x.citizenId == profile.CitizenId);
|
||||||
|
if (orgProfile != null)
|
||||||
|
{
|
||||||
|
profile.profileId = orgProfile.profileId;
|
||||||
|
profile.IsOfficer = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
totalUpdated += profilesToUpdate.Count;
|
||||||
|
Console.WriteLine($"[Job:UpdateStatusPlacementProfiles] [เข้าระบบ] Batch {i + 1}/{totalBatches} → อัปเดต {profilesToUpdate.Count} รายการ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine($"[Job:UpdateStatusPlacementProfiles] อัปเดตรวมทั้งหมด {totalUpdated} รายการ");
|
||||||
|
Console.WriteLine("[Job:UpdateStatusPlacementProfiles] === COMPLETED ===");
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ using BMA.EHR.Domain.Shared;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using static BMA.EHR.Domain.Extensions.DateTimeExtension;
|
using static BMA.EHR.Domain.Extensions.DateTimeExtension;
|
||||||
|
|
||||||
namespace BMA.EHR.Application.Repositories.Reports
|
namespace BMA.EHR.Application.Repositories.Reports
|
||||||
|
|
@ -82,76 +83,128 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
sb.Append(monthDiff == 0 ? "" : $"{monthDiff} เดือน ");
|
sb.Append(monthDiff == 0 ? "" : $"{monthDiff} เดือน ");
|
||||||
sb.Append(dayDiff == 0 ? "" : $"{dayDiff} วัน ");
|
sb.Append(dayDiff == 0 ? "" : $"{dayDiff} วัน ");
|
||||||
}
|
}
|
||||||
var data = await _dbExamContext.Set<Candidate>().AsQueryable()
|
var candidate = await _dbExamContext.Set<Candidate>()
|
||||||
.Where(x => x.Id == id)
|
.Where(x => x.Id == id)
|
||||||
.Select(p => new
|
.Include(p => p.PeriodExam)
|
||||||
{
|
.Include(p => p.Educations)
|
||||||
p.Id,
|
.Include(p => p.PositionExam)
|
||||||
AvatarId = p.ProfileImg == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.ProfileImg.Id,
|
.Include(p => p.ProfileImg)
|
||||||
ExamIdenNumber = p.ExamIdenNumber == null ? "-" : p.ExamIdenNumber.ToThaiNumber(),
|
|
||||||
PositionName = p.PositionExam == null ? "-" : p.PositionExam.PositionName.ToThaiNumber(),
|
|
||||||
PositionLevelName = p.PositionExam == null ? "-" : p.PositionExam.PositionLevelName.ToThaiNumber(),
|
|
||||||
PeriodExamName = p.PeriodExam == null ? "-" : p.PeriodExam.Name.ToThaiNumber(),
|
|
||||||
PeriodExamRound = p.PeriodExam == null ? "-" : p.PeriodExam.Round.ToString().ToThaiNumber(),
|
|
||||||
PeriodExamYear = p.PeriodExam == null ? "-" : (p.PeriodExam.Year + 543).ToString().ToThaiNumber(),
|
|
||||||
|
|
||||||
FullName = $"{p.PrefixName}{p.FirstName} {p.LastName}",
|
|
||||||
Religion = p.ReligionName == null ? "-" : p.ReligionName,
|
|
||||||
Nationality = p.Nationality == null ? "-" : p.Nationality,
|
|
||||||
DateOfBirth = p.DateOfBirth == null ? "-" : p.DateOfBirth.Value.ToThaiFullDate2().ToThaiNumber(),
|
|
||||||
Age = p.DateOfBirth == null ? "-" : p.DateOfBirth.Value.CalculateAgeStrV2(0, 0).ToThaiNumber(),
|
|
||||||
CitizenId = p.CitizenId == null ? "-" : p.CitizenId.ToThaiNumber(),
|
|
||||||
|
|
||||||
EducationLevelExamName = p.Educations.FirstOrDefault() == null ? "-" : p.Educations.FirstOrDefault().EducationLevelExamName.ToThaiNumber(),
|
|
||||||
EducationName = p.Educations.FirstOrDefault() == null ? null : (p.Educations.FirstOrDefault().EducationLevelExamName == "ปริญญาตรี" || p.Educations.FirstOrDefault().EducationLevelExamName == "ปริญญาโท" || p.Educations.FirstOrDefault().EducationLevelExamName == "ปริญญาเอก" ? p.Educations.FirstOrDefault().EducationName : null),
|
|
||||||
EducationMajor = p.Educations.FirstOrDefault() == null ? "-" : p.Educations.FirstOrDefault().EducationMajor.ToThaiNumber(),
|
|
||||||
EducationLocation = p.Educations.FirstOrDefault() == null ? "-" : p.Educations.FirstOrDefault().EducationLocation,
|
|
||||||
EducationEndDate = p.Educations.FirstOrDefault() == null || p.Educations.FirstOrDefault().EducationEndDate == null ? "-" : p.Educations.FirstOrDefault().EducationEndDate.Value.ToThaiFullDate2().ToThaiNumber(),
|
|
||||||
EducationScores = p.Educations.FirstOrDefault() == null ? "-" : p.Educations.FirstOrDefault().EducationScores.ToThaiNumber(),
|
|
||||||
EducationType = p.Educations.FirstOrDefault() == null ? "-" : p.Educations.FirstOrDefault().EducationType,
|
|
||||||
EducationLevelHighName = p.Educations.FirstOrDefault() == null ? "-" : p.Educations.FirstOrDefault().EducationLevelHighName,
|
|
||||||
|
|
||||||
OccupationPositionType = p.OccupationPositionType == "other" ? "ผู้ปฏิบัติงานอื่นในกรุงเทพมหานคร" : (p.OccupationPositionType == "temp" ? "ลูกจ้างชั่วคราว" : (p.OccupationPositionType == "prem" ? "ลูกจ้างประจำ" : "-")),
|
|
||||||
OccupationPosition = p.OccupationPosition == null ? "-" : p.OccupationPosition,
|
|
||||||
OccupationSalary = p.OccupationSalary == null ? "-" : p.OccupationSalary.Value.ToString("N0").ToThaiNumber(),
|
|
||||||
OccupationGroup = p.OccupationGroup == null ? "-" : p.OccupationGroup,
|
|
||||||
OccupationPile = p.OccupationPile == null ? "-" : p.OccupationPile,
|
|
||||||
OccupationOrg = p.OccupationOrg == null ? "-" : p.OccupationOrg,
|
|
||||||
OccupationTelephone = p.OccupationTelephone == null ? "-" : p.OccupationTelephone.ToThaiNumber(),
|
|
||||||
|
|
||||||
CareersTotal = sb.ToString().ToThaiNumber(),
|
|
||||||
// Careers = p.Careers.Select(y => new
|
|
||||||
// {
|
|
||||||
// Position = y.Position,
|
|
||||||
// Type = y.Type,
|
|
||||||
// DurationStart = y.DurationStart.ToThaiShortDate2(),
|
|
||||||
// DurationEnd = y.DurationEnd.ToThaiShortDate2(),
|
|
||||||
// RangeDate = y.RangeDate,
|
|
||||||
// }).ToList(),
|
|
||||||
|
|
||||||
RegistAddress = p.RegistAddress == null ? "-" : p.RegistAddress.ToThaiNumber(),
|
|
||||||
RegistProvinceName = p.RegistProvinceName == null ? "-" : p.RegistProvinceName,
|
|
||||||
RegistDistrictName = p.RegistDistrictName == null ? "-" : p.RegistDistrictName,
|
|
||||||
RegistSubDistrictName = p.RegistSubDistrictName == null ? "-" : p.RegistSubDistrictName,
|
|
||||||
RegistZipCode = p.RegistZipCode == null ? "-" : p.RegistZipCode.ToThaiNumber(),
|
|
||||||
CurrentAddress = p.CurrentAddress == null ? (p.RegistAddress == null ? "-" : p.RegistAddress.ToThaiNumber()) : p.CurrentAddress.ToThaiNumber(),
|
|
||||||
CurrentProvinceName = p.CurrentProvinceName == null ? (p.RegistProvinceName == null ? "-" : p.RegistProvinceName) : p.CurrentProvinceName,
|
|
||||||
CurrentDistrictName = p.CurrentDistrictName == null ? (p.RegistDistrictName == null ? "-" : p.RegistDistrictName) : p.CurrentDistrictName,
|
|
||||||
CurrentSubDistrictName = p.CurrentSubDistrictName == null ? (p.RegistSubDistrictName == null ? "-" : p.RegistSubDistrictName) : p.CurrentSubDistrictName,
|
|
||||||
CurrentZipCode = p.CurrentZipCode == null ? (p.RegistZipCode == null ? "-" : p.RegistZipCode.ToThaiNumber()) : p.CurrentZipCode.ToThaiNumber(),
|
|
||||||
Telephone = p.Telephone == null ? "-" : p.Telephone.ToThaiNumber(),
|
|
||||||
Email = p.Email == null ? "-" : p.Email,
|
|
||||||
|
|
||||||
ContactFullName = $"{p.ContactPrefixName}{p.ContactFirstname} {p.ContactLastname}",
|
|
||||||
ContactRelations = p.ContactRelations == null ? "-" : p.ContactRelations,
|
|
||||||
ContactTel = p.ContactTel == null ? "-" : p.ContactTel.ToThaiNumber(),
|
|
||||||
|
|
||||||
RegisterDate = p.RegisterDate == null ? "-" : p.RegisterDate.Value.ToThaiFullDate().ToThaiNumber(),
|
|
||||||
})
|
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
if (data == null)
|
|
||||||
|
if (candidate == null)
|
||||||
throw new Exception(GlobalMessages.CandidateNotFound);
|
throw new Exception(GlobalMessages.CandidateNotFound);
|
||||||
return data;
|
|
||||||
|
List<string> editorConfirmLists;
|
||||||
|
|
||||||
|
var textOnly = string.IsNullOrEmpty(candidate.PeriodExam?.EditorConfirm)
|
||||||
|
? null
|
||||||
|
: Regex.Replace(
|
||||||
|
candidate.PeriodExam.EditorConfirm,
|
||||||
|
"<[^>]+>",
|
||||||
|
string.Empty
|
||||||
|
)
|
||||||
|
.Replace(" ", " ")
|
||||||
|
.Trim();
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(textOnly))
|
||||||
|
{
|
||||||
|
// ลบข้อความทั้งหมดก่อน "1." เพื่อให้เริ่มต้นที่ข้อแรกเสมอ
|
||||||
|
var cleanedText = Regex.Replace(textOnly, @"^.*?1\.", "1.").Trim();
|
||||||
|
|
||||||
|
// ถ้าข้อ 3 จบด้วย "มาตรา 1374." แล้วเลข 4. ติดกับประโยค ให้แทรกขึ้นบรรทัดใหม่เป็นข้อ 4.
|
||||||
|
if (!cleanedText.Contains("\n4.") && Regex.IsMatch(cleanedText, @"1374\.\s*"))
|
||||||
|
{
|
||||||
|
cleanedText = Regex.Replace(cleanedText, @"1374\.\s*", "137\n4. ");
|
||||||
|
}
|
||||||
|
|
||||||
|
// แยกข้อความเป็นแต่ละข้อ โดย split เมื่อเจอ pattern "ตัวเลข. "
|
||||||
|
// ใช้ lookahead (?=...) เพื่อไม่กินตัวเลขทิ้ง และให้ตัวเลขยังอยู่ในผลลัพธ์
|
||||||
|
editorConfirmLists = Regex.Split(cleanedText, @"(?=\d+\. )")
|
||||||
|
.Where(s => !string.IsNullOrWhiteSpace(s))
|
||||||
|
.Select(s => s.Replace("\n", "").Replace("\r", "").Trim())
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
editorConfirmLists = new List<string> { "-" };
|
||||||
|
}
|
||||||
|
|
||||||
|
return new
|
||||||
|
{
|
||||||
|
candidate.Id,
|
||||||
|
AvatarId = candidate.ProfileImg?.Id ?? Guid.Empty,
|
||||||
|
ExamIdenNumber = candidate.ExamIdenNumber ?? "-",
|
||||||
|
PositionName = candidate.PositionExam?.PositionName ?? "-",
|
||||||
|
PositionLevelName = candidate.PositionExam?.PositionLevelName ?? "-",
|
||||||
|
PeriodExamName = candidate.PeriodExam?.Name ?? "-",
|
||||||
|
PeriodExamRound = candidate.PeriodExam?.Round.ToString() ?? "-",
|
||||||
|
PeriodExamYear = candidate.PeriodExam != null ? (candidate.PeriodExam.Year + 543).ToString() : "-",
|
||||||
|
FullName = $"{candidate.PrefixName}{candidate.FirstName} {candidate.LastName}",
|
||||||
|
Religion = candidate.ReligionName ?? "-",
|
||||||
|
Nationality = candidate.Nationality ?? "-",
|
||||||
|
DateOfBirth = candidate.DateOfBirth?.ToThaiFullDate2() ?? "-",
|
||||||
|
Age = candidate.DateOfBirth?.CalculateAgeStrV2(0, 0) ?? "-",
|
||||||
|
CitizenId = candidate.CitizenId ?? "-",
|
||||||
|
|
||||||
|
EducationLevelExamName = candidate.Educations.FirstOrDefault()?.EducationLevelExamName ?? "-",
|
||||||
|
EducationName = (candidate.Educations.FirstOrDefault()?.EducationLevelExamName is "ปริญญาตรี" or "ปริญญาโท" or "ปริญญาเอก")
|
||||||
|
? candidate.Educations.FirstOrDefault()?.EducationName
|
||||||
|
: null,
|
||||||
|
EducationMajor = candidate.Educations.FirstOrDefault()?.EducationMajor ?? "-",
|
||||||
|
EducationLocation = candidate.Educations.FirstOrDefault()?.EducationLocation ?? "-",
|
||||||
|
EducationEndDate = candidate.Educations.FirstOrDefault()?.EducationEndDate?.ToThaiFullDate2() ?? "-",
|
||||||
|
EducationScores = candidate.Educations.FirstOrDefault()?.EducationScores ?? "-",
|
||||||
|
EducationType = candidate.Educations.FirstOrDefault()?.EducationType ?? "-",
|
||||||
|
EducationLevelHighName = candidate.Educations.FirstOrDefault()?.EducationLevelHighName ?? "-",
|
||||||
|
|
||||||
|
OccupationPositionType = candidate.OccupationPositionType == "other" ? "ผู้ปฏิบัติงานอื่นในกรุงเทพมหานคร" :
|
||||||
|
candidate.OccupationPositionType == "temp" ? "ลูกจ้างชั่วคราว" :
|
||||||
|
candidate.OccupationPositionType == "prem" ? "ลูกจ้างประจำ" : "-",
|
||||||
|
OccupationPosition = candidate.OccupationPosition ?? "-",
|
||||||
|
OccupationSalary = candidate.OccupationSalary.HasValue
|
||||||
|
? (candidate.OccupationSalary.Value % 1 == 0
|
||||||
|
? candidate.OccupationSalary.Value.ToString("N0")
|
||||||
|
: candidate.OccupationSalary.Value.ToString("N2"))
|
||||||
|
: "-",
|
||||||
|
OccupationGroup = candidate.OccupationGroup ?? "-",
|
||||||
|
OccupationPile = candidate.OccupationPile ?? "-",
|
||||||
|
OccupationOrg = candidate.OccupationOrg ?? "-",
|
||||||
|
OccupationTelephone = candidate.OccupationTelephone ?? "-",
|
||||||
|
|
||||||
|
CareersTotal = sb.ToString(),
|
||||||
|
|
||||||
|
RegistAddress = candidate.RegistAddress ?? "-",
|
||||||
|
RegistProvinceName = candidate.RegistProvinceName ?? "-",
|
||||||
|
RegistDistrictName = candidate.RegistDistrictName ?? "-",
|
||||||
|
RegistSubDistrictName = candidate.RegistSubDistrictName ?? "-",
|
||||||
|
RegistZipCode = candidate.RegistZipCode ?? "-",
|
||||||
|
CurrentAddress = candidate.CurrentAddress ?? candidate.RegistAddress ?? "-",
|
||||||
|
CurrentProvinceName = candidate.CurrentProvinceName ?? candidate.RegistProvinceName ?? "-",
|
||||||
|
CurrentDistrictName = candidate.CurrentDistrictName ?? candidate.RegistDistrictName ?? "-",
|
||||||
|
CurrentSubDistrictName = candidate.CurrentSubDistrictName ?? candidate.RegistSubDistrictName ?? "-",
|
||||||
|
CurrentZipCode = candidate.CurrentZipCode ?? candidate.RegistZipCode ?? "-",
|
||||||
|
Telephone = candidate.Telephone ?? "-",
|
||||||
|
Email = candidate.Email ?? "-",
|
||||||
|
|
||||||
|
ContactFullName = $"{candidate.ContactPrefixName}{candidate.ContactFirstname} {candidate.ContactLastname}",
|
||||||
|
ContactRelations = candidate.ContactRelations ?? "-",
|
||||||
|
ContactTel = candidate.ContactTel ?? "-",
|
||||||
|
|
||||||
|
RegisterDate = candidate.RegisterDate?.ToThaiFullDate() ?? "-",
|
||||||
|
|
||||||
|
IsBachelors = candidate.PositionExam != null && !string.IsNullOrEmpty(candidate.PositionExam.PositionLevelName) && candidate.PositionExam.PositionLevelName.Trim() == "ปฏิบัติการ"
|
||||||
|
? new List<object>
|
||||||
|
{
|
||||||
|
new { label = "ชื่อปริญญา", value = candidate.Educations.FirstOrDefault()?.EducationName ?? "-" },
|
||||||
|
new { label = "สาขาวิชา/วิชาเอก", value = candidate.Educations.FirstOrDefault()?.EducationMajor ?? "-" }
|
||||||
|
}
|
||||||
|
: new List<object>
|
||||||
|
{
|
||||||
|
new { label = "สาขาวิชา/วิชาเอก", value = candidate.Educations.FirstOrDefault()?.EducationMajor ?? "-" }
|
||||||
|
},
|
||||||
|
|
||||||
|
EditorConfirms = editorConfirmLists
|
||||||
|
};
|
||||||
}
|
}
|
||||||
public async Task<dynamic> GetExamCareerCandidateAsync(Guid id)
|
public async Task<dynamic> GetExamCareerCandidateAsync(Guid id)
|
||||||
{
|
{
|
||||||
|
|
@ -176,10 +229,10 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
{
|
{
|
||||||
Position = item.Position,
|
Position = item.Position,
|
||||||
Type = item.Type,
|
Type = item.Type,
|
||||||
DurationStart = item.DurationStart.ToThaiNumber(),
|
DurationStart = item.DurationStart,
|
||||||
DurationEnd = item.DurationEnd.ToThaiNumber(),
|
DurationEnd = item.DurationEnd,
|
||||||
RangeDate = item.RangeDate.ToThaiNumber(),
|
RangeDate = item.RangeDate,
|
||||||
Index = retVal.ToString().ToThaiNumber(),
|
Index = retVal.ToString(),
|
||||||
};
|
};
|
||||||
data.Add(_data);
|
data.Add(_data);
|
||||||
retVal++;
|
retVal++;
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
using System.Globalization;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
|
|
||||||
|
|
@ -844,13 +845,16 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
OcId = x.Request.OrganizationId // Organization ID
|
OcId = x.Request.OrganizationId // Organization ID
|
||||||
})
|
})
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
var org = _userProfileRepository.GetOc(nodeId, node, AccessToken);
|
||||||
|
var organizationName = $"{(!string.IsNullOrEmpty(org.Child4) ? org.Child4 + "/" : "")}{(!string.IsNullOrEmpty(org.Child3) ? org.Child3 + "/" : "")}{(!string.IsNullOrEmpty(org.Child2) ? org.Child2 + "/" : "")}{(!string.IsNullOrEmpty(org.Child1) ? org.Child1 + "/" : "")}{org.Root ?? ""}";
|
||||||
var insignia = (from r in data
|
var insignia = (from r in data
|
||||||
group r by new { OcId = r.OcId, InsigniaInitial = r.InsigniaInitial } into g
|
group r by new { OcId = r.OcId, InsigniaInitial = r.InsigniaInitial } into g
|
||||||
select new
|
select new
|
||||||
{
|
{
|
||||||
RowNo = 1,
|
RowNo = 1,
|
||||||
DepartmentName = _userProfileRepository.GetOc(g.Key.OcId, 0, AccessToken).Root, //_organizationCommonRepository.GetOrganizationNameFullPath(g.Key.OcId, false, false),
|
DepartmentName = organizationName,
|
||||||
|
//_userProfileRepository.GetOc(g.Key.OcId, 0, AccessToken).Root,
|
||||||
|
//_organizationCommonRepository.GetOrganizationNameFullPath(g.Key.OcId, false, false),
|
||||||
InsigniaInitial = g.Key.InsigniaInitial,
|
InsigniaInitial = g.Key.InsigniaInitial,
|
||||||
G1Male = g.Sum(x => x.Gendor == "ชาย" && x.RequestInsigniaName == "เหรียญจักรพรรดิมาลา" ? 1 : 0).ToString().ToThaiNumber(),
|
G1Male = g.Sum(x => x.Gendor == "ชาย" && x.RequestInsigniaName == "เหรียญจักรพรรดิมาลา" ? 1 : 0).ToString().ToThaiNumber(),
|
||||||
G1Female = g.Sum(x => x.Gendor == "หญิง" && x.RequestInsigniaName == "เหรียญจักรพรรดิมาลา" ? 1 : 0).ToString().ToThaiNumber(),
|
G1Female = g.Sum(x => x.Gendor == "หญิง" && x.RequestInsigniaName == "เหรียญจักรพรรดิมาลา" ? 1 : 0).ToString().ToThaiNumber(),
|
||||||
|
|
@ -889,7 +893,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
select new
|
select new
|
||||||
{
|
{
|
||||||
RowNo = 1,
|
RowNo = 1,
|
||||||
DepartmentName = _userProfileRepository.GetOc(g.Key.OcId, 0, AccessToken).Root, //_organizationCommonRepository.GetOrganizationNameFullPath(g.Key.OcId, false, false),
|
DepartmentName = _userProfileRepository.GetOc(g.Key.OcId, 0, AccessToken)?.Root ?? "-", //_organizationCommonRepository.GetOrganizationNameFullPath(g.Key.OcId, false, false),
|
||||||
G1Male = g.Sum(x => x.Gendor == "ชาย" && x.RequestInsigniaName == "เหรียญจักรพรรดิมาลา" ? 1 : 0),
|
G1Male = g.Sum(x => x.Gendor == "ชาย" && x.RequestInsigniaName == "เหรียญจักรพรรดิมาลา" ? 1 : 0),
|
||||||
G1Female = g.Sum(x => x.Gendor == "หญิง" && x.RequestInsigniaName == "เหรียญจักรพรรดิมาลา" ? 1 : 0),
|
G1Female = g.Sum(x => x.Gendor == "หญิง" && x.RequestInsigniaName == "เหรียญจักรพรรดิมาลา" ? 1 : 0),
|
||||||
G2Male = g.Sum(x => x.Gendor == "ชาย" ? 1 : 0),
|
G2Male = g.Sum(x => x.Gendor == "ชาย" ? 1 : 0),
|
||||||
|
|
@ -1000,6 +1004,16 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
r.FirstName,
|
r.FirstName,
|
||||||
r.LastName,
|
r.LastName,
|
||||||
r.Gender,
|
r.Gender,
|
||||||
|
r.Root,
|
||||||
|
r.RootId,
|
||||||
|
r.Child1,
|
||||||
|
r.Child1Id,
|
||||||
|
r.Child2,
|
||||||
|
r.Child2Id,
|
||||||
|
r.Child3,
|
||||||
|
r.Child3Id,
|
||||||
|
r.Child4,
|
||||||
|
r.Child4Id,
|
||||||
r.RequestInsignia.Id,
|
r.RequestInsignia.Id,
|
||||||
r.Request.OrganizationId
|
r.Request.OrganizationId
|
||||||
})
|
})
|
||||||
|
|
@ -1010,6 +1024,16 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
ProfileId = group.Key.ProfileId,
|
ProfileId = group.Key.ProfileId,
|
||||||
FullName = $"{group.Key.Prefix}{group.Key.FirstName} {group.Key.LastName}",
|
FullName = $"{group.Key.Prefix}{group.Key.FirstName} {group.Key.LastName}",
|
||||||
Gender = group.Key.Gender,
|
Gender = group.Key.Gender,
|
||||||
|
Root = group.Key.Root ?? "",
|
||||||
|
RootId = group.Key.RootId,
|
||||||
|
Child1 = group.Key.Child1 ?? "",
|
||||||
|
Child1Id = group.Key.Child1Id,
|
||||||
|
Child2 = group.Key.Child2 ?? "",
|
||||||
|
Child2Id = group.Key.Child2Id,
|
||||||
|
Child3 = group.Key.Child3 ?? "",
|
||||||
|
Child3Id = group.Key.Child3Id,
|
||||||
|
Child4 = group.Key.Child4 ?? "",
|
||||||
|
Child4Id = group.Key.Child4Id,
|
||||||
Male = group.Count(r => r.Gender == "Male"), // Count male entries
|
Male = group.Count(r => r.Gender == "Male"), // Count male entries
|
||||||
Female = group.Count(r => r.Gender == "Female"), // Count female entries
|
Female = group.Count(r => r.Gender == "Female"), // Count female entries
|
||||||
InsigniaId = group.Key.Id,
|
InsigniaId = group.Key.Id,
|
||||||
|
|
@ -1035,6 +1059,16 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
ProfileId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
|
ProfileId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
|
||||||
FullName = "",
|
FullName = "",
|
||||||
Gender = "",
|
Gender = "",
|
||||||
|
Root = "",
|
||||||
|
RootId = (Guid?)Guid.Parse("00000000-0000-0000-0000-000000000000"),
|
||||||
|
Child1 = "",
|
||||||
|
Child1Id = (Guid?)Guid.Parse("00000000-0000-0000-0000-000000000000"),
|
||||||
|
Child2 = "",
|
||||||
|
Child2Id = (Guid?)Guid.Parse("00000000-0000-0000-0000-000000000000"),
|
||||||
|
Child3 = "",
|
||||||
|
Child3Id = (Guid?)Guid.Parse("00000000-0000-0000-0000-000000000000"),
|
||||||
|
Child4 = "",
|
||||||
|
Child4Id = (Guid?)Guid.Parse("00000000-0000-0000-0000-000000000000"),
|
||||||
Male = 0,
|
Male = 0,
|
||||||
Female = 0,
|
Female = 0,
|
||||||
InsigniaId = ins.InsigniaId,
|
InsigniaId = ins.InsigniaId,
|
||||||
|
|
@ -1081,6 +1115,60 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
return s_data;
|
return s_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<dynamic> GeInsigniaRequestProfiles(Guid id)
|
||||||
|
{
|
||||||
|
var profile = await _dbContext.Set<InsigniaRequestProfile>()
|
||||||
|
.Where(x => x.Id == id)
|
||||||
|
.Select(x => new
|
||||||
|
{
|
||||||
|
Fullname = $"{x.Prefix}{x.FirstName} {x.LastName}",
|
||||||
|
Position = x.Position ?? "",
|
||||||
|
Oc = (x.Child4 == null ? "" : x.Child4 + " ") +
|
||||||
|
(x.Child3 == null ? "" : x.Child3 + " ") +
|
||||||
|
(x.Child2 == null ? "" : x.Child2 + " ") +
|
||||||
|
(x.Child1 == null ? "" : x.Child1 + " ") +
|
||||||
|
(x.Root == null ? "" : x.Root),
|
||||||
|
BirthDate = x.BirthDate == null ? "" : x.BirthDate.Value.ToThaiShortDate().ToString().ToThaiNumber(),
|
||||||
|
DateAppoint = x.DateAppoint == null ? "" : x.DateAppoint.Value.ToThaiShortDate().ToString().ToThaiNumber(),
|
||||||
|
ProfileId = x.ProfileId
|
||||||
|
})
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
if (profile == null)
|
||||||
|
throw new Exception(GlobalMessages.DataNotFound);
|
||||||
|
|
||||||
|
var profileSalarys = await _userProfileRepository.GetProfileSalaryById(profile.ProfileId, AccessToken);
|
||||||
|
var salarys = profileSalarys.Select(x => new
|
||||||
|
{
|
||||||
|
DateAffect = x.DateAffect == null ? "" : x.DateAffect.ToThaiShortDate().ToString().ToThaiNumber(),
|
||||||
|
Position = x.Position ?? "",
|
||||||
|
Root = x.Root,
|
||||||
|
Child1 = x.Child1,
|
||||||
|
Child2 = x.Child2,
|
||||||
|
Child3 = x.Child3,
|
||||||
|
Child4 = x.Child4,
|
||||||
|
Oc = (x.Child4 == null ? "" : x.Child4 + " ") +
|
||||||
|
(x.Child3 == null ? "" : x.Child3 + " ") +
|
||||||
|
(x.Child2 == null ? "" : x.Child2 + " ") +
|
||||||
|
(x.Child1 == null ? "" : x.Child1 + " ") +
|
||||||
|
(x.Root == null ? "" : x.Root),
|
||||||
|
Age = x.Age == null ? "" : x.Age.ToString().ToThaiNumber(),
|
||||||
|
Amount = x.Amount == null ? "" : x.Amount.ToString("N0", new CultureInfo("th-TH")).ToThaiNumber(),
|
||||||
|
Remark = x.Remark == null ? "" : x.Remark.ToThaiNumber(),
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
var result = new
|
||||||
|
{
|
||||||
|
profile.Fullname,
|
||||||
|
profile.Position,
|
||||||
|
profile.Oc,
|
||||||
|
profile.BirthDate,
|
||||||
|
profile.DateAppoint,
|
||||||
|
Salarys = salarys
|
||||||
|
};
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//47-บัญชีระดับผลการประเมินผลการปฏิบัติราชการในรอบ 5 ปี
|
//47-บัญชีระดับผลการประเมินผลการปฏิบัติราชการในรอบ 5 ปี
|
||||||
public async Task<dynamic> GetEvaluationResultReport(Guid id, string type = null, int node = -1, Guid nodeId = default)
|
public async Task<dynamic> GetEvaluationResultReport(Guid id, string type = null, int node = -1, Guid nodeId = default)
|
||||||
{
|
{
|
||||||
|
|
@ -1148,7 +1236,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
var _apiUrl = $"{_baseAPI}/org/unauthorize/calculateEvaluation/{type}";
|
var _apiUrl = $"{_baseAPI}/org/unauthorize/calculateEvaluation/{type}";
|
||||||
using (var _client = new HttpClient())
|
using (var _client = new HttpClient())
|
||||||
{
|
{
|
||||||
_client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
_client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Get, _apiUrl);
|
var _req = new HttpRequestMessage(HttpMethod.Get, _apiUrl);
|
||||||
var _res = await _client.SendAsync(_req);
|
var _res = await _client.SendAsync(_req);
|
||||||
var _result = await _res.Content.ReadAsStringAsync();
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -1253,6 +1341,104 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
return resultList;
|
return resultList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//47-บัญชีระดับผลการประเมินผลการปฏิบัติราชการในรอบ 5 ปี NEW
|
||||||
|
public async Task<dynamic> GetEvaluationResult5YearReport(Guid id, string type = null, int node = -1, Guid nodeId = default)
|
||||||
|
{
|
||||||
|
var period = await _dbContext.Set<InsigniaPeriod>()
|
||||||
|
.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
|
if (period == null)
|
||||||
|
throw new Exception(GlobalMessages.InsigniaPeriodNotFound);
|
||||||
|
|
||||||
|
var data_insigniaQuery = _dbContext.Set<InsigniaRequestProfile>()
|
||||||
|
.Where(x => x.Request.Period.Id == period.Id)
|
||||||
|
.Where(x => x.IsApprove == true)
|
||||||
|
.Where(x => x.Status == "PENDING")
|
||||||
|
.Where(x => x.RequestInsignia.InsigniaType != null);
|
||||||
|
|
||||||
|
if (type == "officer")
|
||||||
|
{
|
||||||
|
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType == "officer");
|
||||||
|
}
|
||||||
|
else if (type == "employee")
|
||||||
|
{
|
||||||
|
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType == "employee");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
switch (node)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
data_insigniaQuery = data_insigniaQuery.Where(r => r.RootDnaId == nodeId);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child1DnaId == nodeId);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child2DnaId == nodeId);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child3DnaId == nodeId);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child4DnaId == nodeId);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
var data = await data_insigniaQuery
|
||||||
|
.Select(x => new
|
||||||
|
{
|
||||||
|
ProfileId = x.ProfileId,
|
||||||
|
FullName = $"{x.Prefix}{x.FirstName} {x.LastName}",
|
||||||
|
RequestInsigniaName = x.RequestInsignia.Name, // Name of the Insignia
|
||||||
|
Reason = x.Reason,
|
||||||
|
Agency = x.Root,
|
||||||
|
ResultAPR1 = x.APR1,
|
||||||
|
ResultOCT1 = x.OCT1,
|
||||||
|
ResultAPR2 = x.APR2,
|
||||||
|
ResultOCT2 = x.OCT2,
|
||||||
|
ResultAPR3 = x.APR3,
|
||||||
|
ResultOCT3 = x.OCT3,
|
||||||
|
ResultAPR4 = x.APR4,
|
||||||
|
ResultOCT4 = x.OCT4,
|
||||||
|
ResultAPR5 = x.APR5,
|
||||||
|
ResultOCT5 = x.OCT5
|
||||||
|
})
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
var seq = 1;
|
||||||
|
var resultList = new List<object>();
|
||||||
|
foreach (var d in data)
|
||||||
|
{
|
||||||
|
resultList.Add(new
|
||||||
|
{
|
||||||
|
rowNo = seq++.ToString().ToThaiNumber(),
|
||||||
|
d.ProfileId,
|
||||||
|
d.FullName,
|
||||||
|
d.RequestInsigniaName,
|
||||||
|
Agency = d.Agency,
|
||||||
|
ResultAPR1 = d.ResultAPR1 ?? "-",
|
||||||
|
ResultOCT1 = d.ResultOCT1 ?? "-",
|
||||||
|
ResultAPR2 = d.ResultAPR2 ?? "-",
|
||||||
|
ResultOCT2 = d.ResultOCT2 ?? "-",
|
||||||
|
ResultAPR3 = d.ResultAPR3 ?? "-",
|
||||||
|
ResultOCT3 = d.ResultOCT3 ?? "-",
|
||||||
|
ResultAPR4 = d.ResultAPR4 ?? "-",
|
||||||
|
ResultOCT4 = d.ResultOCT4 ?? "-",
|
||||||
|
ResultAPR5 = d.ResultAPR5 ?? "-",
|
||||||
|
ResultOCT5 = d.ResultOCT5 ?? "-",
|
||||||
|
Remark = d.Reason ?? "-"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return resultList;
|
||||||
|
}
|
||||||
|
|
||||||
//noti ยื่นเสนอคน
|
//noti ยื่นเสนอคน
|
||||||
public async Task NotifyInsignia()
|
public async Task NotifyInsignia()
|
||||||
{
|
{
|
||||||
|
|
@ -1389,7 +1575,53 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void CalculateInsigniaRequestBkkByType(string type = "officer")
|
||||||
|
{
|
||||||
|
CalInsigniaRequestBkkByType(type).GetAwaiter().GetResult();
|
||||||
|
}
|
||||||
|
|
||||||
//คำนวนผู้ได้รับเครื่องราชฯ
|
//คำนวนผู้ได้รับเครื่องราชฯ
|
||||||
|
public async Task CalInsigniaRequestBkkByType(string type = "officer")
|
||||||
|
{
|
||||||
|
var insigniaPeriods = await _dbContext.Set<InsigniaPeriod>()
|
||||||
|
.Include(x => x.InsigniaRequests)
|
||||||
|
.AsQueryable()
|
||||||
|
.ToListAsync();
|
||||||
|
insigniaPeriods = insigniaPeriods
|
||||||
|
.Where(x => x.StartDate <= DateTime.Now.Date && x.InsigniaRequests.Where(x => x.ProfileType!.ToLower().Trim() == type.Trim().ToLower()).Count() == 0).ToList();
|
||||||
|
|
||||||
|
foreach (var insigniaPeriod in insigniaPeriods)
|
||||||
|
{
|
||||||
|
var organizations = await _userProfileRepository.GetActiveRootLatestAsync(AccessToken);
|
||||||
|
if (organizations == null)
|
||||||
|
continue;
|
||||||
|
insigniaPeriod.RevisionId = Guid.Parse(organizations[0].OrgRevisionId);
|
||||||
|
foreach (var organization in organizations)
|
||||||
|
{
|
||||||
|
if (organization == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var result = await _repositoryInsignia.GetInsigniaRequestByTypeAsync(insigniaPeriod.Id, organization.Id, type);
|
||||||
|
if (result != null)
|
||||||
|
{
|
||||||
|
Guid period = result.PeriodId;
|
||||||
|
string requestStatus = result.RequestStatus;
|
||||||
|
var candidate = await _repositoryInsignia.GetInsigniaCandidateBKKByTypeAsync(insigniaPeriod.Id, organization.Id, type);
|
||||||
|
// ตรวจสอบว่ารายการอยู่ใน table insignia_request_new
|
||||||
|
if (requestStatus == null)
|
||||||
|
{
|
||||||
|
// บันทึกรายชื่อ
|
||||||
|
if (candidate != null)
|
||||||
|
await _repositoryInsignia.InsertCandidate(period, organization.Id, organization.OrgRootName, candidate, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public async Task CalInsignaiRequestBkk()
|
public async Task CalInsignaiRequestBkk()
|
||||||
{
|
{
|
||||||
var insigniaPeriods = await _dbContext.Set<InsigniaPeriod>()
|
var insigniaPeriods = await _dbContext.Set<InsigniaPeriod>()
|
||||||
|
|
@ -1430,6 +1662,8 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public async Task<dynamic> GetKhr5TotalReport(Guid id, string type = null, int node = -1, Guid nodeId = default)
|
public async Task<dynamic> GetKhr5TotalReport(Guid id, string type = null, int node = -1, Guid nodeId = default)
|
||||||
{
|
{
|
||||||
var period = await _dbContext.Set<InsigniaNote>()
|
var period = await _dbContext.Set<InsigniaNote>()
|
||||||
|
|
@ -1447,11 +1681,11 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
|
|
||||||
if (type == "officer")
|
if (type == "officer")
|
||||||
{
|
{
|
||||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType.Trim().ToUpper() == "OFFICER");
|
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType.Trim().ToLower() == "officer");
|
||||||
}
|
}
|
||||||
else if (type == "employee")
|
else if (type == "employee")
|
||||||
{
|
{
|
||||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType.Trim().ToUpper() == "EMPLOYEE");
|
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType.Trim().ToLower() == "employee");
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (node)
|
switch (node)
|
||||||
|
|
@ -1520,11 +1754,11 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
|
|
||||||
if (type == "officer")
|
if (type == "officer")
|
||||||
{
|
{
|
||||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType.Trim().ToUpper() == "OFFICER");
|
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType.Trim().ToLower() == "officer");
|
||||||
}
|
}
|
||||||
else if (type == "employee")
|
else if (type == "employee")
|
||||||
{
|
{
|
||||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType.Trim().ToUpper() == "EMPLOYEE");
|
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType.Trim().ToLower() == "employee");
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (node)
|
switch (node)
|
||||||
|
|
@ -1560,6 +1794,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
RequestInsigniaName = x.RequestInsignia.Name,
|
RequestInsigniaName = x.RequestInsignia.Name,
|
||||||
IsApprove = x.IsApprove,
|
IsApprove = x.IsApprove,
|
||||||
InsigniaInitial = $"{x.RequestInsignia.Name}({x.RequestInsignia.ShortName})", // Insignia's full name and short name
|
InsigniaInitial = $"{x.RequestInsignia.Name}({x.RequestInsignia.ShortName})", // Insignia's full name and short name
|
||||||
|
DatePayment = x.DatePayment,
|
||||||
OcId = x.Root
|
OcId = x.Root
|
||||||
}).ToListAsync();
|
}).ToListAsync();
|
||||||
var insignia = (from r in data
|
var insignia = (from r in data
|
||||||
|
|
@ -1570,8 +1805,10 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
DepartmentName = g.Key.OcId,
|
DepartmentName = g.Key.OcId,
|
||||||
InsigniaTypeName = g.Key.InsigniaTypeName,
|
InsigniaTypeName = g.Key.InsigniaTypeName,
|
||||||
RequestInsigniaName = g.Key.RequestInsigniaName,
|
RequestInsigniaName = g.Key.RequestInsigniaName,
|
||||||
Pending = g.Sum(x => x.IsApprove == false ? 1 : 0),
|
/* Pending = g.Sum(x => x.IsApprove == false ? 1 : 0),
|
||||||
Done = g.Sum(x => x.IsApprove == true ? 1 : 0),
|
Done = g.Sum(x => x.IsApprove == true ? 1 : 0),*/
|
||||||
|
Pending = g.Sum(x => x.DatePayment == null ? 1 : 0),
|
||||||
|
Done = g.Sum(x => x.DatePayment != null ? 1 : 0),
|
||||||
Remark = "",
|
Remark = "",
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
|
|
@ -1593,11 +1830,11 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
|
|
||||||
if (type == "officer")
|
if (type == "officer")
|
||||||
{
|
{
|
||||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType.Trim().ToUpper() == "OFFICER");
|
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType.Trim().ToLower() == "officer");
|
||||||
}
|
}
|
||||||
else if (type == "employee")
|
else if (type == "employee")
|
||||||
{
|
{
|
||||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType.Trim().ToUpper() == "EMPLOYEE");
|
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType.Trim().ToLower() == "employee");
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (node)
|
switch (node)
|
||||||
|
|
@ -1630,7 +1867,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
{
|
{
|
||||||
CitizenId = x.CitizenId,
|
CitizenId = x.CitizenId,
|
||||||
Prefix = x.Prefix,
|
Prefix = x.Prefix,
|
||||||
FullName = $"{x.Prefix}{x.FirstName} {x.LastName}",
|
FullName = $"{x.FirstName} {x.LastName}",
|
||||||
PosTypeName = x.PosTypeName,
|
PosTypeName = x.PosTypeName,
|
||||||
PosLevelName = x.PosLevelName,
|
PosLevelName = x.PosLevelName,
|
||||||
Position = x.Position,
|
Position = x.Position,
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Get, api_url);
|
var req = new HttpRequestMessage(HttpMethod.Get, api_url);
|
||||||
var res = await client.SendAsync(req);
|
var res = await client.SendAsync(req);
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -161,7 +161,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Get, api_url);
|
var req = new HttpRequestMessage(HttpMethod.Get, api_url);
|
||||||
var res = await client.SendAsync(req);
|
var res = await client.SendAsync(req);
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -433,7 +433,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Get, api_url);
|
var req = new HttpRequestMessage(HttpMethod.Get, api_url);
|
||||||
var res = await client.SendAsync(req);
|
var res = await client.SendAsync(req);
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -642,7 +642,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Get, api_url);
|
var req = new HttpRequestMessage(HttpMethod.Get, api_url);
|
||||||
var res = await client.SendAsync(req);
|
var res = await client.SendAsync(req);
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -894,7 +894,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var req = new HttpRequestMessage(HttpMethod.Get, api_url);
|
var req = new HttpRequestMessage(HttpMethod.Get, api_url);
|
||||||
var res = await client.SendAsync(req);
|
var res = await client.SendAsync(req);
|
||||||
var result = await res.Content.ReadAsStringAsync();
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
var _res = await client.SendAsync(_req);
|
var _res = await client.SendAsync(_req);
|
||||||
var _result = await _res.Content.ReadAsStringAsync();
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -192,7 +192,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
}).ToList();
|
}).ToList();
|
||||||
}
|
}
|
||||||
string SignDate = retireHistorys.SignDate != null ? DateTime.Parse(retireHistorys.SignDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber() : "-";
|
string SignDate = retireHistorys.SignDate != null ? DateTime.Parse(retireHistorys.SignDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber() : "-";
|
||||||
return new { SignDate, retireHistorys.Detail, retireHistorys.Id, retireHistorys.CreatedAt, Year = retireHistorys.Year.ToThaiYear().ToString().ToThaiNumber(), retireHistorys.Round, retireHistorys.Type, retireHistorys.TypeReport, Total = retireHistorys.Total.ToString().ToThaiNumber(), profiles = mapProfiles };
|
return new { SignDate, Detail = retireHistorys.Detail.ToThaiNumber(), retireHistorys.Id, retireHistorys.CreatedAt, Year = retireHistorys.Year.ToThaiYear().ToString().ToThaiNumber(), retireHistorys.Round, retireHistorys.Type, retireHistorys.TypeReport, Total = retireHistorys.Total.ToString().ToThaiNumber(), profiles = mapProfiles };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -274,13 +274,15 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
{
|
{
|
||||||
if (retire.TypeReport == null)
|
if (retire.TypeReport == null)
|
||||||
{
|
{
|
||||||
profile_retire = profile_retire.OrderBy(x => rootOrder.ToObject<List<string>>().IndexOf(x.root))
|
profile_retire = profile_retire
|
||||||
|
.OrderBy(x => string.IsNullOrEmpty(x.root) ? int.MaxValue : rootOrder.ToObject<List<string>>().IndexOf(x.root))
|
||||||
.ThenBy(x => child1Order.ToObject<List<string>>().IndexOf(x.child1 ?? ""))
|
.ThenBy(x => child1Order.ToObject<List<string>>().IndexOf(x.child1 ?? ""))
|
||||||
.ThenBy(x => child2Order.ToObject<List<string>>().IndexOf(x.child2 ?? ""))
|
.ThenBy(x => child2Order.ToObject<List<string>>().IndexOf(x.child2 ?? ""))
|
||||||
.ThenBy(x => child3Order.ToObject<List<string>>().IndexOf(x.child3 ?? ""))
|
.ThenBy(x => child3Order.ToObject<List<string>>().IndexOf(x.child3 ?? ""))
|
||||||
.ThenBy(x => child4Order.ToObject<List<string>>().IndexOf(x.child4 ?? ""))
|
.ThenBy(x => child4Order.ToObject<List<string>>().IndexOf(x.child4 ?? ""))
|
||||||
.ThenBy(x => posTypeNameOrder.ToObject<List<string>>().IndexOf(x.posTypeName ?? ""))
|
.ThenBy(x => posTypeNameOrder.ToObject<List<string>>().IndexOf(x.posTypeName ?? ""))
|
||||||
.ThenBy(x => posLevelNameOrder.ToObject<List<string>>().IndexOf(x.posLevelName ?? "")).ToList();
|
.ThenBy(x => posLevelNameOrder.ToObject<List<string>>().IndexOf(x.posLevelName ?? ""))
|
||||||
|
.ThenBy(x => x.posNo).ToList();
|
||||||
}
|
}
|
||||||
mapProfiles = profile_retire.Select((profile, index) =>
|
mapProfiles = profile_retire.Select((profile, index) =>
|
||||||
{
|
{
|
||||||
|
|
@ -310,7 +312,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
root = (isDuplicateRoot ? "" : profile.root + "\n") +
|
root = (isDuplicateRoot ? "" : profile.root + "\n") +
|
||||||
(isDuplicateHospital || !hospital.ToObject<List<string>>().Contains(profile.child1) ? "" : profile.child1 + "\n") +
|
(isDuplicateHospital || !hospital.ToObject<List<string>>().Contains(profile.child1) ? "" : profile.child1 + "\n") +
|
||||||
(isDuplicatePosType ? "" : $"ตำแหน่งประเภท{profile.posTypeName}" + "\n") +
|
(isDuplicatePosType ? "" : $"ตำแหน่งประเภท{profile.posTypeName}" + "\n") +
|
||||||
(isDuplicatePosLevel ? "" : $"ระดับ{profile.posLevelName}"),
|
(isDuplicatePosLevel ? "" : $"ระดับ{profile.posLevelName}").ToThaiNumber(),
|
||||||
child = (profile.posExecutiveName == null ? "" : profile.posExecutiveName + "\n") +
|
child = (profile.posExecutiveName == null ? "" : profile.posExecutiveName + "\n") +
|
||||||
(profile.child4 == null ? "" : profile.child4 + "\n") +
|
(profile.child4 == null ? "" : profile.child4 + "\n") +
|
||||||
(profile.child3 == null ? "" : profile.child3 + "\n") +
|
(profile.child3 == null ? "" : profile.child3 + "\n") +
|
||||||
|
|
@ -324,7 +326,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
}).ToList();
|
}).ToList();
|
||||||
}
|
}
|
||||||
string SignDate = retire.SignDate != null ? DateTime.Parse(retire.SignDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber() : "-";
|
string SignDate = retire.SignDate != null ? DateTime.Parse(retire.SignDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber() : "-";
|
||||||
return new { SignDate, retire.Detail, retire.Id, retire.CreatedAt, Year = retire.Year.ToThaiYear().ToString().ToThaiNumber(), retire.Round, retire.Type, retire.TypeReport, Total = profile_retire.Count.ToString().ToThaiNumber(), profiles = mapProfiles };
|
return new { SignDate, Detail = retire.Detail.ToThaiNumber(), retire.Id, retire.CreatedAt, Year = retire.Year.ToThaiYear().ToString().ToThaiNumber(), retire.Round, retire.Type, retire.TypeReport, Total = profile_retire.Count.ToString().ToThaiNumber(), profiles = mapProfiles };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
@ -503,6 +505,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
p.CommanderRejectReason,
|
p.CommanderRejectReason,
|
||||||
p.CommanderRejectDate,
|
p.CommanderRejectDate,
|
||||||
p.RemarkHorizontal,
|
p.RemarkHorizontal,
|
||||||
|
Type = "OFFICER"
|
||||||
})
|
})
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
if (data == null)
|
if (data == null)
|
||||||
|
|
@ -540,10 +543,130 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
p.CommanderRejectReason,
|
p.CommanderRejectReason,
|
||||||
p.CommanderRejectDate,
|
p.CommanderRejectDate,
|
||||||
p.RemarkHorizontal,
|
p.RemarkHorizontal,
|
||||||
|
Type = "EMPLOYEE",
|
||||||
})
|
})
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
if (data == null)
|
if (data == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
var approverPositionExecutiveName = "...............";
|
||||||
|
var approverStatus = "☐ อนุญาต";
|
||||||
|
var approverRejectStatus = "☐ ยับยั้งการลาออกไว้จนถึงวันที่...................";
|
||||||
|
var approver = "...................";
|
||||||
|
var approverPosition = "...................";
|
||||||
|
|
||||||
|
var diffDate = "☐ ไม่น้อยกว่า ๓๐ วัน ☐ น้อยกว่า ๓๐ วัน";
|
||||||
|
if (data.SendDate.HasValue && data.ActiveDate.HasValue)
|
||||||
|
{
|
||||||
|
var time = data.ActiveDate.Value - data.SendDate.Value;
|
||||||
|
var day = time.TotalDays;
|
||||||
|
if (day < 30)
|
||||||
|
{
|
||||||
|
diffDate = "☐ ไม่น้อยกว่า ๓๐ วัน ☑ น้อยกว่า ๓๐ วัน";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
diffDate = "☑ ไม่น้อยกว่า ๓๐ วัน ☐ น้อยกว่า ๓๐ วัน";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var commanderDateUpdate = "วันที่...................";
|
||||||
|
var commanderStatus = "☐ อนุญาต ตั้งแต่วันที่...................";
|
||||||
|
var commanderCommentApprove = "...................";
|
||||||
|
var commanderRejectStatus = "☐ ยับยั้งการลาออกไว้จนถึงวันที่...................";
|
||||||
|
var commanderCommentReject = "...................";
|
||||||
|
var commander = "...................";
|
||||||
|
var commanderPosition = "...................";
|
||||||
|
|
||||||
|
if (data.Type == "OFFICER")
|
||||||
|
{
|
||||||
|
var Approver = _dbContext.Set<RetirementResignApprover>()
|
||||||
|
.Where(x => x.RetirementResign.Id == data.Id && x.ApproveType == "APPROVER")
|
||||||
|
.ToList();
|
||||||
|
var Commander = _dbContext.Set<RetirementResignApprover>()
|
||||||
|
.Where(x => x.RetirementResign.Id == data.Id && x.ApproveType == "COMMANDER")
|
||||||
|
.OrderByDescending(x => x.Seq)
|
||||||
|
.ToList();
|
||||||
|
if (Approver.Count > 0)
|
||||||
|
{
|
||||||
|
approverPositionExecutiveName = Approver[0].PositionExecutiveName;
|
||||||
|
approverStatus = Approver[0].ApproveStatus == "APPROVE" ? "☑ อนุญาต" : approverStatus;
|
||||||
|
approverRejectStatus = Approver[0].ApproveStatus == "REJECT"
|
||||||
|
? $"☑ ยับยั้งการลาออกไว้จนถึง{(Approver[0].RejectDate != null ? DateTime.Parse(Approver[0].RejectDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber() : "วันที่...................")}"
|
||||||
|
: approverRejectStatus;
|
||||||
|
approver = $"{Approver[0].Prefix}{Approver[0].FirstName} {Approver[0].LastName}";
|
||||||
|
approverPosition = Approver[0].PositionName;
|
||||||
|
}
|
||||||
|
if (Commander.Count > 0)
|
||||||
|
{
|
||||||
|
commanderDateUpdate = Commander.Count > 1
|
||||||
|
? Commander[1].LastUpdatedAt != null
|
||||||
|
? DateTime.Parse(Commander[1].LastUpdatedAt.ToString()).ToThaiFullDate().ToString().ToThaiNumber()
|
||||||
|
: commanderDateUpdate
|
||||||
|
: Commander[0].LastUpdatedAt != null
|
||||||
|
? DateTime.Parse(Commander[0].LastUpdatedAt.ToString()).ToThaiFullDate().ToString().ToThaiNumber()
|
||||||
|
: commanderDateUpdate;
|
||||||
|
commanderStatus = Commander[0].ApproveStatus == "APPROVE"
|
||||||
|
? $"☑ อนุญาต ตั้งแต่{(Commander[0].LastUpdatedAt != null ? DateTime.Parse(Commander[0].LastUpdatedAt.ToString()).ToThaiFullDate().ToString().ToThaiNumber() : "วันที่...................")}"
|
||||||
|
: commanderStatus;
|
||||||
|
commanderCommentApprove = Commander[0].ApproveStatus == "APPROVE"
|
||||||
|
? !string.IsNullOrWhiteSpace(Commander[0].Comment) ? Commander[0].Comment : commanderCommentApprove
|
||||||
|
: commanderCommentApprove;
|
||||||
|
commanderRejectStatus = Commander[0].ApproveStatus == "REJECT"
|
||||||
|
? $"☑ ยับยั้งการลาออกไว้จนถึง{(Commander[0].RejectDate != null ? DateTime.Parse(Commander[0].RejectDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber() : "วันที่...................")}"
|
||||||
|
: approverRejectStatus;
|
||||||
|
commanderCommentReject = Commander[0].ApproveStatus == "REJECT"
|
||||||
|
? !string.IsNullOrWhiteSpace(Commander[0].Comment) ? Commander[0].Comment : commanderCommentReject
|
||||||
|
: commanderCommentReject;
|
||||||
|
commander = $"{Commander[0].Prefix}{Commander[0].FirstName} {Commander[0].LastName}";
|
||||||
|
commanderPosition = Commander[0].PositionName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var EmpApproves = _dbContext.Set<RetirementResignEmployeeApprover>()
|
||||||
|
.Where(x => x.RetirementResignEmployee.Id == data.Id && x.ApproveType == "APPROVER")
|
||||||
|
.ToList();
|
||||||
|
var EmpCommander = _dbContext.Set<RetirementResignEmployeeApprover>()
|
||||||
|
.Where(x => x.RetirementResignEmployee.Id == data.Id && x.ApproveType == "COMMANDER")
|
||||||
|
.OrderByDescending(x => x.Seq)
|
||||||
|
.ToList();
|
||||||
|
if (EmpApproves.Count > 0)
|
||||||
|
{
|
||||||
|
approverPositionExecutiveName = EmpApproves[0].PositionExecutiveName;
|
||||||
|
approverStatus = EmpApproves[0].ApproveStatus == "APPROVE" ? "☑ อนุญาต" : approverStatus;
|
||||||
|
approverRejectStatus = EmpApproves[0].ApproveStatus == "REJECT"
|
||||||
|
? $"☑ ยับยั้งการลาออกไว้จนถึง{(EmpApproves[0].RejectDate != null ? DateTime.Parse(EmpApproves[0].RejectDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber() : "วันที่...................")}"
|
||||||
|
: approverRejectStatus;
|
||||||
|
approver = $"{EmpApproves[0].Prefix}{EmpApproves[0].FirstName} {EmpApproves[0].LastName}";
|
||||||
|
approverPosition = EmpApproves[0].PositionName;
|
||||||
|
}
|
||||||
|
if (EmpCommander.Count > 0)
|
||||||
|
{
|
||||||
|
commanderDateUpdate = EmpCommander.Count > 1
|
||||||
|
? EmpCommander[1].LastUpdatedAt != null
|
||||||
|
? DateTime.Parse(EmpCommander[1].LastUpdatedAt.ToString()).ToThaiFullDate().ToString().ToThaiNumber()
|
||||||
|
: commanderDateUpdate
|
||||||
|
: EmpCommander[0].LastUpdatedAt != null
|
||||||
|
? DateTime.Parse(EmpCommander[0].LastUpdatedAt.ToString()).ToThaiFullDate().ToString().ToThaiNumber()
|
||||||
|
: commanderDateUpdate;
|
||||||
|
commanderStatus = EmpCommander[0].ApproveStatus == "APPROVE"
|
||||||
|
? $"☑ อนุญาต ตั้งแต่{(EmpCommander[0].LastUpdatedAt != null ? DateTime.Parse(EmpCommander[0].LastUpdatedAt.ToString()).ToThaiFullDate().ToString().ToThaiNumber() : "วันที่...................")}"
|
||||||
|
: commanderStatus;
|
||||||
|
commanderCommentApprove = EmpCommander[0].ApproveStatus == "APPROVE"
|
||||||
|
? !string.IsNullOrWhiteSpace(EmpCommander[0].Comment) ? EmpCommander[0].Comment : commanderCommentApprove
|
||||||
|
: commanderCommentApprove;
|
||||||
|
commanderRejectStatus = EmpCommander[0].ApproveStatus == "REJECT"
|
||||||
|
? $"☑ ยับยั้งการลาออกไว้จนถึง{(EmpCommander[0].RejectDate != null ? DateTime.Parse(EmpCommander[0].RejectDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber() : "วันที่...................")}"
|
||||||
|
: approverRejectStatus;
|
||||||
|
commanderCommentReject = EmpCommander[0].ApproveStatus == "REJECT"
|
||||||
|
? !string.IsNullOrWhiteSpace(EmpCommander[0].Comment) ? EmpCommander[0].Comment : commanderCommentReject
|
||||||
|
: commanderCommentReject;
|
||||||
|
commander = $"{EmpCommander[0].Prefix}{EmpCommander[0].FirstName} {EmpCommander[0].LastName}";
|
||||||
|
commanderPosition = EmpCommander[0].PositionName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var _data = new
|
var _data = new
|
||||||
{
|
{
|
||||||
data.Id,
|
data.Id,
|
||||||
|
|
@ -578,6 +701,19 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
data.CommanderRejectReason,
|
data.CommanderRejectReason,
|
||||||
CommanderRejectDate = string.IsNullOrEmpty(data.CommanderRejectDate.ToString()) ? string.Empty : DateTime.Parse(data.CommanderRejectDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber(),
|
CommanderRejectDate = string.IsNullOrEmpty(data.CommanderRejectDate.ToString()) ? string.Empty : DateTime.Parse(data.CommanderRejectDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber(),
|
||||||
data.RemarkHorizontal,
|
data.RemarkHorizontal,
|
||||||
|
dear = approverPositionExecutiveName,
|
||||||
|
approverStatus,
|
||||||
|
approverRejectStatus,
|
||||||
|
approver,
|
||||||
|
approverPosition,
|
||||||
|
diffDate,
|
||||||
|
commanderDateUpdate,
|
||||||
|
commanderStatus,
|
||||||
|
commanderCommentApprove,
|
||||||
|
commanderRejectStatus,
|
||||||
|
commanderCommentReject,
|
||||||
|
commander,
|
||||||
|
commanderPosition
|
||||||
};
|
};
|
||||||
|
|
||||||
return _data;
|
return _data;
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,8 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
|
|
||||||
return new
|
return new
|
||||||
{
|
{
|
||||||
CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM")).ToThaiFullDate().ToString().ToThaiNumber().Remove(0, 15),
|
//CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM")).ToThaiFullDate().ToString().ToThaiNumber().Remove(0, 15),
|
||||||
|
CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).ToThaiFullDate2().ToString().ToThaiNumber(),
|
||||||
Name = $"{data.prefix}{data.firstName} {data.lastName}",
|
Name = $"{data.prefix}{data.firstName} {data.lastName}",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -52,7 +53,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
|
|
||||||
return new
|
return new
|
||||||
{
|
{
|
||||||
CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM")).ToThaiFullDate().ToString().ToThaiNumber().Remove(0, 15),
|
CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).ToThaiFullDate2().ToString().ToThaiNumber(),
|
||||||
Subject = $"ข้าราชการกรุงเทพมหานครสามัญขอโอน",
|
Subject = $"ข้าราชการกรุงเทพมหานครสามัญขอโอน",
|
||||||
Name = $"{data.prefix}{data.firstName} {data.lastName}",
|
Name = $"{data.prefix}{data.firstName} {data.lastName}",
|
||||||
};
|
};
|
||||||
|
|
@ -67,7 +68,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
return new
|
return new
|
||||||
{
|
{
|
||||||
CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM")).ToThaiFullDate().ToString().ToThaiNumber().Remove(0, 15),
|
CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).ToThaiFullDate2().ToString().ToThaiNumber(),
|
||||||
Subject = $"ข้าราชการขอโอน",
|
Subject = $"ข้าราชการขอโอน",
|
||||||
Name = $"{data.prefix}{data.firstName} {data.lastName}",
|
Name = $"{data.prefix}{data.firstName} {data.lastName}",
|
||||||
Location = $"สำนักงานคณะกรรมการข้าราชการกรุงเทพมหานคร ๑๗๓ ถนนดินสอ กทม. ๑๐๒๐๐",
|
Location = $"สำนักงานคณะกรรมการข้าราชการกรุงเทพมหานคร ๑๗๓ ถนนดินสอ กทม. ๑๐๒๐๐",
|
||||||
|
|
@ -84,7 +85,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
|
|
||||||
return new
|
return new
|
||||||
{
|
{
|
||||||
CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM")).ToThaiFullDate().ToString().ToThaiNumber().Remove(0, 15),
|
CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).ToThaiFullDate2().ToString().ToThaiNumber(),
|
||||||
Subject = $"ข้าราชการกรุงเทพมหานครสามัญขอโอน",
|
Subject = $"ข้าราชการกรุงเทพมหานครสามัญขอโอน",
|
||||||
Subject2 = $"ตรวจสอบหนี้สิน และภาระผูกพันกับกรุงเทพมหานครของข้าราชการ",
|
Subject2 = $"ตรวจสอบหนี้สิน และภาระผูกพันกับกรุงเทพมหานครของข้าราชการ",
|
||||||
Subject3 = $"ตรวจสอบหนี้สินและภาระผูกพันของข้าราชการ",
|
Subject3 = $"ตรวจสอบหนี้สินและภาระผูกพันของข้าราชการ",
|
||||||
|
|
@ -105,7 +106,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
|
|
||||||
return new
|
return new
|
||||||
{
|
{
|
||||||
CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM")).ToThaiFullDate().ToString().ToThaiNumber().Remove(0, 15),
|
CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).ToThaiFullDate2().ToString().ToThaiNumber(),
|
||||||
Subject = $"ข้าราชการกรุงเทพมหานครสามัญขอโอน",
|
Subject = $"ข้าราชการกรุงเทพมหานครสามัญขอโอน",
|
||||||
Subject2 = $"ตรวจสอบพฤติการณ์ทางวินัย และภาระหนี้สิน (เงินกู้สวัสดิการข้าราชการ) ของข้าราชการ",
|
Subject2 = $"ตรวจสอบพฤติการณ์ทางวินัย และภาระหนี้สิน (เงินกู้สวัสดิการข้าราชการ) ของข้าราชการ",
|
||||||
Subject3 = $"ตรวจสอบภาระผูกพันกับกรุงเทพมหานครเกี่ยวกับการลาศึกษา อบรม ของข้าราชการ",
|
Subject3 = $"ตรวจสอบภาระผูกพันกับกรุงเทพมหานครเกี่ยวกับการลาศึกษา อบรม ของข้าราชการ",
|
||||||
|
|
@ -126,7 +127,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
|
|
||||||
return new
|
return new
|
||||||
{
|
{
|
||||||
CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM")).ToThaiFullDate().ToString().ToThaiNumber().Remove(0, 15),
|
CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).ToThaiFullDate2().ToString().ToThaiNumber(),
|
||||||
Subject = $"ข้าราชการกรุงเทพมหานครสามัญขอโอน",
|
Subject = $"ข้าราชการกรุงเทพมหานครสามัญขอโอน",
|
||||||
Subject2 = $"ตรวจสอบพฤติการณ์ทางวินัย และภาระหนี้สิน (เงินกู้สวัสดิการข้าราชการ) ของข้าราชการ",
|
Subject2 = $"ตรวจสอบพฤติการณ์ทางวินัย และภาระหนี้สิน (เงินกู้สวัสดิการข้าราชการ) ของข้าราชการ",
|
||||||
Subject3 = $"ตรวจสอบภาระผูกพันกับกรุงเทพมหานครเกี่ยวกับการลาศึกษา อบรม ของข้าราชการ",
|
Subject3 = $"ตรวจสอบภาระผูกพันกับกรุงเทพมหานครเกี่ยวกับการลาศึกษา อบรม ของข้าราชการ",
|
||||||
|
|
|
||||||
1027
BMA.EHR.Application/Repositories/RetirementEmployeeRepository.cs
Normal file
1027
BMA.EHR.Application/Repositories/RetirementEmployeeRepository.cs
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1,11 +1,14 @@
|
||||||
using BMA.EHR.Application.Common.Interfaces;
|
using BMA.EHR.Application.Common.Interfaces;
|
||||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||||
|
using BMA.EHR.Domain.Models.Notifications;
|
||||||
using BMA.EHR.Domain.Models.Retirement;
|
using BMA.EHR.Domain.Models.Retirement;
|
||||||
|
using BMA.EHR.Domain.Shared;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
|
using System.Net.Http.Json;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
|
|
@ -17,15 +20,18 @@ namespace BMA.EHR.Application.Repositories
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
private readonly NotificationRepository _repositoryNoti;
|
private readonly NotificationRepository _repositoryNoti;
|
||||||
private readonly IConfiguration _configuration;
|
private readonly IConfiguration _configuration;
|
||||||
|
private readonly string URL = string.Empty;
|
||||||
public RetirementRepository(IApplicationDBContext dbContext,
|
public RetirementRepository(IApplicationDBContext dbContext,
|
||||||
NotificationRepository repositoryNoti,
|
NotificationRepository repositoryNoti,
|
||||||
IHttpContextAccessor httpContextAccessor,
|
IHttpContextAccessor httpContextAccessor,
|
||||||
|
UserProfileRepository userProfileRepository,
|
||||||
IConfiguration configuration) : base(dbContext, httpContextAccessor)
|
IConfiguration configuration) : base(dbContext, httpContextAccessor)
|
||||||
{
|
{
|
||||||
_dbContext = dbContext;
|
_dbContext = dbContext;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
_repositoryNoti = repositoryNoti;
|
_repositoryNoti = repositoryNoti;
|
||||||
_configuration = configuration;
|
_configuration = configuration;
|
||||||
|
URL = _configuration["VITE_URL_MGT"];
|
||||||
}
|
}
|
||||||
|
|
||||||
#region " Properties "
|
#region " Properties "
|
||||||
|
|
@ -83,54 +89,836 @@ namespace BMA.EHR.Application.Repositories
|
||||||
await _dbContext.SaveChangesAsync();
|
await _dbContext.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
//เกษียณอายุราชการ
|
|
||||||
//public async Task ExecuteRetirement()
|
|
||||||
//{
|
|
||||||
// var retirePeriodOfficer = await _dbContext.Set<RetirementPeriod>()
|
|
||||||
// .Include(x => x.RetirementRawProfiles.Where(y => y.Remove != "REMOVE"))
|
|
||||||
// .Where(x => x.Year == DateTime.Now.Year)
|
|
||||||
// .Where(x => x.Type.Trim().ToUpper().Contains("OFFICER"))
|
|
||||||
// .FirstOrDefaultAsync();
|
|
||||||
|
|
||||||
// if (retirePeriodOfficer == null)
|
|
||||||
// return;
|
|
||||||
|
|
||||||
// var body = new
|
|
||||||
// {
|
|
||||||
// data = retirePeriodOfficer.RetirementRawProfiles
|
|
||||||
// .Select(x => new
|
|
||||||
// {
|
|
||||||
// profileId = x.profileId
|
|
||||||
// })
|
|
||||||
// .ToList()
|
|
||||||
// };
|
|
||||||
|
|
||||||
// //ข้าราชการ
|
|
||||||
// //var apiUrl = $"{_configuration["API"]}/org/unauthorize/retirement";
|
|
||||||
// using (var client = new HttpClient())
|
|
||||||
// {
|
|
||||||
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
|
||||||
// client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
|
||||||
|
|
||||||
// var jsonBody = JsonConvert.SerializeObject(body);
|
|
||||||
// var content = new StringContent(jsonBody, Encoding.UTF8, "application/json");
|
|
||||||
|
|
||||||
// var _req = new HttpRequestMessage(HttpMethod.Patch, apiUrl)
|
|
||||||
// {
|
|
||||||
// Content = content
|
|
||||||
// };
|
|
||||||
// var response = await client.SendAsync(_req);
|
|
||||||
// var responseContent = await response.Content.ReadAsStringAsync();
|
|
||||||
// if (!response.IsSuccessStatusCode)
|
|
||||||
// {
|
|
||||||
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
public void TestMethod()
|
public void TestMethod()
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
public async Task<RetirementResign?> GetByIdAsync(Guid id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var data = await _dbContext.Set<RetirementResign>().AsQueryable()
|
||||||
|
.Include(x => x.Approvers)
|
||||||
|
.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public async Task OfficerApproveRetirementResign(Guid id)
|
||||||
|
{
|
||||||
|
var rawData = await GetByIdAsync(id);
|
||||||
|
if (rawData == null)
|
||||||
|
{
|
||||||
|
throw new Exception(GlobalMessages.DataNotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
rawData.Status = "PENDING";
|
||||||
|
if (rawData.ApproveStep == "st1")
|
||||||
|
{
|
||||||
|
rawData.ApproveStep = "st2";
|
||||||
|
}
|
||||||
|
else if (rawData.ApproveStep == "st3")
|
||||||
|
{
|
||||||
|
rawData.ApproveStep = "st4";
|
||||||
|
// TODO: Send notification to 1st Approver
|
||||||
|
var _firstCommander = rawData.Approvers
|
||||||
|
.Where(x => x.ApproveType!.ToUpper() == "APPROVER")
|
||||||
|
.OrderBy(x => x.Seq)
|
||||||
|
.FirstOrDefault();
|
||||||
|
// Send Notification
|
||||||
|
var _noti1 = new Notification
|
||||||
|
{
|
||||||
|
Body = $"การขอลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||||
|
ReceiverUserId = _firstCommander!.ProfileId,
|
||||||
|
Type = "",
|
||||||
|
Payload = $"{URL}/retirement/resign-detail/{id}",
|
||||||
|
};
|
||||||
|
_dbContext.Set<Notification>().Add(_noti1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Send notification to 1st Commander
|
||||||
|
var firstCommander = rawData.Approvers
|
||||||
|
.Where(x => x.ApproveType!.ToUpper() == "COMMANDER")
|
||||||
|
.OrderBy(x => x.Seq)
|
||||||
|
.FirstOrDefault();
|
||||||
|
// Send Notification
|
||||||
|
var noti1 = new Notification
|
||||||
|
{
|
||||||
|
Body = $"การขอลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||||
|
ReceiverUserId = firstCommander!.ProfileId,
|
||||||
|
Type = "",
|
||||||
|
Payload = $"{URL}/retirement/resign-detail/{id}",
|
||||||
|
};
|
||||||
|
_dbContext.Set<Notification>().Add(noti1);
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task CommanderApproveRetirementResign(Guid id, string reason, DateTime? date)
|
||||||
|
{
|
||||||
|
// Get UserId from token
|
||||||
|
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||||
|
|
||||||
|
|
||||||
|
var rawData = await GetByIdAsync(id);
|
||||||
|
if (rawData == null)
|
||||||
|
{
|
||||||
|
throw new Exception(GlobalMessages.DataNotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (rawData.ApproveStep != "st2")
|
||||||
|
// {
|
||||||
|
// throw new Exception("คำขอนี้ยังไม่ได้อยู่ในขั้นตอนที่สามารถอนุมัติได้ ไม่สามารถทำรายการได้");
|
||||||
|
// }
|
||||||
|
|
||||||
|
var approvers = rawData.Approvers.Where(x => x.ApproveType!.ToUpper() == "COMMANDER").OrderBy(x => x.Seq).ToList();
|
||||||
|
|
||||||
|
var approver = approvers.FirstOrDefault(x => x.KeycloakId == userId);
|
||||||
|
if (approver == null)
|
||||||
|
{
|
||||||
|
throw new Exception("คุณไม่มีสิทธิ์อนุมัติการลาออกในขั้นตอนนี้");
|
||||||
|
}
|
||||||
|
|
||||||
|
// check prev approver มี action แล้วหรือไม่?
|
||||||
|
var prevApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq - 1);
|
||||||
|
|
||||||
|
if (prevApprover != null)
|
||||||
|
{
|
||||||
|
if (prevApprover.ApproveStatus == "PENDING")
|
||||||
|
{
|
||||||
|
throw new Exception("ไม่สามารถทำการอนุมัติได้ เนื่องจากยังอยู่ระหว่างการพิจารณาโดยผู้บังคับบัญชารายก่อนหน้า");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var maxSeq = approvers.Max(x => x.Seq);
|
||||||
|
|
||||||
|
approver.ApproveStatus = "APPROVE";
|
||||||
|
approver.Comment = reason;
|
||||||
|
approver.RejectDate = date;
|
||||||
|
|
||||||
|
if (approver.Seq != maxSeq)
|
||||||
|
{
|
||||||
|
rawData.Status = "PENDING";
|
||||||
|
|
||||||
|
var nextApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq + 1);
|
||||||
|
|
||||||
|
// Send Noti
|
||||||
|
var noti = new Notification
|
||||||
|
{
|
||||||
|
Body = $"การขอลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||||
|
ReceiverUserId = nextApprover!.ProfileId,
|
||||||
|
Type = "",
|
||||||
|
Payload = $"{URL}/retirement/resign-detail/{id}",
|
||||||
|
};
|
||||||
|
_dbContext.Set<Notification>().Add(noti);
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rawData.Status = "PENDING";
|
||||||
|
rawData.ApproveStep = "st3";
|
||||||
|
|
||||||
|
if (rawData.Group == "1.1")
|
||||||
|
{
|
||||||
|
// TODO: Send notification to 1st Approver
|
||||||
|
var firstCommander = rawData.Approvers
|
||||||
|
.Where(x => x.ApproveType!.ToUpper() == "APPROVER")
|
||||||
|
.OrderBy(x => x.Seq)
|
||||||
|
.FirstOrDefault();
|
||||||
|
|
||||||
|
// Send Notification
|
||||||
|
var noti1 = new Notification
|
||||||
|
{
|
||||||
|
Body = $"การขอลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||||
|
ReceiverUserId = firstCommander!.ProfileId,
|
||||||
|
Type = "",
|
||||||
|
Payload = $"{URL}/retirement/resign-detail/{id}",
|
||||||
|
};
|
||||||
|
_dbContext.Set<Notification>().Add(noti1);
|
||||||
|
}
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task CommanderRejectRetirementResign(Guid id, string reason, DateTime? date)
|
||||||
|
{
|
||||||
|
// Get UserId from token
|
||||||
|
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||||
|
|
||||||
|
|
||||||
|
var rawData = await GetByIdAsync(id);
|
||||||
|
if (rawData == null)
|
||||||
|
{
|
||||||
|
throw new Exception(GlobalMessages.DataNotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (rawData.ApproveStep != "st2")
|
||||||
|
// {
|
||||||
|
// throw new Exception("คำขอนี้ยังไม่ได้อยู่ในขั้นตอนที่สามารถอนุมัติได้ ไม่สามารถทำรายการได้");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// check commander approve
|
||||||
|
var approvers = rawData.Approvers.Where(x => x.ApproveType!.ToUpper() == "COMMANDER").OrderBy(x => x.Seq).ToList();
|
||||||
|
|
||||||
|
var approver = approvers.FirstOrDefault(x => x.KeycloakId == userId);
|
||||||
|
if (approver == null)
|
||||||
|
{
|
||||||
|
throw new Exception("คุณไม่มีสิทธิ์อนุมัติการลาออกในขั้นตอนนี้");
|
||||||
|
}
|
||||||
|
|
||||||
|
// check prev approver มี action แล้วหรือไม่?
|
||||||
|
var prevApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq - 1);
|
||||||
|
|
||||||
|
if (prevApprover != null)
|
||||||
|
{
|
||||||
|
if (prevApprover.ApproveStatus == "PENDING")
|
||||||
|
{
|
||||||
|
throw new Exception("ไม่สามารถทำการอนุมัติได้ เนื่องจากยังอยู่ระหว่างการพิจารณาโดยผู้บังคับบัญชารายก่อนหน้า");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var maxSeq = approvers.Max(x => x.Seq);
|
||||||
|
|
||||||
|
approver.ApproveStatus = "REJECT";
|
||||||
|
approver.Comment = reason;
|
||||||
|
approver.RejectDate = date;
|
||||||
|
|
||||||
|
if (approver.Seq != maxSeq)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
var nextApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq + 1);
|
||||||
|
// Send Noti
|
||||||
|
var noti = new Notification
|
||||||
|
{
|
||||||
|
Body = $"การขอลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||||
|
ReceiverUserId = nextApprover!.ProfileId,
|
||||||
|
Type = "",
|
||||||
|
Payload = $"{URL}/retirement/resign-detail/{id}",
|
||||||
|
};
|
||||||
|
_dbContext.Set<Notification>().Add(noti);
|
||||||
|
|
||||||
|
rawData.Status = "PENDING";
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rawData.Status = "PENDING";
|
||||||
|
// rawData.LeaveComment = reason;
|
||||||
|
// if (rawData.Group != "1.1")
|
||||||
|
// {
|
||||||
|
rawData.ApproveStep = "st3";
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (rawData.Group == "1.1")
|
||||||
|
{
|
||||||
|
// TODO: Send notification to 1st Approver
|
||||||
|
var firstCommander = rawData.Approvers
|
||||||
|
.Where(x => x.ApproveType!.ToUpper() == "APPROVER")
|
||||||
|
.OrderBy(x => x.Seq)
|
||||||
|
.FirstOrDefault();
|
||||||
|
// Send Notification
|
||||||
|
var noti1 = new Notification
|
||||||
|
{
|
||||||
|
Body = $"การขอลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||||
|
ReceiverUserId = firstCommander!.ProfileId,
|
||||||
|
Type = "",
|
||||||
|
Payload = $"{URL}/retirement/resign-detail/{id}",
|
||||||
|
};
|
||||||
|
_dbContext.Set<Notification>().Add(noti1);
|
||||||
|
}
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task ApproveRetirementResign(Guid id, string reason, DateTime? date)
|
||||||
|
{
|
||||||
|
// Get UserId from token
|
||||||
|
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||||
|
|
||||||
|
var rawData = await GetByIdAsync(id);
|
||||||
|
if (rawData == null)
|
||||||
|
{
|
||||||
|
throw new Exception(GlobalMessages.DataNotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (rawData.ApproveStep != "st3")
|
||||||
|
// {
|
||||||
|
// throw new Exception("คำขอนี้ยังไม่ได้อยู่ในขั้นตอนที่สามารถอนุมัติได้ ไม่สามารถทำรายการได้");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// check commander approve
|
||||||
|
var approvers = rawData.Approvers.Where(x => x.ApproveType!.ToUpper() == "APPROVER").OrderBy(x => x.Seq).ToList();
|
||||||
|
|
||||||
|
var approver = approvers.FirstOrDefault(x => x.KeycloakId == userId);
|
||||||
|
if (approver == null)
|
||||||
|
{
|
||||||
|
throw new Exception("คุณไม่มีสิทธิ์อนุมัติการลาออกในขั้นตอนนี้");
|
||||||
|
}
|
||||||
|
|
||||||
|
// check prev approver มี action แล้วหรือไม่?
|
||||||
|
var prevApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq - 1);
|
||||||
|
|
||||||
|
if (prevApprover != null)
|
||||||
|
{
|
||||||
|
if (prevApprover.ApproveStatus == "PENDING")
|
||||||
|
{
|
||||||
|
throw new Exception("ไม่สามารถทำการอนุมัติได้ เนื่องจากยังอยู่ระหว่างการพิจารณาโดยผู้บังคับบัญชารายก่อนหน้า");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var maxSeq = approvers.Max(x => x.Seq);
|
||||||
|
|
||||||
|
approver.ApproveStatus = "APPROVE";
|
||||||
|
approver.Comment = reason;
|
||||||
|
approver.RejectDate = date;
|
||||||
|
|
||||||
|
if (approver.Seq != maxSeq)
|
||||||
|
{
|
||||||
|
var nextApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq + 1);
|
||||||
|
// Send Noti
|
||||||
|
var noti1 = new Notification
|
||||||
|
{
|
||||||
|
Body = $"การขอลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||||
|
ReceiverUserId = nextApprover!.ProfileId,
|
||||||
|
Type = "",
|
||||||
|
Payload = "",
|
||||||
|
};
|
||||||
|
_dbContext.Set<Notification>().Add(noti1);
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rawData.Status = "APPROVE";
|
||||||
|
// rawData.LeaveDirectorComment = reason;
|
||||||
|
if (rawData.Group != "1.1")
|
||||||
|
{
|
||||||
|
rawData.ApproveStep = "st5";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rawData.ApproveStep = "st4";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rawData.profileId != null)
|
||||||
|
{
|
||||||
|
// Send Noti
|
||||||
|
var noti = new Notification
|
||||||
|
{
|
||||||
|
Body = $"การขอลาออกของคุณได้รับการอนุมัติ",
|
||||||
|
ReceiverUserId = Guid.Parse(rawData.profileId),
|
||||||
|
Type = "",
|
||||||
|
Payload = "",
|
||||||
|
};
|
||||||
|
_dbContext.Set<Notification>().Add(noti);
|
||||||
|
}
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task RejectRetirementResign(Guid id, string reason, DateTime? date)
|
||||||
|
{
|
||||||
|
// Get UserId from token
|
||||||
|
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||||
|
|
||||||
|
var rawData = await GetByIdAsync(id);
|
||||||
|
if (rawData == null)
|
||||||
|
{
|
||||||
|
throw new Exception(GlobalMessages.DataNotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (rawData.ApproveStep != "st3")
|
||||||
|
// {
|
||||||
|
// throw new Exception("คำขอนี้ยังไม่ได้อยู่ในขั้นตอนที่สามารถอนุมัติได้ ไม่สามารถทำรายการได้");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// check commander approve
|
||||||
|
var approvers = rawData.Approvers.Where(x => x.ApproveType!.ToUpper() == "APPROVER").OrderBy(x => x.Seq).ToList();
|
||||||
|
|
||||||
|
var approver = approvers.FirstOrDefault(x => x.KeycloakId == userId);
|
||||||
|
if (approver == null)
|
||||||
|
{
|
||||||
|
throw new Exception("คุณไม่มีสิทธิ์อนุมัติการลาออกในขั้นตอนนี้");
|
||||||
|
}
|
||||||
|
|
||||||
|
// check prev approver มี action แล้วหรือไม่?
|
||||||
|
var prevApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq - 1);
|
||||||
|
|
||||||
|
if (prevApprover != null)
|
||||||
|
{
|
||||||
|
if (prevApprover.ApproveStatus == "PENDING")
|
||||||
|
{
|
||||||
|
throw new Exception("ไม่สามารถทำการอนุมัติได้ เนื่องจากยังอยู่ระหว่างการพิจารณาโดยผู้บังคับบัญชารายก่อนหน้า");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var maxSeq = approvers.Max(x => x.Seq);
|
||||||
|
|
||||||
|
approver.ApproveStatus = "REJECT";
|
||||||
|
approver.Comment = reason;
|
||||||
|
approver.RejectDate = date;
|
||||||
|
|
||||||
|
if (approver.Seq != maxSeq)
|
||||||
|
{
|
||||||
|
var nextApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq + 1);
|
||||||
|
// Send Noti
|
||||||
|
var noti1 = new Notification
|
||||||
|
{
|
||||||
|
Body = $"การขอลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||||
|
ReceiverUserId = nextApprover!.ProfileId,
|
||||||
|
Type = "",
|
||||||
|
Payload = "",
|
||||||
|
};
|
||||||
|
_dbContext.Set<Notification>().Add(noti1);
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rawData.Status = "REJECT";
|
||||||
|
if (rawData.Group != "1.1")
|
||||||
|
{
|
||||||
|
rawData.ApproveStep = "st5";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rawData.ApproveStep = "st4";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send Noti
|
||||||
|
var noti = new Notification
|
||||||
|
{
|
||||||
|
Body = $"การขอลาออกของคุณไม่ได้รับการอนุมัติ \r\nเนื่องจาก{reason}",
|
||||||
|
ReceiverUserId = Guid.Parse(rawData.profileId),
|
||||||
|
Type = "",
|
||||||
|
Payload = "",
|
||||||
|
};
|
||||||
|
_dbContext.Set<Notification>().Add(noti);
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<RetirementResignCancel?> GetByIdCancelAsync(Guid id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var data = await _dbContext.Set<RetirementResignCancel>().AsQueryable()
|
||||||
|
.Include(x => x.Approvers)
|
||||||
|
.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public async Task OfficerApproveRetirementResignCancel(Guid id)
|
||||||
|
{
|
||||||
|
var rawData = await GetByIdCancelAsync(id);
|
||||||
|
if (rawData == null)
|
||||||
|
{
|
||||||
|
throw new Exception(GlobalMessages.DataNotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
rawData.Status = "PENDING";
|
||||||
|
if (rawData.ApproveStep == "st1")
|
||||||
|
{
|
||||||
|
rawData.ApproveStep = "st2";
|
||||||
|
}
|
||||||
|
else if (rawData.ApproveStep == "st3")
|
||||||
|
{
|
||||||
|
rawData.ApproveStep = "st4";
|
||||||
|
// TODO: Send notification to 1st Approver
|
||||||
|
var _firstCommander = rawData.Approvers
|
||||||
|
.Where(x => x.ApproveType!.ToUpper() == "APPROVER")
|
||||||
|
.OrderBy(x => x.Seq)
|
||||||
|
.FirstOrDefault();
|
||||||
|
// Send Notification
|
||||||
|
var _noti1 = new Notification
|
||||||
|
{
|
||||||
|
Body = $"การขอยกเลิกลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||||
|
ReceiverUserId = _firstCommander!.ProfileId,
|
||||||
|
Type = "",
|
||||||
|
Payload = $"{URL}/retirement/resign-detail-reject/{rawData.Id}",
|
||||||
|
};
|
||||||
|
_dbContext.Set<Notification>().Add(_noti1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Send notification to 1st Commander
|
||||||
|
var firstCommander = rawData.Approvers
|
||||||
|
.Where(x => x.ApproveType!.ToUpper() == "COMMANDER")
|
||||||
|
.OrderBy(x => x.Seq)
|
||||||
|
.FirstOrDefault();
|
||||||
|
// Send Notification
|
||||||
|
var noti1 = new Notification
|
||||||
|
{
|
||||||
|
Body = $"การขอยกเลิกลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||||
|
ReceiverUserId = firstCommander!.ProfileId,
|
||||||
|
Type = "",
|
||||||
|
Payload = $"{URL}/retirement/resign-detail-reject/{rawData.Id}",
|
||||||
|
};
|
||||||
|
_dbContext.Set<Notification>().Add(noti1);
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task CommanderApproveRetirementResignCancel(Guid id, string reason, DateTime? date)
|
||||||
|
{
|
||||||
|
// Get UserId from token
|
||||||
|
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||||
|
|
||||||
|
|
||||||
|
var rawData = await GetByIdCancelAsync(id);
|
||||||
|
if (rawData == null)
|
||||||
|
{
|
||||||
|
throw new Exception(GlobalMessages.DataNotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (rawData.ApproveStep != "st2")
|
||||||
|
// {
|
||||||
|
// throw new Exception("คำขอนี้ยังไม่ได้อยู่ในขั้นตอนที่สามารถอนุมัติได้ ไม่สามารถทำรายการได้");
|
||||||
|
// }
|
||||||
|
|
||||||
|
var approvers = rawData.Approvers.Where(x => x.ApproveType!.ToUpper() == "COMMANDER").OrderBy(x => x.Seq).ToList();
|
||||||
|
|
||||||
|
var approver = approvers.FirstOrDefault(x => x.KeycloakId == userId);
|
||||||
|
if (approver == null)
|
||||||
|
{
|
||||||
|
throw new Exception("คุณไม่มีสิทธิ์อนุมัติการลาออกในขั้นตอนนี้");
|
||||||
|
}
|
||||||
|
|
||||||
|
// check prev approver มี action แล้วหรือไม่?
|
||||||
|
var prevApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq - 1);
|
||||||
|
|
||||||
|
if (prevApprover != null)
|
||||||
|
{
|
||||||
|
if (prevApprover.ApproveStatus == "PENDING")
|
||||||
|
{
|
||||||
|
throw new Exception("ไม่สามารถทำการอนุมัติได้ เนื่องจากยังอยู่ระหว่างการพิจารณาโดยผู้บังคับบัญชารายก่อนหน้า");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var maxSeq = approvers.Max(x => x.Seq);
|
||||||
|
|
||||||
|
approver.ApproveStatus = "APPROVE";
|
||||||
|
approver.Comment = reason;
|
||||||
|
approver.RejectDate = date;
|
||||||
|
|
||||||
|
if (approver.Seq != maxSeq)
|
||||||
|
{
|
||||||
|
rawData.Status = "PENDING";
|
||||||
|
|
||||||
|
var nextApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq + 1);
|
||||||
|
|
||||||
|
// Send Noti
|
||||||
|
var noti = new Notification
|
||||||
|
{
|
||||||
|
Body = $"การขอยกเลิกลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||||
|
ReceiverUserId = nextApprover!.ProfileId,
|
||||||
|
Type = "",
|
||||||
|
Payload = $"{URL}/retirement/resign-detail-reject/{rawData.Id}",
|
||||||
|
};
|
||||||
|
_dbContext.Set<Notification>().Add(noti);
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rawData.Status = "PENDING";
|
||||||
|
rawData.ApproveStep = "st3";
|
||||||
|
|
||||||
|
if (rawData.Group == "1.1")
|
||||||
|
{
|
||||||
|
// TODO: Send notification to 1st Approver
|
||||||
|
var firstCommander = rawData.Approvers
|
||||||
|
.Where(x => x.ApproveType!.ToUpper() == "APPROVER")
|
||||||
|
.OrderBy(x => x.Seq)
|
||||||
|
.FirstOrDefault();
|
||||||
|
|
||||||
|
// Send Notification
|
||||||
|
var noti1 = new Notification
|
||||||
|
{
|
||||||
|
Body = $"การขอยกเลิกลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||||
|
ReceiverUserId = firstCommander!.ProfileId,
|
||||||
|
Type = "",
|
||||||
|
Payload = $"{URL}/retirement/resign-detail-reject/{rawData.Id}",
|
||||||
|
};
|
||||||
|
_dbContext.Set<Notification>().Add(noti1);
|
||||||
|
}
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task CommanderRejectRetirementResignCancel(Guid id, string reason, DateTime? date)
|
||||||
|
{
|
||||||
|
// Get UserId from token
|
||||||
|
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||||
|
|
||||||
|
|
||||||
|
var rawData = await GetByIdCancelAsync(id);
|
||||||
|
if (rawData == null)
|
||||||
|
{
|
||||||
|
throw new Exception(GlobalMessages.DataNotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (rawData.ApproveStep != "st2")
|
||||||
|
// {
|
||||||
|
// throw new Exception("คำขอนี้ยังไม่ได้อยู่ในขั้นตอนที่สามารถอนุมัติได้ ไม่สามารถทำรายการได้");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// check commander approve
|
||||||
|
var approvers = rawData.Approvers.Where(x => x.ApproveType!.ToUpper() == "COMMANDER").OrderBy(x => x.Seq).ToList();
|
||||||
|
|
||||||
|
var approver = approvers.FirstOrDefault(x => x.KeycloakId == userId);
|
||||||
|
if (approver == null)
|
||||||
|
{
|
||||||
|
throw new Exception("คุณไม่มีสิทธิ์อนุมัติการลาออกในขั้นตอนนี้");
|
||||||
|
}
|
||||||
|
|
||||||
|
// check prev approver มี action แล้วหรือไม่?
|
||||||
|
var prevApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq - 1);
|
||||||
|
|
||||||
|
if (prevApprover != null)
|
||||||
|
{
|
||||||
|
if (prevApprover.ApproveStatus == "PENDING")
|
||||||
|
{
|
||||||
|
throw new Exception("ไม่สามารถทำการอนุมัติได้ เนื่องจากยังอยู่ระหว่างการพิจารณาโดยผู้บังคับบัญชารายก่อนหน้า");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var maxSeq = approvers.Max(x => x.Seq);
|
||||||
|
|
||||||
|
approver.ApproveStatus = "REJECT";
|
||||||
|
approver.Comment = reason;
|
||||||
|
approver.RejectDate = date;
|
||||||
|
|
||||||
|
if (approver.Seq != maxSeq)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
var nextApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq + 1);
|
||||||
|
// Send Noti
|
||||||
|
var noti = new Notification
|
||||||
|
{
|
||||||
|
Body = $"การขอยกเลิกลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||||
|
ReceiverUserId = nextApprover!.ProfileId,
|
||||||
|
Type = "",
|
||||||
|
Payload = $"{URL}/retirement/resign-detail-reject/{rawData.Id}",
|
||||||
|
};
|
||||||
|
_dbContext.Set<Notification>().Add(noti);
|
||||||
|
|
||||||
|
rawData.Status = "PENDING";
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rawData.Status = "PENDING";
|
||||||
|
// rawData.LeaveComment = reason;
|
||||||
|
// if (rawData.Group != "1.1")
|
||||||
|
// {
|
||||||
|
rawData.ApproveStep = "st3";
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (rawData.Group == "1.1")
|
||||||
|
{
|
||||||
|
// TODO: Send notification to 1st Approver
|
||||||
|
var firstCommander = rawData.Approvers
|
||||||
|
.Where(x => x.ApproveType!.ToUpper() == "APPROVER")
|
||||||
|
.OrderBy(x => x.Seq)
|
||||||
|
.FirstOrDefault();
|
||||||
|
// Send Notification
|
||||||
|
var noti1 = new Notification
|
||||||
|
{
|
||||||
|
Body = $"การขอยกเลิกลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||||
|
ReceiverUserId = firstCommander!.ProfileId,
|
||||||
|
Type = "",
|
||||||
|
Payload = $"{URL}/retirement/resign-detail-reject/{rawData.Id}",
|
||||||
|
};
|
||||||
|
_dbContext.Set<Notification>().Add(noti1);
|
||||||
|
}
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task ApproveRetirementResignCancel(Guid id, string reason, DateTime? date)
|
||||||
|
{
|
||||||
|
// Get UserId from token
|
||||||
|
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||||
|
|
||||||
|
var rawData = await GetByIdCancelAsync(id);
|
||||||
|
if (rawData == null)
|
||||||
|
{
|
||||||
|
throw new Exception(GlobalMessages.DataNotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (rawData.ApproveStep != "st3")
|
||||||
|
// {
|
||||||
|
// throw new Exception("คำขอนี้ยังไม่ได้อยู่ในขั้นตอนที่สามารถอนุมัติได้ ไม่สามารถทำรายการได้");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// check commander approve
|
||||||
|
var approvers = rawData.Approvers.Where(x => x.ApproveType!.ToUpper() == "APPROVER").OrderBy(x => x.Seq).ToList();
|
||||||
|
|
||||||
|
var approver = approvers.FirstOrDefault(x => x.KeycloakId == userId);
|
||||||
|
if (approver == null)
|
||||||
|
{
|
||||||
|
throw new Exception("คุณไม่มีสิทธิ์อนุมัติการลาออกในขั้นตอนนี้");
|
||||||
|
}
|
||||||
|
|
||||||
|
// check prev approver มี action แล้วหรือไม่?
|
||||||
|
var prevApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq - 1);
|
||||||
|
|
||||||
|
if (prevApprover != null)
|
||||||
|
{
|
||||||
|
if (prevApprover.ApproveStatus == "PENDING")
|
||||||
|
{
|
||||||
|
throw new Exception("ไม่สามารถทำการอนุมัติได้ เนื่องจากยังอยู่ระหว่างการพิจารณาโดยผู้บังคับบัญชารายก่อนหน้า");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var maxSeq = approvers.Max(x => x.Seq);
|
||||||
|
|
||||||
|
approver.ApproveStatus = "APPROVE";
|
||||||
|
approver.Comment = reason;
|
||||||
|
approver.RejectDate = date;
|
||||||
|
|
||||||
|
if (approver.Seq != maxSeq)
|
||||||
|
{
|
||||||
|
var nextApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq + 1);
|
||||||
|
// Send Noti
|
||||||
|
var noti1 = new Notification
|
||||||
|
{
|
||||||
|
Body = $"การขอยกเลิกลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||||
|
ReceiverUserId = nextApprover!.ProfileId,
|
||||||
|
Type = "",
|
||||||
|
Payload = "",
|
||||||
|
};
|
||||||
|
_dbContext.Set<Notification>().Add(noti1);
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rawData.Status = "APPROVE";
|
||||||
|
// rawData.LeaveDirectorComment = reason;
|
||||||
|
if (rawData.Group != "1.1")
|
||||||
|
{
|
||||||
|
rawData.ApproveStep = "st5";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rawData.ApproveStep = "st4";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rawData.profileId != null)
|
||||||
|
{
|
||||||
|
// Send Noti
|
||||||
|
var noti = new Notification
|
||||||
|
{
|
||||||
|
Body = $"การขอยกเลิกลาออกของคุณได้รับการอนุมัติ",
|
||||||
|
ReceiverUserId = Guid.Parse(rawData.profileId),
|
||||||
|
Type = "",
|
||||||
|
Payload = "",
|
||||||
|
};
|
||||||
|
_dbContext.Set<Notification>().Add(noti);
|
||||||
|
}
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task RejectRetirementResignCancel(Guid id, string reason, DateTime? date)
|
||||||
|
{
|
||||||
|
// Get UserId from token
|
||||||
|
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||||
|
|
||||||
|
var rawData = await GetByIdCancelAsync(id);
|
||||||
|
if (rawData == null)
|
||||||
|
{
|
||||||
|
throw new Exception(GlobalMessages.DataNotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (rawData.ApproveStep != "st3")
|
||||||
|
// {
|
||||||
|
// throw new Exception("คำขอนี้ยังไม่ได้อยู่ในขั้นตอนที่สามารถอนุมัติได้ ไม่สามารถทำรายการได้");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// check commander approve
|
||||||
|
var approvers = rawData.Approvers.Where(x => x.ApproveType!.ToUpper() == "APPROVER").OrderBy(x => x.Seq).ToList();
|
||||||
|
|
||||||
|
var approver = approvers.FirstOrDefault(x => x.KeycloakId == userId);
|
||||||
|
if (approver == null)
|
||||||
|
{
|
||||||
|
throw new Exception("คุณไม่มีสิทธิ์อนุมัติการลาออกในขั้นตอนนี้");
|
||||||
|
}
|
||||||
|
|
||||||
|
// check prev approver มี action แล้วหรือไม่?
|
||||||
|
var prevApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq - 1);
|
||||||
|
|
||||||
|
if (prevApprover != null)
|
||||||
|
{
|
||||||
|
if (prevApprover.ApproveStatus == "PENDING")
|
||||||
|
{
|
||||||
|
throw new Exception("ไม่สามารถทำการอนุมัติได้ เนื่องจากยังอยู่ระหว่างการพิจารณาโดยผู้บังคับบัญชารายก่อนหน้า");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var maxSeq = approvers.Max(x => x.Seq);
|
||||||
|
|
||||||
|
approver.ApproveStatus = "REJECT";
|
||||||
|
approver.Comment = reason;
|
||||||
|
approver.RejectDate = date;
|
||||||
|
|
||||||
|
if (approver.Seq != maxSeq)
|
||||||
|
{
|
||||||
|
var nextApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq + 1);
|
||||||
|
// Send Noti
|
||||||
|
var noti1 = new Notification
|
||||||
|
{
|
||||||
|
Body = $"การขอยกเลิกลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||||
|
ReceiverUserId = nextApprover!.ProfileId,
|
||||||
|
Type = "",
|
||||||
|
Payload = "",
|
||||||
|
};
|
||||||
|
_dbContext.Set<Notification>().Add(noti1);
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rawData.Status = "REJECT";
|
||||||
|
if (rawData.Group != "1.1")
|
||||||
|
{
|
||||||
|
rawData.ApproveStep = "st5";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rawData.ApproveStep = "st4";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send Noti
|
||||||
|
var noti = new Notification
|
||||||
|
{
|
||||||
|
Body = $"การขอยกเลิกลาออกของคุณไม่ได้รับการอนุมัติ \r\nเนื่องจาก{reason}",
|
||||||
|
ReceiverUserId = Guid.Parse(rawData.profileId),
|
||||||
|
Type = "",
|
||||||
|
Payload = "",
|
||||||
|
};
|
||||||
|
_dbContext.Set<Notification>().Add(noti);
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
using BMA.EHR.Application.Common.Interfaces;
|
using BMA.EHR.Application.Common.Interfaces;
|
||||||
using BMA.EHR.Application.Responses.Insignias;
|
using BMA.EHR.Application.Responses.Insignias;
|
||||||
|
using BMA.EHR.Application.Responses.Leaves;
|
||||||
using BMA.EHR.Application.Responses.Organizations;
|
using BMA.EHR.Application.Responses.Organizations;
|
||||||
using BMA.EHR.Application.Responses.Profiles;
|
using BMA.EHR.Application.Responses.Profiles;
|
||||||
using BMA.EHR.Domain.Models.HR;
|
using BMA.EHR.Domain.Models.HR;
|
||||||
|
|
@ -9,8 +10,6 @@ using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System.Reflection.Emit;
|
|
||||||
using System.Security.Cryptography;
|
|
||||||
|
|
||||||
namespace BMA.EHR.Application.Repositories
|
namespace BMA.EHR.Application.Repositories
|
||||||
{
|
{
|
||||||
|
|
@ -67,7 +66,7 @@ namespace BMA.EHR.Application.Repositories
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var apiPath = $"{_configuration["API"]}/org/dotnet/root/officer/{rootId}";
|
var apiPath = $"{_configuration["API"]}/org/unauthorize/root/officer/{rootId}";
|
||||||
var apiKey = _configuration["API_KEY"];
|
var apiKey = _configuration["API_KEY"];
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -129,11 +128,11 @@ namespace BMA.EHR.Application.Repositories
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<GetProfileByRootIdDto>> GetEmployeeProfileByPositionAsync(Guid rootId, dynamic empPosId, string? accessToken)
|
public async Task<List<GetProfileByRootIdDto>> GetEmployeeProfileByPositionAsync(Guid rootId, string[] empPosId, string? accessToken)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var apiPath = $"{_configuration["API"]}/org/dotnet/find/employee/position";
|
var apiPath = $"{_configuration["API"]}/org/unauthorize/find/employee/position";
|
||||||
var apiKey = _configuration["API_KEY"];
|
var apiKey = _configuration["API_KEY"];
|
||||||
|
|
||||||
var body = new
|
var body = new
|
||||||
|
|
@ -142,7 +141,12 @@ namespace BMA.EHR.Application.Repositories
|
||||||
empPosId
|
empPosId
|
||||||
};
|
};
|
||||||
|
|
||||||
var apiResult = await PostExternalAPIAsync(apiPath, accessToken, body, apiKey);
|
//var bodyJson = JsonConvert.SerializeObject(bodyRaw);
|
||||||
|
|
||||||
|
// สร้าง HTTP content
|
||||||
|
//var body = new StringContent(bodyJson, Encoding.UTF8, "application/json");
|
||||||
|
|
||||||
|
var apiResult = await PostExternalAPIAsync(apiPath, accessToken ?? "", body, apiKey);
|
||||||
|
|
||||||
if (apiResult != null)
|
if (apiResult != null)
|
||||||
{
|
{
|
||||||
|
|
@ -153,7 +157,7 @@ namespace BMA.EHR.Application.Repositories
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
@ -182,11 +186,36 @@ namespace BMA.EHR.Application.Repositories
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetProfileByKeycloakIdDto?> GetProfileByProfileIdAsync(Guid keycloakId, string? accessToken)
|
|
||||||
|
|
||||||
|
public async Task<GetProfileByKeycloakIdDto?> GetProfileByKeycloakIdNewAsync(Guid keycloakId, string? accessToken,CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var apiPath = $"{_configuration["API"]}/org/dotnet/profile/{keycloakId}";
|
var apiPath = $"{_configuration["API"]}/org/dotnet/by-keycloak/{keycloakId}";
|
||||||
|
var apiKey = _configuration["API_KEY"];
|
||||||
|
|
||||||
|
var apiResult = await GetExternalAPIAsync(apiPath, accessToken ?? "", apiKey, cancellationToken);
|
||||||
|
if (apiResult != null)
|
||||||
|
{
|
||||||
|
var raw = JsonConvert.DeserializeObject<GetProfileByKeycloakIdResultDto>(apiResult);
|
||||||
|
if (raw != null)
|
||||||
|
return raw.Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<GetProfileByKeycloakIdDto?> GetProfileByKeycloakIdNew2Async(Guid keycloakId, string? accessToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var apiPath = $"{_configuration["API"]}/org/dotnet/by-keycloak2/{keycloakId}";
|
||||||
var apiKey = _configuration["API_KEY"];
|
var apiKey = _configuration["API_KEY"];
|
||||||
|
|
||||||
var apiResult = await GetExternalAPIAsync(apiPath, accessToken ?? "", apiKey);
|
var apiResult = await GetExternalAPIAsync(apiPath, accessToken ?? "", apiKey);
|
||||||
|
|
@ -205,6 +234,161 @@ namespace BMA.EHR.Application.Repositories
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<GetProfileByKeycloakIdDto?> GetProfileByCheckInAsync(Guid keycloakId, string? accessToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var apiPath = $"{_configuration["API"]}/org/dotnet/check-keycloak/{keycloakId}";
|
||||||
|
var apiKey = _configuration["API_KEY"];
|
||||||
|
|
||||||
|
var apiResult = await GetExternalAPIAsync(apiPath, accessToken ?? "", apiKey);
|
||||||
|
if (apiResult != null)
|
||||||
|
{
|
||||||
|
var raw = JsonConvert.DeserializeObject<GetProfileByKeycloakIdResultDto>(apiResult);
|
||||||
|
if (raw != null)
|
||||||
|
return raw.Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<GetProfileLeaveByKeycloakDto?> GetProfileLeaveByKeycloakIdAsync(Guid keycloakId, string? accessToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var apiPath = $"{_configuration["API"]}/org/dotnet/profile-leave/keycloak/{keycloakId}";
|
||||||
|
var apiKey = _configuration["API_KEY"];
|
||||||
|
|
||||||
|
var apiResult = await GetExternalAPIAsync(apiPath, accessToken ?? "", apiKey);
|
||||||
|
if (apiResult != null)
|
||||||
|
{
|
||||||
|
var raw = JsonConvert.DeserializeObject<GetProfileLeaveByKeycloakResultDto>(apiResult);
|
||||||
|
if (raw != null)
|
||||||
|
return raw.Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<GetOcStaff>?> GetOCStaffAsync(Guid profileId, string? accessToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var apiPath = $"{_configuration["API"]}/org/dotnet/find-staff";
|
||||||
|
var apiKey = _configuration["API_KEY"];
|
||||||
|
var body = new
|
||||||
|
{
|
||||||
|
assignId = "SYS_LEAVE_LIST",
|
||||||
|
profileId = profileId
|
||||||
|
};
|
||||||
|
|
||||||
|
//var profiles = new List<GetOcStaff>();
|
||||||
|
|
||||||
|
var apiResult = await PostExternalAPIAsync(apiPath, accessToken ?? "", body, apiKey);
|
||||||
|
if (apiResult != null)
|
||||||
|
{
|
||||||
|
var raw = JsonConvert.DeserializeObject<GetOcStaffResultDto>(apiResult);
|
||||||
|
if (raw != null)
|
||||||
|
return raw.Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<GetProfileLeaveByKeycloakDto?> GetProfileLeaveReportByKeycloakIdAsync(Guid keycloakId, string? accessToken, string? report)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var apiPath = $"{_configuration["API"]}/org/dotnet/profile-leave/keycloak";
|
||||||
|
var apiKey = _configuration["API_KEY"];
|
||||||
|
var body = new
|
||||||
|
{
|
||||||
|
keycloakId = keycloakId,
|
||||||
|
report = report
|
||||||
|
};
|
||||||
|
|
||||||
|
//var profiles = new List<SearchProfileDto>();
|
||||||
|
|
||||||
|
var apiResult = await PostExternalAPIAsync(apiPath, accessToken, body, apiKey);
|
||||||
|
if (apiResult != null)
|
||||||
|
{
|
||||||
|
var raw = JsonConvert.DeserializeObject<GetProfileLeaveByKeycloakResultDto>(apiResult);
|
||||||
|
if (raw != null)
|
||||||
|
return raw.Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<GetProfileByKeycloakIdDto?> GetProfileByProfileIdAsync(Guid profileId, string? accessToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var apiPath = $"{_configuration["API"]}/org/dotnet/profile/{profileId}";
|
||||||
|
var apiKey = _configuration["API_KEY"];
|
||||||
|
|
||||||
|
var apiResult = await GetExternalAPIAsync(apiPath, accessToken ?? "", apiKey);
|
||||||
|
if (apiResult != null)
|
||||||
|
{
|
||||||
|
var raw = JsonConvert.DeserializeObject<GetProfileByKeycloakIdResultDto>(apiResult);
|
||||||
|
if (raw != null)
|
||||||
|
return raw.Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<GetProfileByKeycloakIdDto?> GetProfileByProfileIdNoAuthAsync(Guid profileId, string? accessToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var apiPath = $"{_configuration["API"]}/org/unauthorize/profile/{profileId}";
|
||||||
|
var apiKey = _configuration["API_KEY"];
|
||||||
|
|
||||||
|
var apiResult = await GetExternalAPIAsync(apiPath, accessToken ?? "", apiKey);
|
||||||
|
if (apiResult != null)
|
||||||
|
{
|
||||||
|
var raw = JsonConvert.DeserializeObject<GetProfileByKeycloakIdResultDto>(apiResult);
|
||||||
|
if (raw != null)
|
||||||
|
return raw.Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public async Task<bool> UpdateDutyTimeAsync(Guid profileId, Guid roundId, DateTime effectiveDate, string? accessToken)
|
public async Task<bool> UpdateDutyTimeAsync(Guid profileId, Guid roundId, DateTime effectiveDate, string? accessToken)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -493,6 +677,223 @@ namespace BMA.EHR.Application.Repositories
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<List<GetProfileByKeycloakIdRootDto>> GetProfileByAdminRole(string? accessToken, int? node, string? nodeId, string role, string? revisionId, int? reqNode, string? reqNodeId, DateTime? startDate, DateTime? endDate)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var apiPath = $"{_configuration["API"]}/org/dotnet/officer-by-admin-role";
|
||||||
|
var apiKey = _configuration["API_KEY"];
|
||||||
|
var body = new
|
||||||
|
{
|
||||||
|
node = node,
|
||||||
|
nodeId = nodeId,
|
||||||
|
role = role,
|
||||||
|
revisionId = revisionId,
|
||||||
|
reqNode = reqNode,
|
||||||
|
reqNodeId = reqNodeId,
|
||||||
|
//startDate = startDate,
|
||||||
|
//endDate = endDate
|
||||||
|
};
|
||||||
|
|
||||||
|
var profiles = new List<SearchProfileDto>();
|
||||||
|
|
||||||
|
var apiResult = await PostExternalAPIAsync(apiPath, accessToken, body, apiKey);
|
||||||
|
if (apiResult != null)
|
||||||
|
{
|
||||||
|
var raw = JsonConvert.DeserializeObject<GetListProfileByKeycloakIdRootResultDto>(apiResult);
|
||||||
|
if (raw != null)
|
||||||
|
return raw.Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<GetProfileByKeycloakIdRootDto>> GetProfileByAdminRolev2(string? accessToken, int? node, string? nodeId, string role, string? revisionId, int? reqNode, string? reqNodeId, DateTime? startDate, DateTime? endDate)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var apiPath = $"{_configuration["API"]}/org/dotnet/officer-by-admin-rolev2";
|
||||||
|
var apiKey = _configuration["API_KEY"];
|
||||||
|
var body = new
|
||||||
|
{
|
||||||
|
node = node,
|
||||||
|
nodeId = nodeId,
|
||||||
|
role = role,
|
||||||
|
// revisionId = revisionId,
|
||||||
|
reqNode = reqNode,
|
||||||
|
reqNodeId = reqNodeId,
|
||||||
|
// startDate = startDate,
|
||||||
|
// endDate = endDate
|
||||||
|
date = endDate
|
||||||
|
};
|
||||||
|
Console.WriteLine(body);
|
||||||
|
|
||||||
|
var profiles = new List<SearchProfileDto>();
|
||||||
|
|
||||||
|
var apiResult = await PostExternalAPIAsync(apiPath, accessToken, body, apiKey);
|
||||||
|
if (apiResult != null)
|
||||||
|
{
|
||||||
|
var raw = JsonConvert.DeserializeObject<GetListProfileByKeycloakIdRootResultDto>(apiResult);
|
||||||
|
if (raw != null)
|
||||||
|
return raw.Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new List<GetProfileByKeycloakIdRootDto>();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<GetProfileByKeycloakIdRootDto>> GetProfileByAdminRolev3(string? accessToken, int? node, string? nodeId, string role, string? revisionId, int? reqNode, string? reqNodeId, DateTime? startDate, DateTime? endDate)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var apiPath = $"{_configuration["API"]}/org/dotnet/officer-by-admin-rolev3";
|
||||||
|
var apiKey = _configuration["API_KEY"];
|
||||||
|
var body = new
|
||||||
|
{
|
||||||
|
node = node,
|
||||||
|
nodeId = nodeId,
|
||||||
|
role = role,
|
||||||
|
// revisionId = revisionId,
|
||||||
|
reqNode = reqNode,
|
||||||
|
reqNodeId = reqNodeId,
|
||||||
|
startDate = startDate,
|
||||||
|
endDate = endDate
|
||||||
|
};
|
||||||
|
|
||||||
|
var profiles = new List<SearchProfileDto>();
|
||||||
|
|
||||||
|
var apiResult = await PostExternalAPIAsync(apiPath, accessToken, body, apiKey);
|
||||||
|
if (apiResult != null)
|
||||||
|
{
|
||||||
|
var raw = JsonConvert.DeserializeObject<GetListProfileByKeycloakIdRootResultDto>(apiResult);
|
||||||
|
if (raw != null)
|
||||||
|
return raw.Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<GetProfileByKeycloakIdRootDto>> GetAllOfficerByRootDnaId(string? rootDnaId, DateTime date)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var apiPath = $"{_configuration["API"]}/org/unauthorize/officer-list";
|
||||||
|
var apiKey = _configuration["API_KEY"];
|
||||||
|
var body = new
|
||||||
|
{
|
||||||
|
reqNode = 0,
|
||||||
|
reqNodeId = rootDnaId,
|
||||||
|
date = date
|
||||||
|
};
|
||||||
|
//Console.WriteLine(body);
|
||||||
|
|
||||||
|
var profiles = new List<SearchProfileDto>();
|
||||||
|
|
||||||
|
var apiResult = await PostExternalAPIAsync(apiPath, "", body, apiKey);
|
||||||
|
if (apiResult != null)
|
||||||
|
{
|
||||||
|
var raw = JsonConvert.DeserializeObject<GetListProfileByKeycloakIdRootResultDto>(apiResult);
|
||||||
|
if (raw != null)
|
||||||
|
return raw.Result;
|
||||||
|
else
|
||||||
|
return new List<GetProfileByKeycloakIdRootDto>();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return new List<GetProfileByKeycloakIdRootDto>();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<GetProfileByKeycloakIdRootDto>> GetAllEmployeeByRootDnaId(string? rootDnaId, DateTime date)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var apiPath = $"{_configuration["API"]}/org/unauthorize/employee-list";
|
||||||
|
var apiKey = _configuration["API_KEY"];
|
||||||
|
var body = new
|
||||||
|
{
|
||||||
|
reqNode = 0,
|
||||||
|
reqNodeId = rootDnaId,
|
||||||
|
startDate = date,
|
||||||
|
endDate = date
|
||||||
|
};
|
||||||
|
//Console.WriteLine(body);
|
||||||
|
|
||||||
|
var profiles = new List<SearchProfileDto>();
|
||||||
|
|
||||||
|
var apiResult = await PostExternalAPIAsync(apiPath, "", body, apiKey);
|
||||||
|
if (apiResult != null)
|
||||||
|
{
|
||||||
|
var raw = JsonConvert.DeserializeObject<GetListProfileByKeycloakIdRootResultDto>(apiResult);
|
||||||
|
if (raw != null)
|
||||||
|
return raw.Result;
|
||||||
|
else
|
||||||
|
return new List<GetProfileByKeycloakIdRootDto>();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return new List<GetProfileByKeycloakIdRootDto>();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<GetProfileByKeycloakIdRootDto>> GetProfileByAdminRolev4(string? accessToken, int? node, string? nodeId, string role, string? revisionId, int? reqNode, string? reqNodeId, DateTime? startDate, DateTime? endDate)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var apiPath = $"{_configuration["API"]}/org/dotnet/officer-by-admin-rolev4";
|
||||||
|
var apiKey = _configuration["API_KEY"];
|
||||||
|
var body = new
|
||||||
|
{
|
||||||
|
node = node,
|
||||||
|
nodeId = nodeId,
|
||||||
|
role = role,
|
||||||
|
// revisionId = revisionId,
|
||||||
|
reqNode = reqNode,
|
||||||
|
reqNodeId = reqNodeId,
|
||||||
|
// startDate = startDate,
|
||||||
|
// endDate = endDate
|
||||||
|
date = endDate
|
||||||
|
};
|
||||||
|
Console.WriteLine(body);
|
||||||
|
|
||||||
|
var profiles = new List<SearchProfileDto>();
|
||||||
|
|
||||||
|
var apiResult = await PostExternalAPIAsync(apiPath, accessToken, body, apiKey);
|
||||||
|
if (apiResult != null)
|
||||||
|
{
|
||||||
|
var raw = JsonConvert.DeserializeObject<GetListProfileByKeycloakIdRootResultDto>(apiResult);
|
||||||
|
if (raw != null)
|
||||||
|
return raw.Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new List<GetProfileByKeycloakIdRootDto>();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<List<GetProfileByKeycloakIdRootDto>> GetProfileWithKeycloakAllOfficerRetireFilterAndRevision(string? accessToken, int? node, string? nodeId, bool isAll, bool? isRetirement, string? revisionId)
|
public async Task<List<GetProfileByKeycloakIdRootDto>> GetProfileWithKeycloakAllOfficerRetireFilterAndRevision(string? accessToken, int? node, string? nodeId, bool isAll, bool? isRetirement, string? revisionId)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -526,6 +927,41 @@ namespace BMA.EHR.Application.Repositories
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<List<GetProfileByKeycloakIdRootDto>> GetProfileWithKeycloakAllOfficerRetireFilterAndRevisionAndDate(string? accessToken, int? node, string? nodeId, bool isAll, bool? isRetirement, string? revisionId, DateTime? startDate, DateTime? endDate)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var apiPath = $"{_configuration["API"]}/org/dotnet/keycloak-all-officer/date";
|
||||||
|
var apiKey = _configuration["API_KEY"];
|
||||||
|
var body = new
|
||||||
|
{
|
||||||
|
node = node,
|
||||||
|
nodeId = nodeId,
|
||||||
|
isAll = isAll,
|
||||||
|
isRetirement = isRetirement,
|
||||||
|
revisionId = revisionId,
|
||||||
|
startDate = startDate,
|
||||||
|
endDate = endDate,
|
||||||
|
};
|
||||||
|
|
||||||
|
var profiles = new List<SearchProfileDto>();
|
||||||
|
|
||||||
|
var apiResult = await PostExternalAPIAsync(apiPath, accessToken, body, apiKey);
|
||||||
|
if (apiResult != null)
|
||||||
|
{
|
||||||
|
var raw = JsonConvert.DeserializeObject<GetListProfileByKeycloakIdRootResultDto>(apiResult);
|
||||||
|
if (raw != null)
|
||||||
|
return raw.Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<List<GetProfileByKeycloakIdRootDto>> GetProfileWithKeycloakAllEmployeeAndRevision(string? accessToken, int? node, string? nodeId, bool isAll, string? revisionId)
|
public async Task<List<GetProfileByKeycloakIdRootDto>> GetProfileWithKeycloakAllEmployeeAndRevision(string? accessToken, int? node, string? nodeId, bool isAll, string? revisionId)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -589,7 +1025,80 @@ namespace BMA.EHR.Application.Repositories
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public async Task<List<SearchProfileDto>> SearchProfile(string? citizenId, string? firstName, string? lastName, string accessToken)
|
|
||||||
|
public async Task<List<GetProfileByKeycloakIdRootDto>> GetEmployeeByAdminRole(string? accessToken, int? node, string? nodeId, string role, string? revisionId, int? reqNode, string? reqNodeId, DateTime? startDate, DateTime? endDate)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var apiPath = $"{_configuration["API"]}/org/dotnet/employee-by-admin-role";
|
||||||
|
var apiKey = _configuration["API_KEY"];
|
||||||
|
var body = new
|
||||||
|
{
|
||||||
|
node = node,
|
||||||
|
nodeId = nodeId,
|
||||||
|
role = role,
|
||||||
|
revisionId = revisionId,
|
||||||
|
reqNode = reqNode,
|
||||||
|
reqNodeId = reqNodeId,
|
||||||
|
startDate = startDate,
|
||||||
|
endDate = endDate
|
||||||
|
};
|
||||||
|
|
||||||
|
var profiles = new List<SearchProfileDto>();
|
||||||
|
|
||||||
|
var apiResult = await PostExternalAPIAsync(apiPath, accessToken, body, apiKey);
|
||||||
|
if (apiResult != null)
|
||||||
|
{
|
||||||
|
var raw = JsonConvert.DeserializeObject<GetListProfileByKeycloakIdRootResultDto>(apiResult);
|
||||||
|
if (raw != null)
|
||||||
|
return raw.Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<GetProfileByKeycloakIdRootDto>> GetEmployeeByAdminRolev2(string? accessToken, int? node, string? nodeId, string role, string? revisionId, int? reqNode, string? reqNodeId, DateTime? startDate, DateTime? endDate)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var apiPath = $"{_configuration["API"]}/org/dotnet/employee-by-admin-rolev2";
|
||||||
|
var apiKey = _configuration["API_KEY"];
|
||||||
|
var body = new
|
||||||
|
{
|
||||||
|
node = node,
|
||||||
|
nodeId = nodeId,
|
||||||
|
role = role,
|
||||||
|
// isRetirement
|
||||||
|
reqNode = reqNode,
|
||||||
|
reqNodeId = reqNodeId,
|
||||||
|
date = endDate
|
||||||
|
};
|
||||||
|
Console.WriteLine(body);
|
||||||
|
|
||||||
|
var profiles = new List<SearchProfileDto>();
|
||||||
|
|
||||||
|
var apiResult = await PostExternalAPIAsync(apiPath, accessToken, body, apiKey);
|
||||||
|
if (apiResult != null)
|
||||||
|
{
|
||||||
|
var raw = JsonConvert.DeserializeObject<GetListProfileByKeycloakIdRootResultDto>(apiResult);
|
||||||
|
if (raw != null)
|
||||||
|
return raw.Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new List<GetProfileByKeycloakIdRootDto>();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<GetProfileByKeycloakIdRootAddTotalDto> SearchProfile(string? citizenId, string? firstName, string? lastName, string accessToken, int page, int pageSize, string? role, string? nodeId, int? node,string? selectedNodeId,int? selectedNode )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -599,42 +1108,31 @@ namespace BMA.EHR.Application.Repositories
|
||||||
{
|
{
|
||||||
citizenId = citizenId,
|
citizenId = citizenId,
|
||||||
firstName = firstName,
|
firstName = firstName,
|
||||||
lastName = lastName
|
lastName = lastName,
|
||||||
|
role = role,
|
||||||
|
nodeId = nodeId,
|
||||||
|
node = node,
|
||||||
|
page = page,
|
||||||
|
pageSize = pageSize,
|
||||||
|
selectedNodeId = selectedNodeId,
|
||||||
|
selectedNode = selectedNode
|
||||||
};
|
};
|
||||||
|
|
||||||
var profiles = new List<SearchProfileDto>();
|
var profiles = new List<GetProfileByKeycloakIdRootDto>();
|
||||||
|
var total = 0;
|
||||||
|
|
||||||
var apiResult = await PostExternalAPIAsync(apiPath, accessToken, body, apiKey);
|
var apiResult = await PostExternalAPIAsync(apiPath, accessToken, body, apiKey);
|
||||||
if (apiResult != null)
|
if (apiResult != null)
|
||||||
{
|
{
|
||||||
var raw = JsonConvert.DeserializeObject<SearchProfileResultDto>(apiResult);
|
var raw = JsonConvert.DeserializeObject<GetListProfileByKeycloakIdRootResultAddTotalDto>(apiResult);
|
||||||
if (raw != null && raw.Result != null)
|
if (raw != null && raw.Result != null)
|
||||||
{
|
{
|
||||||
profiles.AddRange(raw.Result);
|
profiles = raw.Result.Data;
|
||||||
|
total = raw.Result.Total;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return profiles;
|
return new GetProfileByKeycloakIdRootAddTotalDto { Data = profiles, Total = total };
|
||||||
|
|
||||||
//var data = _dbContext.Set<Profile>().AsQueryable()
|
|
||||||
// .Where(x => x.ProfileType == "officer");
|
|
||||||
|
|
||||||
|
|
||||||
//if (citizenId != null)
|
|
||||||
// data = data.Where(x => x.CitizenId!.Contains(citizenId));
|
|
||||||
|
|
||||||
//if (firstName != null)
|
|
||||||
// data = data.Where(x => x.FirstName!.Contains(firstName));
|
|
||||||
|
|
||||||
//if (lastName != null)
|
|
||||||
// data = data.Where(x => x.LastName!.Contains(lastName));
|
|
||||||
|
|
||||||
//data = data.Include(x => x.Prefix)
|
|
||||||
// .Include(x => x.Position)
|
|
||||||
// .Include(x => x.PositionLevel)
|
|
||||||
// .Include(x => x.PosNo);
|
|
||||||
|
|
||||||
//return await data.ToListAsync();
|
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|
@ -642,7 +1140,7 @@ namespace BMA.EHR.Application.Repositories
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<SearchProfileDto>> SearchProfileEmployee(string? citizenId, string? firstName, string? lastName, string accessToken)
|
public async Task<GetProfileByKeycloakIdRootAddTotalDto> SearchProfileEmployee(string? citizenId, string? firstName, string? lastName, string accessToken, int page, int pageSize, string? role, string? nodeId, int? node)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -652,42 +1150,29 @@ namespace BMA.EHR.Application.Repositories
|
||||||
{
|
{
|
||||||
citizenId = citizenId,
|
citizenId = citizenId,
|
||||||
firstName = firstName,
|
firstName = firstName,
|
||||||
lastName = lastName
|
lastName = lastName,
|
||||||
|
role = role,
|
||||||
|
nodeId = nodeId,
|
||||||
|
node = node,
|
||||||
|
page = page,
|
||||||
|
pageSize = pageSize,
|
||||||
};
|
};
|
||||||
|
|
||||||
var profiles = new List<SearchProfileDto>();
|
var profiles = new List<GetProfileByKeycloakIdRootDto>();
|
||||||
|
var total = 0;
|
||||||
|
|
||||||
var apiResult = await PostExternalAPIAsync(apiPath, accessToken, body, apiKey);
|
var apiResult = await PostExternalAPIAsync(apiPath, accessToken, body, apiKey);
|
||||||
if (apiResult != null)
|
if (apiResult != null)
|
||||||
{
|
{
|
||||||
var raw = JsonConvert.DeserializeObject<SearchProfileResultDto>(apiResult);
|
var raw = JsonConvert.DeserializeObject<GetListProfileByKeycloakIdRootResultAddTotalDto>(apiResult);
|
||||||
if (raw != null && raw.Result != null)
|
if (raw != null && raw.Result != null)
|
||||||
{
|
{
|
||||||
profiles.AddRange(raw.Result);
|
profiles.AddRange(raw.Result.Data);
|
||||||
|
total = raw.Result.Total;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return profiles;
|
return new GetProfileByKeycloakIdRootAddTotalDto { Data = profiles, Total = total };
|
||||||
|
|
||||||
|
|
||||||
//var data = _dbContext.Set<Profile>().AsQueryable()
|
|
||||||
// .Where(x => x.ProfileType == "employee");
|
|
||||||
|
|
||||||
|
|
||||||
//if (citizenId != null)
|
|
||||||
// data = data.Where(x => x.CitizenId!.Contains(citizenId));
|
|
||||||
|
|
||||||
//if (firstName != null)
|
|
||||||
// data = data.Where(x => x.FirstName!.Contains(firstName));
|
|
||||||
|
|
||||||
//if (lastName != null)
|
|
||||||
// data = data.Where(x => x.LastName!.Contains(lastName));
|
|
||||||
|
|
||||||
//data = data.Include(x => x.Prefix);
|
|
||||||
////.Include(x => x.PosNoEmployee);
|
|
||||||
|
|
||||||
|
|
||||||
//return await data.ToListAsync();
|
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|
@ -756,7 +1241,30 @@ namespace BMA.EHR.Application.Repositories
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public GetUserOCIdDto? GetUserOC(Guid keycloakId, string? accessToken)
|
public async Task<GetUserOCAllDto?> GetUserOCAll(Guid keycloakId, string? accessToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var apiPath = $"{_configuration["API"]}/org/dotnet/user-oc-all/{keycloakId}";
|
||||||
|
var apiKey = _configuration["API_KEY"];
|
||||||
|
|
||||||
|
var apiResult = await GetExternalAPIAsync(apiPath, accessToken ?? "", apiKey);
|
||||||
|
if (apiResult != null)
|
||||||
|
{
|
||||||
|
var raw = JsonConvert.DeserializeObject<GetUserOCAllResultDto>(apiResult);
|
||||||
|
return raw?.Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<GetUserOCIdDto?> GetUserOC(Guid keycloakId, string? accessToken)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -767,15 +1275,11 @@ namespace BMA.EHR.Application.Repositories
|
||||||
var apiResult = GetExternalAPIAsync(apiPath, accessToken ?? "", apiKey);
|
var apiResult = GetExternalAPIAsync(apiPath, accessToken ?? "", apiKey);
|
||||||
if (apiResult.Result != null)
|
if (apiResult.Result != null)
|
||||||
{
|
{
|
||||||
var raw = JsonConvert.DeserializeObject<GetUserOCIdDto>(apiResult.Result);
|
var raw = JsonConvert.DeserializeObject<GetUserOCIdResultDto>(apiResult.Result);
|
||||||
|
|
||||||
return raw;
|
if (raw != null)
|
||||||
|
return raw.Result;
|
||||||
//if (raw == null || raw.RootId == null)
|
|
||||||
// return Guid.Empty;
|
|
||||||
//return raw.RootId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
|
@ -814,7 +1318,7 @@ namespace BMA.EHR.Application.Repositories
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public GetOrganizationResponseDTO? GetOc(Guid ocId, int level, string? accessToken)
|
public GetOrganizationResponseDTO? GetOcByNodeId(Guid ocId, int level, string? accessToken)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -845,6 +1349,38 @@ namespace BMA.EHR.Application.Repositories
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public GetOrganizationResponseDTO? GetOc(Guid ocId, int level, string? accessToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var apiPath = $"{_configuration["API"]}/org/find/allv2";
|
||||||
|
var apiKey = _configuration["API_KEY"];
|
||||||
|
var body = new
|
||||||
|
{
|
||||||
|
nodeId = ocId,
|
||||||
|
node = level
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var apiResult = PostExternalAPIAsync(apiPath, accessToken ?? "", body, apiKey).Result;
|
||||||
|
if (apiResult != null)
|
||||||
|
{
|
||||||
|
var raw = JsonConvert.DeserializeObject<GetOrganizationResponseResultDTO>(apiResult);
|
||||||
|
if (raw != null && raw.Result != null)
|
||||||
|
{
|
||||||
|
return raw.Result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public GetProfileByIdDto GetOfficerProfileById(Guid id, string? accessToken)
|
public GetProfileByIdDto GetOfficerProfileById(Guid id, string? accessToken)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -964,7 +1500,7 @@ namespace BMA.EHR.Application.Repositories
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var apiPath = $"{_configuration["API"]}/org/active/root/all";
|
var apiPath = $"{_configuration["API"]}/org/unauthorize/active/root/all";
|
||||||
var apiKey = _configuration["API_KEY"];
|
var apiKey = _configuration["API_KEY"];
|
||||||
|
|
||||||
var apiResult = await GetExternalAPIAsync(apiPath, accessToken ?? "", apiKey);
|
var apiResult = await GetExternalAPIAsync(apiPath, accessToken ?? "", apiKey);
|
||||||
|
|
@ -1002,6 +1538,48 @@ namespace BMA.EHR.Application.Repositories
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task PostInsigniaMessageToSocket(string message, string userId, string? accessToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var apiPath = $"{_configuration["API"]}/org/through-socket/notify";
|
||||||
|
var apiKey = _configuration["API_KEY"];
|
||||||
|
|
||||||
|
var body = new
|
||||||
|
{
|
||||||
|
message = message,
|
||||||
|
userId = userId
|
||||||
|
};
|
||||||
|
|
||||||
|
var apiResult = await PostExternalAPIBooleanAsync(apiPath, accessToken ?? "", body, apiKey);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task PostProfileEmpInsigniaAsync(PostProfileEmpInsigniaDto body, string? accessToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var apiPath = $"{_configuration["API"]}/org/profile-employee/insignia";
|
||||||
|
var apiKey = _configuration["API_KEY"];
|
||||||
|
|
||||||
|
var profiles = new List<SearchProfileDto>();
|
||||||
|
|
||||||
|
var apiResult = await PostExternalAPIBooleanAsync(apiPath, accessToken ?? "", body, apiKey);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<GetIsOfficerDto> GetIsOfficerRootAsync(string? accessToken, string sys)
|
public async Task<GetIsOfficerDto> GetIsOfficerRootAsync(string? accessToken, string sys)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -1024,6 +1602,82 @@ namespace BMA.EHR.Application.Repositories
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<List<GetMarkStatusDto>> GetInsigniaRequestsProfileAsync(string[] profileIds, string type, string? accessToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var apiPath = $"{_configuration["API"]}/org/dotnet/find/insignia-requests-profile/{type}";
|
||||||
|
var apiKey = _configuration["API_KEY"];
|
||||||
|
|
||||||
|
var body = new
|
||||||
|
{
|
||||||
|
profileIds
|
||||||
|
};
|
||||||
|
|
||||||
|
var apiResult = await PostExternalAPIAsync(apiPath, accessToken, body, apiKey);
|
||||||
|
|
||||||
|
if (apiResult != null)
|
||||||
|
{
|
||||||
|
var raw = JsonConvert.DeserializeObject<GetMarkStatusResultDto>(apiResult);
|
||||||
|
if (raw != null)
|
||||||
|
return raw.Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetOrgProfileByProfileIdDto GetOrgProfileByProfileId(Guid id, string? accessToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var apiPath = $"{_configuration["API"]}/org/profile/org-user/{id}";
|
||||||
|
var apiKey = _configuration["API_KEY"];
|
||||||
|
|
||||||
|
var apiResult = GetExternalAPIAsync(apiPath, accessToken ?? "", apiKey);
|
||||||
|
if (apiResult.Result != null)
|
||||||
|
{
|
||||||
|
var raw = JsonConvert.DeserializeObject<GetOrgProfileByProfileIdResultDto>(apiResult.Result);
|
||||||
|
if (raw != null)
|
||||||
|
return raw.Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public async Task<List<GetProfileSalaryDto>> GetProfileSalaryById(Guid profileId, string? accessToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var apiPath = $"{_configuration["API"]}/org/profile/insignia/position";
|
||||||
|
var apiKey = _configuration["API_KEY"];
|
||||||
|
var body = new
|
||||||
|
{
|
||||||
|
profileId = profileId.ToString(),
|
||||||
|
};
|
||||||
|
var apiResult = await PostExternalAPIAsync(apiPath, accessToken ?? "", body, apiKey);
|
||||||
|
if (apiResult != null)
|
||||||
|
{
|
||||||
|
var raw = JsonConvert.DeserializeObject<GetProfileSalaryResultDto>(apiResult);
|
||||||
|
if (raw != null)
|
||||||
|
return raw.Result;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,4 +9,18 @@ namespace BMA.EHR.Application.Requests
|
||||||
public Guid? BorrowOrganizationId { get; set; }
|
public Guid? BorrowOrganizationId { get; set; }
|
||||||
public Guid InsigniaNoteProfileId { get; set; }
|
public Guid InsigniaNoteProfileId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class InsigniaReclaimRequest
|
||||||
|
{
|
||||||
|
public DateTime ReclaimDate { get; set; }
|
||||||
|
public Guid InsigniaNoteProfileId { get; set; }
|
||||||
|
|
||||||
|
public string? ReclaimNote { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class UpdateInsigniaReclaimRequest
|
||||||
|
{
|
||||||
|
public DateTime ReclaimDate { get; set; }
|
||||||
|
public string? ReclaimNote { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
public bool? MarkDiscipline { get; set; }
|
public bool? MarkDiscipline { get; set; }
|
||||||
public bool? MarkLeave { get; set; }
|
public bool? MarkLeave { get; set; }
|
||||||
public bool? MarkRate { get; set; }
|
public bool? MarkRate { get; set; }
|
||||||
|
public bool? MarkInsignia { get; set; }
|
||||||
public List<InsigniaRequestDoc>? Docs { get; set; }
|
public List<InsigniaRequestDoc>? Docs { get; set; }
|
||||||
|
|
||||||
public List<MatchingCondition> MatchingConditions { get; set; } = new List<MatchingCondition>();
|
public List<MatchingCondition> MatchingConditions { get; set; } = new List<MatchingCondition>();
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,14 @@ namespace BMA.EHR.Application.Requests
|
||||||
public string? Child4 { get; set; }
|
public string? Child4 { get; set; }
|
||||||
|
|
||||||
public List<MatchingCondition> MatchingConditions { get; set; } = new List<MatchingCondition>();
|
public List<MatchingCondition> MatchingConditions { get; set; } = new List<MatchingCondition>();
|
||||||
|
|
||||||
|
public bool? MarkDiscipline { get; set; } = false;
|
||||||
|
|
||||||
|
public bool? MarkLeave { get; set; } = false;
|
||||||
|
|
||||||
|
public bool? MarkRate { get; set; } = false;
|
||||||
|
|
||||||
|
public bool? MarkInsignia { get; set; } = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MatchingCondition
|
public class MatchingCondition
|
||||||
|
|
|
||||||
|
|
@ -13,5 +13,6 @@
|
||||||
|
|
||||||
public bool? isReport { get; set; }
|
public bool? isReport { get; set; }
|
||||||
|
|
||||||
|
public bool? isTemplate { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
namespace BMA.EHR.Application.Responses.Insignias
|
||||||
|
{
|
||||||
|
public class PostProfileEmpInsigniaDto
|
||||||
|
{
|
||||||
|
public Guid profileEmployeeId { get; set; }
|
||||||
|
|
||||||
|
public int year { get; set; } = 0;
|
||||||
|
|
||||||
|
public string no { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string volume { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string section { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string page { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public DateTime receiveDate { get; set; } = DateTime.MinValue;
|
||||||
|
|
||||||
|
public Guid insigniaId { get; set; }
|
||||||
|
|
||||||
|
public DateTime dateAnnounce { get; set; } = DateTime.MinValue;
|
||||||
|
|
||||||
|
public string issue { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string volumeNo { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public DateTime? refCommandDate { get; set; }
|
||||||
|
|
||||||
|
public string refCommandNo { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string note { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using BMA.EHR.Domain.Shared;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Application.Responses.Leaves
|
||||||
|
{
|
||||||
|
public class GetPermissionWithActingDto
|
||||||
|
{
|
||||||
|
public string privilege {get; set;} = string.Empty;
|
||||||
|
public bool isAct {get; set;} = false;
|
||||||
|
public List<ActingPermission> posMasterActs {get; set;} = new();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ActingPermission
|
||||||
|
{
|
||||||
|
public string posNo {get; set;} = string.Empty;
|
||||||
|
//public string? privilege {get; set;} = "PARENT";
|
||||||
|
[JsonConverter(typeof(PrivilegeConverter))]
|
||||||
|
public string privilege {get; set;} = "CHILD";
|
||||||
|
|
||||||
|
public Guid? rootDnaId {get; set;}
|
||||||
|
public Guid? child1DnaId {get; set;}
|
||||||
|
public Guid? child2DnaId {get; set;}
|
||||||
|
public Guid? child3DnaId {get; set;}
|
||||||
|
public Guid? child4DnaId {get; set;}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class GetPermissionWithActingResultDto
|
||||||
|
{
|
||||||
|
public int status {get; set;} = 0;
|
||||||
|
public string message {get; set;} = string.Empty;
|
||||||
|
public GetPermissionWithActingDto result {get; set;} = new();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
namespace BMA.EHR.Application.Responses.Leaves
|
||||||
|
{
|
||||||
|
public class GetProfileLeaveByKeycloakDto
|
||||||
|
{
|
||||||
|
public string ProfileType { get; set; }
|
||||||
|
public string Prefix { get; set; }
|
||||||
|
public string FirstName { get; set; }
|
||||||
|
public string LastName { get; set; }
|
||||||
|
public string CitizenId { get; set; }
|
||||||
|
public DateTime BirthDate { get; set; }
|
||||||
|
public DateTime RetireDate { get; set; }
|
||||||
|
public string GovAge { get; set; } = string.Empty;
|
||||||
|
public string Age { get; set; } = string.Empty;
|
||||||
|
public DateTime DateAppoint { get; set; }
|
||||||
|
public DateTime DateCurrent { get; set; }
|
||||||
|
public int? Amount { get; set; } = 0;
|
||||||
|
public string? TelephoneNumber { get; set; } = string.Empty;
|
||||||
|
public string Position { get; set; } = string.Empty;
|
||||||
|
public string PosLevel { get; set; } = string.Empty;
|
||||||
|
public string PosType { get; set; } = string.Empty;
|
||||||
|
public string? PositionLeaveName { get; set; }
|
||||||
|
public string? PosExecutiveName { get; set; }
|
||||||
|
public string CurrentAddress { get; set; } = string.Empty;
|
||||||
|
public string Oc { get; set; } = string.Empty;
|
||||||
|
public bool isCommission { get; set; } = false;
|
||||||
|
public string Root { get; set; } = string.Empty;
|
||||||
|
public string? Child1 { get; set; }
|
||||||
|
public string? Child2 { get; set; }
|
||||||
|
public string? Child3 { get; set; }
|
||||||
|
public string? Child4 { get; set; }
|
||||||
|
public List<ProfileLeavePosition> Positions { get; set; } = new();
|
||||||
|
public List<ProfileLeaveEducation> Educations { get; set; } = new();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ProfileLeavePosition
|
||||||
|
{
|
||||||
|
public string? PositionName { get; set; } = string.Empty;
|
||||||
|
public DateTime DateStart { get; set; }
|
||||||
|
public DateTime DateEnd { get; set; }
|
||||||
|
public string? PositionType { get; set; } = string.Empty;
|
||||||
|
public string? PositionLevel { get; set; } = string.Empty;
|
||||||
|
public string? OrgRoot { get; set; } = string.Empty;
|
||||||
|
public string? OrgChild1 { get; set; } = string.Empty;
|
||||||
|
public string? OrgChild2 { get; set; } = string.Empty;
|
||||||
|
public string? OrgChild3 { get; set; } = string.Empty;
|
||||||
|
public string? OrgChild4 { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ProfileLeaveEducation
|
||||||
|
{
|
||||||
|
public string EducationLevel { get; set; } = string.Empty;
|
||||||
|
public string Institute { get; set; } = string.Empty;
|
||||||
|
public string? Country { get; set; } = string.Empty;
|
||||||
|
public DateTime? FinishDate { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
namespace BMA.EHR.Application.Responses.Leaves
|
||||||
|
{
|
||||||
|
public class GetProfileLeaveByKeycloakResultDto
|
||||||
|
{
|
||||||
|
public string Message { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public int Status { get; set; } = -1;
|
||||||
|
|
||||||
|
public GetProfileLeaveByKeycloakDto? Result { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
public string LeaveTypeCode { get; set; } = string.Empty;
|
public string LeaveTypeCode { get; set; } = string.Empty;
|
||||||
|
|
||||||
public double SumLeaveDay { get; set; }
|
public double SumLeaveDay { get; set; } = 0.0;
|
||||||
|
|
||||||
|
public int CountLeaveDay { get; set; } = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,5 +37,11 @@ namespace BMA.EHR.Application.Responses.Organizations
|
||||||
public string? Child4 { get; set; }
|
public string? Child4 { get; set; }
|
||||||
|
|
||||||
public string? Child4ShortName { get; set; }
|
public string? Child4ShortName { get; set; }
|
||||||
|
|
||||||
|
public Guid? RootDnaId { get; set; }
|
||||||
|
public Guid? Child1DnaId { get; set; }
|
||||||
|
public Guid? Child2DnaId { get; set; }
|
||||||
|
public Guid? Child3DnaId { get; set; }
|
||||||
|
public Guid? Child4DnaId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,4 +8,12 @@
|
||||||
|
|
||||||
public List<GetProfileByKeycloakIdRootDto> Result { get; set; } = new();
|
public List<GetProfileByKeycloakIdRootDto> Result { get; set; } = new();
|
||||||
}
|
}
|
||||||
|
public class GetListProfileByKeycloakIdRootResultAddTotalDto
|
||||||
|
{
|
||||||
|
public string Message { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public int Status { get; set; } = -1;
|
||||||
|
|
||||||
|
public GetProfileByKeycloakIdRootAddTotalDto Result { get; set; } = new();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
23
BMA.EHR.Application/Responses/Profiles/GetMarkStatusDto.cs
Normal file
23
BMA.EHR.Application/Responses/Profiles/GetMarkStatusDto.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
namespace BMA.EHR.Application.Responses.Profiles
|
||||||
|
{
|
||||||
|
public class GetMarkStatusDto
|
||||||
|
{
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
public bool? MarkDiscipline { get; set; } = false;
|
||||||
|
public bool? MarkLeave { get; set; } = false;
|
||||||
|
public bool? MarkRate { get; set; } = false;
|
||||||
|
public bool? MarkInsignia { get; set; } = false;
|
||||||
|
|
||||||
|
public string? APR1 { get; set; }
|
||||||
|
public string? APR2 { get; set; }
|
||||||
|
public string? APR3 { get; set; }
|
||||||
|
public string? APR4 { get; set; }
|
||||||
|
public string? APR5 { get; set; }
|
||||||
|
|
||||||
|
public string? OCT1 { get; set; }
|
||||||
|
public string? OCT2 { get; set; }
|
||||||
|
public string? OCT3 { get; set; }
|
||||||
|
public string? OCT4 { get; set; }
|
||||||
|
public string? OCT5 { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
namespace BMA.EHR.Application.Responses.Profiles
|
||||||
|
{
|
||||||
|
public class GetMarkStatusResultDto
|
||||||
|
{
|
||||||
|
public string Message { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public int Status { get; set; } = -1;
|
||||||
|
|
||||||
|
public List<GetMarkStatusDto> Result { get; set; } = new();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
35
BMA.EHR.Application/Responses/Profiles/GetOcStaff.cs
Normal file
35
BMA.EHR.Application/Responses/Profiles/GetOcStaff.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Application.Responses.Profiles
|
||||||
|
{
|
||||||
|
public class GetOcStaff
|
||||||
|
{
|
||||||
|
public Guid ProfileId { get; set; }
|
||||||
|
public Guid Keycloak { get; set; }
|
||||||
|
public string FullName { get; set; } = null!;
|
||||||
|
public Guid? RootId { get; set; }
|
||||||
|
public Guid? OrgChild1Id { get; set; }
|
||||||
|
public Guid? OrgChild2Id { get; set; }
|
||||||
|
public Guid? OrgChild3Id { get; set; }
|
||||||
|
public Guid? OrgChild4Id { get; set; }
|
||||||
|
public Guid? RootDnaId { get; set; }
|
||||||
|
public Guid? Child1DnaId { get; set; }
|
||||||
|
public Guid? Child2DnaId { get; set; }
|
||||||
|
public Guid? Child3DnaId { get; set; }
|
||||||
|
public Guid? Child4DnaId { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class GetOcStaffResultDto
|
||||||
|
{
|
||||||
|
public string Message { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public int Status { get; set; } = -1;
|
||||||
|
|
||||||
|
public List<GetOcStaff> Result { get; set; } = new();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
namespace BMA.EHR.Application.Responses.Profiles
|
||||||
|
{
|
||||||
|
public class GetOrgProfileByProfileIdDto
|
||||||
|
{
|
||||||
|
public string? Root { get; set; }
|
||||||
|
public string? Child1 { get; set; }
|
||||||
|
public string? Child2 { get; set; }
|
||||||
|
public string? Child3 { get; set; }
|
||||||
|
public string? Child4 { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
namespace BMA.EHR.Application.Responses.Profiles
|
||||||
|
{
|
||||||
|
public class GetOrgProfileByProfileIdResultDto
|
||||||
|
{
|
||||||
|
public string Message { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public int Status { get; set; } = -1;
|
||||||
|
|
||||||
|
public GetOrgProfileByProfileIdDto? Result { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -44,6 +44,8 @@ namespace BMA.EHR.Application.Responses.Profiles
|
||||||
public string? ProfileType { get; set; }
|
public string? ProfileType { get; set; }
|
||||||
public bool? IsLeave { get; set; }
|
public bool? IsLeave { get; set; }
|
||||||
|
|
||||||
|
public bool? IsProbation { get; set; }
|
||||||
|
|
||||||
public string? Root { get; set; }
|
public string? Root { get; set; }
|
||||||
public string? Child1 { get; set; }
|
public string? Child1 { get; set; }
|
||||||
public string? Child2 { get; set; }
|
public string? Child2 { get; set; }
|
||||||
|
|
@ -81,6 +83,10 @@ namespace BMA.EHR.Application.Responses.Profiles
|
||||||
|
|
||||||
public string? PositionLeaveName { get; set; }
|
public string? PositionLeaveName { get; set; }
|
||||||
|
|
||||||
|
public string? PosExecutiveName { get; set; }
|
||||||
|
|
||||||
|
public string? CommanderPositionName { get; set; } = string.Empty;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PosLevel
|
public class PosLevel
|
||||||
|
|
|
||||||
|
|
@ -16,5 +16,27 @@ namespace BMA.EHR.Application.Responses.Profiles
|
||||||
public string? PositionLevel { get; set; }
|
public string? PositionLevel { get; set; }
|
||||||
public string? PositionType { get; set; }
|
public string? PositionType { get; set; }
|
||||||
public string? Oc { get; set; }
|
public string? Oc { get; set; }
|
||||||
|
public string? OrgRootId { get; set; }
|
||||||
|
public string? OrgChild1Id { get; set; }
|
||||||
|
public string? OrgChild2Id { get; set; }
|
||||||
|
public string? OrgChild3Id { get; set; }
|
||||||
|
public string? OrgChild4Id { get; set; }
|
||||||
|
|
||||||
|
public DateTime? DateStart { get; set; }
|
||||||
|
|
||||||
|
public DateTime? DateAppoint { get; set; }
|
||||||
|
|
||||||
|
public string? RootDnaId { get; set; }
|
||||||
|
public string? Child1DnaId { get; set; }
|
||||||
|
public string? Child2DnaId { get; set; }
|
||||||
|
public string? Child3DnaId { get; set; }
|
||||||
|
public string? Child4DnaId { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class GetProfileByKeycloakIdRootAddTotalDto
|
||||||
|
{
|
||||||
|
public List<GetProfileByKeycloakIdRootDto> Data { get; set; } = new();
|
||||||
|
|
||||||
|
public int Total { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,5 +63,15 @@ namespace BMA.EHR.Application.Responses.Profiles
|
||||||
public Guid? Child4Id { get; set; }
|
public Guid? Child4Id { get; set; }
|
||||||
public Guid? Child4DnaId { get; set; }
|
public Guid? Child4DnaId { get; set; }
|
||||||
public string? Child4 { get; set; }
|
public string? Child4 { get; set; }
|
||||||
|
|
||||||
|
public string? ProfileType { get; set; }
|
||||||
|
|
||||||
|
public bool? MarkDiscipline { get; set; } = false;
|
||||||
|
|
||||||
|
public bool? MarkLeave { get; set; } = false;
|
||||||
|
|
||||||
|
public bool? MarkRate { get; set; } = false;
|
||||||
|
|
||||||
|
public bool? MarkInsignia { get; set; } = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
namespace BMA.EHR.Application.Responses.Profiles
|
||||||
|
{
|
||||||
|
public class GetProfileSalaryDto
|
||||||
|
{
|
||||||
|
public DateTime DateAffect { get; set; }
|
||||||
|
public string Position { get; set; } = string.Empty;
|
||||||
|
public string Root { get; set; } = string.Empty;
|
||||||
|
public string Child1 { get; set; } = string.Empty;
|
||||||
|
public string Child2 { get; set; } = string.Empty;
|
||||||
|
public string Child3 { get; set; } = string.Empty;
|
||||||
|
public string Child4 { get; set; } = string.Empty;
|
||||||
|
public int Age { get; set; } = 0;
|
||||||
|
public int Amount { get; set; } = 0;
|
||||||
|
public string Remark { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
namespace BMA.EHR.Application.Responses.Profiles
|
||||||
|
{
|
||||||
|
public class GetProfileSalaryResultDto
|
||||||
|
{
|
||||||
|
public string Message { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public int Status { get; set; } = -1;
|
||||||
|
|
||||||
|
public List<GetProfileSalaryDto> Result { get; set; } = new();
|
||||||
|
}
|
||||||
|
}
|
||||||
57
BMA.EHR.Application/Responses/Profiles/GetUserOCAllDto.cs
Normal file
57
BMA.EHR.Application/Responses/Profiles/GetUserOCAllDto.cs
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
namespace BMA.EHR.Application.Responses.Profiles
|
||||||
|
{
|
||||||
|
public class GetUserOCAllDto
|
||||||
|
{
|
||||||
|
public Guid ProfileId { get; set; }
|
||||||
|
public string? Prefix { get; set; }
|
||||||
|
public string? Rank { get; set; }
|
||||||
|
public string? Avatar { get; set; }
|
||||||
|
public string? AvatarName { get; set; }
|
||||||
|
public string? FirstName { get; set; }
|
||||||
|
public string? LastName { get; set; }
|
||||||
|
public string? CitizenId { get; set; }
|
||||||
|
public DateTime? BirthDate { get; set; }
|
||||||
|
public string? Position { get; set; }
|
||||||
|
|
||||||
|
public int? PosMaster { get; set; }
|
||||||
|
public int? PosMasterNo { get; set; }
|
||||||
|
public string? PosLevelName { get; set; }
|
||||||
|
public string? PosLevelRank { get; set; }
|
||||||
|
public Guid? PosLevelId { get; set; }
|
||||||
|
public string? PosTypeName { get; set; }
|
||||||
|
public string? PosTypeRank { get; set; }
|
||||||
|
public Guid? PosTypeId { get; set; }
|
||||||
|
|
||||||
|
public string? PosExecutiveName { get; set; }
|
||||||
|
public int? PosExecutivePriority { get; set; }
|
||||||
|
public Guid? PosExecutiveId { get; set; }
|
||||||
|
|
||||||
|
public string RootId { get; set; }
|
||||||
|
public string? RootDnaId { get; set; }
|
||||||
|
public string? Root { get; set; }
|
||||||
|
public string? RootShortName { get; set; }
|
||||||
|
|
||||||
|
public string? Child1Id { get; set; }
|
||||||
|
public string? Child1DnaId { get; set; }
|
||||||
|
public string? Child1 { get; set; }
|
||||||
|
public string? Child1ShortName { get; set; }
|
||||||
|
|
||||||
|
public string? Child2Id { get; set; }
|
||||||
|
public string? Child2DnaId { get; set; }
|
||||||
|
public string? Child2 { get; set; }
|
||||||
|
public string? Child2ShortName { get; set; }
|
||||||
|
|
||||||
|
public string? Child3Id { get; set; }
|
||||||
|
public string? Child3DnaId { get; set; }
|
||||||
|
public string? Child3 { get; set; }
|
||||||
|
public string? Child3ShortName { get; set; }
|
||||||
|
|
||||||
|
public string? Child4Id { get; set; }
|
||||||
|
public string? Child4DnaId { get; set; }
|
||||||
|
public string? Child4 { get; set; }
|
||||||
|
public string? Child4ShortName { get; set; }
|
||||||
|
|
||||||
|
public int? Node { get; set; }
|
||||||
|
public string? NodeId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
namespace BMA.EHR.Application.Responses.Profiles
|
||||||
|
{
|
||||||
|
public class GetUserOCAllResultDto
|
||||||
|
{
|
||||||
|
public string Message { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public int Status { get; set; } = -1;
|
||||||
|
|
||||||
|
public GetUserOCAllDto? Result { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,26 +4,27 @@
|
||||||
{
|
{
|
||||||
public Guid ProfileId { get; set; }
|
public Guid ProfileId { get; set; }
|
||||||
|
|
||||||
public string Prefix { get; set; } = string.Empty;
|
public string? Prefix { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string Rank { get; set; } = string.Empty;
|
public string? Rank { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string Avatar { get; set; } = string.Empty;
|
public string? Avatar { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string FirstName { get; set; } = string.Empty;
|
public string? FirstName { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string LastName { get; set; } = string.Empty;
|
public string? LastName { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string CitizenId { get; set; } = string.Empty;
|
public string? CitizenId { get; set; } = string.Empty;
|
||||||
|
|
||||||
public DateTime BirthDate { get; set; } = DateTime.MinValue;
|
public DateTime? BirthDate { get; set; } = DateTime.MinValue;
|
||||||
|
|
||||||
public string Position { get; set; } = string.Empty;
|
public string? Position { get; set; } = string.Empty;
|
||||||
|
|
||||||
public Guid RootId { get; set; }
|
public Guid RootId { get; set; }
|
||||||
|
public Guid? RootDnaId { get; set; }
|
||||||
|
|
||||||
public string Root { get; set; } = string.Empty;
|
public string? Root { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string RootShortName { get; set; } = string.Empty;
|
public string? RootShortName { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
24
BMA.EHR.CheckInConsumer/.dockerignore
Normal file
24
BMA.EHR.CheckInConsumer/.dockerignore
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
# Build artifacts
|
||||||
|
bin/
|
||||||
|
obj/
|
||||||
|
|
||||||
|
# IDE / tooling
|
||||||
|
Properties/
|
||||||
|
.vs/
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
# Source control
|
||||||
|
.git/
|
||||||
|
.gitignore
|
||||||
|
|
||||||
|
# Documentation
|
||||||
|
*.md
|
||||||
|
|
||||||
|
# Docker
|
||||||
|
Dockerfile
|
||||||
|
.dockerignore
|
||||||
|
|
||||||
|
# OS files
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
|
|
@ -6,6 +6,9 @@
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||||
|
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||||
|
<NoWarn>$(NoWarn);$(WarningsNotAsErrors)</NoWarn>
|
||||||
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
83
BMA.EHR.CheckInConsumer/CHANGELOG-checkin-speedup.md
Normal file
83
BMA.EHR.CheckInConsumer/CHANGELOG-checkin-speedup.md
Normal file
|
|
@ -0,0 +1,83 @@
|
||||||
|
# สรุปการปรับปรุงระบบลงเวลา (CheckInConsumer)
|
||||||
|
|
||||||
|
วันที่แก้ไข: 23 มิถุนายน 2026
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ปัญหาเดิม
|
||||||
|
|
||||||
|
ตอนที่พนักงานลงเวลาพร้อมกันจำนวนมาก (ประมาณ 2,000 รายการ) ระบบประมวลผลทีละรายการ ทำให้ต้องรอคิวนานถึง **22 นาที** กว่าจะประมวลผลเสร็จทั้งหมด
|
||||||
|
|
||||||
|
เปรียบเทียบเหมือน **โต๊ะบัญชี 1 คน รับคิวทีละคน** ทั้งที่มีคนรอ 2,000 คน → คิวยาวมาก
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## วิธีที่แก้ (เข้าใจง่าย ๆ)
|
||||||
|
|
||||||
|
### 1. เพิ่มคนช่วยประมวลผลพร้อมกัน (Concurrency)
|
||||||
|
- **ก่อน:** ประมวลผลทีละรายการ (เหมือนมีโต๊ะบัญชี 1 โต๊ะ)
|
||||||
|
- **หลัง:** ประมวลผลพร้อมกันได้สูงสุด **5 รายการ** (เหมือนเปิดโต๊ะบัญชี 5 โต๊ะ)
|
||||||
|
|
||||||
|
> ผลที่ได้: เวลารอคิวลดลงจาก **22 นาที → ประมาณ 4–5 นาที**
|
||||||
|
|
||||||
|
### 2. จัดคิวล่วงหน้าให้ RabbitMQ (Prefetch)
|
||||||
|
- **ก่อน:** ระบบดึงข้อมูลมาทีละชิ้น ทำให้เสียเวลารอส่งต่อ
|
||||||
|
- **หลัง:** ระบบดึงข้อมูลมาเป็นชุด ๆ ละ 20 ชิ้นไว้เตรียมพร้อม → ลดเวลารอระหว่างรายการ
|
||||||
|
|
||||||
|
### 3. ลดเวลารอเมื่อ API มีปัญหา (Timeout)
|
||||||
|
- **ก่อน:** ถ้า API ค้าง ระบบจะรอนานถึง **5 นาที** ต่อรายการ
|
||||||
|
- **หลัง:** ลดเหลือ **1 นาที** → รายการที่มีปัญหาจะถูกปฏิเสธเร็วขึ้น ไม่ทำให้คิวค้าง
|
||||||
|
|
||||||
|
### 4. ปรับปรุงการเชื่อมต่อ HTTP
|
||||||
|
- เปลี่ยนระบบเชื่อมต่อให้รองรับการส่งคำขอหลายรายการพร้อมกันโดยไม่สะดุด
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ตัวเลขเปรียบเทียบ
|
||||||
|
|
||||||
|
| รายการ | ก่อนแก้ | หลังแก้ |
|
||||||
|
|---|---|---|
|
||||||
|
| จำนวนรายการที่ประมวลผลพร้อมกัน | 1 | 5 |
|
||||||
|
| เวลารอคิวสูงสุด (2,000 รายการ) | ~22 นาที | ~4–5 นาที |
|
||||||
|
| เวลารอเมื่อ API มีปัญหา | 5 นาที | 1 นาที |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ไฟล์ที่แก้ไข
|
||||||
|
|
||||||
|
1. **`Program.cs`** — โค้ดหลักของตัวประมวลผลคิว
|
||||||
|
2. **`appsettings.json`** — ไฟล์ตั้งค่าระบบ
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## วิธีปรับความเร็วเพิ่มเติม (ไม่ต้องเขียนโค้ดใหม่)
|
||||||
|
|
||||||
|
ถ้าหลังทดสอบแล้วเห็นว่าระบบรับได้ และอยากให้เร็วขึ้นอีก ให้แก้ไขไฟล์ `appsettings.json` แล้ว restart โปรแกรมได้เลย:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"MaxConcurrency": 10, ← เพิ่มจาก 5 เป็น 10 (ประมวลผลพร้อมกัน 10 รายการ)
|
||||||
|
"PrefetchCount": 50, ← ควรตั้งเป็น ประมาณ MaxConcurrency × 2 ขึ้นไป
|
||||||
|
"HttpTimeoutSeconds": 60 ← เวลารอ API วินาที
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**ค่าที่ใช้และผลที่คาดการณ์:**
|
||||||
|
- `MaxConcurrency = 5` → ใช้เวลา ~4–5 นาที (ค่าเริ่มต้นปลอดภัย)
|
||||||
|
- `MaxConcurrency = 10` → ใช้เวลา ~2–3 นาที
|
||||||
|
- `MaxConcurrency = 20` → ใช้เวลา ~1–2 นาที (ต้องตรวจสอบว่าระบบหลังบ้านรับไหวก่อน)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ข้อควรระวัง / คำแนะนำ
|
||||||
|
|
||||||
|
1. **ควรทดสอบในระบบทดสอบก่อน** โดยดูว่า
|
||||||
|
- ไม่มี error ในระบบหลัก (API)
|
||||||
|
- ฐานข้อมูลไม่ช้าผิดปกติ
|
||||||
|
- ไม่พบปัญหาลงเวลาซ้ำซ้อน
|
||||||
|
|
||||||
|
2. ถ้าพบปัญหา เช่น
|
||||||
|
- มี error ใน API → **ลด** `MaxConcurrency` เหลือ 2 หรือ 3
|
||||||
|
- ลงเวลาซ้ำ → แจ้งทีมเทคนิคเพื่อแก้ฝั่ง API เพิ่มเติม
|
||||||
|
|
||||||
|
3. **ค่า `MaxConcurrency = 5` เป็นค่าปลอดภัย** เพราะระบบ API ด้านหลังยังมีข้อจำกัดอยู่บางส่วน หากต้องการเพิ่มให้สูงกว่านี้ (เช่น 20–50) ควรปรึกษาทีมเทคนิคเพื่อปรับปรุงฝั่ง API ก่อน
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
## See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
## See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
||||||
#
|
#
|
||||||
## This stage is used when running from VS in fast mode (Default for Debug configuration)
|
## This stage is used when running from VS in fast mode (Default for Debug configuration)
|
||||||
#FROM mcr.microsoft.com/dotnet/runtime:8.0 AS base
|
#FROM mcr.microsoft.com/dotnet/runtime:8.0 AS base
|
||||||
|
|
@ -21,6 +21,7 @@
|
||||||
#ARG BUILD_CONFIGURATION=Release
|
#ARG BUILD_CONFIGURATION=Release
|
||||||
#RUN dotnet publish "BMA.EHR.CheckInConsumer.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
#RUN dotnet publish "BMA.EHR.CheckInConsumer.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
||||||
#
|
#
|
||||||
|
|
||||||
## This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration)
|
## This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration)
|
||||||
#FROM base AS final
|
#FROM base AS final
|
||||||
#WORKDIR /app
|
#WORKDIR /app
|
||||||
|
|
@ -29,30 +30,25 @@
|
||||||
|
|
||||||
|
|
||||||
# ใช้ official .NET SDK image สำหรับการ build
|
# ใช้ official .NET SDK image สำหรับการ build
|
||||||
|
# Note: Build context = repository root (ตามที่ GitHub Actions ใช้)
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||||
|
|
||||||
# กำหนด working directory ภายใน container
|
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
|
||||||
# คัดลอกไฟล์ .csproj และ restore dependencies
|
# copy เฉพาะ .csproj ก่อน เพื่อใช้ layer caching (restore เร็ว เก็บ cache นาน)
|
||||||
# COPY *.csproj ./
|
COPY BMA.EHR.CheckInConsumer/BMA.EHR.CheckInConsumer.csproj ./BMA.EHR.CheckInConsumer/
|
||||||
COPY . ./
|
WORKDIR /src/BMA.EHR.CheckInConsumer
|
||||||
RUN dotnet restore
|
RUN dotnet restore "BMA.EHR.CheckInConsumer.csproj"
|
||||||
|
|
||||||
# คัดลอกไฟล์ทั้งหมดและ build
|
# คัดลอก source ที่เหลือแล้ว publish
|
||||||
COPY . ./
|
COPY BMA.EHR.CheckInConsumer/ ./
|
||||||
RUN dotnet build -c Release -o /app/build
|
RUN dotnet publish "BMA.EHR.CheckInConsumer.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
||||||
# WORKDIR "/src/BMA.EHR.CheckInConsumer"
|
|
||||||
# RUN dotnet build "BMA.EHR.CheckInConsumer.csproj" -c Release -o /app/build
|
|
||||||
|
|
||||||
# ใช้ stage ใหม่สำหรับการ runtime
|
# ใช้ stage ใหม่สำหรับ runtime (image เล็กลง)
|
||||||
FROM mcr.microsoft.com/dotnet/runtime:8.0 AS runtime
|
FROM mcr.microsoft.com/dotnet/runtime:8.0 AS runtime
|
||||||
|
|
||||||
# กำหนด working directory สำหรับ runtime
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# คัดลอกไฟล์จาก build stage มายัง runtime stage
|
COPY --from=build /app/publish .
|
||||||
COPY --from=build /app/build .
|
|
||||||
|
|
||||||
# ระบุ entry point ของแอปพลิเคชัน
|
|
||||||
ENTRYPOINT ["dotnet", "BMA.EHR.CheckInConsumer.dll"]
|
ENTRYPOINT ["dotnet", "BMA.EHR.CheckInConsumer.dll"]
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using RabbitMQ.Client;
|
using RabbitMQ.Client;
|
||||||
using RabbitMQ.Client.Events;
|
using RabbitMQ.Client.Events;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
@ -18,66 +18,101 @@ var user = configuration["Rabbit:User"] ?? "";
|
||||||
var pass = configuration["Rabbit:Password"] ?? "";
|
var pass = configuration["Rabbit:Password"] ?? "";
|
||||||
var queue = configuration["Rabbit:Queue"] ?? "basic-queue";
|
var queue = configuration["Rabbit:Queue"] ?? "basic-queue";
|
||||||
|
|
||||||
|
// Concurrency & prefetch (configurable via appsettings.json)
|
||||||
|
var maxConcurrency = int.TryParse(configuration["MaxConcurrency"], out var c) && c > 0 ? c : 5;
|
||||||
|
var prefetchCount = ushort.TryParse(configuration["PrefetchCount"], out var p) && p > 0 ? p : (ushort)20;
|
||||||
|
var httpTimeoutSec = int.TryParse(configuration["HttpTimeoutSeconds"], out var t) && t > 0 ? t : 60;
|
||||||
|
|
||||||
|
WriteToConsole($"Config -> MaxConcurrency: {maxConcurrency}, PrefetchCount: {prefetchCount}, HttpTimeout: {httpTimeoutSec}s");
|
||||||
|
|
||||||
// create connection
|
// create connection
|
||||||
var factory = new ConnectionFactory()
|
var factory = new ConnectionFactory()
|
||||||
{
|
{
|
||||||
//Uri = new Uri("amqp://admin:P@ssw0rd@192.168.4.11:5672")
|
HostName = host,
|
||||||
HostName = host,// หรือ hostname ของ RabbitMQ Server ที่คุณใช้
|
UserName = user,
|
||||||
UserName = user, // ใส่ชื่อผู้ใช้ของคุณ
|
Password = pass,
|
||||||
Password = pass // ใส่รหัสผ่านของคุณ
|
DispatchConsumersAsync = true
|
||||||
};
|
};
|
||||||
|
|
||||||
using var connection = factory.CreateConnection();
|
using var connection = factory.CreateConnection();
|
||||||
using var channel = connection.CreateModel();
|
using var channel = connection.CreateModel();
|
||||||
|
|
||||||
//channel.QueueDeclare(queue: "bma-checkin-queue", durable: true, exclusive: false, autoDelete: false, arguments: null);
|
|
||||||
channel.QueueDeclare(queue: queue, durable: true, exclusive: false, autoDelete: false, arguments: null);
|
channel.QueueDeclare(queue: queue, durable: true, exclusive: false, autoDelete: false, arguments: null);
|
||||||
|
|
||||||
var consumer = new EventingBasicConsumer(channel);
|
// Prefetch: RabbitMQ จะส่ง message หลายตัวมาที่ consumer พร้อมกัน (ลด network round-trip)
|
||||||
|
channel.BasicQos(prefetchSize: 0, prefetchCount: prefetchCount, global: false);
|
||||||
|
|
||||||
consumer.Received += async (model, ea) =>
|
// HttpClient แบบ SocketsHttpHandler พร้อม connection pooling รองรับ concurrent requests
|
||||||
|
var socketsHandler = new SocketsHttpHandler
|
||||||
{
|
{
|
||||||
|
MaxConnectionsPerServer = maxConcurrency * 2,
|
||||||
|
PooledConnectionLifetime = TimeSpan.FromMinutes(2),
|
||||||
|
PooledConnectionIdleTimeout = TimeSpan.FromSeconds(30)
|
||||||
|
};
|
||||||
|
using var httpClient = new HttpClient(socketsHandler);
|
||||||
|
httpClient.Timeout = TimeSpan.FromSeconds(httpTimeoutSec);
|
||||||
|
|
||||||
|
// SemaphoreSlim คุมจำนวน message ที่ประมวลผลพร้อมกัน (เนื่องจาก API มีข้อจำกัดเรื่อง concurrency)
|
||||||
|
using var semaphore = new SemaphoreSlim(maxConcurrency, maxConcurrency);
|
||||||
|
|
||||||
|
var consumer = new AsyncEventingBasicConsumer(channel);
|
||||||
|
|
||||||
|
consumer.Received += (model, ea) =>
|
||||||
|
{
|
||||||
|
// รอ semaphore ก่อนเริ่มประมวลผล
|
||||||
|
semaphore.WaitAsync().ContinueWith(async _ =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
var body = ea.Body.ToArray();
|
var body = ea.Body.ToArray();
|
||||||
var message = Encoding.UTF8.GetString(body);
|
var message = Encoding.UTF8.GetString(body);
|
||||||
await CallRestApi(message);
|
|
||||||
|
|
||||||
// convert string into object
|
WriteToConsole($"Received message: {message}");
|
||||||
//var request = JsonConvert.DeserializeObject<CheckInRequest>(message);
|
|
||||||
//using (var db = new ApplicationDbContext())
|
|
||||||
//{
|
|
||||||
// var item = new AttendantItem
|
|
||||||
// {
|
|
||||||
// Name = request.Name,
|
|
||||||
// CheckInDateTime = request.CheckInDateTime,
|
|
||||||
// };
|
|
||||||
// db.AttendantItems.Add(item);
|
|
||||||
// db.SaveChanges();
|
|
||||||
|
|
||||||
// WriteToConsole($"ได้รับคำขอจาก Queue: {message}");
|
var success = await CallRestApi(message, httpClient, configuration);
|
||||||
// WriteToConsole($"ตอบกลับจาก REST API: {JsonConvert.SerializeObject(item)}");
|
|
||||||
//}
|
|
||||||
|
|
||||||
WriteToConsole($"ได้รับคำขอจาก Queue: {message}");
|
if (success)
|
||||||
//WriteToConsole($"ตอบกลับจาก REST API: {JsonConvert.SerializeObject(item)}");
|
{
|
||||||
|
channel.BasicAck(ea.DeliveryTag, multiple: false);
|
||||||
|
WriteToConsole("Message processed successfully");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
channel.BasicNack(ea.DeliveryTag, multiple: false, requeue: false);
|
||||||
|
WriteToConsole("Message processing failed - message rejected");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
WriteToConsole($"Error processing message: {ex.Message}");
|
||||||
|
channel.BasicNack(ea.DeliveryTag, multiple: false, requeue: false);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
semaphore.Release();
|
||||||
|
}
|
||||||
|
}, TaskScheduler.Default).ConfigureAwait(false);
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
};
|
};
|
||||||
|
|
||||||
//channel.BasicConsume(queue: "bma-checkin-queue", autoAck: true, consumer: consumer);
|
channel.BasicConsume(queue: queue, autoAck: false, consumer: consumer);
|
||||||
channel.BasicConsume(queue: queue, autoAck: true, consumer: consumer);
|
|
||||||
|
|
||||||
//Console.WriteLine("\nPress 'Enter' to exit the process...");
|
WriteToConsole("Consumer started. Waiting for messages...");
|
||||||
|
|
||||||
|
// Keep the application running
|
||||||
await Task.Delay(-1);
|
await Task.Delay(-1);
|
||||||
|
|
||||||
static void WriteToConsole(string message)
|
static void WriteToConsole(string message)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} : {message}");
|
Console.WriteLine($"{DateTime.Now:yyyy-MM-dd HH:mm:ss} : {message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
async Task CallRestApi(string requestData)
|
static async Task<bool> CallRestApi(string requestData, HttpClient client, IConfiguration configuration)
|
||||||
{
|
{
|
||||||
using var client = new HttpClient();
|
try
|
||||||
|
{
|
||||||
var apiPath = $"{configuration["API"]}/leave/process-check-in";
|
var apiPath = $"{configuration["API"]}/leave/process-check-in";
|
||||||
|
|
||||||
var content = new StringContent(requestData, Encoding.UTF8, "application/json");
|
var content = new StringContent(requestData, Encoding.UTF8, "application/json");
|
||||||
|
|
||||||
var response = await client.PostAsync(apiPath, content);
|
var response = await client.PostAsync(apiPath, content);
|
||||||
|
|
@ -85,17 +120,34 @@ async Task CallRestApi(string requestData)
|
||||||
if (response.IsSuccessStatusCode)
|
if (response.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
var responseContent = await response.Content.ReadAsStringAsync();
|
var responseContent = await response.Content.ReadAsStringAsync();
|
||||||
WriteToConsole(responseContent);
|
WriteToConsole($"API Success: {responseContent}");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var errorMessage = await response.Content.ReadAsStringAsync();
|
var errorMessage = await response.Content.ReadAsStringAsync();
|
||||||
var res = JsonSerializer.Deserialize<ResponseObject>(errorMessage);
|
var res = JsonSerializer.Deserialize<ResponseObject>(errorMessage);
|
||||||
WriteToConsole($"Error: {res.Message}");
|
WriteToConsole($"API Error ({response.StatusCode}): {res?.Message ?? errorMessage}");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (HttpRequestException ex)
|
||||||
|
{
|
||||||
|
WriteToConsole($"HTTP Error: {ex.Message}");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
catch (TaskCanceledException ex)
|
||||||
|
{
|
||||||
|
WriteToConsole($"Timeout: {ex.Message}");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
WriteToConsole($"Unexpected Error: {ex.Message}");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class ResponseObject
|
public class ResponseObject
|
||||||
{
|
{
|
||||||
[JsonPropertyName("status")]
|
[JsonPropertyName("status")]
|
||||||
|
|
@ -111,28 +163,14 @@ public class ResponseObject
|
||||||
public class CheckTimeDtoRB
|
public class CheckTimeDtoRB
|
||||||
{
|
{
|
||||||
public Guid? CheckInId { get; set; }
|
public Guid? CheckInId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public double Lat { get; set; } = 0;
|
public double Lat { get; set; } = 0;
|
||||||
|
|
||||||
|
|
||||||
public double Lon { get; set; } = 0;
|
public double Lon { get; set; } = 0;
|
||||||
|
|
||||||
|
|
||||||
public string POI { get; set; } = string.Empty;
|
public string POI { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
|
||||||
public bool IsLocation { get; set; } = true;
|
public bool IsLocation { get; set; } = true;
|
||||||
|
|
||||||
public string? LocationName { get; set; } = string.Empty;
|
public string? LocationName { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string? Remark { get; set; } = string.Empty;
|
public string? Remark { get; set; } = string.Empty;
|
||||||
|
|
||||||
public Guid? UserId { get; set; }
|
public Guid? UserId { get; set; }
|
||||||
|
|
||||||
public DateTime? CurrentDate { get; set; }
|
public DateTime? CurrentDate { get; set; }
|
||||||
|
|
||||||
public string? CheckInFileName { get; set; }
|
public string? CheckInFileName { get; set; }
|
||||||
|
|
||||||
public byte[]? CheckInFileBytes { get; set; }
|
public byte[]? CheckInFileBytes { get; set; }
|
||||||
}
|
}
|
||||||
|
|
@ -1,9 +1,12 @@
|
||||||
{
|
{
|
||||||
"Rabbit": {
|
"Rabbit": {
|
||||||
"Host": "192.168.1.40",
|
"Host": "192.168.1.63",
|
||||||
"User": "admin",
|
"User": "admin",
|
||||||
"Password": "Test123456",
|
"Password": "12345678",
|
||||||
"Queue": "bma-checkin-queue"
|
"Queue": "hrms-checkin-queue-dev"
|
||||||
},
|
},
|
||||||
"API": "https://localhost:7283/api/v1"
|
"API": "https://localhost:7283/api/v1",
|
||||||
|
"MaxConcurrency": 5,
|
||||||
|
"PrefetchCount": 20,
|
||||||
|
"HttpTimeoutSeconds": 60
|
||||||
}
|
}
|
||||||
|
|
@ -9,6 +9,9 @@
|
||||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||||
<DockerfileContext>.</DockerfileContext>
|
<DockerfileContext>.</DockerfileContext>
|
||||||
<RootNamespace>BMA.EHR.Command.Service</RootNamespace>
|
<RootNamespace>BMA.EHR.Command.Service</RootNamespace>
|
||||||
|
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||||
|
<NoWarn>$(NoWarn);$(WarningsNotAsErrors)</NoWarn>
|
||||||
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -115,12 +115,15 @@ var app = builder.Build();
|
||||||
|
|
||||||
app.UseHttpsRedirection();
|
app.UseHttpsRedirection();
|
||||||
app.UseCors();
|
app.UseCors();
|
||||||
|
|
||||||
|
app.UseMiddleware<CombinedErrorHandlerAndLoggingMiddleware>();
|
||||||
|
|
||||||
app.UseAuthentication();
|
app.UseAuthentication();
|
||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
app.UseDefaultFiles();
|
app.UseDefaultFiles();
|
||||||
app.UseStaticFiles();
|
app.UseStaticFiles();
|
||||||
app.MapControllers();
|
app.MapControllers();
|
||||||
app.UseMiddleware<ErrorHandlerMiddleware>();
|
|
||||||
|
|
||||||
// apply migrations
|
// apply migrations
|
||||||
//await using var scope = app.Services.CreateAsyncScope();
|
//await using var scope = app.Services.CreateAsyncScope();
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,9 @@
|
||||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||||
<DockerfileContext>.</DockerfileContext>
|
<DockerfileContext>.</DockerfileContext>
|
||||||
<RootNamespace>BMA.EHR.Discipline.Service</RootNamespace>
|
<RootNamespace>BMA.EHR.Discipline.Service</RootNamespace>
|
||||||
|
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||||
|
<NoWarn>$(NoWarn);$(WarningsNotAsErrors)</NoWarn>
|
||||||
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -8,14 +8,15 @@ using BMA.EHR.Infrastructure.Persistence;
|
||||||
// using BMA.EHR.Placement.Service.Requests;
|
// using BMA.EHR.Placement.Service.Requests;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Swashbuckle.AspNetCore.Annotations;
|
|
||||||
using System.Runtime.Serialization;
|
|
||||||
using System.Security.Claims;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
using Swashbuckle.AspNetCore.Annotations;
|
||||||
|
using System.Linq;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
|
using System.Security.Claims;
|
||||||
|
|
||||||
namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
||||||
{
|
{
|
||||||
|
|
@ -33,12 +34,14 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
||||||
private readonly NotificationRepository _repositoryNoti;
|
private readonly NotificationRepository _repositoryNoti;
|
||||||
private readonly PermissionRepository _permission;
|
private readonly PermissionRepository _permission;
|
||||||
private readonly IConfiguration _configuration;
|
private readonly IConfiguration _configuration;
|
||||||
|
private readonly UserProfileRepository _userProfileRepository;
|
||||||
|
|
||||||
public DisciplineComplaintController(DisciplineDbContext context,
|
public DisciplineComplaintController(DisciplineDbContext context,
|
||||||
MinIODisciplineService documentService,
|
MinIODisciplineService documentService,
|
||||||
NotificationRepository repositoryNoti,
|
NotificationRepository repositoryNoti,
|
||||||
IHttpContextAccessor httpContextAccessor,
|
IHttpContextAccessor httpContextAccessor,
|
||||||
IConfiguration configuration,
|
IConfiguration configuration,
|
||||||
|
UserProfileRepository userProfileRepository,
|
||||||
PermissionRepository permission)
|
PermissionRepository permission)
|
||||||
{
|
{
|
||||||
// _repository = repository;
|
// _repository = repository;
|
||||||
|
|
@ -48,6 +51,7 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
||||||
_repositoryNoti = repositoryNoti;
|
_repositoryNoti = repositoryNoti;
|
||||||
_permission = permission;
|
_permission = permission;
|
||||||
_configuration = configuration;
|
_configuration = configuration;
|
||||||
|
_userProfileRepository = userProfileRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region " Properties "
|
#region " Properties "
|
||||||
|
|
@ -103,6 +107,152 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
||||||
return Success(new { data, total = data_search.Count() });
|
return Success(new { data, total = data_search.Count() });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// list รายการวินัยเรื่องร้องเรียน (ค้นหาขั้นสูง)
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost("advance-search")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetAdvanceSearchDisciplineComplaint([FromBody] DisciplineComplaintAdvanceSearcRequest req)
|
||||||
|
{
|
||||||
|
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_DISCIPLINE_COMPLAIN");
|
||||||
|
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
|
||||||
|
if (jsonData["status"]?.ToString() != "200")
|
||||||
|
{
|
||||||
|
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||||
|
}
|
||||||
|
|
||||||
|
var page = req.page <= 0 ? 1 : req.page;
|
||||||
|
var pageSize = req.pageSize <= 0 ? 25 : req.pageSize;
|
||||||
|
var keyword = string.IsNullOrEmpty(req.keyword) ? string.Empty : req.keyword;
|
||||||
|
var status = string.IsNullOrEmpty(req.status) ? string.Empty : req.status;
|
||||||
|
|
||||||
|
var data_search = (from x in _context.DisciplineComplaints
|
||||||
|
where x.Title.Contains(keyword) ||
|
||||||
|
(x.Appellant == null ? false : x.Appellant.Contains(keyword))
|
||||||
|
select x).ToList();
|
||||||
|
|
||||||
|
if (status.Trim().ToUpper() != "ALL")
|
||||||
|
data_search = data_search.Where(x => x.Status.Contains(status.Trim().ToUpper())).ToList();
|
||||||
|
|
||||||
|
if (
|
||||||
|
(req.dateReceivedStart.HasValue && req.dateReceivedEnd.HasValue) ||
|
||||||
|
(req.dateConsiderationStart.HasValue && req.dateConsiderationEnd.HasValue) ||
|
||||||
|
(!string.IsNullOrEmpty(req.respondentType)) ||
|
||||||
|
(!string.IsNullOrEmpty(req.offenseDetails)) ||
|
||||||
|
(!string.IsNullOrEmpty(req.levelConsideration))
|
||||||
|
)
|
||||||
|
{
|
||||||
|
data_search = data_search
|
||||||
|
.Where(x =>
|
||||||
|
(!req.dateReceivedStart.HasValue || !req.dateReceivedEnd.HasValue ||
|
||||||
|
(x.DateReceived.HasValue &&
|
||||||
|
x.DateReceived.Value.Date <= req.dateReceivedStart.Value.Date &&
|
||||||
|
x.DateReceived.Value.Date >= req.dateReceivedEnd.Value.Date))
|
||||||
|
&&
|
||||||
|
(!req.dateConsiderationStart.HasValue || !req.dateConsiderationEnd.HasValue ||
|
||||||
|
(x.DateConsideration.HasValue &&
|
||||||
|
x.DateConsideration.Value.Date <= req.dateConsiderationStart.Value.Date &&
|
||||||
|
x.DateConsideration.Value.Date >= req.dateConsiderationEnd.Value.Date))
|
||||||
|
&&
|
||||||
|
(string.IsNullOrEmpty(req.respondentType) || x.RespondentType == req.respondentType)
|
||||||
|
&&
|
||||||
|
(string.IsNullOrEmpty(req.offenseDetails) || x.OffenseDetails == req.offenseDetails)
|
||||||
|
&&
|
||||||
|
(string.IsNullOrEmpty(req.levelConsideration) || x.LevelConsideration == req.levelConsideration)
|
||||||
|
)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
var query = data_search
|
||||||
|
.Select(x => new
|
||||||
|
{
|
||||||
|
Id = x.Id,//id ข้อมูลเรื่องร้องเรียน
|
||||||
|
Title = x.Title,//ชื่อเรื่อง
|
||||||
|
RespondentType = x.RespondentType,
|
||||||
|
Appellant = x.Appellant,//ผู้ถูกร้องเรียน
|
||||||
|
OffenseDetails = x.OffenseDetails,//ลักษณะความผิด
|
||||||
|
CreatedAt = x.CreatedAt,//วันที่สร้างเรื่องร้องเรียน
|
||||||
|
LevelConsideration = x.LevelConsideration,//ระดับการพิจารณา
|
||||||
|
DateConsideration = x.DateConsideration,//วันที่กำหนดพิจารณา
|
||||||
|
DateReceived = x.DateReceived,//วันที่รับเรื่อง
|
||||||
|
Status = x.Status,//สถานะเรื่องร้องเรียน มีดังนี้ ใหม่ (NEW), ยุติเรื่อง (STOP), มีมูลส่งไปสืบสวนแล้ว (SEND_INVESTIGATE)
|
||||||
|
Result = x.Result,
|
||||||
|
});
|
||||||
|
|
||||||
|
bool desc = req.descending ?? false;
|
||||||
|
if (!string.IsNullOrEmpty(req.sortBy))
|
||||||
|
{
|
||||||
|
switch (req.sortBy)
|
||||||
|
{
|
||||||
|
case "title":
|
||||||
|
query = desc ? query.OrderByDescending(x => x.Title)
|
||||||
|
: query.OrderBy(x => x.Title);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "respondentType":
|
||||||
|
query = desc ? query.OrderByDescending(x => x.RespondentType)
|
||||||
|
: query.OrderBy(x => x.RespondentType);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "appellant":
|
||||||
|
query = desc ? query.OrderByDescending(x => x.Appellant)
|
||||||
|
: query.OrderBy(x => x.Appellant);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "offenseDetails":
|
||||||
|
query = desc ? query.OrderByDescending(x => x.OffenseDetails)
|
||||||
|
: query.OrderBy(x => x.OffenseDetails);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "createdAt":
|
||||||
|
query = desc ? query.OrderByDescending(x => x.CreatedAt)
|
||||||
|
: query.OrderBy(x => x.CreatedAt);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "levelConsideration":
|
||||||
|
query = desc ? query.OrderByDescending(x => x.LevelConsideration)
|
||||||
|
: query.OrderBy(x => x.LevelConsideration);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "dateConsideration":
|
||||||
|
query = desc ? query.OrderByDescending(x => x.DateConsideration)
|
||||||
|
: query.OrderBy(x => x.DateConsideration);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "dateReceived":
|
||||||
|
query = desc ? query.OrderByDescending(x => x.DateReceived)
|
||||||
|
: query.OrderBy(x => x.DateReceived);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "status":
|
||||||
|
query = desc ? query.OrderByDescending(x => x.Status)
|
||||||
|
: query.OrderBy(x => x.Status);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "result":
|
||||||
|
query = desc ? query.OrderByDescending(x => x.Result)
|
||||||
|
: query.OrderBy(x => x.Result);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
query = query.OrderByDescending(x => x.DateConsideration);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
var data = query
|
||||||
|
.Skip((page - 1) * pageSize)
|
||||||
|
.Take(pageSize)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
return Success(new { data, total = data_search.Count() });
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// list รายการวินัยเรื่องร้องเรียนในหน้าออกคำสั่ง
|
/// list รายการวินัยเรื่องร้องเรียนในหน้าออกคำสั่ง
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -299,6 +449,11 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
||||||
{
|
{
|
||||||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||||
}
|
}
|
||||||
|
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||||
|
|
||||||
|
var profile = await _userProfileRepository.GetUserOC(userId, token.Replace("Bearer ", ""));
|
||||||
|
if (profile == null)
|
||||||
|
return Error(GlobalMessages.DataNotFound);
|
||||||
var disciplineComplaint = new Domain.Models.Discipline.DisciplineComplaint
|
var disciplineComplaint = new Domain.Models.Discipline.DisciplineComplaint
|
||||||
{
|
{
|
||||||
RespondentType = req.respondentType.Trim().ToUpper(),
|
RespondentType = req.respondentType.Trim().ToUpper(),
|
||||||
|
|
@ -310,6 +465,7 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
||||||
Title = req.title,
|
Title = req.title,
|
||||||
Description = req.description,
|
Description = req.description,
|
||||||
DateReceived = req.dateReceived,
|
DateReceived = req.dateReceived,
|
||||||
|
RootDnaId = profile.RootDnaId,
|
||||||
LevelConsideration = req.levelConsideration == null ? null : req.levelConsideration.Trim().ToUpper(),
|
LevelConsideration = req.levelConsideration == null ? null : req.levelConsideration.Trim().ToUpper(),
|
||||||
DateConsideration = req.dateConsideration,
|
DateConsideration = req.dateConsideration,
|
||||||
OffenseDetails = req.offenseDetails == null ? null : req.offenseDetails.Trim().ToUpper(),
|
OffenseDetails = req.offenseDetails == null ? null : req.offenseDetails.Trim().ToUpper(),
|
||||||
|
|
@ -582,6 +738,7 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
||||||
{
|
{
|
||||||
RespondentType = data.RespondentType.Trim().ToUpper(),
|
RespondentType = data.RespondentType.Trim().ToUpper(),
|
||||||
Organization = data.Organization,
|
Organization = data.Organization,
|
||||||
|
RootDnaId = data.RootDnaId,
|
||||||
ConsideredAgency = data.ConsideredAgency,
|
ConsideredAgency = data.ConsideredAgency,
|
||||||
OrganizationId = data.OrganizationId,
|
OrganizationId = data.OrganizationId,
|
||||||
ConsideredAgencyId = data.ConsideredAgencyId,
|
ConsideredAgencyId = data.ConsideredAgencyId,
|
||||||
|
|
@ -680,7 +837,7 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||||
{
|
{
|
||||||
refId = persons.Select(x => x.PersonId),
|
refId = persons.Select(x => x.PersonId),
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
using BMA.EHR.Application.Repositories;
|
using BMA.EHR.Application.Repositories;
|
||||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||||
|
using BMA.EHR.Application.Responses.Profiles;
|
||||||
using BMA.EHR.Discipline.Service.Requests;
|
using BMA.EHR.Discipline.Service.Requests;
|
||||||
using BMA.EHR.Domain.Common;
|
using BMA.EHR.Domain.Common;
|
||||||
using BMA.EHR.Domain.Extensions;
|
using BMA.EHR.Domain.Extensions;
|
||||||
|
|
@ -32,6 +33,7 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
private readonly NotificationRepository _repositoryNoti;
|
private readonly NotificationRepository _repositoryNoti;
|
||||||
private readonly IConfiguration _configuration;
|
private readonly IConfiguration _configuration;
|
||||||
|
private readonly UserProfileRepository _userProfileRepository;
|
||||||
private readonly PermissionRepository _permission;
|
private readonly PermissionRepository _permission;
|
||||||
|
|
||||||
public DisciplineComplaint_AppealController(DisciplineDbContext context,
|
public DisciplineComplaint_AppealController(DisciplineDbContext context,
|
||||||
|
|
@ -40,6 +42,7 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
||||||
MinIODisciplineService documentService,
|
MinIODisciplineService documentService,
|
||||||
IHttpContextAccessor httpContextAccessor,
|
IHttpContextAccessor httpContextAccessor,
|
||||||
IConfiguration configuration,
|
IConfiguration configuration,
|
||||||
|
UserProfileRepository userProfileRepository,
|
||||||
PermissionRepository permission)
|
PermissionRepository permission)
|
||||||
{
|
{
|
||||||
// _repository = repository;
|
// _repository = repository;
|
||||||
|
|
@ -49,6 +52,7 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
||||||
_documentService = documentService;
|
_documentService = documentService;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
_configuration = configuration;
|
_configuration = configuration;
|
||||||
|
_userProfileRepository = userProfileRepository;
|
||||||
_permission = permission;
|
_permission = permission;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -58,6 +62,8 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
||||||
|
|
||||||
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||||
private string? token => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
|
private string? token => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
|
||||||
|
|
||||||
|
private string? AccessToken => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
|
||||||
private static string StatusDisciplineComplaintAppeal(string value)
|
private static string StatusDisciplineComplaintAppeal(string value)
|
||||||
{
|
{
|
||||||
switch (value)
|
switch (value)
|
||||||
|
|
@ -84,14 +90,15 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpGet("user")]
|
[HttpGet("user")]
|
||||||
public async Task<ActionResult<ResponseObject>> GetDisciplineUser(string status = "ALL", string type = "ALL", int year = 0, int page = 1, int pageSize = 25, string keyword = "")
|
public async Task<ActionResult<ResponseObject>> GetDisciplineUser(string status = "ALL", string type = "ALL", int year = 0, int page = 1, int pageSize = 25, string keyword = "", string? sortBy = null, bool descending = false)
|
||||||
{
|
{
|
||||||
var id = "";
|
var id = "";
|
||||||
var apiUrl = $"{_configuration["API"]}/org/profile/keycloak/position";
|
//var apiUrl = $"{_configuration["API"]}/org/profile/keycloak/position";
|
||||||
|
var apiUrl = $"{_configuration["API"]}/org/dotnet/get-profileId";
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
var _res = await client.SendAsync(_req);
|
var _res = await client.SendAsync(_req);
|
||||||
var _result = await _res.Content.ReadAsStringAsync();
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -119,7 +126,7 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
||||||
data_search = data_search.Where(x => x.Type == type).ToList();
|
data_search = data_search.Where(x => x.Type == type).ToList();
|
||||||
if (year != 0)
|
if (year != 0)
|
||||||
data_search = data_search.Where(x => x.Year == year).ToList();
|
data_search = data_search.Where(x => x.Year == year).ToList();
|
||||||
var data = data_search
|
var query = data_search
|
||||||
.Select(x => new
|
.Select(x => new
|
||||||
{
|
{
|
||||||
Id = x.Id,
|
Id = x.Id,
|
||||||
|
|
@ -135,8 +142,42 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
||||||
ProfileId = x.ProfileId,
|
ProfileId = x.ProfileId,
|
||||||
LastUpdatedAt = x.LastUpdatedAt,
|
LastUpdatedAt = x.LastUpdatedAt,
|
||||||
CreatedAt = x.CreatedAt
|
CreatedAt = x.CreatedAt
|
||||||
})
|
});
|
||||||
.OrderByDescending(x => x.CreatedAt)
|
if (!string.IsNullOrEmpty(sortBy))
|
||||||
|
{
|
||||||
|
{
|
||||||
|
if (sortBy == "title")
|
||||||
|
query = descending ? query.OrderByDescending(x => x.Title) : query.OrderBy(x => x.Title);
|
||||||
|
else if (sortBy == "year")
|
||||||
|
query = descending ? query.OrderByDescending(x => x.Year) : query.OrderBy(x => x.Year);
|
||||||
|
else if (sortBy == "status")
|
||||||
|
query = descending ? query.OrderByDescending(x => x.Status) : query.OrderBy(x => x.Status);
|
||||||
|
else if (sortBy == "description")
|
||||||
|
query = descending ? query.OrderByDescending(x => x.Description) : query.OrderBy(x => x.Description);
|
||||||
|
else if (sortBy == "type")
|
||||||
|
query = descending ? query.OrderByDescending(x => x.Type) : query.OrderBy(x => x.Type);
|
||||||
|
else if (sortBy == "caseType")
|
||||||
|
query = descending ? query.OrderByDescending(x => x.CaseType) : query.OrderBy(x => x.CaseType);
|
||||||
|
else if (sortBy == "caseNumber")
|
||||||
|
query = descending ? query.OrderByDescending(x => x.CaseNumber) : query.OrderBy(x => x.CaseNumber);
|
||||||
|
else if (sortBy == "fullname")
|
||||||
|
query = descending ? query.OrderByDescending(x => x.Fullname) : query.OrderBy(x => x.Fullname);
|
||||||
|
else if (sortBy == "citizenId")
|
||||||
|
query = descending ? query.OrderByDescending(x => x.CitizenId) : query.OrderBy(x => x.CitizenId);
|
||||||
|
else if (sortBy == "lastUpdatedAt")
|
||||||
|
query = descending ? query.OrderByDescending(x => x.LastUpdatedAt) : query.OrderBy(x => x.LastUpdatedAt);
|
||||||
|
else if (sortBy == "createdAt")
|
||||||
|
query = descending ? query.OrderByDescending(x => x.CreatedAt) : query.OrderBy(x => x.CreatedAt);
|
||||||
|
else
|
||||||
|
query = query.OrderByDescending(x => x.CreatedAt); // default
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
query = query.OrderByDescending(x => x.CreatedAt);
|
||||||
|
}
|
||||||
|
|
||||||
|
var data = query
|
||||||
.Skip((page - 1) * pageSize)
|
.Skip((page - 1) * pageSize)
|
||||||
.Take(pageSize)
|
.Take(pageSize)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
@ -317,12 +358,15 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
||||||
[HttpPost()]
|
[HttpPost()]
|
||||||
public async Task<ActionResult<ResponseObject>> CreateDiscipline([FromForm] DisciplineComplaint_AppealRequest req)
|
public async Task<ActionResult<ResponseObject>> CreateDiscipline([FromForm] DisciplineComplaint_AppealRequest req)
|
||||||
{
|
{
|
||||||
|
//var apiUrl = $"{_configuration["API"]}/org/profile/keycloak/position";
|
||||||
var apiUrl = $"{_configuration["API"]}/org/profile/keycloak/position";
|
var apiUrl = $"{_configuration["API"]}/org/dotnet/get-profileId";
|
||||||
|
var id = "";
|
||||||
|
var type = "";
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization =
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
var _res = await client.SendAsync(_req);
|
var _res = await client.SendAsync(_req);
|
||||||
var _result = await _res.Content.ReadAsStringAsync();
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
@ -331,16 +375,19 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
||||||
|
|
||||||
if (org == null || org.result == null)
|
if (org == null || org.result == null)
|
||||||
return Success(new { data = new List<dynamic>(), total = 0 });
|
return Success(new { data = new List<dynamic>(), total = 0 });
|
||||||
var id = org.result.profileId;
|
id = org.result.profileId;
|
||||||
if (id == "")
|
if (id == "")
|
||||||
return Success(new { data = new List<dynamic>(), total = 0 });
|
return Success(new { data = new List<dynamic>(), total = 0 });
|
||||||
|
type = org.result.profileType;
|
||||||
|
}
|
||||||
|
|
||||||
var disciplineComplaint_Appeal = new Domain.Models.Discipline.DisciplineComplaint_Appeal
|
var disciplineComplaint_Appeal = new Domain.Models.Discipline.DisciplineComplaint_Appeal
|
||||||
{
|
{
|
||||||
Title = req.Title,
|
Title = req.Title,
|
||||||
Description = req.Description,
|
Description = req.Description,
|
||||||
Status = "NEW",
|
Status = "NEW",
|
||||||
Type = req.Type.Trim().ToUpper(),
|
Type = req.Type.Trim().ToUpper(),
|
||||||
Year = req.Year == null ? DateTime.Now.Year : req.Year,
|
Year = req.Year == null ? DateTime.Now.CalculateFisicalYear() : req.Year,
|
||||||
CaseType = req.CaseType,
|
CaseType = req.CaseType,
|
||||||
CaseNumber = req.CaseNumber,
|
CaseNumber = req.CaseNumber,
|
||||||
Fullname = req.Fullname,
|
Fullname = req.Fullname,
|
||||||
|
|
@ -348,7 +395,7 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
||||||
ProfileId = id,
|
ProfileId = id,
|
||||||
Position = req.Position,
|
Position = req.Position,
|
||||||
Oc = req.Oc,
|
Oc = req.Oc,
|
||||||
profileType = org.result.profileType,
|
profileType = type,
|
||||||
CreatedFullName = FullName ?? "System Administrator",
|
CreatedFullName = FullName ?? "System Administrator",
|
||||||
CreatedUserId = UserId ?? "",
|
CreatedUserId = UserId ?? "",
|
||||||
CreatedAt = DateTime.Now,
|
CreatedAt = DateTime.Now,
|
||||||
|
|
@ -356,6 +403,36 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
||||||
LastUpdateUserId = UserId ?? "",
|
LastUpdateUserId = UserId ?? "",
|
||||||
LastUpdatedAt = DateTime.Now,
|
LastUpdatedAt = DateTime.Now,
|
||||||
};
|
};
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
|
var _apiUrl = $"{_configuration["API"]}/org/profile/profileid/position/{id}";
|
||||||
|
var _req = new HttpRequestMessage(HttpMethod.Get, _apiUrl);
|
||||||
|
var _res = await client.SendAsync(_req);
|
||||||
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
|
||||||
|
|
||||||
|
if (org == null || org.result == null)
|
||||||
|
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
|
||||||
|
|
||||||
|
disciplineComplaint_Appeal.root = org.result.root;
|
||||||
|
disciplineComplaint_Appeal.rootId = org.result.rootId;
|
||||||
|
disciplineComplaint_Appeal.rootDnaId = org.result.rootDnaId;
|
||||||
|
disciplineComplaint_Appeal.child1 = org.result.child1;
|
||||||
|
disciplineComplaint_Appeal.child1Id = org.result.child1Id;
|
||||||
|
disciplineComplaint_Appeal.child1DnaId = org.result.child1DnaId;
|
||||||
|
disciplineComplaint_Appeal.child2 = org.result.child2;
|
||||||
|
disciplineComplaint_Appeal.child2Id = org.result.child2Id;
|
||||||
|
disciplineComplaint_Appeal.child2DnaId = org.result.child2DnaId;
|
||||||
|
disciplineComplaint_Appeal.child3 = org.result.child3;
|
||||||
|
disciplineComplaint_Appeal.child3Id = org.result.child3Id;
|
||||||
|
disciplineComplaint_Appeal.child3DnaId = org.result.child3DnaId;
|
||||||
|
disciplineComplaint_Appeal.child4 = org.result.child4;
|
||||||
|
disciplineComplaint_Appeal.child4Id = org.result.child4Id;
|
||||||
|
disciplineComplaint_Appeal.child4DnaId = org.result.child4DnaId;
|
||||||
|
}
|
||||||
var disciplineComplaint_Appeal_History = new DisciplineComplaint_Appeal_History
|
var disciplineComplaint_Appeal_History = new DisciplineComplaint_Appeal_History
|
||||||
{
|
{
|
||||||
DisciplineComplaint_Appeal = disciplineComplaint_Appeal,
|
DisciplineComplaint_Appeal = disciplineComplaint_Appeal,
|
||||||
|
|
@ -396,13 +473,18 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var baseAPIOrg = _configuration["API"];
|
var baseAPIOrg = _configuration["API"];
|
||||||
var apiUrlOrg = $"{baseAPIOrg}/org/workflow/find/director";
|
var system = "SYS_DISCIPLINE_APPEAL";
|
||||||
|
var apiUrlOrg = $"{baseAPIOrg}/org/workflow/find/director/{system}";
|
||||||
var refId = new List<Guid>();
|
var refId = new List<Guid>();
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
client.DefaultRequestHeaders.Authorization =
|
||||||
|
new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var __res = await client.PostAsJsonAsync(apiUrlOrg, new
|
var __res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||||
{
|
{
|
||||||
refId = new List<Guid> { id },
|
refId = new List<Guid> { Guid.Parse(id) },
|
||||||
});
|
});
|
||||||
var __result = await __res.Content.ReadAsStringAsync();
|
var __result = await __res.Content.ReadAsStringAsync();
|
||||||
var __org = JsonConvert.DeserializeObject<DirectorRequest>(__result);
|
var __org = JsonConvert.DeserializeObject<DirectorRequest>(__result);
|
||||||
|
|
@ -410,6 +492,7 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
||||||
{
|
{
|
||||||
refId = __org.result.Select(x => Guid.Parse(x.id)).ToList();
|
refId = __org.result.Select(x => Guid.Parse(x.id)).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
await _repositoryNoti.PushNotificationsAsync(
|
await _repositoryNoti.PushNotificationsAsync(
|
||||||
refId.ToArray(),
|
refId.ToArray(),
|
||||||
$"มีคำขอยื่นอุทธรณ์/ร้องทุกข์จาก {req.Fullname}",
|
$"มีคำขอยื่นอุทธรณ์/ร้องทุกข์จาก {req.Fullname}",
|
||||||
|
|
@ -419,10 +502,10 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
||||||
true,
|
true,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
await _context.SaveChangesAsync();
|
|
||||||
return Success(disciplineComplaint_Appeal.Id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
return Success(disciplineComplaint_Appeal.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -458,6 +541,37 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
||||||
LastUpdateUserId = UserId ?? "",
|
LastUpdateUserId = UserId ?? "",
|
||||||
LastUpdatedAt = DateTime.Now,
|
LastUpdatedAt = DateTime.Now,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
|
var apiUrl = $"{_configuration["API"]}/org/profile/profileid/position/{req.ProfileId}";
|
||||||
|
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
|
var _res = await client.SendAsync(_req);
|
||||||
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
|
||||||
|
|
||||||
|
if (org == null || org.result == null)
|
||||||
|
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
|
||||||
|
|
||||||
|
disciplineComplaint_Appeal.root = org.result.root;
|
||||||
|
disciplineComplaint_Appeal.rootId = org.result.rootId;
|
||||||
|
disciplineComplaint_Appeal.rootDnaId = org.result.rootDnaId;
|
||||||
|
disciplineComplaint_Appeal.child1 = org.result.child1;
|
||||||
|
disciplineComplaint_Appeal.child1Id = org.result.child1Id;
|
||||||
|
disciplineComplaint_Appeal.child1DnaId = org.result.child1DnaId;
|
||||||
|
disciplineComplaint_Appeal.child2 = org.result.child2;
|
||||||
|
disciplineComplaint_Appeal.child2Id = org.result.child2Id;
|
||||||
|
disciplineComplaint_Appeal.child2DnaId = org.result.child2DnaId;
|
||||||
|
disciplineComplaint_Appeal.child3 = org.result.child3;
|
||||||
|
disciplineComplaint_Appeal.child3Id = org.result.child3Id;
|
||||||
|
disciplineComplaint_Appeal.child3DnaId = org.result.child3DnaId;
|
||||||
|
disciplineComplaint_Appeal.child4 = org.result.child4;
|
||||||
|
disciplineComplaint_Appeal.child4Id = org.result.child4Id;
|
||||||
|
disciplineComplaint_Appeal.child4DnaId = org.result.child4DnaId;
|
||||||
|
}
|
||||||
var disciplineComplaint_Appeal_History = new DisciplineComplaint_Appeal_History
|
var disciplineComplaint_Appeal_History = new DisciplineComplaint_Appeal_History
|
||||||
{
|
{
|
||||||
DisciplineComplaint_Appeal = disciplineComplaint_Appeal,
|
DisciplineComplaint_Appeal = disciplineComplaint_Appeal,
|
||||||
|
|
@ -498,13 +612,14 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var baseAPIOrg = _configuration["API"];
|
var baseAPIOrg = _configuration["API"];
|
||||||
var apiUrlOrg = $"{baseAPIOrg}/org/workflow/find/director";
|
var system = "SYS_DISCIPLINE_APPEAL";
|
||||||
|
var apiUrlOrg = $"{baseAPIOrg}/org/workflow/find/director/{system}";
|
||||||
var refId = new List<Guid>();
|
var refId = new List<Guid>();
|
||||||
|
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||||
var __res = await client.PostAsJsonAsync(apiUrlOrg, new
|
var __res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||||
{
|
{
|
||||||
refId = new List<Guid> { Guid.Parse(req.ProfileId) },
|
refId = new List<Guid> { Guid.Parse(req.ProfileId) },
|
||||||
|
|
@ -633,7 +748,7 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpGet("admin")]
|
[HttpGet("admin")]
|
||||||
public async Task<ActionResult<ResponseObject>> GetDisciplineAdmin(string status = "ALL", string type = "ALL", int year = 0, int page = 1, int pageSize = 25, string keyword = "")
|
public async Task<ActionResult<ResponseObject>> GetDisciplineAdmin(string status = "ALL", string type = "ALL", int year = 0, int page = 1, int pageSize = 25, string keyword = "", string? sortBy = "", bool? descending = false)
|
||||||
{
|
{
|
||||||
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_DISCIPLINE_APPEAL");
|
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_DISCIPLINE_APPEAL");
|
||||||
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
|
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
|
||||||
|
|
@ -641,6 +756,42 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
||||||
{
|
{
|
||||||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||||
}
|
}
|
||||||
|
string role = jsonData["result"]?.ToString();
|
||||||
|
var nodeId = string.Empty;
|
||||||
|
var profileAdmin = new GetUserOCAllDto();
|
||||||
|
profileAdmin = await _userProfileRepository.GetUserOCAll(Guid.Parse(UserId!), AccessToken);
|
||||||
|
if (role == "NORMAL" || role == "CHILD")
|
||||||
|
{
|
||||||
|
nodeId = profileAdmin?.Node == 4
|
||||||
|
? profileAdmin?.Child4DnaId
|
||||||
|
: profileAdmin?.Node == 3
|
||||||
|
? profileAdmin?.Child3DnaId
|
||||||
|
: profileAdmin?.Node == 2
|
||||||
|
? profileAdmin?.Child2DnaId
|
||||||
|
: profileAdmin?.Node == 1
|
||||||
|
? profileAdmin?.Child1DnaId
|
||||||
|
: profileAdmin?.Node == 0
|
||||||
|
? profileAdmin?.RootDnaId
|
||||||
|
: "";
|
||||||
|
}
|
||||||
|
if (role == "BROTHER")
|
||||||
|
{
|
||||||
|
nodeId = profileAdmin?.Node == 4
|
||||||
|
? profileAdmin?.Child3DnaId
|
||||||
|
: profileAdmin?.Node == 3
|
||||||
|
? profileAdmin?.Child2DnaId
|
||||||
|
: profileAdmin?.Node == 2
|
||||||
|
? profileAdmin?.Child1DnaId
|
||||||
|
: profileAdmin?.Node == 1 || profileAdmin?.Node == 0
|
||||||
|
? profileAdmin?.RootDnaId
|
||||||
|
: "";
|
||||||
|
}
|
||||||
|
else if (role == "ROOT" /*|| role == "PARENT"*/)
|
||||||
|
{
|
||||||
|
nodeId = profileAdmin?.RootDnaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
var node = profileAdmin?.Node;
|
||||||
var data_search = (from x in _context.DisciplineComplaint_Appeals
|
var data_search = (from x in _context.DisciplineComplaint_Appeals
|
||||||
where (x.Title == null ? false : x.Title.Contains(keyword)) ||
|
where (x.Title == null ? false : x.Title.Contains(keyword)) ||
|
||||||
(x.Description == null ? false : x.Description.Contains(keyword)) ||
|
(x.Description == null ? false : x.Description.Contains(keyword)) ||
|
||||||
|
|
@ -655,7 +806,43 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
||||||
data_search = data_search.Where(x => x.Type == type).ToList();
|
data_search = data_search.Where(x => x.Type == type).ToList();
|
||||||
if (year != 0)
|
if (year != 0)
|
||||||
data_search = data_search.Where(x => x.Year == year).ToList();
|
data_search = data_search.Where(x => x.Year == year).ToList();
|
||||||
var data = data_search
|
|
||||||
|
if (role == "OWNER")
|
||||||
|
{
|
||||||
|
node = null;
|
||||||
|
}
|
||||||
|
if (role == "OWNER" || role == "CHILD")
|
||||||
|
{
|
||||||
|
data_search = data_search
|
||||||
|
.Where(x => node == 4 ? x.child4DnaId == nodeId : (node == 3 ? x.child3DnaId == nodeId : (node == 2 ? x.child2DnaId == nodeId : (node == 1 ? x.child1DnaId == nodeId : (node == 0 ? x.rootDnaId == nodeId : (node == null ? true : true)))))).ToList();
|
||||||
|
}
|
||||||
|
else if (role == "BROTHER")
|
||||||
|
{
|
||||||
|
data_search = data_search
|
||||||
|
.Where(x => node == 4 ? x.child3DnaId == nodeId : (node == 3 ? x.child2DnaId == nodeId : (node == 2 ? x.child1DnaId == nodeId : (node == 1 || node == 0 ? x.rootDnaId == nodeId : (node == null ? true : true))))).ToList();
|
||||||
|
}
|
||||||
|
else if (role == "ROOT")
|
||||||
|
{
|
||||||
|
data_search = data_search
|
||||||
|
.Where(x => x.rootDnaId == nodeId).ToList();
|
||||||
|
}
|
||||||
|
// else if (role == "PARENT")
|
||||||
|
// {
|
||||||
|
// data_search = data_search
|
||||||
|
// .Where(x => x.rootDnaId == nodeId && x.child1DnaId != null).ToList();
|
||||||
|
// }
|
||||||
|
else if (role == "NORMAL")
|
||||||
|
{
|
||||||
|
data_search = data_search.Where(x =>
|
||||||
|
node == 0 ? x.rootDnaId == nodeId && x.child1DnaId == null :
|
||||||
|
node == 1 ? x.child1DnaId == nodeId && x.child2DnaId == null :
|
||||||
|
node == 2 ? x.child2DnaId == nodeId && x.child3DnaId == null :
|
||||||
|
node == 3 ? x.child3DnaId == nodeId && x.child4DnaId == null :
|
||||||
|
node == 4 ? x.child4DnaId == nodeId :
|
||||||
|
true
|
||||||
|
).ToList();
|
||||||
|
}
|
||||||
|
var query = data_search
|
||||||
.Select(x => new
|
.Select(x => new
|
||||||
{
|
{
|
||||||
Id = x.Id,
|
Id = x.Id,
|
||||||
|
|
@ -671,12 +858,76 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
||||||
ProfileId = x.ProfileId,
|
ProfileId = x.ProfileId,
|
||||||
LastUpdatedAt = x.LastUpdatedAt,
|
LastUpdatedAt = x.LastUpdatedAt,
|
||||||
profileType = x.profileType
|
profileType = x.profileType
|
||||||
})
|
});
|
||||||
|
bool desc = descending ?? false;
|
||||||
|
if (!string.IsNullOrEmpty(sortBy))
|
||||||
|
{
|
||||||
|
switch (sortBy)
|
||||||
|
{
|
||||||
|
case "title":
|
||||||
|
query = desc ? query.OrderByDescending(x => x.Title)
|
||||||
|
: query.OrderBy(x => x.Title);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "description":
|
||||||
|
query = desc ? query.OrderByDescending(x => x.Description)
|
||||||
|
: query.OrderBy(x => x.Description);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "status":
|
||||||
|
query = desc ? query.OrderByDescending(x => x.Status)
|
||||||
|
: query.OrderBy(x => x.Status);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "type":
|
||||||
|
query = desc ? query.OrderByDescending(x => x.Type)
|
||||||
|
: query.OrderBy(x => x.Type);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "year":
|
||||||
|
query = desc ? query.OrderByDescending(x => x.Year)
|
||||||
|
: query.OrderBy(x => x.Year);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "caseType":
|
||||||
|
query = desc ? query.OrderByDescending(x => x.CaseType)
|
||||||
|
: query.OrderBy(x => x.CaseType);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "caseNumber":
|
||||||
|
query = desc ? query.OrderByDescending(x => x.CaseNumber)
|
||||||
|
: query.OrderBy(x => x.CaseNumber);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "fullname":
|
||||||
|
query = desc ? query.OrderByDescending(x => x.Fullname)
|
||||||
|
: query.OrderBy(x => x.Fullname);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "lastUpdatedAt":
|
||||||
|
query = desc ? query.OrderByDescending(x => x.LastUpdatedAt)
|
||||||
|
: query.OrderBy(x => x.LastUpdatedAt);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "profileType":
|
||||||
|
query = desc ? query.OrderByDescending(x => x.profileType)
|
||||||
|
: query.OrderBy(x => x.profileType);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
query = query
|
||||||
.OrderByDescending(x => x.profileType)
|
.OrderByDescending(x => x.profileType)
|
||||||
.ThenByDescending(x => x.LastUpdatedAt)
|
.ThenByDescending(x => x.LastUpdatedAt);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
var data = query
|
||||||
.Skip((page - 1) * pageSize)
|
.Skip((page - 1) * pageSize)
|
||||||
.Take(pageSize)
|
.Take(pageSize)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
return Success(new { data, total = data_search.Count() });
|
return Success(new { data, total = data_search.Count() });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,10 +29,12 @@ namespace BMA.EHR.DisciplineDirector.Service.Controllers
|
||||||
private readonly MinIOService _documentService;
|
private readonly MinIOService _documentService;
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
private readonly PermissionRepository _permission;
|
private readonly PermissionRepository _permission;
|
||||||
|
private readonly UserProfileRepository _userProfileRepository;
|
||||||
|
|
||||||
public DisciplineDirectorController(DisciplineDbContext context,
|
public DisciplineDirectorController(DisciplineDbContext context,
|
||||||
MinIOService documentService,
|
MinIOService documentService,
|
||||||
IHttpContextAccessor httpContextAccessor,
|
IHttpContextAccessor httpContextAccessor,
|
||||||
|
UserProfileRepository userProfileRepository,
|
||||||
PermissionRepository permission)
|
PermissionRepository permission)
|
||||||
{
|
{
|
||||||
// _repository = repository;
|
// _repository = repository;
|
||||||
|
|
@ -40,6 +42,7 @@ namespace BMA.EHR.DisciplineDirector.Service.Controllers
|
||||||
_documentService = documentService;
|
_documentService = documentService;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
_permission = permission;
|
_permission = permission;
|
||||||
|
_userProfileRepository = userProfileRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region " Properties "
|
#region " Properties "
|
||||||
|
|
@ -47,6 +50,7 @@ namespace BMA.EHR.DisciplineDirector.Service.Controllers
|
||||||
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||||
|
|
||||||
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||||
|
private string? token => _httpContextAccessor.HttpContext.Request.Headers["Authorization"];
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
@ -59,8 +63,9 @@ namespace BMA.EHR.DisciplineDirector.Service.Controllers
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpGet("{path}")]
|
[HttpGet("{path}")]
|
||||||
public async Task<ActionResult<ResponseObject>> GetDiscipline(string path, int page = 1, int pageSize = 25, string keyword = "")
|
public async Task<ActionResult<ResponseObject>> GetDiscipline(string path, int page = 1, int pageSize = 25, string keyword = "", string? sortBy = "", bool? descending = false)
|
||||||
{
|
{
|
||||||
|
// สิทธิ์การเข้าถึง
|
||||||
path = path.Trim().ToUpper();
|
path = path.Trim().ToUpper();
|
||||||
string getPermission;
|
string getPermission;
|
||||||
if (path == "MAIN")
|
if (path == "MAIN")
|
||||||
|
|
@ -80,23 +85,27 @@ namespace BMA.EHR.DisciplineDirector.Service.Controllers
|
||||||
getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_DISCIPLINE_INFO");
|
getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_DISCIPLINE_INFO");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
|
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
|
||||||
if (jsonData["status"]?.ToString() != "200")
|
if (jsonData["status"]?.ToString() != "200")
|
||||||
{
|
{
|
||||||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||||
}
|
}
|
||||||
|
var _permiss = jsonData["result"]?.ToString();
|
||||||
|
// สิทธิ์มองเห็นรายชื่อ
|
||||||
|
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||||
|
var profile = await _userProfileRepository.GetUserOC(userId, token.Replace("Bearer ", ""));
|
||||||
|
if (profile == null)
|
||||||
|
return Error(GlobalMessages.DataNotFound);
|
||||||
|
|
||||||
var data_search = (from x in _context.DisciplineDirectors.Include(x => x.DisciplineInvestigate_Directors).Include(x => x.DisciplineDisciplinary_DirectorInvestigates)
|
var data_search = (from x in _context.DisciplineDirectors.Include(x => x.DisciplineInvestigate_Directors).Include(x => x.DisciplineDisciplinary_DirectorInvestigates)
|
||||||
where /*x.Prefix.Contains(keyword) ||
|
where (((x.Prefix ?? "") + (x.FirstName ?? "") + " " + (x.LastName ?? "")).Contains(keyword) ||
|
||||||
x.FirstName.Contains(keyword) ||
|
|
||||||
x.LastName.Contains(keyword) ||*/
|
|
||||||
((x.Prefix ?? "") + (x.FirstName ?? "") + " " + (x.LastName ?? "")).Contains(keyword) ||
|
|
||||||
x.Position.Contains(keyword) ||
|
x.Position.Contains(keyword) ||
|
||||||
x.Email.Contains(keyword) ||
|
x.Email.Contains(keyword) ||
|
||||||
x.Phone.Contains(keyword) ||
|
x.Phone.Contains(keyword) ||
|
||||||
x.Qualification.Contains(keyword)
|
x.Qualification.Contains(keyword)) &&
|
||||||
|
(_permiss != "OWNER" && x.RootDnaId == profile.RootDnaId || _permiss == "OWNER" && true)
|
||||||
select x).ToList();
|
select x).ToList();
|
||||||
var data = data_search
|
var query = data_search
|
||||||
.Select(x => new
|
.Select(x => new
|
||||||
{
|
{
|
||||||
Id = x.Id,
|
Id = x.Id,
|
||||||
|
|
@ -109,7 +118,66 @@ namespace BMA.EHR.DisciplineDirector.Service.Controllers
|
||||||
Qualification = x.Qualification,
|
Qualification = x.Qualification,
|
||||||
TotalInvestigate = x.DisciplineInvestigate_Directors.Count(),
|
TotalInvestigate = x.DisciplineInvestigate_Directors.Count(),
|
||||||
TotalDisciplinary = x.DisciplineDisciplinary_DirectorInvestigates.Count(),
|
TotalDisciplinary = x.DisciplineDisciplinary_DirectorInvestigates.Count(),
|
||||||
})
|
});
|
||||||
|
|
||||||
|
bool desc = descending ?? false;
|
||||||
|
if (!string.IsNullOrEmpty(sortBy))
|
||||||
|
{
|
||||||
|
if (sortBy == "position")
|
||||||
|
{
|
||||||
|
query = desc ? query.OrderByDescending(x => x.Position)
|
||||||
|
: query.OrderBy(x => x.Position);
|
||||||
|
}
|
||||||
|
else if (sortBy == "prefix" || sortBy == "firstName" || sortBy == "lastName")
|
||||||
|
{
|
||||||
|
query = desc ?
|
||||||
|
query
|
||||||
|
//.OrderByDescending(x => x.Prefix)
|
||||||
|
.OrderByDescending(x => x.FirstName)
|
||||||
|
.ThenByDescending(x => x.LastName) :
|
||||||
|
query
|
||||||
|
//.OrderBy(x => x.Prefix)
|
||||||
|
.OrderBy(x => x.FirstName)
|
||||||
|
.ThenBy(x => x.LastName);
|
||||||
|
}
|
||||||
|
else if (sortBy == "email")
|
||||||
|
{
|
||||||
|
{
|
||||||
|
query = desc ? query.OrderByDescending(x => x.Email)
|
||||||
|
: query.OrderBy(x => x.Email);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (sortBy == "phone")
|
||||||
|
{
|
||||||
|
{
|
||||||
|
query = desc ? query.OrderByDescending(x => x.Phone)
|
||||||
|
: query.OrderBy(x => x.Phone);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (sortBy == "qualification")
|
||||||
|
{
|
||||||
|
{
|
||||||
|
query = desc ? query.OrderByDescending(x => x.Qualification)
|
||||||
|
: query.OrderBy(x => x.Qualification);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (sortBy == "totalInvestigate")
|
||||||
|
{
|
||||||
|
{
|
||||||
|
query = desc ? query.OrderByDescending(x => x.TotalInvestigate)
|
||||||
|
: query.OrderBy(x => x.TotalInvestigate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (sortBy == "totalDisciplinary")
|
||||||
|
{
|
||||||
|
{
|
||||||
|
query = desc ? query.OrderByDescending(x => x.TotalDisciplinary)
|
||||||
|
: query.OrderBy(x => x.TotalDisciplinary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var data = query
|
||||||
.Skip((page - 1) * pageSize)
|
.Skip((page - 1) * pageSize)
|
||||||
.Take(pageSize)
|
.Take(pageSize)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
@ -188,6 +256,7 @@ namespace BMA.EHR.DisciplineDirector.Service.Controllers
|
||||||
Email = req.email,
|
Email = req.email,
|
||||||
Phone = req.phone,
|
Phone = req.phone,
|
||||||
Qualification = req.qualification,
|
Qualification = req.qualification,
|
||||||
|
RootDnaId = req.rootDnaId,
|
||||||
CreatedFullName = FullName ?? "System Administrator",
|
CreatedFullName = FullName ?? "System Administrator",
|
||||||
CreatedUserId = UserId ?? "",
|
CreatedUserId = UserId ?? "",
|
||||||
CreatedAt = DateTime.Now,
|
CreatedAt = DateTime.Now,
|
||||||
|
|
@ -279,7 +348,13 @@ namespace BMA.EHR.DisciplineDirector.Service.Controllers
|
||||||
if (director == null)
|
if (director == null)
|
||||||
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
||||||
|
|
||||||
|
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||||
|
var profile = await _userProfileRepository.GetUserOC(userId, token.Replace("Bearer ", ""));
|
||||||
|
if (profile == null)
|
||||||
|
return Error(GlobalMessages.DataNotFound);
|
||||||
|
|
||||||
var data = await _context.DisciplineInvestigates
|
var data = await _context.DisciplineInvestigates
|
||||||
|
.Where(x => x.RootDnaId == profile.RootDnaId || x.RootDnaId == null)
|
||||||
.Where(x => x.DisciplineInvestigate_Directors
|
.Where(x => x.DisciplineInvestigate_Directors
|
||||||
.Where(x => x.DisciplineDirector == director)
|
.Where(x => x.DisciplineDirector == director)
|
||||||
.FirstOrDefault() != null
|
.FirstOrDefault() != null
|
||||||
|
|
@ -316,7 +391,13 @@ namespace BMA.EHR.DisciplineDirector.Service.Controllers
|
||||||
if (director == null)
|
if (director == null)
|
||||||
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
||||||
|
|
||||||
|
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||||
|
var profile = await _userProfileRepository.GetProfileByKeycloakIdNewAsync(userId, token.Replace("Bearer ", ""));
|
||||||
|
if (profile == null)
|
||||||
|
return Error(GlobalMessages.DataNotFound);
|
||||||
|
|
||||||
var data = await _context.DisciplineDisciplinarys
|
var data = await _context.DisciplineDisciplinarys
|
||||||
|
.Where(x => x.RootDnaId == profile.RootDnaId || x.RootDnaId == null)
|
||||||
.Where(x => x.DisciplineDisciplinary_DirectorInvestigates
|
.Where(x => x.DisciplineDisciplinary_DirectorInvestigates
|
||||||
.Where(x => x.DisciplineDirector == director)
|
.Where(x => x.DisciplineDirector == director)
|
||||||
.FirstOrDefault() != null
|
.FirstOrDefault() != null
|
||||||
|
|
|
||||||
|
|
@ -100,6 +100,157 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
||||||
return Success(new { data, total = data_search.Count() });
|
return Success(new { data, total = data_search.Count() });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// list รายการวินัยเรื่องสอบสวน (ค้นหาขั้นสูง)
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost("advance-search")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetAdvanceSearcDisciplineDisciplinary([FromBody] DisciplineDisciplinaryAdvanceSearcRequest req)
|
||||||
|
{
|
||||||
|
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_DISCIPLINE_INTERROGATE");
|
||||||
|
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
|
||||||
|
if (jsonData["status"]?.ToString() != "200")
|
||||||
|
{
|
||||||
|
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||||
|
}
|
||||||
|
|
||||||
|
var page = req.page <= 0 ? 1 : req.page;
|
||||||
|
var pageSize = req.pageSize <= 0 ? 25 : req.pageSize;
|
||||||
|
var keyword = string.IsNullOrEmpty(req.keyword) ? string.Empty : req.keyword;
|
||||||
|
var status = string.IsNullOrEmpty(req.status) ? string.Empty : req.status;
|
||||||
|
|
||||||
|
var data_search = (from x in _context.DisciplineDisciplinarys
|
||||||
|
where x.Title.Contains(keyword) ||
|
||||||
|
x.DisciplinaryFaultLevel.Contains(keyword) ||
|
||||||
|
x.DisciplinaryCaseFault.Contains(keyword)
|
||||||
|
select x).ToList();
|
||||||
|
if (status.Trim().ToUpper() != "ALL")
|
||||||
|
data_search = data_search.Where(x => x.Status.Contains(status.Trim().ToUpper())).ToList();
|
||||||
|
|
||||||
|
if (
|
||||||
|
(req.disciplinaryDateStart.HasValue && req.disciplinaryDateEnd.HasValue) ||
|
||||||
|
(req.dateReceivedStart.HasValue && req.dateReceivedEnd.HasValue) ||
|
||||||
|
(!string.IsNullOrEmpty(req.respondentType)) ||
|
||||||
|
(!string.IsNullOrEmpty(req.offenseDetails)) ||
|
||||||
|
(!string.IsNullOrEmpty(req.disciplinaryFaultLevel)) ||
|
||||||
|
(!string.IsNullOrEmpty(req.disciplinaryCaseFault))
|
||||||
|
)
|
||||||
|
{
|
||||||
|
data_search = data_search
|
||||||
|
.Where(x =>
|
||||||
|
//วันที่รับเรือง
|
||||||
|
(!req.dateReceivedStart.HasValue || !req.dateReceivedEnd.HasValue ||
|
||||||
|
(x.DateReceived.HasValue &&
|
||||||
|
x.DateReceived.Value.Date <= req.dateReceivedStart.Value.Date &&
|
||||||
|
x.DateReceived.Value.Date >= req.dateReceivedEnd.Value.Date))
|
||||||
|
&&
|
||||||
|
//วันที่สอบสวน
|
||||||
|
(!req.disciplinaryDateStart.HasValue || !req.disciplinaryDateEnd.HasValue ||
|
||||||
|
(x.DisciplinaryDateStart.HasValue && x.DisciplinaryDateEnd.HasValue &&
|
||||||
|
x.DisciplinaryDateStart.Value.Date <= req.disciplinaryDateStart.Value.Date &&
|
||||||
|
x.DisciplinaryDateEnd.Value.Date >= req.disciplinaryDateEnd.Value.Date))
|
||||||
|
&&
|
||||||
|
(string.IsNullOrEmpty(req.respondentType) || x.RespondentType == req.respondentType)
|
||||||
|
&&
|
||||||
|
(string.IsNullOrEmpty(req.offenseDetails) || x.OffenseDetails == req.offenseDetails)
|
||||||
|
&&
|
||||||
|
(string.IsNullOrEmpty(req.disciplinaryFaultLevel) || x.DisciplinaryFaultLevel == req.disciplinaryFaultLevel)
|
||||||
|
&&
|
||||||
|
(string.IsNullOrEmpty(req.disciplinaryCaseFault) || (x.DisciplinaryCaseFault?.Contains(req.disciplinaryCaseFault) ?? false))
|
||||||
|
)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
var query = data_search
|
||||||
|
.Select(x => new
|
||||||
|
{
|
||||||
|
Id = x.Id,//id ข้อมูลเรื่องสอบสวน
|
||||||
|
Title = x.Title,//ชื่อเรื่อง
|
||||||
|
RespondentType = x.RespondentType,//ผู้ถูกสืบสวน
|
||||||
|
OffenseDetails = x.OffenseDetails,//ลักษณะความผิด
|
||||||
|
DisciplinaryFaultLevel = x.DisciplinaryFaultLevel,//ระดับโทษความผิด
|
||||||
|
DisciplinaryCaseFault = x.DisciplinaryCaseFault,//กรณีความผิด
|
||||||
|
Status = x.Status,//สถานะหรือผลการสอบสวน
|
||||||
|
DateReceived = x.DateReceived, //วันที่รับเรื่อง
|
||||||
|
CreatedAt = x.CreatedAt,//วันที่สร้างเรื่องสอบสวน
|
||||||
|
DisciplinaryDateStart = x.DisciplinaryDateStart, //วันที่เริ่มการสอบสวน
|
||||||
|
DisciplinaryDateEnd = x.DisciplinaryDateEnd, //วันที่สิ้นสุดการสอบสวน
|
||||||
|
});
|
||||||
|
|
||||||
|
bool desc = req.descending ?? false;
|
||||||
|
if (!string.IsNullOrEmpty(req.sortBy))
|
||||||
|
{
|
||||||
|
switch (req.sortBy)
|
||||||
|
{
|
||||||
|
case "title":
|
||||||
|
query = desc ? query.OrderByDescending(x => x.Title)
|
||||||
|
: query.OrderBy(x => x.Title);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "respondentType":
|
||||||
|
query = desc ? query.OrderByDescending(x => x.RespondentType)
|
||||||
|
: query.OrderBy(x => x.RespondentType);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "offenseDetails":
|
||||||
|
query = desc ? query.OrderByDescending(x => x.OffenseDetails)
|
||||||
|
: query.OrderBy(x => x.OffenseDetails);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "disciplinaryFaultLevel":
|
||||||
|
query = desc ? query.OrderByDescending(x => x.DisciplinaryFaultLevel)
|
||||||
|
: query.OrderBy(x => x.DisciplinaryFaultLevel);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "disciplinaryCaseFault":
|
||||||
|
query = desc ? query.OrderByDescending(x => x.DisciplinaryCaseFault)
|
||||||
|
: query.OrderBy(x => x.DisciplinaryCaseFault);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "status":
|
||||||
|
query = desc ? query.OrderByDescending(x => x.Status)
|
||||||
|
: query.OrderBy(x => x.Status);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "dateReceived":
|
||||||
|
query = desc ? query.OrderByDescending(x => x.DateReceived)
|
||||||
|
: query.OrderBy(x => x.DateReceived);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "createdAt":
|
||||||
|
query = desc ? query.OrderByDescending(x => x.CreatedAt)
|
||||||
|
: query.OrderBy(x => x.CreatedAt);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "disciplinaryDateStart":
|
||||||
|
query = desc ? query.OrderByDescending(x => x.DisciplinaryDateStart)
|
||||||
|
: query.OrderBy(x => x.DisciplinaryDateStart);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "disciplinaryDateEnd":
|
||||||
|
query = desc ? query.OrderByDescending(x => x.DisciplinaryDateEnd)
|
||||||
|
: query.OrderBy(x => x.DisciplinaryDateEnd);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
query = query.OrderByDescending(x => x.DisciplinaryDateStart);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
var data = query
|
||||||
|
.Skip((page - 1) * pageSize)
|
||||||
|
.Take(pageSize)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
return Success(new { data, total = data_search.Count() });
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// get รายการวินัยเรื่องสอบสวน
|
/// get รายการวินัยเรื่องสอบสวน
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -1561,7 +1712,7 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
||||||
{
|
{
|
||||||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||||
}
|
}
|
||||||
foreach (var item in req.Id)
|
foreach (var item in req.id)
|
||||||
{
|
{
|
||||||
var uppdated = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
|
var uppdated = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
|
||||||
.FirstOrDefaultAsync(x => x.Id == item);
|
.FirstOrDefaultAsync(x => x.Id == item);
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue