protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L6PA_EBBVPPC_1519 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Guid();

            P_L6PA_GBBVPfID_1714 getPatientParam = new P_L6PA_GBBVPfID_1714();
            getPatientParam.HEC_PatientID = Parameter.HEC_PatientID;
            L6PA_GBBVPfID_1714 patient = cls_Get_BBV_Patients_For_ID.Invoke(Connection, Transaction, getPatientParam, securityTicket).Result;

            if (patient == null)
            {
                var error = new FR_Guid();
                error.ErrorMessage = "No Such ID";
                error.Status       = FR_Status.Error_Internal;
                return(error);
            }

            ORM_HEC_STU_Study_ParticipatingPatient.Query ppQuery = new ORM_HEC_STU_Study_ParticipatingPatient.Query();
            ppQuery.IsDeleted    = false;
            ppQuery.Tenant_RefID = securityTicket.TenantID;
            ppQuery.HEC_STU_Study_ParticipatingPatientID = patient.HEC_STU_Study_ParticipatingPatientID;
            var ppRes = ORM_HEC_STU_Study_ParticipatingPatient.Query.Search(Connection, Transaction, ppQuery);

            ORM_HEC_STU_Study_ParticipatingPatient ParticipatingPatient = ppRes[0];
            ParticipatingPatient.Participation_Comment = Parameter.Comment;
            ParticipatingPatient.Save(Connection, Transaction);

            return(returnValue);

            #endregion UserCode
        }
