Ejemplo n.º 1
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_L5PL_GPfPaPLV_2357_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5PL_GPfPaPLV_2357 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_L5PL_GPfPaPLV_2357_Array functionReturn = new FR_L5PL_GPfPaPLV_2357_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_Prices_for_ProductID_and_PriceListVersionID", ex);
            }
            return(functionReturn);
        }
Ejemplo n.º 2
0
        protected static FR_L5PL_GPfPaPLV_2357_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L5PL_GPfPaPLV_2357 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            var returnStatus = new FR_L5PL_GPfPaPLV_2357_Array();

            DbCommand command = Connection.CreateCommand();

            command.Connection  = Connection;
            command.Transaction = Transaction;
            var commandLocation = "CL5_Zugseil_PriceLists.Atomic.Retrieval.SQL.cls_Get_Prices_for_ProductID_and_PriceListVersionID.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, "ProductID", Parameter.ProductID);

            CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "PriceListReleaseID", Parameter.PriceListReleaseID);



            List <L5PL_GPfPaPLV_2357> results = new List <L5PL_GPfPaPLV_2357>();
            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[] { "Pricelist_RefID", "CMN_SLS_Pricelist_ReleaseID", "Release_Version", "PricelistRelease_ValidFrom", "PricelistRelease_ValidTo", "IsPricelistAlwaysActive", "CMN_SLS_PriceID", "CMN_PRO_Product_Variant_RefID", "CMN_PRO_Product_RefID", "PriceAmount", "CMN_Currency_RefID" });
                while (reader.Read())
                {
                    L5PL_GPfPaPLV_2357 resultItem = new L5PL_GPfPaPLV_2357();
                    //0:Parameter Pricelist_RefID of type Guid
                    resultItem.Pricelist_RefID = reader.GetGuid(0);
                    //1:Parameter CMN_SLS_Pricelist_ReleaseID of type Guid
                    resultItem.CMN_SLS_Pricelist_ReleaseID = reader.GetGuid(1);
                    //2:Parameter Release_Version of type String
                    resultItem.Release_Version = reader.GetString(2);
                    //3:Parameter PricelistRelease_ValidFrom of type String
                    resultItem.PricelistRelease_ValidFrom = reader.GetString(3);
                    //4:Parameter PricelistRelease_ValidTo of type String
                    resultItem.PricelistRelease_ValidTo = reader.GetString(4);
                    //5:Parameter IsPricelistAlwaysActive of type bool
                    resultItem.IsPricelistAlwaysActive = reader.GetBoolean(5);
                    //6:Parameter CMN_SLS_PriceID of type Guid
                    resultItem.CMN_SLS_PriceID = reader.GetGuid(6);
                    //7:Parameter CMN_PRO_Product_Variant_RefID of type Guid
                    resultItem.CMN_PRO_Product_Variant_RefID = reader.GetGuid(7);
                    //8:Parameter CMN_PRO_Product_RefID of type Guid
                    resultItem.CMN_PRO_Product_RefID = reader.GetGuid(8);
                    //9:Parameter PriceAmount of type decimal
                    resultItem.PriceAmount = reader.GetDecimal(9);
                    //10:Parameter CMN_Currency_RefID of type Guid
                    resultItem.CMN_Currency_RefID = reader.GetGuid(10);

                    results.Add(resultItem);
                }
            }
            catch (Exception ex)
            {
                reader.Close();
                throw new Exception("Exception occured durng data retrieval in method cls_Get_Prices_for_ProductID_and_PriceListVersionID", ex);
            }
            reader.Close();
            //Load all the dictionaries from the datatables
            loader.Load();

            returnStatus.Result = results.ToArray();
            return(returnStatus);
        }