///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L5SG_GDfSCbA_1641_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5SG_GDfSCbA_1641 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L5SG_GDfSCbA_1641_Array functionReturn = new FR_L5SG_GDfSCbA_1641_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_Data_for_StockCorrection_by_Article", ex); } return(functionReturn); }
protected static FR_L5SG_GDfSCbA_1641_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L5SG_GDfSCbA_1641 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { var returnStatus = new FR_L5SG_GDfSCbA_1641_Array(); DbCommand command = Connection.CreateCommand(); command.Connection = Connection; command.Transaction = Transaction; var commandLocation = "CL5_APOLogistic_Storage.Atomic.Retrieval.SQL.cls_Get_Data_for_StockCorrection_by_Article.sql"; command.CommandText = new System.IO.StreamReader(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(commandLocation)).ReadToEnd(); CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "ticket", securityTicket); command.CommandTimeout = QueryTimeout; CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "BatchNumber", Parameter.BatchNumber); CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "ExpirationDate", Parameter.ExpirationDate); command.CommandText = System.Text.RegularExpressions.Regex.Replace(command.CommandText, "=[ \t]*@ProductID_List", " IN $$ProductID_List$$"); CSV2Core_MySQL.Support.DBSQLSupport.AppendINStatement(command, "$ProductID_List$", Parameter.ProductID_List); List <L5SG_GDfSCbA_1641> results = new List <L5SG_GDfSCbA_1641>(); var loader = new CSV2Core_MySQL.Dictionaries.MultiTable.Loader.DictionaryLoader(Connection, Transaction); var reader = new CSV2Core_MySQL.Support.DBSQLReader(command.ExecuteReader()); try { reader.SetOrdinals(new string[] { "Product_Number", "Product_Name_DictID", "DosageFormGlobalPropertyName", "DosageForm_Name_DictID", "PackageContent_Amount", "ISOCode", "Quantity_Current", "BatchNumber", "ExpirationDate", "Rack_Name", "Shelf_Name", "Area_Name", "Warehouse_Name", "CMN_PRO_ProductID", "LOG_ProductTrackingInstanceID", "CurrentQuantityOnTrackingInstance", "LOG_WRH_Shelf_ContentID" }); while (reader.Read()) { L5SG_GDfSCbA_1641 resultItem = new L5SG_GDfSCbA_1641(); //0:Parameter Product_Number of type String resultItem.Product_Number = reader.GetString(0); //1:Parameter Product_Name of type Dict resultItem.Product_Name = reader.GetDictionary(1); resultItem.Product_Name.SourceTable = "cmn_pro_products"; loader.Append(resultItem.Product_Name); //2:Parameter DosageFormGlobalPropertyName of type String resultItem.DosageFormGlobalPropertyName = reader.GetString(2); //3:Parameter DosageForm_Name of type Dict resultItem.DosageForm_Name = reader.GetDictionary(3); resultItem.DosageForm_Name.SourceTable = "hec_product_dosageforms"; loader.Append(resultItem.DosageForm_Name); //4:Parameter PackageContent_Amount of type String resultItem.PackageContent_Amount = reader.GetString(4); //5:Parameter ISOCode of type String resultItem.ISOCode = reader.GetString(5); //6:Parameter Quantity_Current of type double resultItem.Quantity_Current = reader.GetDouble(6); //7:Parameter BatchNumber of type String resultItem.BatchNumber = reader.GetString(7); //8:Parameter ExpirationDate of type DateTime resultItem.ExpirationDate = reader.GetDate(8); //9:Parameter Rack_Name of type String resultItem.Rack_Name = reader.GetString(9); //10:Parameter Shelf_Name of type String resultItem.Shelf_Name = reader.GetString(10); //11:Parameter Area_Name of type String resultItem.Area_Name = reader.GetString(11); //12:Parameter Warehouse_Name of type String resultItem.Warehouse_Name = reader.GetString(12); //13:Parameter CMN_PRO_ProductID of type Guid resultItem.CMN_PRO_ProductID = reader.GetGuid(13); //14:Parameter LOG_ProductTrackingInstanceID of type Guid resultItem.LOG_ProductTrackingInstanceID = reader.GetGuid(14); //15:Parameter CurrentQuantityOnTrackingInstance of type double resultItem.CurrentQuantityOnTrackingInstance = reader.GetDouble(15); //16:Parameter LOG_WRH_Shelf_ContentID of type Guid resultItem.LOG_WRH_Shelf_ContentID = reader.GetGuid(16); results.Add(resultItem); } } catch (Exception ex) { reader.Close(); throw new Exception("Exception occured durng data retrieval in method cls_Get_Data_for_StockCorrection_by_Article", ex); } reader.Close(); //Load all the dictionaries from the datatables loader.Load(); returnStatus.Result = results.ToArray(); return(returnStatus); }