///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L3MP_GPfT_1209_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L3MP_GPfT_1209_Array functionReturn = new FR_L3MP_GPfT_1209_Array(); try { if (cleanupConnection == true) { Connection = CSV2Core_MySQL.Support.DBSQLSupport.CreateConnection(ConnectionString); Connection.Open(); } if (cleanupTransaction == true) { Transaction = Connection.BeginTransaction(); } functionReturn = Execute(Connection, Transaction, 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_Get_Practice_For_Tenant", ex); } return(functionReturn); }
protected static FR_L3MP_GPfT_1209_Array Execute(DbConnection Connection, DbTransaction Transaction, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L3MP_GPfT_1209_Array(); List <L3MP_GPfT_1209> res = new List <L3MP_GPfT_1209>(); var baseInfos = cls_Get_Practice_BaseInfo_For_Tenant.Invoke(Connection, Transaction, securityTicket).Result; var contactsP = cls_Get_Practice_ContactPerson_For_Tenant.Invoke(Connection, Transaction, securityTicket).Result; var officeHoursQuery = new ORM_CMN_CAL_WeeklyOfficeHours_Template.Query(); officeHoursQuery.IsDeleted = false; officeHoursQuery.Tenant_RefID = securityTicket.TenantID; var officeHours = ORM_CMN_CAL_WeeklyOfficeHours_Template.Query.Search(Connection, Transaction, officeHoursQuery); var companyTypeQuery = new ORM_CMN_COM_CompanyInfo_Type.Query(); companyTypeQuery.IsDeleted = false; companyTypeQuery.Tenant_RefID = securityTicket.TenantID; var companyTypes = ORM_CMN_COM_CompanyInfo_Type.Query.Search(Connection, Transaction, companyTypeQuery); var pHealthcareQuery = new ORM_HEC_PublicHealthcare_PhysitianAssociation.Query(); pHealthcareQuery.Tenant_RefID = securityTicket.TenantID; var pHealthcares = ORM_HEC_PublicHealthcare_PhysitianAssociation.Query.Search(Connection, Transaction, pHealthcareQuery); var customerQuery = new ORM_CMN_BPT_CTM_Customer.Query(); customerQuery.Tenant_RefID = securityTicket.TenantID; var customers = ORM_CMN_BPT_CTM_Customer.Query.Search(Connection, Transaction, customerQuery); var affinityStatusQuery = new ORM_CMN_BPT_CTM_AffinityStatus.Query(); affinityStatusQuery.Tenant_RefID = securityTicket.TenantID; var affinityStatuses = ORM_CMN_BPT_CTM_AffinityStatus.Query.Search(Connection, Transaction, affinityStatusQuery); var compAddressQuery = new ORM_CMN_COM_CompanyInfo_Address.Query(); compAddressQuery.Tenant_RefID = securityTicket.TenantID; compAddressQuery.IsShipping = true; compAddressQuery.IsDeleted = false; var compAddresses = ORM_CMN_COM_CompanyInfo_Address.Query.Search(Connection, Transaction, compAddressQuery); var addressQuery = new ORM_CMN_UniversalContactDetail.Query(); addressQuery.Tenant_RefID = securityTicket.TenantID; addressQuery.IsDeleted = false; var addresses = ORM_CMN_UniversalContactDetail.Query.Search(Connection, Transaction, addressQuery); foreach (var bInfo in baseInfos) { L3MP_GPfT_1209 practice = new L3MP_GPfT_1209(); practice.BaseInfo = bInfo; if (bInfo.ContactPerson_RefID != null) { var contactPerson = contactsP.FirstOrDefault(c => c.CMN_BPT_BusinessParticipantID == bInfo.ContactPerson_RefID); practice.ContactPerson = contactPerson; } if (bInfo.WeeklyOfficeHours_Template_RefID != Guid.Empty && bInfo.WeeklySurgeryHours_Template_RefID != Guid.Empty) { var oHours = officeHours.FirstOrDefault(o => o.CMN_CAL_WeeklyOfficeHours_TemplateID == bInfo.WeeklyOfficeHours_Template_RefID); var cHours = officeHours.FirstOrDefault(o => o.CMN_CAL_WeeklyOfficeHours_TemplateID == bInfo.WeeklySurgeryHours_Template_RefID); if (oHours != null && cHours != null) { practice.OfficeHours = new L3MP_GPfT_1209_OfficeHours(); practice.OfficeHours.ConsultingHours_FormattedOfficeHours = cHours.FormattedOfficeHours; practice.OfficeHours.WorkingHours_FormattedOfficeHours = oHours.FormattedOfficeHours; } } if (bInfo.CompanyType_RefID != Guid.Empty) { practice.OtherOphthal_PracticeData = new L3MP_GPfT_1209_OtherOphthal_PracticeData(); var company = companyTypes.FirstOrDefault(c => c.CMN_COM_CompanyInfo_TypeID == bInfo.CompanyType_RefID); if (company != null) { practice.OtherOphthal_PracticeData.CompanyType_Name = company.CompanyType_Name; practice.OtherOphthal_PracticeData.CMN_COM_CompanyInfo_TypeID = company.CMN_COM_CompanyInfo_TypeID; } var pHealthcare = pHealthcares.FirstOrDefault(c => c.HEC_PublicHealthcare_PhysitianAssociationID == bInfo.AssociatedWith_PhysitianAssociation_RefID); if (pHealthcare != null) { practice.OtherOphthal_PracticeData.HealthAssociation_Name = pHealthcare.HealthAssociation_Name; practice.OtherOphthal_PracticeData.HEC_PublicHealthcare_PhysitianAssociationID = pHealthcare.HEC_PublicHealthcare_PhysitianAssociationID; } } var customer = customers.FirstOrDefault(c => c.Ext_BusinessParticipant_RefID == bInfo.CMN_BPT_BusinessParticipantID); if (customer != null) { var affinityStatus = affinityStatuses.FirstOrDefault(a => a.CMN_BPT_CTM_AffinityStatusID == customer.CustomerAffinityStatus_RefID); if (affinityStatus != null) { practice.OtherOphthal_PracticeData.CMN_BPT_CTM_AffinityStatusID = affinityStatus.CMN_BPT_CTM_AffinityStatusID; practice.OtherOphthal_PracticeData.AffinityStatus_Name = affinityStatus.AffinityStatus_Name; } } var compAddress = compAddresses.FirstOrDefault(ca => ca.CompanyInfo_RefID == bInfo.CMN_COM_CompanyInfoID); if (compAddress != null) { var address = addresses.FirstOrDefault(a => a.CMN_UniversalContactDetailID == compAddress.Address_UCD_RefID); if (address != null) { practice.ShippingAddress = new L3MP_GPfT_1209_ShippingAddress(); practice.ShippingAddress.CMN_UniversalContactDetailID = address.CMN_UniversalContactDetailID; practice.ShippingAddress.CMN_COM_CompanyInfo_AddressID = compAddress.CMN_COM_CompanyInfo_AddressID; practice.ShippingAddress.Region_Name = address.Region_Name; practice.ShippingAddress.Street_Name = address.Street_Name; practice.ShippingAddress.Street_Number = address.Street_Number; practice.ShippingAddress.Town = address.Town; practice.ShippingAddress.ZIP = address.ZIP; } } res.Add(practice); } returnValue.Result = res.ToArray(); return(returnValue); #endregion UserCode }