protected static FR_L5SG_GSPwP_1825 Execute(DbConnection Connection, DbTransaction Transaction, P_L5SG_GSPwP_1825 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L5SG_GSPwP_1825(); returnValue.Result = new L5SG_GSPwP_1825(); var filterCriteria = new P_L3WH_GSPfFC_1504() { WarehouseGroupID = Parameter.Warehouse_GroupID, WarehouseID = Parameter.WarehouseID, AreaID = Parameter.AreaID, RackID = Parameter.RackID, UseShelfIDList = Parameter.UseShelfList, ShelfIDs = Parameter.ShelfID_List, UseProductIDList = false, ProductIDs = new Guid[] { Guid.Empty }, BottomShelfQuantity = (int?)Parameter.QuantityBottom, TopShelfQuantity = (int?)Parameter.QuantityTop, UseProductTrackingInstanceIDList = false, ProductTrackingInstanceIDs = new Guid[] { Guid.Empty }, StartExpirationDate = null, EndExpirationDate = null }; returnValue.Result.WareHouseStructure = cls_Get_StoragePlaces_for_FilterCriteria.Invoke( Connection, Transaction, filterCriteria, securityTicket).Result; if (Parameter.PredefinedProduct != null && Parameter.PredefinedProduct != Guid.Empty && Parameter.IsMultiSelect == false) { foreach (L3WH_GSPfFC_1504 whStructure in returnValue.Result.WareHouseStructure.Where(whStructure => whStructure.Predefined_Product_RefID == Parameter.PredefinedProduct)) { returnValue.Result.HasDefaultShelf = true; returnValue.Result.ShelfID = whStructure.LOG_WRH_ShelfID; return(returnValue); } } // second case. Area has flag IsDefaultIntakeArea set to true foreach (L3WH_GSPfFC_1504 whStructure in returnValue.Result.WareHouseStructure) { if (whStructure.IsDefaultIntakeArea) { var rack = ORM_LOG_WRH_Rack.Query.Search(Connection, Transaction, new ORM_LOG_WRH_Rack.Query { Area_RefID = whStructure.LOG_WRH_AreaID, IsDeleted = false }).FirstOrDefault(); if (rack != null) { var shelf = ORM_LOG_WRH_Shelf.Query.Search(Connection, Transaction, new ORM_LOG_WRH_Shelf.Query { Rack_RefID = rack.LOG_WRH_RackID, IsDeleted = false }).FirstOrDefault(); if (shelf != null) { returnValue.Result.ShelfID = whStructure.LOG_WRH_ShelfID; returnValue.Result.HasDefaultShelf = false; return(returnValue); } } } } // third case - no default settings at all returnValue.Result.HasDefaultShelf = false; returnValue.Result.ShelfID = null; 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_L5SG_GSPwP_1825 Invoke(DbConnection Connection, DbTransaction Transaction, P_L5SG_GSPwP_1825 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { return(Invoke(Connection, Transaction, null, Parameter, securityTicket)); }
///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L5SG_GSPwP_1825 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5SG_GSPwP_1825 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L5SG_GSPwP_1825 functionReturn = new FR_L5SG_GSPwP_1825(); 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_StoragePlaces_with_Predefined", ex); } return(functionReturn); }
///<summary> /// Opens the connection/transaction for the given connectionString, and closes them when complete ///<summary> public static FR_L5SG_GSPwP_1825 Invoke(string ConnectionString, P_L5SG_GSPwP_1825 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { return(Invoke(null, null, ConnectionString, Parameter, securityTicket)); }