///<summary> /// Opens the connection/transaction for the given connectionString, and closes them when complete ///<summary> public static FR_L5BR_GDBFDBID_1155 Invoke(string ConnectionString, P_L5BR_GDBFDBID_1155 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { return(Invoke(null, null, ConnectionString, Parameter, securityTicket)); }
///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L5BR_GDBFDBID_1155 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5BR_GDBFDBID_1155 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L5BR_GDBFDBID_1155 functionReturn = new FR_L5BR_GDBFDBID_1155(); 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 { } Guid errorID = Guid.NewGuid(); ServerLog.Instance.Fatal("Application error occured. ErrorID = " + errorID, ex); throw new Exception("Exception occured in method cls_Get_DefaultBreakes_For_DeafultBreakeID", ex); } return(functionReturn); }
protected static FR_L5BR_GDBFDBID_1155 Execute(DbConnection Connection, DbTransaction Transaction, P_L5BR_GDBFDBID_1155 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L5BR_GDBFDBID_1155(); ORM_CMN_PPS_BreakTime_Default.Query defaultBreakTimeQuery = new ORM_CMN_PPS_BreakTime_Default.Query(); defaultBreakTimeQuery.CMN_PPS_BreakTime_DefaultID = Parameter.CMN_PPS_BreakTime_DefaultID; defaultBreakTimeQuery.IsDeleted = false; defaultBreakTimeQuery.Tenant_RefID = securityTicket.TenantID; List <ORM_CMN_PPS_BreakTime_Default> defaultBreakes = ORM_CMN_PPS_BreakTime_Default.Query.Search(Connection, Transaction, defaultBreakTimeQuery); if (defaultBreakes.Count != 0) { L5BR_GDBFT_1153 breakItem = new L5BR_GDBFT_1153(); breakItem.BreakTime_Template_RefID = defaultBreakes[0].BreakTime_Template_RefID; breakItem.CMN_PPS_BreakTime_DefaultID = defaultBreakes[0].CMN_PPS_BreakTime_DefaultID; breakItem.ExpectedWorkTime_in_sec = defaultBreakes[0].ExpectedWorkTime_in_sec; breakItem.ValidFromTimeOffset_in_sec = defaultBreakes[0].ValidFromTimeOffset_in_sec; breakItem.ValidToTimeOffset_in_sec = defaultBreakes[0].ValidToTimeOffset_in_sec; ORM_CMN_PPS_BreakTime_Defaults_StructureBinding.Query structureBindingQuery = new ORM_CMN_PPS_BreakTime_Defaults_StructureBinding.Query(); structureBindingQuery.BreakTime_Default_RefID = defaultBreakes[0].CMN_PPS_BreakTime_DefaultID; structureBindingQuery.IsDeleted = false; structureBindingQuery.Tenant_RefID = securityTicket.TenantID; var structureBindings = ORM_CMN_PPS_BreakTime_Defaults_StructureBinding.Query.Search(Connection, Transaction, structureBindingQuery); if (structureBindings.Count != 0) { breakItem.BoundTo_Office_RefID = structureBindings[0].BoundTo_Office_RefID; breakItem.BoundTo_WorkArea_RefID = structureBindings[0].BoundTo_WorkArea_RefID; breakItem.BoundTo_Workplace_RefID = structureBindings[0].BoundTo_Workplace_RefID; } else { breakItem.BoundTo_Office_RefID = Guid.Empty; breakItem.BoundTo_WorkArea_RefID = Guid.Empty; breakItem.BoundTo_Workplace_RefID = Guid.Empty; } returnValue.Result = new L5BR_GDBFDBID_1155(); returnValue.Result.DefaultBreak = breakItem; } else { return(returnValue); } //Put your code here return(returnValue); #endregion UserCode }
///<summary> /// Invokes the method for the given Connection, and Transaction, leaving them open/not commited if no exceptions occured ///<summary> public static FR_L5BR_GDBFDBID_1155 Invoke(DbConnection Connection, DbTransaction Transaction, P_L5BR_GDBFDBID_1155 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { return(Invoke(Connection, Transaction, null, Parameter, securityTicket)); }