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

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

            DbCommand command = Connection.CreateCommand();

            command.Connection  = Connection;
            command.Transaction = Transaction;
            var commandLocation = "CL3_Articles.Atomic.Retrieval.SQL.cls_Get_LocalArticles_for_SearchConditions.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, "LanguageID", Parameter.LanguageID);

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

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

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

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

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

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

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

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

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



            List <L3AR_GLAfSC_1320_raw> results = new List <L3AR_GLAfSC_1320_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[] { "CMN_PRO_ProductID", "ProductITL", "ProductName", "Product_Number", "IsProductPartOfDefaultStock", "ProductDistributionStatus", "ProducerName", "UnitAmount_DisplayLabel", "UnitIsoCode", "DossageFormName", "TaxRate", "IsActiveComponent", "SubstanceName" });
                while (reader.Read())
                {
                    L3AR_GLAfSC_1320_raw resultItem = new L3AR_GLAfSC_1320_raw();
                    //0:Parameter CMN_PRO_ProductID of type Guid
                    resultItem.CMN_PRO_ProductID = reader.GetGuid(0);
                    //1:Parameter ProductITL of type String
                    resultItem.ProductITL = reader.GetString(1);
                    //2:Parameter ProductName of type String
                    resultItem.ProductName = reader.GetString(2);
                    //3:Parameter Product_Number of type String
                    resultItem.Product_Number = reader.GetString(3);
                    //4:Parameter IsProductPartOfDefaultStock of type bool
                    resultItem.IsProductPartOfDefaultStock = reader.GetBoolean(4);
                    //5:Parameter ProductDistributionStatus of type int
                    resultItem.ProductDistributionStatus = reader.GetInteger(5);
                    //6:Parameter ProducerName of type string
                    resultItem.ProducerName = reader.GetString(6);
                    //7:Parameter UnitAmount_DisplayLabel of type String
                    resultItem.UnitAmount_DisplayLabel = reader.GetString(7);
                    //8:Parameter UnitIsoCode of type String
                    resultItem.UnitIsoCode = reader.GetString(8);
                    //9:Parameter DossageFormName of type string
                    resultItem.DossageFormName = reader.GetString(9);
                    //10:Parameter TaxRate of type double
                    resultItem.TaxRate = reader.GetDouble(10);
                    //11:Parameter IsActiveComponent of type bool
                    resultItem.IsActiveComponent = reader.GetBoolean(11);
                    //12:Parameter SubstanceName of type String
                    resultItem.SubstanceName = reader.GetString(12);

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

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