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

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

            DbCommand command = Connection.CreateCommand();

            command.Connection  = Connection;
            command.Transaction = Transaction;
            var commandLocation = "CL5_APOAdmin_Articles.Atomic.Retrieval.SQL.cls_Get_ProductSuppliers_for_ProductID.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);



            List <L5AA_GPSfPI_1248_raw> results = new List <L5AA_GPSfPI_1248_raw>();
            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[] { "SupplierPriority", "MinimalPackageOrderingAmount", "BatchOrderSize", "DisplayName", "Tenant_RefID", "CMN_PRO_Product_RefID", "RecommendedRetailPrice_RefID", "SupplierType_Name_DictID", "GlobalPropertyMatchingID", "CMN_BPT_Supplier_RefID", "CMN_PRO_Product_SupplierID", "ProcurementPrice_RefID", "PriceValue_Amount", "ORD_PRC_DiscountType_RefID", "DiscountValue" });
                while (reader.Read())
                {
                    L5AA_GPSfPI_1248_raw resultItem = new L5AA_GPSfPI_1248_raw();
                    //0:Parameter SupplierPriority of type int
                    resultItem.SupplierPriority = reader.GetInteger(0);
                    //1:Parameter MinimalPackageOrderingAmount of type Double
                    resultItem.MinimalPackageOrderingAmount = reader.GetDouble(1);
                    //2:Parameter BatchOrderSize of type int
                    resultItem.BatchOrderSize = reader.GetInteger(2);
                    //3:Parameter DisplayName of type String
                    resultItem.DisplayName = reader.GetString(3);
                    //4:Parameter Tenant_RefID of type Guid
                    resultItem.Tenant_RefID = reader.GetGuid(4);
                    //5:Parameter CMN_PRO_Product_RefID of type Guid
                    resultItem.CMN_PRO_Product_RefID = reader.GetGuid(5);
                    //6:Parameter RecommendedRetailPrice_RefID of type Guid
                    resultItem.RecommendedRetailPrice_RefID = reader.GetGuid(6);
                    //7:Parameter SupplierType_Name_DictID of type Guid
                    resultItem.SupplierType_Name_DictID = reader.GetGuid(7);
                    //8:Parameter GlobalPropertyMatchingID of type String
                    resultItem.GlobalPropertyMatchingID = reader.GetString(8);
                    //9:Parameter CMN_BPT_Supplier_RefID of type Guid
                    resultItem.CMN_BPT_Supplier_RefID = reader.GetGuid(9);
                    //10:Parameter CMN_PRO_Product_SupplierID of type Guid
                    resultItem.CMN_PRO_Product_SupplierID = reader.GetGuid(10);
                    //11:Parameter ProcurementPrice_RefID of type Guid
                    resultItem.ProcurementPrice_RefID = reader.GetGuid(11);
                    //12:Parameter PriceValue_Amount of type Double
                    resultItem.PriceValue_Amount = reader.GetDouble(12);
                    //13:Parameter ORD_PRC_DiscountType_RefID of type Guid
                    resultItem.ORD_PRC_DiscountType_RefID = reader.GetGuid(13);
                    //14:Parameter DiscountValue of type Double
                    resultItem.DiscountValue = reader.GetDouble(14);

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

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