コード例 #1
0
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_CAS_CAPA_1237 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            //Leave UserCode region to enable user code saving
            #region UserCode
            var returnValue = new FR_Guid();
            //Put your code here

            ORM_HEC_ACT_PlannedAction aftercare_planned_action = new ORM_HEC_ACT_PlannedAction();
            aftercare_planned_action.Creation_Timestamp      = DateTime.Now;
            aftercare_planned_action.HEC_ACT_PlannedActionID = Guid.NewGuid();
            aftercare_planned_action.IsPerformed             = false;
            aftercare_planned_action.MedicalPractice_RefID   = Parameter.practice_id;
            aftercare_planned_action.Modification_Timestamp  = DateTime.Now;
            aftercare_planned_action.Patient_RefID           = Parameter.patient_id;
            aftercare_planned_action.PlannedFor_Date         = Parameter.treatment_date;
            aftercare_planned_action.Tenant_RefID            = securityTicket.TenantID;

            Guid id = Guid.Empty;

            var aftercare_doctor_account = cls_Get_Doctor_AccountID_for_DoctorID.Invoke(Connection, Transaction, new P_DO_GDAIDfDID_1549()
            {
                DoctorID = Parameter.aftercare_doctor_practice_id
            }, securityTicket).Result;
            if (aftercare_doctor_account != null)
            {
                id = aftercare_doctor_account.accountID;
            }
            else
            {
                var aftercare_practice_account = cls_Get_Practice_AccountID_for_PracticeID.Invoke(Connection, Transaction, new P_DO_GPAIDfPID_1522()
                {
                    PracticeID = Parameter.aftercare_doctor_practice_id
                }, securityTicket).Result;
                if (aftercare_practice_account != null)
                {
                    id = aftercare_practice_account.accountID;
                }
            }

            ORM_USR_Account.Query aftercare_accountQ = new ORM_USR_Account.Query();
            aftercare_accountQ.USR_AccountID = id;
            aftercare_accountQ.Tenant_RefID  = securityTicket.TenantID;
            aftercare_accountQ.IsDeleted     = false;

            var aftercare_account = ORM_USR_Account.Query.Search(Connection, Transaction, aftercare_accountQ).SingleOrDefault();
            if (aftercare_account != null)
            {
                aftercare_planned_action.ToBePerformedBy_BusinessParticipant_RefID = aftercare_account.BusinessParticipant_RefID;
            }

            aftercare_planned_action.Save(Connection, Transaction);

            ORM_HEC_CAS_Case_RelevantPlannedAction aftercare_planned_action_to_case = new ORM_HEC_CAS_Case_RelevantPlannedAction();
            aftercare_planned_action_to_case.Case_RefID         = Parameter.case_id;
            aftercare_planned_action_to_case.Creation_Timestamp = DateTime.Now;
            aftercare_planned_action_to_case.HEC_CAS_Case_RelevantPlannedActionID = Guid.NewGuid();
            aftercare_planned_action_to_case.Modification_Timestamp = DateTime.Now;
            aftercare_planned_action_to_case.PlannedAction_RefID    = aftercare_planned_action.HEC_ACT_PlannedActionID;
            aftercare_planned_action_to_case.Tenant_RefID           = securityTicket.TenantID;

            aftercare_planned_action_to_case.Save(Connection, Transaction);

            ORM_HEC_ACT_ActionType.Query aftercare_planned_action_typeQ = new ORM_HEC_ACT_ActionType.Query();
            aftercare_planned_action_typeQ.GlobalPropertyMatchingID = "mm.docconect.doc.app.planned.action.aftercare";
            aftercare_planned_action_typeQ.Tenant_RefID             = securityTicket.TenantID;
            aftercare_planned_action_typeQ.IsDeleted = false;

            var aftercare_planned_action_type_id = Guid.Empty;

            var aftercare_planned_action_type = ORM_HEC_ACT_ActionType.Query.Search(Connection, Transaction, aftercare_planned_action_typeQ).SingleOrDefault();

            if (aftercare_planned_action_type == null)
            {
                aftercare_planned_action_type = new ORM_HEC_ACT_ActionType();

                Dict action_type_name_dict = new Dict(ORM_HEC_ACT_ActionType.TableName);

                foreach (var lang in Parameter.all_languagesL)
                {
                    var content = lang.ISO_639_1.Equals("DE") ? "nachsorge" : "aftercare";
                    action_type_name_dict.AddEntry(lang.CMN_LanguageID, content);
                }

                aftercare_planned_action_type.ActionType_Name          = action_type_name_dict;
                aftercare_planned_action_type.Creation_Timestamp       = DateTime.Now;
                aftercare_planned_action_type.GlobalPropertyMatchingID = "mm.docconect.doc.app.planned.action.aftercare";
                aftercare_planned_action_type.Modification_Timestamp   = DateTime.Now;
                aftercare_planned_action_type.HEC_ACT_ActionTypeID     = Guid.NewGuid();
                aftercare_planned_action_type.Tenant_RefID             = securityTicket.TenantID;
                aftercare_planned_action_type.Save(Connection, Transaction);

                aftercare_planned_action_type_id = aftercare_planned_action_type.HEC_ACT_ActionTypeID;
            }
            else
            {
                aftercare_planned_action_type_id = aftercare_planned_action_type.HEC_ACT_ActionTypeID;
            }

            ORM_HEC_ACT_PlannedAction_2_ActionType aftercare_planned_action_2_type = new ORM_HEC_ACT_PlannedAction_2_ActionType();
            aftercare_planned_action_2_type.Tenant_RefID                         = securityTicket.TenantID;
            aftercare_planned_action_2_type.Creation_Timestamp                   = DateTime.Now;
            aftercare_planned_action_2_type.IsDeleted                            = false;
            aftercare_planned_action_2_type.HEC_ACT_ActionType_RefID             = aftercare_planned_action_type_id;
            aftercare_planned_action_2_type.HEC_ACT_PlannedAction_RefID          = aftercare_planned_action.HEC_ACT_PlannedActionID;
            aftercare_planned_action_2_type.Modification_Timestamp               = DateTime.Now;
            aftercare_planned_action_2_type.HEC_ACT_PlannedAction_2_ActionTypeID = Guid.NewGuid();

            aftercare_planned_action_2_type.Save(Connection, Transaction);

            returnValue.Result = aftercare_planned_action.HEC_ACT_PlannedActionID;
            return(returnValue);

            #endregion UserCode
        }
