protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L5CU_CACDA_1644 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_Guid(); //Put your code here if (Parameter.IsCompany) { ORM_CMN_COM_CompanyInfo_Address.Query queryComAdressIsDefault = new ORM_CMN_COM_CompanyInfo_Address.Query(); queryComAdressIsDefault.IsDefault = true; queryComAdressIsDefault.CompanyInfo_RefID = Parameter.CompanyInfoID; queryComAdressIsDefault.IsBilling = Parameter.IsBilling; queryComAdressIsDefault.IsShipping = !Parameter.IsBilling; List <ORM_CMN_COM_CompanyInfo_Address> companyAdresses = ORM_CMN_COM_CompanyInfo_Address.Query.Search(Connection, Transaction, queryComAdressIsDefault); if (companyAdresses.Count != 0 || companyAdresses != null) { foreach (ORM_CMN_COM_CompanyInfo_Address item1 in companyAdresses) { item1.IsDefault = false; item1.Save(Connection, Transaction); } } } else { ORM_CMN_PER_PersonInfo_2_Address.Query queryPerAdressIsDefault = new ORM_CMN_PER_PersonInfo_2_Address.Query(); queryPerAdressIsDefault.IsPrimary = true; queryPerAdressIsDefault.CMN_PER_PersonInfo_RefID = Parameter.PersonInfoID; queryPerAdressIsDefault.IsAddress_Billing = Parameter.IsBilling; queryPerAdressIsDefault.IsAddress_Shipping = !Parameter.IsBilling; List <ORM_CMN_PER_PersonInfo_2_Address> personAdresses = ORM_CMN_PER_PersonInfo_2_Address.Query.Search(Connection, Transaction, queryPerAdressIsDefault); if (personAdresses.Count != 0 || personAdresses != null) { foreach (ORM_CMN_PER_PersonInfo_2_Address item1 in personAdresses) { item1.IsPrimary = false; item1.Save(Connection, Transaction); } } } return(returnValue); #endregion UserCode }
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 }
protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L5OP_SP_1602 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_Guid(); P_L2LN_GALFTID_1530 langParam = new P_L2LN_GALFTID_1530(); langParam.Tenant_RefID = securityTicket.TenantID; var languages = cls_Get_All_Languages_ForTenantID.Invoke(Connection, Transaction, langParam, securityTicket).Result; P_L3MP_SPBI_1602 basePracticeParam = new P_L3MP_SPBI_1602(); basePracticeParam.HEC_MedicalPractiseID = Parameter.HEC_MedicalPractiseID; basePracticeParam.Contact_EmergencyPhoneNumber = Parameter.PhoneNumber; basePracticeParam.Contact_Website_URL = Parameter.HomepageURL; basePracticeParam.PracticeEmail = Parameter.ContactEmail; basePracticeParam.PracticeName = Parameter.DisplyName; basePracticeParam.Region_Name = Parameter.AddressRegion; basePracticeParam.Street_Name = Parameter.AddressStreetName; basePracticeParam.Street_Number = Parameter.AddressStreetNumber; basePracticeParam.Town = Parameter.AddressCity; basePracticeParam.ZIP = Parameter.AddressZipCode; var practiceID = cls_Save_Practice_BaseInfo.Invoke(Connection, Transaction, basePracticeParam, securityTicket).Result; var practicesQuery = new ORM_HEC_MedicalPractis.Query(); practicesQuery.HEC_MedicalPractiseID = practiceID; var practices = ORM_HEC_MedicalPractis.Query.Search(Connection, Transaction, practicesQuery).First(); var companyInfoQuery = new ORM_CMN_COM_CompanyInfo.Query(); companyInfoQuery.CMN_COM_CompanyInfoID = practices.Ext_CompanyInfo_RefID; var companyInfo = ORM_CMN_COM_CompanyInfo.Query.Search(Connection, Transaction, companyInfoQuery).First(); var bParticipantQuery = new ORM_CMN_BPT_BusinessParticipant.Query(); bParticipantQuery.IfCompany_CMN_COM_CompanyInfo_RefID = companyInfo.CMN_COM_CompanyInfoID; var bParticipant = ORM_CMN_BPT_BusinessParticipant.Query.Search(Connection, Transaction, bParticipantQuery).First(); ORM_CMN_BPT_BusinessParticipant bpContctPerson; if (practices.ContactPerson_RefID != Guid.Empty) { var bpContctPersonQuery = new ORM_CMN_BPT_BusinessParticipant.Query(); bpContctPersonQuery.CMN_BPT_BusinessParticipantID = practices.ContactPerson_RefID; bpContctPerson = ORM_CMN_BPT_BusinessParticipant.Query.Search(Connection, Transaction, bpContctPersonQuery).First(); } else { bpContctPerson = new ORM_CMN_BPT_BusinessParticipant(); bpContctPerson.Tenant_RefID = securityTicket.TenantID; bpContctPerson.IsNaturalPerson = true; } bpContctPerson.DisplayName = Parameter.ContactPerson_Name; bpContctPerson.Save(Connection, Transaction); practices.ContactPerson_RefID = bpContctPerson.CMN_BPT_BusinessParticipantID; ORM_CMN_CAL_WeeklyOfficeHours_Template officeHours; ORM_CMN_CAL_WeeklyOfficeHours_Template consultingHours; if (practices.WeeklyOfficeHours_Template_RefID != Guid.Empty && practices.WeeklySurgeryHours_Template_RefID != Guid.Empty) { var officeHoursQuery = new ORM_CMN_CAL_WeeklyOfficeHours_Template.Query(); officeHoursQuery.CMN_CAL_WeeklyOfficeHours_TemplateID = practices.WeeklyOfficeHours_Template_RefID; officeHours = ORM_CMN_CAL_WeeklyOfficeHours_Template.Query.Search(Connection, Transaction, officeHoursQuery).First(); officeHoursQuery.CMN_CAL_WeeklyOfficeHours_TemplateID = practices.WeeklySurgeryHours_Template_RefID; consultingHours = ORM_CMN_CAL_WeeklyOfficeHours_Template.Query.Search(Connection, Transaction, officeHoursQuery).First(); } else { officeHours = new ORM_CMN_CAL_WeeklyOfficeHours_Template(); officeHours.CMN_CAL_WeeklyOfficeHours_TemplateID = Guid.NewGuid(); consultingHours = new ORM_CMN_CAL_WeeklyOfficeHours_Template(); consultingHours.CMN_CAL_WeeklyOfficeHours_TemplateID = Guid.NewGuid(); practices.WeeklyOfficeHours_Template_RefID = officeHours.CMN_CAL_WeeklyOfficeHours_TemplateID; practices.WeeklySurgeryHours_Template_RefID = consultingHours.CMN_CAL_WeeklyOfficeHours_TemplateID; } consultingHours.Tenant_RefID = securityTicket.TenantID; officeHours.Tenant_RefID = securityTicket.TenantID; consultingHours.FormattedOfficeHours = Parameter.Consultation_FormattedOfficeHours; officeHours.FormattedOfficeHours = Parameter.Working_FormattedOfficeHours; consultingHours.Save(Connection, Transaction); officeHours.Save(Connection, Transaction); ORM_CMN_COM_CompanyInfo_Type companyType; var companyTypeQuery = new ORM_CMN_COM_CompanyInfo_Type.Query(); companyTypeQuery.IsDeleted = false; companyTypeQuery.CMN_COM_CompanyInfo_TypeID = Parameter.PracticeType_RefID; companyType = ORM_CMN_COM_CompanyInfo_Type.Query.Search(Connection, Transaction, companyTypeQuery).FirstOrDefault(); if (companyType == null) { companyType = new ORM_CMN_COM_CompanyInfo_Type(); companyType.CMN_COM_CompanyInfo_TypeID = Parameter.PracticeType_RefID; companyType.CompanyType_Name = new Dict(); companyType.CompanyType_Name.DictionaryID = Guid.NewGuid(); if (languages != null) { foreach (var item in languages) { companyType.CompanyType_Name.AddEntry(item.CMN_LanguageID, STLD_PracticeType.typesItems.First(t => t.Value == Parameter.PracticeType_RefID).Text); } } } companyInfo.CompanyType_RefID = Parameter.PracticeType_RefID; ORM_HEC_PublicHealthcare_PhysitianAssociation pHealthcare; var pHealthcareQuery = new ORM_HEC_PublicHealthcare_PhysitianAssociation.Query(); pHealthcareQuery.HEC_PublicHealthcare_PhysitianAssociationID = Parameter.HealthAssociation_RefID; pHealthcare = ORM_HEC_PublicHealthcare_PhysitianAssociation.Query.Search(Connection, Transaction, pHealthcareQuery).FirstOrDefault(); if (pHealthcare == null) { pHealthcare = new ORM_HEC_PublicHealthcare_PhysitianAssociation(); pHealthcare.HEC_PublicHealthcare_PhysitianAssociationID = Parameter.HealthAssociation_RefID; pHealthcare.HealthAssociation_Name = STLD_MedicalAssociation.associationItems.First(t => t.Value == Parameter.HealthAssociation_RefID).Text; pHealthcare.Save(Connection, Transaction); } practices.AssociatedWith_PhysitianAssociation_RefID = Parameter.HealthAssociation_RefID; ORM_CMN_BPT_CTM_Customer customer; var customerQuery = new ORM_CMN_BPT_CTM_Customer.Query(); customerQuery.Ext_BusinessParticipant_RefID = bParticipant.CMN_BPT_BusinessParticipantID; var customerRes = ORM_CMN_BPT_CTM_Customer.Query.Search(Connection, Transaction, customerQuery); if (customerRes.Count == 0) { customer = new ORM_CMN_BPT_CTM_Customer(); customer.CMN_BPT_CTM_CustomerID = Guid.NewGuid(); customer.Ext_BusinessParticipant_RefID = bParticipant.CMN_BPT_BusinessParticipantID; } else { customer = ORM_CMN_BPT_CTM_Customer.Query.Search(Connection, Transaction, customerQuery).First(); } var affinityStatusQuery = new ORM_CMN_BPT_CTM_AffinityStatus.Query(); affinityStatusQuery.CMN_BPT_CTM_AffinityStatusID = Parameter.AffinityStatus_RefID; var affinityStatus = ORM_CMN_BPT_CTM_AffinityStatus.Query.Search(Connection, Transaction, affinityStatusQuery).FirstOrDefault(); if (affinityStatus == null) { affinityStatus = new ORM_CMN_BPT_CTM_AffinityStatus(); affinityStatus.CMN_BPT_CTM_AffinityStatusID = Parameter.AffinityStatus_RefID; affinityStatus.AffinityStatus_Name = new Dict(); affinityStatus.AffinityStatus_Name.DictionaryID = Guid.NewGuid(); if (languages != null) { foreach (var item in languages) { affinityStatus.AffinityStatus_Name.AddEntry(item.CMN_LanguageID, STLD_AffinityStatus.affinityItems.First(t => t.Value == Parameter.AffinityStatus_RefID).Text); } } affinityStatus.Save(Connection, Transaction); } customer.CustomerAffinityStatus_RefID = Parameter.AffinityStatus_RefID; customer.Tenant_RefID = securityTicket.TenantID; customer.Save(Connection, Transaction); ORM_CMN_COM_CompanyInfo_Address compAddress; ORM_CMN_UniversalContactDetail address; var compAddressQuery = new ORM_CMN_COM_CompanyInfo_Address.Query(); compAddressQuery.Tenant_RefID = securityTicket.TenantID; compAddressQuery.CompanyInfo_RefID = practices.Ext_CompanyInfo_RefID; var compAddressRes = ORM_CMN_COM_CompanyInfo_Address.Query.Search(Connection, Transaction, compAddressQuery); if (compAddressRes.Count > 0) { compAddress = compAddressRes.First(); var addressQuery = new ORM_CMN_UniversalContactDetail.Query(); addressQuery.CMN_UniversalContactDetailID = compAddress.Address_UCD_RefID; address = ORM_CMN_UniversalContactDetail.Query.Search(Connection, Transaction, addressQuery).First(); } else { compAddress = new ORM_CMN_COM_CompanyInfo_Address(); compAddress.CMN_COM_CompanyInfo_AddressID = Guid.NewGuid(); compAddress.IsShipping = true; compAddress.CompanyInfo_RefID = companyInfo.CMN_COM_CompanyInfoID; address = new ORM_CMN_UniversalContactDetail(); address.CMN_UniversalContactDetailID = Guid.NewGuid(); compAddress.Address_UCD_RefID = address.CMN_UniversalContactDetailID; } address.Town = Parameter.ShippingAddressCity; address.Street_Number = Parameter.ShippingAddressStreetNumber; address.Street_Name = Parameter.ShippingAddressStreetName; address.ZIP = Parameter.ShippingAddressZipCode; address.Region_Name = Parameter.ShippingAddressRegion; address.Tenant_RefID = securityTicket.TenantID; address.Save(Connection, Transaction); compAddress.Tenant_RefID = securityTicket.TenantID; compAddress.Save(Connection, Transaction); ORM_CMN_BPT_BusinessParticipant contactPBP; if (practices.ContactPerson_RefID != Guid.Empty) { var contactPBPQuery = new ORM_CMN_BPT_BusinessParticipant.Query(); contactPBPQuery.CMN_BPT_BusinessParticipantID = practices.ContactPerson_RefID; contactPBP = ORM_CMN_BPT_BusinessParticipant.Query.Search(Connection, Transaction, contactPBPQuery).First(); } else { contactPBP = new ORM_CMN_BPT_BusinessParticipant(); contactPBP.CMN_BPT_BusinessParticipantID = Guid.NewGuid(); contactPBP.IsCompany = true; practices.ContactPerson_RefID = contactPBP.CMN_BPT_BusinessParticipantID; } contactPBP.DisplayName = Parameter.ContactPerson_Name; contactPBP.Tenant_RefID = securityTicket.TenantID; contactPBP.Save(Connection, Transaction); companyInfo.Save(Connection, Transaction); practices.Save(Connection, Transaction); returnValue.Result = practices.HEC_MedicalPractiseID; return(returnValue); #endregion UserCode }
protected static FR_L3MP_GPfID_1222 Execute(DbConnection Connection, DbTransaction Transaction, P_L3MP_GPfID_1222 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L3MP_GPfID_1222(); returnValue.Result = new L3MP_GPfID_1222(); P_L3MP_GPBIfID_1131 paramBasicInfo = new P_L3MP_GPBIfID_1131(); paramBasicInfo.HEC_MedicalPractiseID = Parameter.HEC_MedicalPractiseID; var baseInfo = cls_Get_Practice_BaseInfo_For_ID.Invoke(Connection, Transaction, paramBasicInfo, securityTicket).Result; if (baseInfo == null) { returnValue.Result = null; return(returnValue); } returnValue.Result.BaseInfo = baseInfo; P_L3MP_GPCPfPID_1155 paramCP = new P_L3MP_GPCPfPID_1155(); paramCP.CMN_BPT_BusinessParticipantID = baseInfo.ContactPerson_RefID; var contactPerson = cls_Get_Practice_ContactPerson_For_PersonID.Invoke(Connection, Transaction, paramCP, securityTicket).Result; returnValue.Result.ContactPerson = contactPerson; if (baseInfo.WeeklyOfficeHours_Template_RefID != Guid.Empty && baseInfo.WeeklySurgeryHours_Template_RefID != Guid.Empty) { returnValue.Result.OfficeHours = new L3MP_GPfID_1222_OfficeHours(); var officeHoursQuery = new ORM_CMN_CAL_WeeklyOfficeHours_Template.Query(); officeHoursQuery.IsDeleted = false; officeHoursQuery.Tenant_RefID = securityTicket.TenantID; officeHoursQuery.CMN_CAL_WeeklyOfficeHours_TemplateID = baseInfo.WeeklyOfficeHours_Template_RefID; var officeHours = ORM_CMN_CAL_WeeklyOfficeHours_Template.Query.Search(Connection, Transaction, officeHoursQuery).First(); returnValue.Result.OfficeHours.WorkingHours_FormattedOfficeHours = officeHours.FormattedOfficeHours; officeHoursQuery.CMN_CAL_WeeklyOfficeHours_TemplateID = baseInfo.WeeklySurgeryHours_Template_RefID; var consultingHours = ORM_CMN_CAL_WeeklyOfficeHours_Template.Query.Search(Connection, Transaction, officeHoursQuery).First(); returnValue.Result.OfficeHours.ConsultingHours_FormattedOfficeHours = consultingHours.FormattedOfficeHours; returnValue.Result.OtherOphthal_PracticeData = new L3MP_GPfID_1222_OtherOphthal_PracticeData(); var companyTypeQuery = new ORM_CMN_COM_CompanyInfo_Type.Query(); companyTypeQuery.IsDeleted = false; companyTypeQuery.CMN_COM_CompanyInfo_TypeID = baseInfo.CompanyType_RefID; var companyType = ORM_CMN_COM_CompanyInfo_Type.Query.Search(Connection, Transaction, companyTypeQuery).First(); returnValue.Result.OtherOphthal_PracticeData.CompanyType_Name = companyType.CompanyType_Name; returnValue.Result.OtherOphthal_PracticeData.CMN_COM_CompanyInfo_TypeID = companyType.CMN_COM_CompanyInfo_TypeID; var pHealthcareQuery = new ORM_HEC_PublicHealthcare_PhysitianAssociation.Query(); pHealthcareQuery.HEC_PublicHealthcare_PhysitianAssociationID = baseInfo.AssociatedWith_PhysitianAssociation_RefID; var pHealthcare = ORM_HEC_PublicHealthcare_PhysitianAssociation.Query.Search(Connection, Transaction, pHealthcareQuery).First(); returnValue.Result.OtherOphthal_PracticeData.HealthAssociation_Name = pHealthcare.HealthAssociation_Name; returnValue.Result.OtherOphthal_PracticeData.HEC_PublicHealthcare_PhysitianAssociationID = baseInfo.AssociatedWith_PhysitianAssociation_RefID; var customerQuery = new ORM_CMN_BPT_CTM_Customer.Query(); customerQuery.Ext_BusinessParticipant_RefID = baseInfo.CMN_BPT_BusinessParticipantID; var customer = ORM_CMN_BPT_CTM_Customer.Query.Search(Connection, Transaction, customerQuery).FirstOrDefault(); if (customer != null) { var affinityStatusQuery = new ORM_CMN_BPT_CTM_AffinityStatus.Query(); affinityStatusQuery.CMN_BPT_CTM_AffinityStatusID = customer.CustomerAffinityStatus_RefID; var affinityStatus = ORM_CMN_BPT_CTM_AffinityStatus.Query.Search(Connection, Transaction, affinityStatusQuery).FirstOrDefault(); if (affinityStatus != null) { returnValue.Result.OtherOphthal_PracticeData.CMN_BPT_CTM_AffinityStatusID = affinityStatus.CMN_BPT_CTM_AffinityStatusID; returnValue.Result.OtherOphthal_PracticeData.AffinityStatus_Name = affinityStatus.AffinityStatus_Name; } } returnValue.Result.ShippingAddress = new L3MP_GPfID_1222_ShippingAddress(); var compAddressQuery = new ORM_CMN_COM_CompanyInfo_Address.Query(); compAddressQuery.Tenant_RefID = securityTicket.TenantID; compAddressQuery.CompanyInfo_RefID = baseInfo.CMN_COM_CompanyInfoID; compAddressQuery.IsShipping = true; compAddressQuery.IsDeleted = false; var compAddress = ORM_CMN_COM_CompanyInfo_Address.Query.Search(Connection, Transaction, compAddressQuery).First(); var addressQuery = new ORM_CMN_UniversalContactDetail.Query(); addressQuery.Tenant_RefID = securityTicket.TenantID; addressQuery.IsDeleted = false; addressQuery.CMN_UniversalContactDetailID = compAddress.Address_UCD_RefID; var address = ORM_CMN_UniversalContactDetail.Query.Search(Connection, Transaction, addressQuery).First(); returnValue.Result.ShippingAddress.CMN_UniversalContactDetailID = address.CMN_UniversalContactDetailID; returnValue.Result.ShippingAddress.CMN_COM_CompanyInfo_AddressID = compAddress.CMN_COM_CompanyInfo_AddressID; returnValue.Result.ShippingAddress.Region_Name = address.Region_Name; returnValue.Result.ShippingAddress.Street_Name = address.Street_Name; returnValue.Result.ShippingAddress.Street_Number = address.Street_Number; returnValue.Result.ShippingAddress.Town = address.Town; returnValue.Result.ShippingAddress.ZIP = address.ZIP; } return(returnValue); #endregion UserCode }