protected static FR_CAS_CCTS_1001 Execute(DbConnection Connection, DbTransaction Transaction, P_CAS_CCTS_1001 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_CAS_CCTS_1001(); returnValue.Result = new CAS_CCTS_1001(); var StatusForCase = ORM_BIL_BillPosition_TransmitionStatus.Query.Search(Connection, Transaction, new ORM_BIL_BillPosition_TransmitionStatus.Query() { IsDeleted = false, IsActive = true, Tenant_RefID = securityTicket.TenantID, BIL_BillPosition_TransmitionStatusID = Parameter.BIL_BillPosition_TransmitionStatusID }).SingleOrDefault(); if (!Parameter.AreCasesPaymentAndStatus) { if (StatusForCase != null) { returnValue.Result.Old_Status_Modification_Timestamp = StatusForCase.Modification_Timestamp; StatusForCase.Modification_Timestamp = DateTime.Now; StatusForCase.IsActive = false; StatusForCase.Save(Connection, Transaction); returnValue.Result.New_Status_Modification_Timestamp = StatusForCase.Modification_Timestamp; var NewStatusForCase = new ORM_BIL_BillPosition_TransmitionStatus(); NewStatusForCase.IsDeleted = false; NewStatusForCase.Creation_Timestamp = DateTime.Now; NewStatusForCase.Modification_Timestamp = DateTime.Now; NewStatusForCase.Tenant_RefID = securityTicket.TenantID; NewStatusForCase.IsActive = true; NewStatusForCase.BIL_BillPosition_TransmitionStatusID = Guid.NewGuid(); NewStatusForCase.BillPosition_RefID = StatusForCase.BillPosition_RefID; NewStatusForCase.TransmitionCode = Convert.ToInt32(Parameter.StatusTo); NewStatusForCase.TransmittedOnDate = DateTime.Now; NewStatusForCase.TransmitionStatusKey = StatusForCase.TransmitionStatusKey; NewStatusForCase.Save(Connection, Transaction); returnValue.Result.New_BIL_BillPosition_TransmitionStatusID = NewStatusForCase.BIL_BillPosition_TransmitionStatusID; } } return(returnValue); #endregion UserCode }
///<summary> /// Ivokes the method with the given Connection, leaving it open if no exceptions occured ///<summary> public static FR_CAS_CCTS_1001 Invoke(DbConnection Connection, P_CAS_CCTS_1001 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { return(Invoke(Connection, null, null, Parameter, securityTicket)); }
///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_CAS_CCTS_1001 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_CAS_CCTS_1001 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_CAS_CCTS_1001 functionReturn = new FR_CAS_CCTS_1001(); 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_Change_Case_TransmitionStatus", ex); } return(functionReturn); }