Example #1
0
        protected static FR_Bool Execute(DbConnection Connection, DbTransaction Transaction, P_PH_DP_1523 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Bool();
            //Put your code here

            #region delete pharmacy
            var pharmacy = ORM_HEC_Pharmacy.Query.Search(Connection, Transaction, new ORM_HEC_Pharmacy.Query
            {
                Tenant_RefID   = securityTicket.TenantID,
                IsDeleted      = false,
                HEC_PharmacyID = Parameter.PharmacyID
            }).SingleOrDefault();
            ORM_HEC_Pharmacy.Query.SoftDelete(Connection, Transaction, new ORM_HEC_Pharmacy.Query
            {
                Tenant_RefID   = securityTicket.TenantID,
                IsDeleted      = false,
                HEC_PharmacyID = pharmacy.HEC_PharmacyID
            });
            #endregion

            #region delete person info
            var contactInfo = ORM_CMN_BPT_BusinessParticipant.Query.Search(Connection, Transaction, new ORM_CMN_BPT_BusinessParticipant.Query
            {
                Tenant_RefID = securityTicket.TenantID,
                IsDeleted    = false,
                CMN_BPT_BusinessParticipantID = pharmacy.ContactPerson_BusinessParticipant_RefID
            }).SingleOrDefault();

            ORM_CMN_BPT_BusinessParticipant.Query.SoftDelete(Connection, Transaction, new ORM_CMN_BPT_BusinessParticipant.Query
            {
                Tenant_RefID = securityTicket.TenantID,
                IsDeleted    = false,
                CMN_BPT_BusinessParticipantID = contactInfo.CMN_BPT_BusinessParticipantID
            });

            ORM_CMN_PER_PersonInfo.Query.SoftDelete(Connection, Transaction, new ORM_CMN_PER_PersonInfo.Query
            {
                Tenant_RefID         = securityTicket.TenantID,
                IsDead               = false,
                CMN_PER_PersonInfoID = contactInfo.IfNaturalPerson_CMN_PER_PersonInfo_RefID
            });
            #endregion

            #region delete company info
            var companyInfo = ORM_CMN_COM_CompanyInfo.Query.Search(Connection, Transaction, new ORM_CMN_COM_CompanyInfo.Query
            {
                Tenant_RefID          = securityTicket.TenantID,
                IsDeleted             = false,
                CMN_COM_CompanyInfoID = pharmacy.Ext_CompanyInfo_RefID
            }).SingleOrDefault();

            ORM_CMN_COM_CompanyInfo.Query.SoftDelete(Connection, Transaction, new ORM_CMN_COM_CompanyInfo.Query
            {
                Tenant_RefID          = securityTicket.TenantID,
                IsDeleted             = false,
                CMN_COM_CompanyInfoID = companyInfo.CMN_COM_CompanyInfoID
            });

            ORM_CMN_UniversalContactDetail.Query.SoftDelete(Connection, Transaction, new ORM_CMN_UniversalContactDetail.Query
            {
                Tenant_RefID = securityTicket.TenantID,
                IsDeleted    = false,
                CMN_UniversalContactDetailID = companyInfo.Contact_UCD_RefID
            });

            var ciBusinessParticipant = ORM_CMN_BPT_BusinessParticipant.Query.Search(Connection, Transaction, new ORM_CMN_BPT_BusinessParticipant.Query
            {
                Tenant_RefID = securityTicket.TenantID,
                IsDeleted    = false,
                IfCompany_CMN_COM_CompanyInfo_RefID = companyInfo.CMN_COM_CompanyInfoID
            }).SingleOrDefault();

            ORM_CMN_BPT_BusinessParticipant.Query.SoftDelete(Connection, Transaction, new ORM_CMN_BPT_BusinessParticipant.Query
            {
                Tenant_RefID = securityTicket.TenantID,
                IsDeleted    = false,
                IfCompany_CMN_COM_CompanyInfo_RefID = companyInfo.CMN_COM_CompanyInfoID
            });

            ORM_CMN_BPT_BusinessParticipant_2_BusinessParticipantGroup.Query.Search(Connection, Transaction, new ORM_CMN_BPT_BusinessParticipant_2_BusinessParticipantGroup.Query
            {
                Tenant_RefID = securityTicket.TenantID,
                IsDeleted    = false,
                CMN_BPT_BusinessParticipant_RefID = ciBusinessParticipant.CMN_BPT_BusinessParticipantID
            });
            #endregion

            returnValue.Result = true;
            return(returnValue);

            #endregion UserCode
        }
Example #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_Bool Invoke(DbConnection Connection, DbTransaction Transaction, P_PH_DP_1523 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(Connection, Transaction, null, Parameter, securityTicket));
 }
Example #3
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_Bool Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_PH_DP_1523 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_Bool functionReturn = new FR_Bool();

            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_Delete_Pharmacy", ex);
            }
            return(functionReturn);
        }
Example #4
0
 ///<summary>
 /// Opens the connection/transaction for the given connectionString, and closes them when complete
 ///<summary>
 public static FR_Bool Invoke(string ConnectionString, P_PH_DP_1523 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(null, null, ConnectionString, Parameter, securityTicket));
 }