Пример #2
0
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L6PA_DBBVP_1711 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            //Leave UserCode region to enable user code saving
            #region UserCode
            var returnValue = new FR_Guid();


            P_L6PA_GBBVPfID_1714 getParam = new P_L6PA_GBBVPfID_1714();
            getParam.HEC_PatientID = Parameter.HEC_PatientID;
            var patient = cls_Get_BBV_Patients_For_ID.Invoke(Connection, Transaction, getParam, securityTicket).Result;
            if (patient != null)
            {
                if (patient.Addresses != null)
                {
                    foreach (var address in patient.Addresses)
                    {
                        P_L6PA_DBBVAFP_1703 delAddressPar = new P_L6PA_DBBVAFP_1703();
                        delAddressPar.CMN_AddressID = address.CMN_AddressID;
                        cls_Delete_BBV_AddressForPatient.Invoke(Connection, Transaction, delAddressPar, securityTicket);
                    }
                }
                if (patient.Contacts != null)
                {
                    foreach (var contact in patient.Contacts)
                    {
                        ORM_CMN_PER_CommunicationContact.Query cQuery = new ORM_CMN_PER_CommunicationContact.Query();
                        cQuery.CMN_PER_CommunicationContactID = contact.CMN_PER_CommunicationContactID;
                        cQuery.IsDeleted    = false;
                        cQuery.Tenant_RefID = securityTicket.TenantID;
                        ORM_CMN_PER_CommunicationContact.Query.SoftDelete(Connection, Transaction, cQuery);
                    }
                }

                ORM_CMN_PER_PersonInfo.Query ORM_CMN_PER_PersonInfoQuery = new ORM_CMN_PER_PersonInfo.Query();
                ORM_CMN_PER_PersonInfoQuery.CMN_PER_PersonInfoID = patient.CMN_PER_PersonInfoID;
                ORM_CMN_PER_PersonInfoQuery.IsDeleted            = false;
                ORM_CMN_PER_PersonInfoQuery.Tenant_RefID         = securityTicket.TenantID;
                ORM_CMN_PER_PersonInfo.Query.SoftDelete(Connection, Transaction, ORM_CMN_PER_PersonInfoQuery);

                ORM_CMN_BPT_BusinessParticipant.Query ORM_CMN_BPT_BusinessParticipantoQuery = new ORM_CMN_BPT_BusinessParticipant.Query();
                ORM_CMN_BPT_BusinessParticipantoQuery.CMN_BPT_BusinessParticipantID = patient.CMN_BPT_BusinessParticipantID;
                ORM_CMN_BPT_BusinessParticipantoQuery.IsDeleted    = false;
                ORM_CMN_BPT_BusinessParticipantoQuery.Tenant_RefID = securityTicket.TenantID;
                ORM_CMN_BPT_BusinessParticipant.Query.SoftDelete(Connection, Transaction, ORM_CMN_BPT_BusinessParticipantoQuery);

                ORM_HEC_Patient.Query ORM_HEC_PatientQuery = new ORM_HEC_Patient.Query();
                ORM_HEC_PatientQuery.HEC_PatientID = patient.HEC_PatientID;
                ORM_HEC_PatientQuery.IsDeleted     = false;
                ORM_HEC_PatientQuery.Tenant_RefID  = securityTicket.TenantID;
                ORM_HEC_Patient.Query.SoftDelete(Connection, Transaction, ORM_HEC_PatientQuery);

                ORM_HEC_Patient_HealthInsurance.Query ORM_HEC_Patient_HealthInsuranceoQuery = new ORM_HEC_Patient_HealthInsurance.Query();
                ORM_HEC_Patient_HealthInsuranceoQuery.HEC_Patient_HealthInsurancesID = patient.HEC_Patient_HealthInsurancesID;
                ORM_HEC_Patient_HealthInsuranceoQuery.IsDeleted    = false;
                ORM_HEC_Patient_HealthInsuranceoQuery.Tenant_RefID = securityTicket.TenantID;
                ORM_HEC_Patient_HealthInsurance.Query.SoftDelete(Connection, Transaction, ORM_HEC_Patient_HealthInsuranceoQuery);

                ORM_HEC_STU_Study_ParticipatingPatient.Query ORM_HEC_STU_Study_ParticipatingPatientQuery = new ORM_HEC_STU_Study_ParticipatingPatient.Query();
                ORM_HEC_STU_Study_ParticipatingPatientQuery.HEC_STU_Study_ParticipatingPatientID = patient.HEC_STU_Study_ParticipatingPatientID;
                ORM_HEC_STU_Study_ParticipatingPatientQuery.IsDeleted    = false;
                ORM_HEC_STU_Study_ParticipatingPatientQuery.Tenant_RefID = securityTicket.TenantID;
                ORM_HEC_STU_Study_ParticipatingPatient.Query.SoftDelete(Connection, Transaction, ORM_HEC_STU_Study_ParticipatingPatientQuery);

                var transactionsQuery = new ORM_HEC_Patient_Prescription_Transaction.Query();
                transactionsQuery.PrescriptionTransaction_Patient_RefID = patient.HEC_PatientID;
                transactionsQuery.IsDeleted = false;
                ORM_HEC_Patient_Prescription_Transaction.Query.SoftDelete(Connection, Transaction, transactionsQuery);
            }
            return(returnValue);

            #endregion UserCode
        }
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L6PA_SBBVAFP_1332 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Guid();

            P_L6PA_GBBVPfID_1714 getPatientParam = new P_L6PA_GBBVPfID_1714();
            getPatientParam.HEC_PatientID = Parameter.HEC_PatientID;
            L6PA_GBBVPfID_1714 patient = cls_Get_BBV_Patients_For_ID.Invoke(Connection, Transaction, getPatientParam, securityTicket).Result;

            if (patient == null)
            {
                var error = new FR_Guid();
                error.ErrorMessage = "No Such ID";
                error.Status       = FR_Status.Error_Internal;
                return(error);
            }

            ORM_CMN_PER_PersonInfo_2_Address.Query query = new ORM_CMN_PER_PersonInfo_2_Address.Query();
            query.CMN_PER_PersonInfo_RefID = patient.CMN_PER_PersonInfoID;
            query.Tenant_RefID             = securityTicket.TenantID;
            query.IsDeleted = false;
            var queryRes = ORM_CMN_PER_PersonInfo_2_Address.Query.Search(Connection, Transaction, query);

            ORM_CMN_Address address = new ORM_CMN_Address();
            if (Parameter.CMN_AddressID != Guid.Empty)
            {
                var result = address.Load(Connection, Transaction, Parameter.CMN_AddressID);
                if (result.Status != FR_Status.Success || address.CMN_AddressID == Guid.Empty)
                {
                    var error = new FR_Guid();
                    error.ErrorMessage = "No Such ID";
                    error.Status       = FR_Status.Error_Internal;
                    return(error);
                }
            }
            address.Street_Name     = Parameter.Street_Name;
            address.Street_Number   = Parameter.Street_Number;
            address.City_Name       = Parameter.City_Name;
            address.City_PostalCode = Parameter.City_PostalCode;
            address.Province_Name   = Parameter.Province_Name;
            address.Tenant_RefID    = securityTicket.TenantID;
            address.Save(Connection, Transaction);

            ORM_CMN_PER_PersonInfo_2_Address assignment = queryRes.FirstOrDefault(a => a.CMN_Address_RefID == Parameter.CMN_AddressID);
            if (assignment == null)
            {
                assignment = new ORM_CMN_PER_PersonInfo_2_Address();

                assignment.CMN_Address_RefID        = address.CMN_AddressID;
                assignment.CMN_PER_PersonInfo_RefID = patient.CMN_PER_PersonInfoID;
                assignment.Tenant_RefID             = securityTicket.TenantID;
                if (queryRes.Count == 0)
                {
                    assignment.IsPrimary = true;
                }
                assignment.SequenceNumber = queryRes.Count + 1;
            }

            assignment.Save(Connection, Transaction);

            returnValue.Result = address.CMN_AddressID;
            return(returnValue);

            #endregion UserCode
        }
