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

            returnValue.Result = new L5OU_SOUT_0934();

            Guid orgUnitTypeId = Guid.Empty;
            if (!Parameter.BaseData.IsDeleted)
            {
                orgUnitTypeId = cls_Save_MedicalPracticeType.Invoke(Connection, Transaction, Parameter.BaseData, securityTicket).Result;
            }
            else
            {
                List <ORM_HEC_MedicalPractice_2_PracticeType> existingOffice = ORM_HEC_MedicalPractice_2_PracticeType.Query.Search(Connection, Transaction, new ORM_HEC_MedicalPractice_2_PracticeType.Query
                {
                    IsDeleted    = false,
                    Tenant_RefID = securityTicket.TenantID,
                    HEC_MedicalPractice_Type_RefID = Parameter.BaseData.HEC_MedicalPractice_TypeID
                }).ToList();

                if (existingOffice.Count > 0) //cannot delete
                {
                    List <ORM_HEC_MedicalPractis> medicalPracticesList = new List <ORM_HEC_MedicalPractis>();
                    foreach (var item in existingOffice)
                    {
                        ORM_HEC_MedicalPractis medPractice = ORM_HEC_MedicalPractis.Query.Search(Connection, Transaction, new ORM_HEC_MedicalPractis.Query
                        {
                            IsDeleted             = false,
                            Tenant_RefID          = securityTicket.TenantID,
                            HEC_MedicalPractiseID = item.HEC_MedicalPractice_RefID
                        }).Single();

                        medicalPracticesList.Add(new ORM_HEC_MedicalPractis {
                            HEC_MedicalPractiseID = item.HEC_MedicalPractice_RefID
                        });
                    }
                    ;

                    if (medicalPracticesList.Count > 0) //cannot delete
                    {
                        List <L5OU_SOUT_0934_UsedInOrgUnit> usedOrgUnitList = new List <L5OU_SOUT_0934_UsedInOrgUnit>();

                        foreach (var item in medicalPracticesList)
                        {
                            ORM_CMN_STR_Office officeName = ORM_CMN_STR_Office.Query.Search(Connection, Transaction, new ORM_CMN_STR_Office.Query
                            {
                                IsDeleted    = false,
                                Tenant_RefID = securityTicket.TenantID,
                                IfMedicalPractise_HEC_MedicalPractice_RefID = item.HEC_MedicalPractiseID
                            }).Single();

                            usedOrgUnitList.Add(new L5OU_SOUT_0934_UsedInOrgUnit {
                                OrgUnitName = officeName.Office_Name
                            });
                        }
                        returnValue.Result.UsedInOrgUnit = usedOrgUnitList.ToArray();
                    }
                }
                if (existingOffice.Count == 0)
                {
                    orgUnitTypeId = cls_Save_MedicalPracticeType.Invoke(Connection, Transaction, Parameter.BaseData, securityTicket).Result;
                }
            }
            returnValue.Result.ID = orgUnitTypeId;

            return(returnValue);
        }
コード例 #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_L5OU_SOUT_0934 Invoke(DbConnection Connection, DbTransaction Transaction, P_L5OU_SOUT_0934 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_L5OU_SOUT_0934 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5OU_SOUT_0934 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_L5OU_SOUT_0934 functionReturn = new FR_L5OU_SOUT_0934();

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