///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L3ASS_GAFID_1815 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L3ASS_GAFID_1815 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L3ASS_GAFID_1815 functionReturn = new FR_L3ASS_GAFID_1815(); 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_Assortment_for_ID", ex); } return(functionReturn); }
protected static FR_L3ASS_GAFID_1815 Execute(DbConnection Connection, DbTransaction Transaction, P_L3ASS_GAFID_1815 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { var returnStatus = new FR_L3ASS_GAFID_1815(); DbCommand command = Connection.CreateCommand(); command.Connection = Connection; command.Transaction = Transaction; var commandLocation = "CL3_Assortment.Atomic.Retrieval.SQL.cls_Get_Assortment_for_ID.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, "AssortmentID", Parameter.AssortmentID); List <L3ASS_GAFID_1815> results = new List <L3ASS_GAFID_1815>(); 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[] { "CMN_PRO_ASS_AssortmentID", "AssortmentName_DictID", "AvailableForOrderingFrom", "AvailableForOrderingThrough", "IsDefaultAssortment_ForPersonalOrder", "IsDefaultAssortment_ForOfficeOrder", "IsDefaultAssortment_ForCostcenterOrder", "IsDefaultAssortment_ForWarehouseOrder", "IsDeleted", "Tenant_RefID" }); while (reader.Read()) { L3ASS_GAFID_1815 resultItem = new L3ASS_GAFID_1815(); //0:Parameter CMN_PRO_ASS_AssortmentID of type Guid resultItem.CMN_PRO_ASS_AssortmentID = reader.GetGuid(0); //1:Parameter AssortmentName of type Dict resultItem.AssortmentName = reader.GetDictionary(1); resultItem.AssortmentName.SourceTable = "cmn_pro_ass_assortments"; loader.Append(resultItem.AssortmentName); //2:Parameter AvailableForOrderingFrom of type DateTime resultItem.AvailableForOrderingFrom = reader.GetDate(2); //3:Parameter AvailableForOrderingThrough of type DateTime resultItem.AvailableForOrderingThrough = reader.GetDate(3); //4:Parameter IsDefaultAssortment_ForPersonalOrder of type bool resultItem.IsDefaultAssortment_ForPersonalOrder = reader.GetBoolean(4); //5:Parameter IsDefaultAssortment_ForOfficeOrder of type bool resultItem.IsDefaultAssortment_ForOfficeOrder = reader.GetBoolean(5); //6:Parameter IsDefaultAssortment_ForCostcenterOrder of type bool resultItem.IsDefaultAssortment_ForCostcenterOrder = reader.GetBoolean(6); //7:Parameter IsDefaultAssortment_ForWarehouseOrder of type bool resultItem.IsDefaultAssortment_ForWarehouseOrder = reader.GetBoolean(7); //8:Parameter IsDeleted of type bool resultItem.IsDeleted = reader.GetBoolean(8); //9:Parameter Tenant_RefID of type Guid resultItem.Tenant_RefID = reader.GetGuid(9); results.Add(resultItem); } } catch (Exception ex) { reader.Close(); throw new Exception("Exception occured durng data retrieval in method cls_Get_Assortment_for_ID", ex); } reader.Close(); //Load all the dictionaries from the datatables loader.Load(); returnStatus.Result = results.FirstOrDefault(); return(returnStatus); }