Пример #4
0
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L6PA_SBBVPP_1434 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Guid();

            P_L6PA_GBBVPfID_1714 getPatientParam = new P_L6PA_GBBVPfID_1714();
            getPatientParam.HEC_PatientID = Parameter.HEC_PatientID;
            L6PA_GBBVPfID_1714 patient = cls_Get_BBV_Patients_For_ID.Invoke(Connection, Transaction, getPatientParam, securityTicket).Result;

            if (patient == null)
            {
                var error = new FR_Guid();
                error.ErrorMessage = "No Such ID";
                error.Status       = FR_Status.Error_Internal;
                return(error);
            }

            ORM_HEC_STU_Study currentStudy;

            ORM_HEC_STU_Study.Query StudyQuer = new ORM_HEC_STU_Study.Query();
            StudyQuer.Tenant_RefID             = securityTicket.TenantID;
            StudyQuer.IsDeleted                = false;
            StudyQuer.GlobalPropertyMatchingID = STLD_Sudies.Sudies_GlobalProperty;
            var studyRes = ORM_HEC_STU_Study.Query.Search(Connection, Transaction, StudyQuer);
            if (studyRes.Count == 0)
            {
                ORM_HEC_STU_Study study = new ORM_HEC_STU_Study();
                study.GlobalPropertyMatchingID = STLD_Sudies.Sudies_GlobalProperty;
                study.Tenant_RefID             = securityTicket.TenantID;
                study.Save(Connection, Transaction);
                currentStudy = study;
            }
            else
            {
                currentStudy = studyRes[0];
            }

            ORM_HEC_STU_Study_ParticipatingPatient.Query ppQuery = new ORM_HEC_STU_Study_ParticipatingPatient.Query();
            ppQuery.IsDeleted    = false;
            ppQuery.Tenant_RefID = securityTicket.TenantID;
            ppQuery.HEC_STU_Study_ParticipatingPatientID = patient.HEC_STU_Study_ParticipatingPatientID;
            var ppRes = ORM_HEC_STU_Study_ParticipatingPatient.Query.Search(Connection, Transaction, ppQuery);

            ORM_HEC_STU_Study_ParticipatingPatient ParticipatingPatient = ppRes[0];
            ParticipatingPatient.Study_RefID = currentStudy.HEC_STU_StudyID;
            ParticipatingPatient.Participation_DateOfSigning = DateTime.Now;
            ParticipatingPatient.Save(Connection, Transaction);

            if (Parameter.Documents != null)
            {
                foreach (var doc in Parameter.Documents)
                {
                    ORM_DOC_SLT_DocumentSlot currentSlot;

                    ORM_DOC_SLT_DocumentSlot.Query QueryORM_DOC_SLT_DocumentSlotQuery = new ORM_DOC_SLT_DocumentSlot.Query();
                    QueryORM_DOC_SLT_DocumentSlotQuery.Tenant_RefID             = securityTicket.TenantID;
                    QueryORM_DOC_SLT_DocumentSlotQuery.IsDeleted                = false;
                    QueryORM_DOC_SLT_DocumentSlotQuery.GlobalPropertyMatchingID = doc.DocSlot_GlobalPropertyMatching;
                    var QueryORM_DOC_SLT_DocumentSlotQueryRes = ORM_DOC_SLT_DocumentSlot.Query.Search(Connection, Transaction, QueryORM_DOC_SLT_DocumentSlotQuery);
                    if (QueryORM_DOC_SLT_DocumentSlotQueryRes.Count == 0)
                    {
                        ORM_DOC_SLT_DocumentSlot DocumentSlot = new ORM_DOC_SLT_DocumentSlot();
                        DocumentSlot.GlobalPropertyMatchingID = doc.DocSlot_GlobalPropertyMatching;
                        DocumentSlot.Tenant_RefID             = securityTicket.TenantID;
                        DocumentSlot.Save(Connection, Transaction);
                        currentSlot = DocumentSlot;
                    }
                    else
                    {
                        currentSlot = QueryORM_DOC_SLT_DocumentSlotQueryRes[0];
                    }

                    ORM_HEC_STU_Study_ParticipationRequiredDocument ParticipationRequiredDocument = new ORM_HEC_STU_Study_ParticipationRequiredDocument();
                    ParticipationRequiredDocument.Tenant_RefID = securityTicket.TenantID;
                    ParticipationRequiredDocument.Study_RefID  = currentStudy.HEC_STU_StudyID;
                    ParticipationRequiredDocument.DOC_SLT_DocumentSlot_RefID         = currentSlot.DOC_SLT_DocumentSlotID;
                    ParticipationRequiredDocument.IsRequiredFor_PatientParticipation = true;
                    ParticipationRequiredDocument.Save(Connection, Transaction);

                    ORM_HEC_STU_Study_PatientDocument PatientDocument = new ORM_HEC_STU_Study_PatientDocument();
                    PatientDocument.Tenant_RefID = securityTicket.TenantID;
                    PatientDocument.ParticipatingPatient_RefID          = ParticipatingPatient.HEC_STU_Study_ParticipatingPatientID;
                    PatientDocument.ParticipationRequiredDocument_RefID = ParticipationRequiredDocument.HEC_STU_Study_ParticipatingPatient_RequiredDocumentID;
                    PatientDocument.Document_RefID = Guid.NewGuid();
                    PatientDocument.Save(Connection, Transaction);

                    var document = new ORM_DOC_Document();
                    document.DOC_DocumentID     = PatientDocument.Document_RefID;
                    document.Alias              = doc.File_Name;
                    document.PrimaryType        = doc.File_Extension;
                    document.Creation_Timestamp = DateTime.Now;
                    document.Tenant_RefID       = securityTicket.TenantID;
                    document.Save(Connection, Transaction);

                    var revision = new ORM_DOC_DocumentRevision();
                    revision.DOC_DocumentRevisionID = Guid.NewGuid();
                    revision.Document_RefID         = PatientDocument.Document_RefID;
                    revision.Revision            = 1;
                    revision.IsLastRevision      = true;
                    revision.UploadedByAccount   = securityTicket.AccountID;
                    revision.File_Name           = doc.File_Name;
                    revision.File_ServerLocation = doc.File_ServerLocation;
                    revision.File_Extension      = doc.File_Extension;
                    revision.File_Size_Bytes     = doc.File_Size_Bytes;
                    revision.Creation_Timestamp  = DateTime.Now;
                    revision.Tenant_RefID        = securityTicket.TenantID;
                    revision.Save(Connection, Transaction);
                }
            }

            return(returnValue);

            #endregion UserCode
        }