コード例 #2
0
 ///<summary>
 /// Invokes the method for the given Connection, and Transaction, leaving them open/not commited if no exceptions occured
 ///<summary>
 public static FR_Guid Invoke(DbConnection Connection, DbTransaction Transaction, P_CAS_CAPA_1237 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(Connection, Transaction, null, Parameter, securityTicket));
 }
コード例 #3
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_Guid Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_CAS_CAPA_1237 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_Guid functionReturn = new FR_Guid();

            try
            {
                if (cleanupConnection == true)
                {
                    Connection = CSV2Core_MySQL.Support.DBSQLSupport.CreateConnection(ConnectionString);
                    Connection.Open();
                }
                if (cleanupTransaction == true)
                {
                    Transaction = Connection.BeginTransaction();
                }

                functionReturn = Execute(Connection, Transaction, Parameter, securityTicket);

                #region Cleanup Connection/Transaction
                //Commit the transaction
                if (cleanupTransaction == true)
                {
                    Transaction.Commit();
                }
                //Close the connection
                if (cleanupConnection == true)
                {
                    Connection.Close();
                }
                #endregion
            }
            catch (Exception ex)
            {
                try
                {
                    if (cleanupTransaction == true && Transaction != null)
                    {
                        Transaction.Rollback();
                    }
                }
                catch { }

                try
                {
                    if (cleanupConnection == true && Connection != null)
                    {
                        Connection.Close();
                    }
                }
                catch { }

                throw new Exception("Exception occured in method cls_Create_Aftercare_Planned_Action", ex);
            }
            return(functionReturn);
        }
コード例 #4
0
 ///<summary>
 /// Opens the connection/transaction for the given connectionString, and closes them when complete
 ///<summary>
 public static FR_Guid Invoke(string ConnectionString, P_CAS_CAPA_1237 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(null, null, ConnectionString, Parameter, securityTicket));
 }