protected static FR_Base Execute(DbConnection Connection,DbTransaction Transaction,P_L5BTS_DSfPID_1103 Parameter,CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null){ //Leave UserCode region to enable user code saving #region UserCode var returnValue = new FR_Base(); var slots = ORM_PPS_TSK_BOK_BookableTimeSlot.Query.Search(Connection, Transaction, new ORM_PPS_TSK_BOK_BookableTimeSlot.Query() { Tenant_RefID = securityTicket.TenantID, IsDeleted = false, Office_RefID = Parameter.OfficeID }).ToArray(); foreach (var slot in slots) { var combinationsForDelete = ORM_PPS_TSK_BOK_AvailableResourceCombination.Query.Search(Connection, Transaction, new ORM_PPS_TSK_BOK_AvailableResourceCombination.Query() { Tenant_RefID = securityTicket.TenantID, IsDeleted = false, BookableTimeSlot_RefID = slot.PPS_TSK_BOK_BookableTimeSlotID }).ToArray(); foreach (var comionationForDelete in combinationsForDelete) { ORM_PPS_TSK_BOK_StaffResource.Query.SoftDelete(Connection, Transaction, new ORM_PPS_TSK_BOK_StaffResource.Query() { Tenant_RefID = securityTicket.TenantID, IsDeleted = false, AvailableResourceCombination_RefID = comionationForDelete.PPS_TSK_BOK_AvailableResourceCombinationID }); ORM_PPS_TSK_BOK_DeviceResource.Query.SoftDelete(Connection, Transaction, new ORM_PPS_TSK_BOK_DeviceResource.Query() { Tenant_RefID = securityTicket.TenantID, IsDeleted = false, AvailableResourceCombination_RefID = comionationForDelete.PPS_TSK_BOK_AvailableResourceCombinationID }); comionationForDelete.IsDeleted = true; comionationForDelete.Save(Connection, Transaction); } slot.IsDeleted = true; slot.Save(Connection, Transaction); } return returnValue; #endregion UserCode }
///<summary> /// Ivokes the method with the given Connection, leaving it open if no exceptions occured ///<summary> public static FR_Base Invoke(DbConnection Connection,P_L5BTS_DSfPID_1103 Parameter,CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { return Invoke(Connection, null, null,Parameter,securityTicket); }
///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_Base Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString,P_L5BTS_DSfPID_1103 Parameter,CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_Base functionReturn = new FR_Base(); 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_Delete_Slots_for_PracticeID",ex); } return functionReturn; }