///<summary> /// Invokes the method for the given Connection, and Transaction, leaving them open/not commited if no exceptions occured ///<summary> public static FR_Base Invoke(DbConnection Connection, DbTransaction Transaction, P_L5CM_DCSFL_1545 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { return(Invoke(Connection, Transaction, null, Parameter, securityTicket)); }
protected static FR_Base Execute(DbConnection Connection, DbTransaction Transaction, P_L5CM_DCSFL_1545 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_Base(); foreach (var item in Parameter.Items) { //Office if (item.StructureType == 1) { P_L5OF_DO_0952 par = new P_L5OF_DO_0952(); par.CMN_STR_OfficeID = item.StructureItemID; par.CMN_CAL_CalendarInstance_RefID = item.CMN_CAL_CalendarInstance_RefID; cls_Delete_Office.Invoke(Connection, Transaction, par); } //WorkArea else if (item.StructureType == 2) { P_L5WA_DWA_0923 par = new P_L5WA_DWA_0923(); par.CMN_STR_PPS_WorkAreaID = item.StructureItemID; par.CMN_CAL_CalendarInstance_RefID = item.CMN_CAL_CalendarInstance_RefID; cls_Delete_WorkArea.Invoke(Connection, Transaction, par); } //WorkPlace else if (item.StructureType == 3) { P_L5WP_DWP_0917 par = new P_L5WP_DWP_0917(); par.CMN_STR_PPS_WorkplaceID = item.StructureItemID; par.CMN_CAL_CalendarInstance_RefID = item.CMN_CAL_CalendarInstance_RefID; cls_Delete_WorkPlace.Invoke(Connection, Transaction, par); } } return(returnValue); #endregion UserCode }
///<summary> /// Opens the connection/transaction for the given connectionString, and closes them when complete ///<summary> public static FR_Base Invoke(string ConnectionString, P_L5CM_DCSFL_1545 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { return(Invoke(null, null, ConnectionString, Parameter, securityTicket)); }
///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_Base Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5CM_DCSFL_1545 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 ex; } return(functionReturn); }