protected static FR_L5OU_SOUT_1447 Execute(DbConnection Connection, DbTransaction Transaction, P_L5OU_SOUT_1447 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { //Leave UserCode region to enable user code saving #region UserCode var returnValue = new FR_L5OU_SOUT_1447(); //Put your code here List <L5OU_SOUT_1447_DeletingMessage> delMessage = new List <L5OU_SOUT_1447_DeletingMessage>(); Guid OfficeTypeId = Guid.Empty; if (!Parameter.BaseData.IsDeleted) { OfficeTypeId = cls_Save_OfficeType.Invoke(Connection, Transaction, Parameter.BaseData, securityTicket).Result; } else { ORM_CMN_STR_Office_2_OfficeType existingOffice = ORM_CMN_STR_Office_2_OfficeType.Query.Search(Connection, Transaction, new ORM_CMN_STR_Office_2_OfficeType.Query { IsDeleted = false, Tenant_RefID = securityTicket.TenantID, Office_Type_RefID = Parameter.BaseData.OfficeTypeID }).FirstOrDefault(); if (existingOffice != null) //cannot delete { delMessage.Add(new L5OU_SOUT_1447_DeletingMessage { DependentTables = "Office" }); } if (delMessage.Count > 0) { returnValue.Result.DeletingMessage = delMessage.ToArray(); } else { OfficeTypeId = cls_Save_OfficeType.Invoke(Connection, Transaction, Parameter.BaseData, securityTicket).Result; } } returnValue.Result.ID = OfficeTypeId; return(returnValue); #endregion UserCode }
///<summary> /// Ivokes the method with the given Connection, leaving it open if no exceptions occured ///<summary> public static FR_L5OU_SOUT_1447 Invoke(DbConnection Connection, P_L5OU_SOUT_1447 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { return(Invoke(Connection, null, null, Parameter, securityTicket)); }
///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L5OU_SOUT_1447 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5OU_SOUT_1447 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L5OU_SOUT_1447 functionReturn = new FR_L5OU_SOUT_1447(); 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_Save_OrgUnitType", ex); } return(functionReturn); }