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
5d1c8ddf
Commit
5d1c8ddf
authored
Mar 11, 2026
by
Krishna Reddy Tamatam
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into production
# Conflicts: # Program.cs # appsettings.json
parents
4dba9096
39af2a52
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
278 deletions
+56
-278
FTPManagementAPIController.cs
Controllers/FTPManagementAPIController.cs
+2
-75
BaseDataAdapter.cs
Services/BaseDataAdapter.cs
+20
-3
FTPDataAdapter.cs
Services/FTPDataAdapter.cs
+34
-200
No files found.
Controllers/FTPManagementAPIController.cs
View file @
5d1c8ddf
...
...
@@ -365,19 +365,15 @@ namespace FTP_Services.Services.Controllers
[
HttpGet
(
"GetConfigValues"
)]
public
IActionResult
GetConfigValues
(
int
CompanyId
)
{
string
DatabaseName
=
_appSettings
.
ConnectionString
;
log
.
Debug
(
"GetConfigValues ==> "
);
try
{
_appSettings
.
ConnectionString
=
_appSettings
.
AdminConnectionString
;
FTPDataAdapter
adapter
=
new
FTPDataAdapter
(
_appSettings
);
List
<
object
>?
RequestsList
=
adapter
.
ConfigValues
(
CompanyId
,
DatabaseName
);
_appSettings
.
ConnectionString
=
DatabaseName
;
List
<
object
>?
RequestsList
=
adapter
.
ConfigValues
(
CompanyId
);
return
Ok
(
RequestsList
);
}
catch
(
Exception
ex
)
{
_appSettings
.
ConnectionString
=
DatabaseName
;
log
.
Error
(
"Fail to get data for GetConfigValues - Error:"
+
ex
.
Message
);
return
NotFound
(
"No results"
);
}
...
...
@@ -493,13 +489,10 @@ namespace FTP_Services.Services.Controllers
public
int
UpdateImageCategory
(
int
sndPatDocId
,
int
sndDocTypeId
,
int
sndUserID
)
{
int
savedCount
=
0
;
string
DatabaseName
=
_appSettings
.
ConnectionString
;
try
{
_appSettings
.
ConnectionString
=
_appSettings
.
ConnectionString_MRD
;
FTPDataAdapter
adapter
=
new
FTPDataAdapter
(
_appSettings
);
savedCount
=
adapter
.
UpdateImageCategory
(
sndPatDocId
,
sndDocTypeId
,
sndUserID
);
_appSettings
.
ConnectionString
=
DatabaseName
;
}
catch
(
Exception
ex
)
{
...
...
@@ -507,7 +500,6 @@ namespace FTP_Services.Services.Controllers
}
finally
{
_appSettings
.
ConnectionString
=
DatabaseName
;
}
return
savedCount
;
}
...
...
@@ -516,10 +508,8 @@ namespace FTP_Services.Services.Controllers
public
int
UpdateImageSortNo
([
FromBody
]
PatientImgDocSort
PatImgDoc
)
{
int
savedCount
=
0
;
string
DatabaseName
=
_appSettings
.
ConnectionString
;
try
{
_appSettings
.
ConnectionString
=
_appSettings
.
ConnectionString_MRD
;
FTPDataAdapter
adapter
=
new
FTPDataAdapter
(
_appSettings
);
savedCount
=
adapter
.
UpdateImageSortNo
(
PatImgDoc
);
}
...
...
@@ -529,7 +519,6 @@ namespace FTP_Services.Services.Controllers
}
finally
{
_appSettings
.
ConnectionString
=
DatabaseName
;
}
return
savedCount
;
}
...
...
@@ -537,19 +526,16 @@ namespace FTP_Services.Services.Controllers
[
HttpPost
(
"SavePatientDocument"
)]
public
IActionResult
SavePatientDocument
([
FromBody
]
PatientDocumentRequest
models
)
{
string
DatabaseName
=
_appSettings
.
ConnectionString
;
try
{
string
Parm_PatDoc
=
JsonConvert
.
SerializeObject
(
models
);
_appSettings
.
ConnectionString
=
_appSettings
.
ConnectionString_MRD
;
FTPDataAdapter
adapter
=
new
FTPDataAdapter
(
_appSettings
);
int
savedCount
=
adapter
.
SavePatientDocumentData
(
Parm_PatDoc
);
log
.
Info
(
$"SavePatientDocument => Successfully saved
{
savedCount
}
records."
);
_appSettings
.
ConnectionString
=
DatabaseName
;
return
Ok
(
savedCount
);
}
catch
(
Exception
ex
)
...
...
@@ -559,49 +545,15 @@ namespace FTP_Services.Services.Controllers
}
finally
{
_appSettings
.
ConnectionString
=
DatabaseName
;
}
}
// [HttpPost("SavePatientDocument1")]
// public int SavePatientDocumentData([FromBody] List<PatientDocumentDetailsModel> models)
// {
// log.Debug("SaveMultiplePatientDocuments ==> Received " + models.Count + " records.");
// int savedCount = 0;
// string DatabaseName = _appSettings.ConnectionString;
// try
// {
// _appSettings.ConnectionString = _appSettings.ConnectionString_MRD;
// if (models == null || models.Count == 0)
// {
// log.Warn("SaveMultiplePatientDocuments => No data received.");
// return 0;
// }
// FTPDataAdapter adapter = new FTPDataAdapter(_appSettings);
// savedCount = adapter.SavePatientDocumentData(models);
// _appSettings.ConnectionString = DatabaseName;
// }
// catch (Exception ex)
// {
// log.Error(
// "SaveMultiplePatientDocuments -> Failed to save documents - Error: "
// + ex.Message
// );
// }
// finally
// {
// _appSettings.ConnectionString = DatabaseName;
// }
// return savedCount;
// }
[
HttpPost
(
"SaveAdmissionDischargeData"
)]
public
IActionResult
SaveAdmissionDischargeData
(
[
FromBody
]
List
<
AdmissionDischargeModel
>
models
)
{
string
DatabaseName
=
_appSettings
.
ConnectionString
;
if
(
models
==
null
||
models
.
Count
==
0
)
{
log
.
Warn
(
"SaveAdmissionDischargeData => No data received."
);
...
...
@@ -612,11 +564,9 @@ namespace FTP_Services.Services.Controllers
try
{
_appSettings
.
ConnectionString
=
_appSettings
.
ConnectionString_MRD
;
FTPDataAdapter
adapter
=
new
FTPDataAdapter
(
_appSettings
);
int
savedCount
=
adapter
.
SaveAdmissionDischargeData
(
models
);
log
.
Info
(
$"SaveAdmissionDischargeData => Successfully saved
{
savedCount
}
records."
);
_appSettings
.
ConnectionString
=
DatabaseName
;
return
Ok
(
savedCount
);
}
catch
(
Exception
ex
)
...
...
@@ -626,7 +576,6 @@ namespace FTP_Services.Services.Controllers
}
finally
{
_appSettings
.
ConnectionString
=
DatabaseName
;
}
}
...
...
@@ -742,10 +691,8 @@ namespace FTP_Services.Services.Controllers
{
log
.
Debug
(
"DeletePatientDocument ==> "
);
string
DeletePT
=
""
;
string
DatabaseName
=
_appSettings
.
ConnectionString
;
try
{
_appSettings
.
ConnectionString
=
_appSettings
.
ConnectionString_MRD
;
FTPDataAdapter
adapter
=
new
FTPDataAdapter
(
_appSettings
);
DeletePT
=
adapter
.
DeletePatientDocumentData
(
AdmissionId
,
...
...
@@ -753,7 +700,6 @@ namespace FTP_Services.Services.Controllers
UserID
,
SndRecType
);
_appSettings
.
ConnectionString
=
DatabaseName
;
}
catch
(
Exception
ex
)
{
...
...
@@ -761,7 +707,6 @@ namespace FTP_Services.Services.Controllers
}
finally
{
_appSettings
.
ConnectionString
=
DatabaseName
;
}
return
DeletePT
;
}
...
...
@@ -1802,10 +1747,8 @@ namespace FTP_Services.Services.Controllers
public
IActionResult
GetHistPatientData
(
int
Parm_PatientId
)
{
log
.
Debug
(
"GetHistPatientData ==> "
);
string
DatabaseName
=
_appSettings
.
ConnectionString
;
try
{
_appSettings
.
ConnectionString
=
_appSettings
.
ConnectionString_MRD
;
FTPDataAdapter
adapter
=
new
FTPDataAdapter
(
_appSettings
);
List
<
object
>?
RequestsList
=
adapter
.
GetHist_PatientData
(
Parm_PatientId
);
return
Ok
(
RequestsList
);
...
...
@@ -1817,7 +1760,6 @@ namespace FTP_Services.Services.Controllers
}
finally
{
_appSettings
.
ConnectionString
=
DatabaseName
;
}
}
...
...
@@ -1825,10 +1767,8 @@ namespace FTP_Services.Services.Controllers
public
IActionResult
GetAdmissionHistoryData
(
int
Parm_HistAdmId
)
{
log
.
Debug
(
"GetHistAdmissionData ==> "
);
string
DatabaseName
=
_appSettings
.
ConnectionString
;
try
{
_appSettings
.
ConnectionString
=
_appSettings
.
ConnectionString_MRD
;
FTPDataAdapter
adapter
=
new
FTPDataAdapter
(
_appSettings
);
List
<
object
>?
RequestsList
=
adapter
.
GetHist_AdmissIonData
(
Parm_HistAdmId
);
return
Ok
(
RequestsList
);
...
...
@@ -1840,7 +1780,6 @@ namespace FTP_Services.Services.Controllers
}
finally
{
_appSettings
.
ConnectionString
=
DatabaseName
;
}
}
...
...
@@ -1872,17 +1811,14 @@ namespace FTP_Services.Services.Controllers
[
HttpPost
(
"SaveHistAdmissionDischargeData"
)]
public
IActionResult
SaveHistAdmissionDischargeData
([
FromBody
]
string
Parm_AdmData
)
{
string
DatabaseName
=
_appSettings
.
ConnectionString
;
try
{
_appSettings
.
ConnectionString
=
_appSettings
.
ConnectionString_MRD
;
FTPDataAdapter
adapter
=
new
FTPDataAdapter
(
_appSettings
);
int
savedCount
=
adapter
.
SaveHistoryOfAdmissionDischargeData
(
Parm_AdmData
);
log
.
Info
(
$"SaveHistAdmissionDischargeData => Successfully saved
{
savedCount
}
records."
);
_appSettings
.
ConnectionString
=
DatabaseName
;
return
Ok
(
savedCount
);
}
catch
(
Exception
ex
)
...
...
@@ -1892,17 +1828,14 @@ namespace FTP_Services.Services.Controllers
}
finally
{
_appSettings
.
ConnectionString
=
DatabaseName
;
}
}
[
HttpPost
(
"ExecuteNonQuery"
)]
public
string
ExecuteNonQuery
([
FromBody
]
string
jsonSql
)
{
string
DatabaseName
=
_appSettings
.
ConnectionString
;
try
{
_appSettings
.
ConnectionString
=
_appSettings
.
ConnectionString_MRD
;
if
(
string
.
IsNullOrWhiteSpace
(
jsonSql
))
{
log
.
Error
(
"Request string is null or empty."
);
...
...
@@ -1918,21 +1851,17 @@ namespace FTP_Services.Services.Controllers
}
finally
{
_appSettings
.
ConnectionString
=
DatabaseName
;
}
}
[
HttpPost
(
"SaveHistoryPatient"
)]
public
int
SaveHistoryPatient
([
FromBody
]
string
Parm_PatientData
)
//string Parm_PatientData
{
string
DatabaseName
=
_appSettings
.
ConnectionString
;
int
savedCount
=
0
;
try
{
_appSettings
.
ConnectionString
=
_appSettings
.
ConnectionString_MRD
;
FTPDataAdapter
adapter
=
new
FTPDataAdapter
(
_appSettings
);
savedCount
=
adapter
.
SaveHistoryOfPatient
(
Parm_PatientData
);
_appSettings
.
ConnectionString
=
DatabaseName
;
}
catch
(
Exception
ex
)
{
...
...
@@ -1940,10 +1869,8 @@ namespace FTP_Services.Services.Controllers
}
finally
{
_appSettings
.
ConnectionString
=
DatabaseName
;
}
return
savedCount
;
}
//-------------------------------------------------------------------------Send Mail ----------------------------------------------------------------------------
...
...
Services/BaseDataAdapter.cs
View file @
5d1c8ddf
...
...
@@ -18,6 +18,8 @@ namespace FTP_Services.Services
#
region
Variables
protected
PetaPoco
.
Database
_repository
;
protected
PetaPoco
.
Database
_adminRepository
;
protected
PetaPoco
.
Database
_mrdRepository
;
//protected IConfiguration _configuration;
protected
AppSettings
_appSettings
;
protected
readonly
log4net
.
ILog
log
=
log4net
.
LogManager
.
GetLogger
(
"BaseDataAdapter"
);
...
...
@@ -28,18 +30,24 @@ namespace FTP_Services.Services
{
log
.
Debug
(
"BaseDataAdapter() called"
);
this
.
_appSettings
=
appSettings
;
string
constr
=
_appSettings
.
ConnectionString
;
log
.
Debug
(
"Connection String -"
+
constr
);
_auth_user_id
=
0
;
_user_id
=
0
;
_repository
=
new
PetaPoco
.
Database
(
constr
,
"npgsql"
);
string
Adminconstr
=
_appSettings
.
AdminConnectionString
;
log
.
Debug
(
"
Connection String -"
+
constr
);
log
.
Debug
(
"
Admin Connection String -"
+
Admin
constr
);
_auth_user_id
=
0
;
_user_id
=
0
;
_repository
=
new
PetaPoco
.
Database
(
Adminconstr
,
"npgsql"
);
_adminRepository
=
new
PetaPoco
.
Database
(
Adminconstr
,
"npgsql"
);
string
MRDConstr
=
_appSettings
.
ConnectionString_MRD
;
log
.
Debug
(
"MRD Connection String -"
+
MRDConstr
);
_auth_user_id
=
0
;
_user_id
=
0
;
_mrdRepository
=
new
PetaPoco
.
Database
(
MRDConstr
,
"npgsql"
);
}
public
void
Dispose
()
...
...
@@ -47,6 +55,14 @@ namespace FTP_Services.Services
if
(
this
.
_repository
.
Connection
!=
null
)
this
.
_repository
.
Connection
.
Close
();
this
.
_repository
.
Dispose
();
if
(
this
.
_adminRepository
.
Connection
!=
null
)
this
.
_adminRepository
.
Connection
.
Close
();
this
.
_adminRepository
.
Dispose
();
if
(
this
.
_mrdRepository
.
Connection
!=
null
)
this
.
_mrdRepository
.
Connection
.
Close
();
this
.
_mrdRepository
.
Dispose
();
}
}
}
\ No newline at end of file
Services/FTPDataAdapter.cs
View file @
5d1c8ddf
...
...
@@ -53,36 +53,7 @@ namespace FTP_Services.Services
}
}
// public List<SearchPatients>? SearchedPatientsData(string SearchText)
// {
// List<SearchPatients>? SearchPatientsData = null;
// try
// {
// using (var tx = _repository.GetTransaction())
// {
// // Check if SearchText is null or empty and set it to a wildcard if true
// string searchTextParam = string.IsNullOrEmpty(SearchText) ? "%" : SearchText.Replace("'", "''");
// // Build the SQL query string
// string sqlQuery = $"SELECT * FROM \"SPScanTool_GetSearchedPatients\"(@Parm_SearchText)";
// // Perform the fetch operation with the constructed SQL query and parameter
// SearchPatientsData = _repository.Fetch<SearchPatients>(
// sqlQuery,
// new { Parm_SearchText = searchTextParam }
// );
// GC.Collect();
// tx.Complete();
// }
// return SearchPatientsData;
// }
// catch (Exception ex)
// {
// log.Error("SearchedPatientsData->Failed to get info from db - " + ex.Message);
// return null;
// }
// }
public
List
<
object
>?
GetUserLocations
(
string
sndUserName
)
{
...
...
@@ -92,7 +63,7 @@ namespace FTP_Services.Services
using
(
var
tx
=
_repository
.
GetTransaction
())
{
string
sqlQuery
=
$"SELECT * FROM \"SPScanTool_GetUserLocations\"(@Parm_UserName)"
;
$"SELECT * FROM \"SPScanTool_GetUserLocations\"(@Parm_UserName
::text
)"
;
UserLocationsData
=
_repository
.
Fetch
<
object
>(
sqlQuery
,
new
{
Parm_UserName
=
sndUserName
}
...
...
@@ -509,30 +480,7 @@ namespace FTP_Services.Services
return
null
;
}
}
// public List<ConfigValues>? ConfigValues(int CompanyId)
// {
// List<ConfigValues>? ConfigValuesData = null;
// try
// {
// using (var tx = _repository.GetTransaction())
// {
// ConfigValuesData = _repository.Fetch<ConfigValues>(
// "SELECT \"ID\", \"Environment\", \"RemotePath\", \"CompanyName\", \"FTPServiceURL\", \"DPI\", \"PDFSizeLimit\", \"DefaultDocType\", \"IsActive\" " +
// "FROM \"ScanConfigMaster\" " +
// "WHERE \"IsActive\" = TRUE " +
// "ORDER BY \"CompanyName\""
// );
// GC.Collect();
// tx.Complete();
// }
// return ConfigValuesData;
// }
// catch (Exception ex)
// {
// log.Error("ConfigValues->Failed to get info from db - " + ex.Message);
// return null;
// }
// }
public
string
GetDatabaseNameFromConnectionString
(
string
connectionString
)
{
...
...
@@ -552,18 +500,22 @@ namespace FTP_Services.Services
// Return a default message if not found
return
"Database name not found!"
;
}
public
List
<
object
>?
ConfigValues
(
int
CompanyId
,
string
StrConnection
)
public
List
<
object
>?
ConfigValues
(
int
CompanyId
)
{
string
DatabaseName
=
GetDatabaseNameFromConnectionString
(
StrConnection
);
string
FFDatabaseName
=
GetDatabaseNameFromConnectionString
(
_appSettings
.
ConnectionString
);
string
AdminDatabaseName
=
GetDatabaseNameFromConnectionString
(
_appSettings
.
AdminConnectionString
);
string
MRDDatabaseName
=
GetDatabaseNameFromConnectionString
(
_appSettings
.
ConnectionString_MRD
);
String
StrDatabases
=
"FFDatabaseName : "
+
FFDatabaseName
+
" , AdminDatabaseName: "
+
AdminDatabaseName
+
", MRDDatabaseName :"
+
MRDDatabaseName
+
";"
;
List
<
object
>?
ConfigValuesData
=
null
;
try
{
using
(
var
tx
=
_
r
epository
.
GetTransaction
())
using
(
var
tx
=
_
adminR
epository
.
GetTransaction
())
{
ConfigValuesData
=
_
r
epository
.
Fetch
<
object
>(
"SELECT '"
+
DatabaseName
+
"' AS \"DatabaseName\", * FROM \"SPScanTool_GetScanConfigByCompanyId\"(@0)"
,
CompanyId
ConfigValuesData
=
_
adminR
epository
.
Fetch
<
object
>(
"SELECT '"
+
StrDatabases
+
"' AS \"DatabaseName\", * FROM \"SPScanTool_GetScanConfigByCompanyId\"(@0)"
,
CompanyId
);
GC
.
Collect
();
...
...
@@ -695,7 +647,7 @@ namespace FTP_Services.Services
try
{
using
(
var
tx
=
_
r
epository
.
GetTransaction
())
using
(
var
tx
=
_
mrdR
epository
.
GetTransaction
())
{
//SPScanTool_SaveAdmissionDischargeData
string
SQLStr
=
"SELECT public.\"MRD_SaveAdmissionDischargeData\"(@MRDId, @PatientId, @AdmissionId, @ProviderId, "
+
...
...
@@ -732,7 +684,7 @@ namespace FTP_Services.Services
Parm_RecType
=
model
.
RecType
};
savedCount
+=
_
r
epository
.
Single
<
int
>(
SQLStr
,
parameters
);
savedCount
+=
_
mrdR
epository
.
Single
<
int
>(
SQLStr
,
parameters
);
}
tx
.
Complete
();
...
...
@@ -760,7 +712,7 @@ namespace FTP_Services.Services
try
{
using
(
var
tx
=
_
r
epository
.
GetTransaction
())
using
(
var
tx
=
_
mrdR
epository
.
GetTransaction
())
{
string
escaped
=
patientDocs
;
...
...
@@ -771,7 +723,7 @@ namespace FTP_Services.Services
string
SQLStr
=
"SELECT * FROM \"MRD_SavePatientDocument\"(@Parm_PatDocData::jsonb)"
;
//::json
var
parameters
=
new
{
Parm_PatDocData
=
cleanJson
};
result
=
_
r
epository
.
Single
<
int
>(
SQLStr
,
parameters
);
result
=
_
mrdR
epository
.
Single
<
int
>(
SQLStr
,
parameters
);
tx
.
Complete
();
}
...
...
@@ -786,54 +738,7 @@ namespace FTP_Services.Services
return
result
;
}
// //Json Model
// public int SavePatientDocumentData1(List<PatientDocumentDetailsModel> patientDocs)
// {
// int savedCount = 0;
// try
// {
// using (var tx = _repository.GetTransaction())
// {
// foreach (var doc in patientDocs)
// {
// //SPScanTool_SavePatientDocument
// string SQLStr = "SELECT * FROM \"MRD_SavePatientDocument\"(@PatDocId, @UploadedDate, @PatientId, @UploadedBy, " +
// "@DocumentName, @DocumentType, @ContentType, @Size, @Description, @DocumentUrl, @ThumbnailUrl,@SortNo, @SplID, @AdmissionID,@Parm_RecType)";
// var parameters = new
// {
// PatDocId = doc.PatDocId,
// UploadedDate = doc.UploadedDate, // Ensure valid date format if needed
// PatientId = doc.PatientId,
// UploadedBy = doc.UploadedBy,
// DocumentName = doc.DocumentName,
// DocumentType = doc.DocumentType,
// ContentType = doc.ContentType,
// Size = doc.Size, // Ensure string is handled correctly
// Description = doc.Description,
// DocumentUrl = doc.DocumentUrl,
// ThumbnailUrl = doc.ThumbnailUrl,
// SortNo = doc.SortNo,
// SplID = doc.SplID,
// AdmissionID = doc.AdmissionID,
// Parm_RecType = doc.RecType
// };
// _repository.Single<int>(SQLStr, parameters);
// savedCount++;
// }
// tx.Complete();
// }
// }
// catch (Exception ex)
// {
// log.Error("SaveMultiplePatientDocuments -> Failed to save records - Error: " + ex.Message);
// }
// finally
// {
// }
// return savedCount;
// }
public
int
UpdateImageCategory
(
int
sndPatDocId
,
int
sndDocTypeId
,
int
sndUserID
)
{
...
...
@@ -841,7 +746,7 @@ namespace FTP_Services.Services
try
{
using
(
var
tx
=
_
r
epository
.
GetTransaction
())
using
(
var
tx
=
_
mrdR
epository
.
GetTransaction
())
{
//string SQLStr = "SELECT * FROM \"SPScanTool_UpdateImageCategory\"(@PatDocId, @DocTypeId, @UserID)";
string
SQLStr
=
"SELECT * FROM \"MRD_UpdateImageCategory\"(@PatDocId, @DocTypeId, @UserID)"
;
...
...
@@ -855,7 +760,7 @@ namespace FTP_Services.Services
//repository.ConnectionString = _appSettings.ConnectionString;
_
r
epository
.
Single
<
int
>(
SQLStr
,
parameters
);
_
mrdR
epository
.
Single
<
int
>(
SQLStr
,
parameters
);
savedCount
++;
tx
.
Complete
();
}
...
...
@@ -874,9 +779,7 @@ namespace FTP_Services.Services
int
savedCount
=
0
;
try
{
string
DatabaseName
=
_appSettings
.
ConnectionString
;
_appSettings
.
ConnectionString
=
_appSettings
.
ConnectionString_MRD
;
using
(
var
tx
=
_repository
.
GetTransaction
())
using
(
var
tx
=
_mrdRepository
.
GetTransaction
())
{
//string SQLStr = "SELECT * FROM public.\"SPScanTool_UpdateImageSortNo\"(@Parm_SortData::jsonb)";
string
SQLStr
=
"SELECT * FROM public.\"MRD_UpdateImageSortNo\"(@Parm_SortData::jsonb)"
;
...
...
@@ -888,10 +791,9 @@ namespace FTP_Services.Services
:
"[]"
};
_
r
epository
.
Single
<
int
>(
SQLStr
,
parameters
);
_
mrdR
epository
.
Single
<
int
>(
SQLStr
,
parameters
);
savedCount
++;
tx
.
Complete
();
_appSettings
.
ConnectionString
=
DatabaseName
;
}
}
catch
(
Exception
ex
)
...
...
@@ -902,82 +804,14 @@ namespace FTP_Services.Services
}
// public int SavePatientDocumentData_bkp(PatientDocumentDetailsModel SndPatDocRec)
// {
// int _save = 0;
// try
// {
// using (var tx = _repository.GetTransaction())
// {
// string SQLStr =
// "SELECT * FROM \"SPScanTool_SavePatientDocument\"("
// + SndPatDocRec.PatDocId
// + ",'"
// + SndPatDocRec.UploadedDate
// + "',"
// + SndPatDocRec.PatientId
// + ","
// + SndPatDocRec.UploadedBy
// + ",'"
// + SndPatDocRec.DocumentName
// + "','"
// + SndPatDocRec.DocumentType
// + "','"
// + SndPatDocRec.ContentType
// + "',"
// + SndPatDocRec.Size
// + ",'"
// + SndPatDocRec.Description
// + "','"
// + SndPatDocRec.DocumentUrl
// + "','"
// + SndPatDocRec.ThumbnailUrl
// + "',"
// + SndPatDocRec.SplID
// + ","
// + SndPatDocRec.AdmissionID
// + ")";
// _save = _repository.Single<int>(SQLStr);
// GC.Collect();
// tx.Complete();
// }
// }
// catch (Exception ex)
// {
// log.Error("SavePatientDocumentData->Failed to get info from db - " + ex.Message);
// }
// return _save;
// }
// public int DeletePatientDocumentData(int SndPatDocRecID)
// {
// int _Delete = 0;
// try
// {
// using (var tx = _repository.GetTransaction())
// {
// string SQLStr =
// "SELECT * FROM \"SPScanTool_DeletePatientDocument\"("
// + SndPatDocRecID
// + ");";
// _Delete = _repository.Single<int>(SQLStr);
// GC.Collect();
// tx.Complete();
// }
// }
// catch (Exception ex)
// {
// log.Error("DeletePatientDocumentData->Failed to get info from db - " + ex.Message);
// }
// return _Delete;
// }
public
string
DeletePatientDocumentData
(
int
SndAdmissionId
,
int
SndPatDocRecID
,
int
SndUserID
,
int
SndRecType
)
{
string
result
=
string
.
Empty
;
try
{
using
(
var
tx
=
_
r
epository
.
GetTransaction
())
using
(
var
tx
=
_
mrdR
epository
.
GetTransaction
())
{
string
SQLStr
=
// "SELECT * FROM \"SPScanTool_DeletePatientDocument\"("
...
...
@@ -985,7 +819,7 @@ namespace FTP_Services.Services
+
SndAdmissionId
+
','
+
SndPatDocRecID
+
','
+
SndUserID
+
','
+
SndRecType
+
");"
;
result
=
_
r
epository
.
Single
<
string
>(
SQLStr
);
result
=
_
mrdR
epository
.
Single
<
string
>(
SQLStr
);
GC
.
Collect
();
tx
.
Complete
();
}
...
...
@@ -1072,14 +906,14 @@ namespace FTP_Services.Services
try
{
using
(
var
tx
=
_
r
epository
.
GetTransaction
())
using
(
var
tx
=
_
mrdR
epository
.
GetTransaction
())
{
// string sqlQuery =
// $"SELECT * FROM \"SPScanTool_Hist_GetPatientData\"(@Parm_PatientId)";
string
sqlQuery
=
$"SELECT * FROM \"MRD_Hist_GetPatientData\"(@Parm_PatientId)"
;
PatientHistoryData
=
_
r
epository
.
Fetch
<
object
>(
PatientHistoryData
=
_
mrdR
epository
.
Fetch
<
object
>(
sqlQuery
,
new
{
...
...
@@ -1137,11 +971,11 @@ namespace FTP_Services.Services
List
<
object
>?
PatientAdmissionHistoryData
=
null
;
try
{
using
(
var
tx
=
_
r
epository
.
GetTransaction
())
using
(
var
tx
=
_
mrdR
epository
.
GetTransaction
())
{
string
sqlQuery
=
$"SELECT * FROM \"MRD_Hist_GetAdmissIonData\"(@Parm_HistAdmId)"
;
// $"SELECT * FROM \"SPScanTool_Hist_GetAdmissIonData\"(@Parm_HistAdmId)";
PatientAdmissionHistoryData
=
_
r
epository
.
Fetch
<
object
>(
PatientAdmissionHistoryData
=
_
mrdR
epository
.
Fetch
<
object
>(
sqlQuery
,
new
{
...
...
@@ -1170,7 +1004,7 @@ namespace FTP_Services.Services
try
{
using
(
var
tx
=
_
r
epository
.
GetTransaction
())
using
(
var
tx
=
_
mrdR
epository
.
GetTransaction
())
{
string
escaped
=
admissionDischargeJson
;
...
...
@@ -1181,7 +1015,7 @@ namespace FTP_Services.Services
string
SQLStr
=
"SELECT * FROM \"MRD_Hist_SaveAdmissionDischargeData\"(@Parm_AdmData::jsonb)"
;
//::json
var
parameters
=
new
{
Parm_AdmData
=
cleanJson
};
result
=
_
r
epository
.
Single
<
int
>(
SQLStr
,
parameters
);
result
=
_
mrdR
epository
.
Single
<
int
>(
SQLStr
,
parameters
);
tx
.
Complete
();
}
...
...
@@ -1201,7 +1035,7 @@ namespace FTP_Services.Services
string
result
=
""
;
try
{
using
(
var
tx
=
_
r
epository
.
GetTransaction
())
using
(
var
tx
=
_
mrdR
epository
.
GetTransaction
())
{
string
escaped
=
sndSQL
;
...
...
@@ -1214,7 +1048,7 @@ namespace FTP_Services.Services
string
SQLStr
=
"SELECT * FROM \"MRD_ExecuteNonQuery\"(@Parm_SQL::jsonb)"
;
var
parameters
=
new
{
Parm_SQL
=
cleanJson
};
// Use the raw JSON string
result
=
_
r
epository
.
Single
<
string
>(
SQLStr
,
parameters
);
result
=
_
mrdR
epository
.
Single
<
string
>(
SQLStr
,
parameters
);
tx
.
Complete
();
}
...
...
@@ -1236,7 +1070,7 @@ namespace FTP_Services.Services
try
{
using
(
var
tx
=
_
r
epository
.
GetTransaction
())
using
(
var
tx
=
_
mrdR
epository
.
GetTransaction
())
{
string
escaped
=
patientDataJson
;
...
...
@@ -1249,7 +1083,7 @@ namespace FTP_Services.Services
string
SQLStr
=
"SELECT * FROM \"MRD_SaveHistoryPatient\"(@Parm_PatientData::jsonb)"
;
var
parameters
=
new
{
Parm_PatientData
=
cleanJson
};
// No serialization here
result
=
_
r
epository
.
Single
<
int
>(
SQLStr
,
parameters
);
result
=
_
mrdR
epository
.
Single
<
int
>(
SQLStr
,
parameters
);
tx
.
Complete
();
}
...
...
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