protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L5OD_SDaR_1351 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { //Leave UserCode region to enable user code saving #region UserCode var returnValue = new FR_Guid(); #region cls_Save_DOC_Document P_L3DO_SD_1409 param1 = new P_L3DO_SD_1409(); param1.Alias = Parameter.File_Name; Guid documentID = cls_Save_DOC_Document.Invoke(Connection, Transaction, param1, securityTicket).Result; #endregion #region cls_Save_DOC_Document_2_Structure P_L3DO_SD2S_1407 param2 = new P_L3DO_SD2S_1407(); param2.Document_RefID = documentID; param2.Structure_RefID = Parameter.Structure_RefID; param2.StructureHeader_RefID = Parameter.Structure_Header_RefID; Guid AssignmentID = cls_Save_DOC_Document_2_Structure.Invoke(Connection, Transaction, param2, securityTicket).Result; #endregion #region cls_Save_DOC_DocumentRevision P_L3DO_SDR_1401 param3 = new P_L3DO_SDR_1401(); param3.Document_RefID = documentID; param3.Revision = 1; param3.IsLocked = false; param3.IsLastRevision = true; param3.UploadedByAccount = securityTicket.AccountID; param3.File_Name = Parameter.File_Name; param3.File_Description = Parameter.File_Description; param3.File_SourceLocation = ""; param3.File_ServerLocation = Parameter.File_ServerLocation; param3.File_MIMEType = Parameter.File_MIMEType; param3.File_Extension = Parameter.File_Extension; param3.File_Size_Bytes = Parameter.File_Size_Bytes; cls_Save_DOC_DocumentRevision.Invoke(Connection, Transaction, param3, securityTicket); #endregion return(returnValue); #endregion UserCode }
protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L5OD_SDfP_1534 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { //Leave UserCode region to enable user code saving #region UserCode var returnValue = new FR_Guid(); var item = new ORM_HEC_Patient_Document(); item.Load(Connection, Transaction, Parameter.HEC_Patient_DocumentID); if (Parameter.IsDeleted == true) { #region Delete DOC_Document P_L3DO_SD_1409 param1 = new P_L3DO_SD_1409(); param1.DOC_DocumentID = item.Document_RefID; param1.IsDeleted = true; cls_Save_DOC_Document.Invoke(Connection, Transaction, param1, securityTicket); #endregion item.IsDeleted = true; return(new FR_Guid(item.Save(Connection, Transaction), item.HEC_Patient_DocumentID)); } //Creation specific parameters (Tenant, Account ... ) if (Parameter.HEC_Patient_DocumentID == Guid.Empty) { #region Delete predefined doc if exists if (Parameter.IsDocument_PatientConsent) { var query = new ORM_HEC_Patient_Document.Query(); query.Patient_RefID = Parameter.Patient_RefID; query.IsDeleted = false; query.IsDocument_PatientConsent = true; var previousdoc = ORM_HEC_Patient_Document.Query.Search(Connection, Transaction, query); foreach (var prev in previousdoc) { prev.IsDeleted = true; prev.Save(Connection, Transaction); #region Delete DOC_Document P_L3DO_SD_1409 delDocParam = new P_L3DO_SD_1409(); delDocParam.DOC_DocumentID = item.Document_RefID; delDocParam.IsDeleted = true; cls_Save_DOC_Document.Invoke(Connection, Transaction, delDocParam, securityTicket); #endregion } } #endregion item.HEC_Patient_DocumentID = Guid.NewGuid(); item.Tenant_RefID = securityTicket.TenantID; #region cls_Save_DOC_Document P_L3DO_SD_1409 param1 = new P_L3DO_SD_1409(); param1.Alias = Parameter.File_Name; param1.PrimaryType = Parameter.File_Extension; Guid documentID = cls_Save_DOC_Document.Invoke(Connection, Transaction, param1, securityTicket).Result; #endregion #region cls_Save_DOC_DocumentRevision P_L3DO_SDR_1401 param3 = new P_L3DO_SDR_1401(); param3.Document_RefID = documentID; param3.Revision = 1; param3.IsLocked = false; param3.IsLastRevision = true; param3.UploadedByAccount = securityTicket.AccountID; param3.File_Name = Parameter.File_Name; param3.File_Description = ""; param3.File_SourceLocation = ""; param3.File_ServerLocation = Parameter.File_ServerLocation; param3.File_MIMEType = Parameter.File_MIMEType; param3.File_Extension = Parameter.File_Extension; param3.File_Size_Bytes = Parameter.File_Size_Bytes; cls_Save_DOC_DocumentRevision.Invoke(Connection, Transaction, param3, securityTicket); #endregion item.Patient_RefID = Parameter.Patient_RefID; item.Document_RefID = documentID; item.IsDocument_Standard = Parameter.IsDocument_Standard; item.IsDocument_PatientConsent = Parameter.IsDocument_PatientConsent; item.IsDocument_PatientParticipationPolicy = Parameter.IsDocument_PatientParticipationPolicy; item.Save(Connection, Transaction); } return(returnValue); #endregion UserCode }