Exemplo n.º 1
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_L5TR_STF_1712 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(Connection, Transaction, null, Parameter, securityTicket));
 }
Exemplo n.º 2
0
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L5TR_STF_1712 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Guid();

            var item = new ORM_HEC_Patient_Treatment();
            if (Parameter.HEC_Patient_TreatmentID != Guid.Empty)
            {
                var result = item.Load(Connection, Transaction, Parameter.HEC_Patient_TreatmentID);
                if (result.Status != FR_Status.Success || item.HEC_Patient_TreatmentID == Guid.Empty)
                {
                    //Item doesn't exist, create it
                    Parameter.HEC_Patient_TreatmentID = Guid.Empty;

                    if (Parameter.IsDeleted)
                    {
                        return(returnValue);
                    }
                }
            }

            if (Parameter.IsDeleted == true)
            {
                item.IsDeleted = true;
                return(new FR_Guid(item.Save(Connection, Transaction), item.HEC_Patient_TreatmentID));
            }

            //Creation specific parameters (Tenant, Account ... )
            if (Parameter.HEC_Patient_TreatmentID == Guid.Empty)
            {
                item.HEC_Patient_TreatmentID = Guid.NewGuid();
                item.Tenant_RefID            = securityTicket.TenantID;
            }

            item.TreatmentPractice_RefID             = Parameter.TreatmentPractice_RefID;
            item.IsTreatmentPerformed                = Parameter.IsTreatmentPerformed;
            item.IfTreatmentPerformed_ByDoctor_RefID = Parameter.IfTreatmentPerformed_ByDoctor_RefID;
            item.IfTreatmentPerformed_Date           = Parameter.IfTreatmentPerformed_Date;
            item.IsTreatmentFollowup = Parameter.IsTreatmentFollowup;
            item.IfTreatmentFollowup_FromTreatment_RefID = Parameter.IfTreatmentFollowup_FromTreatment_RefID;
            item.IsScheduled                = Parameter.IsScheduled;
            item.IfSheduled_Date            = Parameter.IfSheduled_Date;
            item.IfSheduled_ForDoctor_RefID = Parameter.IfSheduled_ForDoctor_RefID;
            item.IsTreatmentBilled          = Parameter.IsTreatmentBilled;
            item.IfTreatmentBilled_Date     = Parameter.IfTreatmentBilled_Date;
            item.Treatment_Comment          = Parameter.Treatment_Comment;

            return(new FR_Guid(item.Save(Connection, Transaction), item.HEC_Patient_TreatmentID));

            #endregion UserCode
        }
Exemplo n.º 3
0
 ///<summary>
 /// Opens the connection/transaction for the given connectionString, and closes them when complete
 ///<summary>
 public static FR_Guid Invoke(string ConnectionString, P_L5TR_STF_1712 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(null, null, ConnectionString, Parameter, securityTicket));
 }
Exemplo n.º 4
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_Guid Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5TR_STF_1712 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 ex;
            }
            return(functionReturn);
        }