///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L3MD_GDwPfT_1404_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L3MD_GDwPfT_1404_Array functionReturn = new FR_L3MD_GDwPfT_1404_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_Doctor_withPractice_forTenant", ex); } return(functionReturn); }
protected static FR_L3MD_GDwPfT_1404_Array Execute(DbConnection Connection, DbTransaction Transaction, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L3MD_GDwPfT_1404_Array(); var basicInfos = cls_Get_Doctor_BaseInfo_withPractice_forTenant.Invoke(Connection, Transaction, securityTicket).Result; var accs = cls_Retrive_Account_Code_Details_forTenant.Invoke(Connection, Transaction, securityTicket).Result; var customerQuery = new ORM_CMN_BPT_CTM_Customer.Query(); customerQuery.Tenant_RefID = securityTicket.TenantID; customerQuery.IsDeleted = false; var customerRes = ORM_CMN_BPT_CTM_Customer.Query.Search(Connection, Transaction, customerQuery); var ORM_CMN_BPT_CTM_Customer_2_SalesRepresentativeQuery = new ORM_CMN_BPT_CTM_Customer_2_SalesRepresentative.Query(); ORM_CMN_BPT_CTM_Customer_2_SalesRepresentativeQuery.Tenant_RefID = securityTicket.TenantID; ORM_CMN_BPT_CTM_Customer_2_SalesRepresentativeQuery.IsDeleted = false; var cust2SalesRespRes = ORM_CMN_BPT_CTM_Customer_2_SalesRepresentative.Query.Search(Connection, Transaction, ORM_CMN_BPT_CTM_Customer_2_SalesRepresentativeQuery); List <L3MD_GDwPfT_1404> retVal = new List <L3MD_GDwPfT_1404>(); foreach (var item in basicInfos) { var doc = new L3MD_GDwPfT_1404(); doc.BaseInfo = item; if (item.Account_RefID != Guid.Empty) { var accountInfo = accs.FirstOrDefault(a => a.BusinessParticipant_RefID == item.Doctor_CMN_BPT_BusinessParticipantID); if (accountInfo != null) { doc.AccountInfo = new L3MD_GDwPfT_1404_AccountInfo(); doc.AccountInfo.AccountCode_ValidFrom = accountInfo.AccountCode_ValidFrom; doc.AccountInfo.AccountCode_Value = accountInfo.AccountCode_Value; doc.AccountInfo.USR_AccountID = accountInfo.Account_RefID; doc.AccountInfo.USR_Device_AccountCodeID = accountInfo.USR_Device_AccountCodeID; } var customer = customerRes.FirstOrDefault(c => c.Ext_BusinessParticipant_RefID == item.Doctor_CMN_BPT_BusinessParticipantID); if (customer != null) { var c2SalesResp = cust2SalesRespRes.FirstOrDefault(sr => sr.Customer_RefID == customer.CMN_BPT_CTM_CustomerID); if (c2SalesResp != null) { doc.SalesRepresentative = new L3MD_GDwPfT_1404_SalesRepresentative(); doc.SalesRepresentative.SalesRepresentative_RefID = c2SalesResp.SalesRepresentative_RefID; } } } retVal.Add(doc); } returnValue.Result = retVal.ToArray(); return(returnValue); #endregion UserCode }