///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L5SO_GSHwBIfT_1533_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5SO_GSHwBIfT_1533 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L5SO_GSHwBIfT_1533_Array functionReturn = new FR_L5SO_GSHwBIfT_1533_Array(); 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_Get_ShippmentHeaders_with_BasicInfo_for_TenantID", ex); } return(functionReturn); }
protected static FR_L5SO_GSHwBIfT_1533_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L5SO_GSHwBIfT_1533 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L5SO_GSHwBIfT_1533_Array(); #region Retrieve Headers var param = new P_L5SO_GSOHfTID_1650() { IsPartiallyReadyForPicking = Parameter.IsPartiallyReadyForPicking, IsReadyForPicking = Parameter.IsReadyForPicking, HasPickingStarted = Parameter.HasPickingStarted, HasPickingFinished = Parameter.HasPickingFinished, IsManuallyCleared_ForPicking = Parameter.IsManuallyCleared_ForPicking, IsBilled = Parameter.IsBilled, IsShipped = Parameter.IsShipped }; var headers = cls_Get_ShippingOrderHeaders_for_TenantID.Invoke(Connection, Transaction, param, securityTicket).Result; var orgUnits = cls_Get_Shipment_OrganizationalUnits_for_TenantID.Invoke(Connection, Transaction, securityTicket).Result; #endregion var result = new List <L5SO_GSHwBIfT_1533>(); foreach (var header in headers) { var notesCount = ORM_LOG_SHP_Shipment_Note.Query.Search(Connection, Transaction, new ORM_LOG_SHP_Shipment_Note.Query() { Shipment_Header_RefID = header.LOG_SHP_Shipment_HeaderID, IsDeleted = false }).Count(); var orgUnit = orgUnits.Where(i => i.LOG_SHP_Shipment_Header_RefID == header.LOG_SHP_Shipment_HeaderID).SingleOrDefault(); if (orgUnit == null) { orgUnit = new L5SO_GSOUfT_1607(); } #region Get Shipment Positions List <Guid> ProductsInHeader = new List <Guid>(); P_L2SH_GSPfToSH_1334 positionsGetParam = new P_L2SH_GSPfToSH_1334(); positionsGetParam.ShipmentHeaderID = header.LOG_SHP_Shipment_HeaderID; var shipmentPositions = cls_Get_ShipmentPositions_for_Tenant_or_ShipmentHeaderID.Invoke(Connection, Transaction, positionsGetParam, securityTicket).Result.ToList(); ProductsInHeader = shipmentPositions.Select(x => x.CMN_PRO_Product_RefID).Distinct().ToList(); #endregion var item = new L5SO_GSHwBIfT_1533() { LOG_SHP_Shipment_HeaderID = header.LOG_SHP_Shipment_HeaderID, ORD_CUO_CustomerOrder_HeaderID = header.ORD_CUO_CustomerOrder_HeaderID, ShipmentHeader_Number = header.ShipmentHeader_Number, CustomerOrder_Number = header.CustomerOrder_Number, CustomerOrderCreationDate = header.CustomerOrderCreationDate, ShippingCreationDate = header.ShippingCreationDate, IsPartiallyReadyForPicking = header.IsPartiallyReadyForPicking, IsReadyForPicking = header.IsReadyForPicking, HasPickingStarted = header.HasPickingStarted, HasPickingFinished = header.HasPickingFinished, IsManuallyCleared_ForPicking = header.IsManuallyCleared_ForPicking, IsBilled = header.IsBilled, IsShipped = header.IsShipped, CompanyName_Line1 = header.CompanyName_Line1, NotesCount = notesCount, CMN_BPT_CTM_OrganizationalUnitID = orgUnit.CMN_BPT_CTM_OrganizationalUnitID, InternalOrganizationalUnitNumber = orgUnit.InternalOrganizationalUnitNumber, InternalOrganizationalUnitSimpleName = orgUnit.InternalOrganizationalUnitSimpleName, ShipmentHeaderAddress = header.Shippipng_AddressUCD_RefID, AllProductIDsInHeader = ProductsInHeader.ToArray() }; result.Add(item); } returnValue.Result = result.ToArray(); return(returnValue); #endregion UserCode }