protected static FR_L5BD_GBwDDfTID_1017_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L5BD_GBwDDfTID_1017 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L5BD_GBwDDfTID_1017_Array(); //Put your code here var statusParam = new P_L5SH_GSSfGPMaT_1700 { GlobalPropertyMatchingID = EnumUtils.GetEnumDescription(EShipmentStatus.Shipped) }; var frStatus = cls_Get_Shipment_Status_for_GlobalPropertyMatchingID_and_TenantID.Invoke(Connection, Transaction, statusParam, securityTicket); Parameter.GetBillsParameter.ShipmentStatusID = frStatus.Result.LOG_SHP_Shipment_StatusID; var bills = cls_Get_AllFilteredBills_for_TenantID.Invoke(Connection, Transaction, Parameter.GetBillsParameter, securityTicket).Result; List <Guid> billHeaderIDs = new List <Guid>(); foreach (var bill in bills) { billHeaderIDs.Add(bill.BIL_BillHeaderID); } P_L5BD_GDDfBHL_1117 getDunningDetailsParameter = new P_L5BD_GDDfBHL_1117(); getDunningDetailsParameter.BillHeaderID_List = billHeaderIDs.ToArray(); getDunningDetailsParameter.DunningLevelID = Parameter.GetDunningDetailsParameter.DunningLevelID; getDunningDetailsParameter.DunningDateFrom = Parameter.GetDunningDetailsParameter.DunningDateFrom; getDunningDetailsParameter.DunningDateTo = Parameter.GetDunningDetailsParameter.DunningDateTo; getDunningDetailsParameter.IsReminded = Parameter.GetDunningDetailsParameter.IsReminded; var dunningDetailsForBills = new List <L5BD_GDDfBHL_1117>(); if (billHeaderIDs.Count > 0) { dunningDetailsForBills = cls_Get_DunningDetails_for_BillHeaderList.Invoke(Connection, Transaction, getDunningDetailsParameter, securityTicket).Result.ToList(); } List <L5BD_GBwDDfTID_1017> billsWithDunningDetails = new List <L5BD_GBwDDfTID_1017>(); foreach (var bill in bills) { L5BD_GBwDDfTID_1017 billWithDunningDetails = new L5BD_GBwDDfTID_1017(); if (dunningDetailsForBills.Where(x => x.BIL_BillHeader_RefID == bill.BIL_BillHeaderID) != null && dunningDetailsForBills.Where(x => x.BIL_BillHeader_RefID == bill.BIL_BillHeaderID).Count() > 0) { billWithDunningDetails.DunningDetails = dunningDetailsForBills.Where(x => x.BIL_BillHeader_RefID == bill.BIL_BillHeaderID).Single(); billWithDunningDetails.Bill = bill; billsWithDunningDetails.Add(billWithDunningDetails); } } returnValue.Result = billsWithDunningDetails.ToArray(); return(returnValue); #endregion UserCode }
protected static FR_L5SH_GCOaROfT_1517 Execute(DbConnection Connection, DbTransaction Transaction, P_L5SH_GCOaROfT_1517 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { //Leave UserCode region to enable user code saving #region UserCode var returnValue = new FR_L5SH_GCOaROfT_1517(); #region Determine Shipment 'Shipped' and 'Created' statuses var statusParam1 = new P_L5SH_GSSfGPMaT_1700 { GlobalPropertyMatchingID = EnumUtils.GetEnumDescription(EShipmentStatus.Shipped) }; var frStatus1 = cls_Get_Shipment_Status_for_GlobalPropertyMatchingID_and_TenantID.Invoke(Connection, Transaction, statusParam1, securityTicket); Parameter.FilterCriteria.ShipmentStatusID_Shipped = frStatus1.Result.LOG_SHP_Shipment_StatusID; var statusParam2 = new P_L5SH_GSSfGPMaT_1700 { GlobalPropertyMatchingID = EnumUtils.GetEnumDescription(EShipmentStatus.Created) }; var frStatus2 = cls_Get_Shipment_Status_for_GlobalPropertyMatchingID_and_TenantID.Invoke(Connection, Transaction, statusParam1, securityTicket); Parameter.FilterCriteria.ShipmentStatusID_Created = frStatus1.Result.LOG_SHP_Shipment_StatusID; #endregion #region Get Client Orders var resultClientOrders = cls_Get_Client_Orders_with_Details_for_TenantID.Invoke(Connection, Transaction, Parameter.FilterCriteria, securityTicket).Result; #endregion #region Get Client Return Orders var clientReturnOrderParameter = new P_L5SH_GCORPwDfT_1455() { Customer = Parameter.FilterCriteria.Customer, OrderNumber = Parameter.FilterCriteria.OrderNumber, PeriodFrom = Parameter.FilterCriteria.PeriodFrom, PeriodTo = Parameter.FilterCriteria.PeriodTo }; var resultClientReturnOrder = cls_Get_CustomerOrderReturnPositions_with_Details_forTenantID.Invoke(Connection, Transaction, clientReturnOrderParameter, securityTicket).Result; #endregion #region Set Result returnValue.Result = new L5SH_GCOaROfT_1517(); returnValue.Result.ClientOrders = resultClientOrders; returnValue.Result.ClientReturnOrders = resultClientReturnOrder; returnValue.Status = FR_Status.Success; #endregion return(returnValue); #endregion UserCode }