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

            FR_L3CA_GCaRfC_1249 functionReturn = new FR_L3CA_GCaRfC_1249();

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

            DbCommand command = Connection.CreateCommand();

            command.Connection  = Connection;
            command.Transaction = Transaction;
            var commandLocation = "CL3_Catalog.Atomic.Retrieval.SQL.cls_Get_Catalog_and_Revisions_for_CatalogID.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, "CatalogID", Parameter.CatalogID);



            List <L3CA_GCaRfC_1249_raw> results = new List <L3CA_GCaRfC_1249_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_CatalogID", "Catalog_Currency_RefID", "Catalog_Language_RefID", "IsPublicCatalog", "CatalogCodeITL", "Catalog_Name_DictID", "CMN_PRO_Catalog_RevisionID", "Valid_From", "Valid_Through", "PublishedBy_BusinessParticipant_RefID", "Default_PricelistRelease_RefID", "PublishedOn_Date", "CatalogRevision_Name", "CatalogRevision_Description", "RevisionNumber" });
                while (reader.Read())
                {
                    L3CA_GCaRfC_1249_raw resultItem = new L3CA_GCaRfC_1249_raw();
                    //0:Parameter CMN_PRO_CatalogID of type Guid
                    resultItem.CMN_PRO_CatalogID = reader.GetGuid(0);
                    //1:Parameter Catalog_Currency_RefID of type Guid
                    resultItem.Catalog_Currency_RefID = reader.GetGuid(1);
                    //2:Parameter Catalog_Language_RefID of type Guid
                    resultItem.Catalog_Language_RefID = reader.GetGuid(2);
                    //3:Parameter IsPublicCatalog of type bool
                    resultItem.IsPublicCatalog = reader.GetBoolean(3);
                    //4:Parameter CatalogCodeITL of type String
                    resultItem.CatalogCodeITL = reader.GetString(4);
                    //5:Parameter Catalog_Name of type Dict
                    resultItem.Catalog_Name             = reader.GetDictionary(5);
                    resultItem.Catalog_Name.SourceTable = "cmn_pro_mastercatalogs";
                    loader.Append(resultItem.Catalog_Name);
                    //6:Parameter CMN_PRO_Catalog_RevisionID of type Guid
                    resultItem.CMN_PRO_Catalog_RevisionID = reader.GetGuid(6);
                    //7:Parameter Valid_From of type DateTime
                    resultItem.Valid_From = reader.GetDate(7);
                    //8:Parameter Valid_Through of type DateTime
                    resultItem.Valid_Through = reader.GetDate(8);
                    //9:Parameter PublishedBy_BusinessParticipant_RefID of type Guid
                    resultItem.PublishedBy_BusinessParticipant_RefID = reader.GetGuid(9);
                    //10:Parameter Default_PricelistRelease_RefID of type Guid
                    resultItem.Default_PricelistRelease_RefID = reader.GetGuid(10);
                    //11:Parameter PublishedOn_Date of type DateTime
                    resultItem.PublishedOn_Date = reader.GetDate(11);
                    //12:Parameter CatalogRevision_Name of type String
                    resultItem.CatalogRevision_Name = reader.GetString(12);
                    //13:Parameter CatalogRevision_Description of type String
                    resultItem.CatalogRevision_Description = reader.GetString(13);
                    //14:Parameter RevisionNumber of type int
                    resultItem.RevisionNumber = reader.GetInteger(14);

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

            returnStatus.Result = L3CA_GCaRfC_1249_raw.Convert(results).FirstOrDefault();

            return(returnStatus);
        }