protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L5BL_SB_1645 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_Guid(); #region Bill Header Guid BillHeaderID; if (Parameter.BillHeaderData.BIL_BillHeaderID == Guid.Empty) { // Create bill header data P_L5CO_CBH_1606 paramHeader = new P_L5CO_CBH_1606 { Bill_Parameter = Parameter }; BillHeaderID = cls_CreateBillHeader.Invoke(Connection, Transaction, paramHeader, securityTicket).Result; } else { //Edit bill header data P_L5CO_EBH_1108 paramHeader = new P_L5CO_EBH_1108 { Bill_Parameter = Parameter }; BillHeaderID = cls_Edit_BillHeader.Invoke(Connection, Transaction, paramHeader, securityTicket).Result; } if (Parameter.InstallmentPlan != null) { var installmentParameter = Parameter.InstallmentPlan; installmentParameter.BillHeaderID = BillHeaderID; cls_Save_InstallmentPlan_for_Bill.Invoke(Connection, Transaction, installmentParameter, securityTicket); } #endregion #region Bill Positions if (Parameter.BillHeaderData.ShipmentHeaderIDs != null && Parameter.BillHeaderData.ShipmentHeaderIDs.Count() != 0) { var paramPos = new P_L5BL_CBPfSH(); paramPos.BillHeaderID = BillHeaderID; paramPos.ShipmentHeaderIDs = Parameter.BillHeaderData.ShipmentHeaderIDs; cls_Create_BillPositions_for_ShipmentHeaders.Invoke(Connection, Transaction, paramPos, securityTicket); } #endregion returnValue.Result = BillHeaderID; return(returnValue); #endregion UserCode }
///<summary> /// Ivokes the method with the given Connection, leaving it open if no exceptions occured ///<summary> public static FR_Guid Invoke(DbConnection Connection, P_L5BL_SB_1645 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { return(Invoke(Connection, null, null, Parameter, securityTicket)); }
///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_Guid Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5BL_SB_1645 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_Guid functionReturn = new FR_Guid(); 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_SaveBill", ex); } return(functionReturn); }