Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
HIMSScannerService
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
HIMSScanner
HIMSScannerService
Commits
f3a3819a
Commit
f3a3819a
authored
Dec 09, 2024
by
Krishna Reddy Tamatam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
For Ftp And Config Changes
parent
ebc733b2
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
25 deletions
+54
-25
FTPManagementAPIController.cs
Controllers/FTPManagementAPIController.cs
+6
-5
AppSettings.cs
Models/AppSettings.cs
+2
-0
FTPInfo.cs
Models/FTPInfo.cs
+4
-0
Program.cs
Program.cs
+1
-1
FTPDataAdapter.cs
Services/FTPDataAdapter.cs
+23
-2
appsettings.json
appsettings.json
+18
-17
No files found.
Controllers/FTPManagementAPIController.cs
View file @
f3a3819a
...
...
@@ -156,9 +156,10 @@ namespace FTP_Services.Services.Controllers
log
.
Debug
(
"GetConfigValues ==> "
);
try
{
string
DatabaseName
=
_appSettings
.
ConnectionString
;
_appSettings
.
ConnectionString
=
_appSettings
.
AdminConnectionString
;
FTPDataAdapter
adapter
=
new
FTPDataAdapter
(
_appSettings
);
List
<
ConfigValues
>?
RequestsList
=
adapter
.
ConfigValues
(
CompanyId
);
List
<
ConfigValues
>?
RequestsList
=
adapter
.
ConfigValues
(
CompanyId
,
DatabaseName
);
return
Ok
(
RequestsList
);
}
catch
(
Exception
ex
)
...
...
@@ -271,18 +272,18 @@ namespace FTP_Services.Services.Controllers
}
[
HttpPost
(
"DownloadBase64DataAsync"
)]
public
async
Task
<
string
>
DownloadBase64DataAsync
(
string
fileNameWithPath
)
public
async
Task
<
string
>
DownloadBase64DataAsync
(
string
fileNameWithPath
,
bool
IsExternal
)
{
bool
isFTPMODE
=
_appSettings
.
FTPConfiguration
.
FTPMODE
;
var
base64
=
string
.
Empty
;
if
(
isFTPMODE
==
true
)
if
(
IsExternal
==
true
)
{
int
bytesRead
;
// byte[] buffer = new byte[2048];
byte
[]
buffer
=
new
byte
[
1048576
];
// 1 MB buffer
byte
[]
fileData
=
null
;
string
FTPURL
=
_appSettings
.
FTPConfiguration
.
FtpURL
.
ToString
();
string
FTPURL
=
_appSettings
.
FTPConfiguration
.
FtpURL
.
ToString
()
+
'/'
+
_appSettings
.
FTPConfiguration
.
DestinationPathFtp
.
ToString
()
;
string
FTPUserName
=
_appSettings
.
FTPConfiguration
.
Username
.
ToString
();
string
FTPPassword
=
_appSettings
.
FTPConfiguration
.
Password
.
ToString
();
...
...
@@ -319,7 +320,7 @@ namespace FTP_Services.Services.Controllers
else
{
string
strDestinationPath
=
_appSettings
.
FTPConfiguration
.
DestinationPath
.
ToString
()
.
FTPConfiguration
.
DestinationPath
File
.
ToString
()
.
Trim
();
string
strFullPath
=
Path
.
Combine
(
strDestinationPath
,
fileNameWithPath
);
if
(
string
.
IsNullOrEmpty
(
strFullPath
)
||
!
System
.
IO
.
File
.
Exists
(
strFullPath
))
...
...
Models/AppSettings.cs
View file @
f3a3819a
...
...
@@ -23,6 +23,8 @@ namespace FTP_Services.Core.Models
public
string
FtpURL
{
get
;
set
;
}
public
bool
FTPMODE
{
get
;
set
;
}
public
string
DestinationPath
{
get
;
set
;
}
public
string
DestinationPathFtp
{
get
;
set
;
}
public
string
DestinationPathFile
{
get
;
set
;
}
public
FTPConfiguration
()
{
...
...
Models/FTPInfo.cs
View file @
f3a3819a
...
...
@@ -152,6 +152,7 @@ namespace FTP_Services.Core.Models
public
string
DefaultDocType
{
get
;
set
;
}
public
bool
IsActive
{
get
;
set
;
}
public
int
CompanyId
{
get
;
set
;
}
public
string
DatabaseName
{
get
;
set
;
}
public
ConfigValues
()
{
...
...
@@ -165,6 +166,7 @@ namespace FTP_Services.Core.Models
DefaultDocType
=
""
;
IsActive
=
true
;
CompanyId
=
1
;
DatabaseName
=
""
;
}
}
...
...
@@ -188,6 +190,7 @@ namespace FTP_Services.Core.Models
public
string
DocumentUrl
{
get
;
set
;
}
public
int
SplID
{
get
;
set
;
}
public
string
ThumbnailUrl
{
get
;
set
;
}
public
bool
IsExternal
{
get
;
set
;
}
public
PatientDocuments
()
...
...
@@ -210,6 +213,7 @@ namespace FTP_Services.Core.Models
DocumentUrl
=
""
;
SplID
=
-
1
;
ThumbnailUrl
=
""
;
IsExternal
=
false
;
}
}
...
...
Program.cs
View file @
f3a3819a
...
...
@@ -138,7 +138,7 @@ if (app.Environment.IsDevelopment())
}
else
{
//app.Run();
//app.Run();
//For Test Site
app
.
Run
(
"http://*:4708"
);
// For Production
//app.Run("http://*:4709"); // For Admin
...
...
Services/FTPDataAdapter.cs
View file @
f3a3819a
...
...
@@ -155,15 +155,36 @@ namespace FTP_Services.Services
// }
// }
public
List
<
ConfigValues
>?
ConfigValues
(
int
CompanyId
)
public
string
GetDatabaseNameFromConnectionString
(
string
connectionString
)
{
// Split connection string by ';'
var
parameters
=
connectionString
.
Split
(
';'
,
StringSplitOptions
.
RemoveEmptyEntries
);
foreach
(
var
param
in
parameters
)
{
// Check if the parameter starts with 'Database=' (case-insensitive)
if
(
param
.
StartsWith
(
"Database="
,
StringComparison
.
OrdinalIgnoreCase
))
{
// Return the value after 'Database='
return
param
.
Split
(
'='
)[
1
];
}
}
// Return a default message if not found
return
"Database name not found!"
;
}
public
List
<
ConfigValues
>?
ConfigValues
(
int
CompanyId
,
string
StrConnection
)
{
string
DatabaseName
=
GetDatabaseNameFromConnectionString
(
StrConnection
);
List
<
ConfigValues
>?
ConfigValuesData
=
null
;
try
{
using
(
var
tx
=
_repository
.
GetTransaction
())
{
ConfigValuesData
=
_repository
.
Fetch
<
ConfigValues
>(
"SELECT * FROM \"SPScanTool_GetScanConfigByCompanyId\"(@0)"
,
CompanyId
"SELECT
'"
+
DatabaseName
+
"' AS \"DatabaseName\",
* FROM \"SPScanTool_GetScanConfigByCompanyId\"(@0)"
,
CompanyId
);
GC
.
Collect
();
...
...
appsettings.json
View file @
f3a3819a
...
...
@@ -2,23 +2,23 @@
"AppSettings"
:
{
"Secret"
:
"A78E-F7FA-B0FD-DAA45BB866CD-AA73D560-DACC-978C-4A9B-9924-5DE7E33F0040-GCD00"
,
"ConnectionString"
:
"SERVER=10.11.12.106;PORT=5432;UID=himsdbuser;PWD=dbuser@hims123!;database=fernandez_20241125;Timeout=1000"
,
"AdminConnectionString"
:
"SERVER=10.11.12.106;PORT=5432;UID=himsdbuser;PWD=dbuser@hims123!;database=
CareaxesAdmin
;Timeout=1000"
,
"AdminConnectionString"
:
"SERVER=10.11.12.106;PORT=5432;UID=himsdbuser;PWD=dbuser@hims123!;database=
fernandez_20241125
;Timeout=1000"
,
"FTPConfiguration"
:
{
"Username"
:
"
fernandez
"
,
"Password"
:
"
fernandez123!
"
,
"FtpURL"
:
"ftp://1
92.168.7.104
/"
,
"Username"
:
"
admin
"
,
"Password"
:
"
Fmh@xp@rt01
"
,
"FtpURL"
:
"ftp://1
83.82.47.232
/"
,
"FTPMODE"
:
false
,
"DestinationPath"
:
"/ftproot/FTPRoot/"
"DestinationPathFile"
:
"/ftproot/FTPRoot/"
,
"DestinationPathFtp"
:
"/apachetomcat/webapps/documents/"
}
},
"https_port"
:
8001
,
"Logging"
:
{
"LogLevel"
:
{
"Default"
:
"Information"
,
"Microsoft"
:
"Warning"
,
"Microsoft.Hosting.Lifetime"
:
"Information"
}
},
"AllowedHosts"
:
"*"
}
},
"https_port"
:
8001
,
"Logging"
:
{
"LogLevel"
:
{
"Default"
:
"Information"
,
"Microsoft"
:
"Warning"
,
"Microsoft.Hosting.Lifetime"
:
"Information"
}
},
"AllowedHosts"
:
"*"
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment