///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L6TR_GTfS_1624 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L6TR_GTfS_1624 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L6TR_GTfS_1624 functionReturn = new FR_L6TR_GTfS_1624(); 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 ex; } return(functionReturn); }
protected static FR_L6TR_GTfS_1624 Execute(DbConnection Connection, DbTransaction Transaction, P_L6TR_GTfS_1624 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L6TR_GTfS_1624(); List <L5TR_GaTfT_1211> AllTreatments = cls_Get_all_Treatment_for_TennantID.Invoke(Connection, Transaction, securityTicket).Result.ToList(); List <L5TR_GaTfT_1211> FilteredTreatments = new List <L5TR_GaTfT_1211>(); if (!Parameter.isBilled || !Parameter.isSheduled || !Parameter.isPerformed) { AllTreatments = AllTreatments.Where(x => (Parameter.isBilled == true && x.IsTreatmentBilled == Parameter.isBilled) || (Parameter.isPerformed == true && x.IsTreatmentPerformed == Parameter.isPerformed && x.IsTreatmentBilled == false) || (Parameter.isSheduled == true && x.IsScheduled == Parameter.isSheduled && x.IsTreatmentPerformed == false)).ToList(); } if (Parameter.PracticeName != "") { foreach (var item in AllTreatments) { if (Core_ClassLibrarySupport.Utils.StringExtensions.ContainsIgnoreCase(item.DisplayName, Parameter.PracticeName) == true) { FilteredTreatments.Add(item); } } AllTreatments = FilteredTreatments; FilteredTreatments = new List <L5TR_GaTfT_1211>(); } if (Parameter.FirstName != "") { foreach (var item in AllTreatments) { if (Core_ClassLibrarySupport.Utils.StringExtensions.ContainsIgnoreCase(item.FirstName, Parameter.FirstName) == true) { FilteredTreatments.Add(item); } } AllTreatments = FilteredTreatments; FilteredTreatments = new List <L5TR_GaTfT_1211>(); } if (Parameter.LastName != "") { foreach (var item in AllTreatments) { if (Core_ClassLibrarySupport.Utils.StringExtensions.ContainsIgnoreCase(item.LastName, Parameter.LastName) == true) { FilteredTreatments.Add(item); } } AllTreatments = FilteredTreatments; FilteredTreatments = new List <L5TR_GaTfT_1211>(); } if (Parameter.InsuranceName != "") { foreach (var item in AllTreatments) { if (Core_ClassLibrarySupport.Utils.StringExtensions.ContainsIgnoreCase(item.CompanyName, Parameter.InsuranceName) == true) { FilteredTreatments.Add(item); } } } if (Parameter.TreatmentFrom != null) { foreach (var item in AllTreatments) { if (item.IsTreatmentBilled == true) { if (item.IfTreatmentBilled_Date > Parameter.TreatmentFrom) { FilteredTreatments.Add(item); } } else if (item.IsTreatmentPerformed == true) { if (item.IfTreatmentPerformed_Date > Parameter.TreatmentFrom) { FilteredTreatments.Add(item); } } else if (item.IsScheduled == true) { if (item.IfSheduled_Date > Parameter.TreatmentFrom) { FilteredTreatments.Add(item); } } } AllTreatments = FilteredTreatments; FilteredTreatments = new List <L5TR_GaTfT_1211>(); } if (Parameter.TreatmentTo != null) { foreach (var item in AllTreatments) { if (item.IsTreatmentBilled == true) { if (item.IfTreatmentBilled_Date < Parameter.TreatmentTo) { FilteredTreatments.Add(item); } } else if (item.IsTreatmentPerformed == true) { if (item.IfTreatmentPerformed_Date < Parameter.TreatmentTo) { FilteredTreatments.Add(item); } } else if (item.IsScheduled == true) { if (item.IfSheduled_Date < Parameter.TreatmentTo) { FilteredTreatments.Add(item); } } } AllTreatments = FilteredTreatments; FilteredTreatments = new List <L5TR_GaTfT_1211>(); } returnValue.Result = new L6TR_GTfS_1624(); returnValue.Result.AllTreatments = AllTreatments.ToArray(); return(returnValue); #endregion UserCode }