Example #1
0
        protected static FR_L5SG_GDfSCbSP_1104_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L5SG_GDfSCbSP_1104 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            var returnStatus = new FR_L5SG_GDfSCbSP_1104_Array();

            DbCommand command = Connection.CreateCommand();

            command.Connection  = Connection;
            command.Transaction = Transaction;
            var commandLocation = "CL5_APOLogistic_Storage.Atomic.Retrieval.SQL.cls_Get_Data_for_StockCorrection_by_StoragePlace.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, "ShelfID", Parameter.ShelfID);



            List <L5SG_GDfSCbSP_1104> results = new List <L5SG_GDfSCbSP_1104>();
            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[] { "Product_Name_DictID", "Product_Number", "DosageFormGlobalPropertyName", "PackageContent_Amount", "ISOCode", "Quantity_Current", "BatchNumber", "ExpirationDate", "CMN_PRO_ProductID", "LOG_WRH_Shelf_ContentID", "LOG_ProductTrackingInstanceID", "CurrentQuantityOnTrackingInstance" });
                while (reader.Read())
                {
                    L5SG_GDfSCbSP_1104 resultItem = new L5SG_GDfSCbSP_1104();
                    //0:Parameter Product_Name_DictID of type Dict
                    resultItem.Product_Name_DictID             = reader.GetDictionary(0);
                    resultItem.Product_Name_DictID.SourceTable = "cmn_pro_products";
                    loader.Append(resultItem.Product_Name_DictID);
                    //1:Parameter Product_Number of type String
                    resultItem.Product_Number = reader.GetString(1);
                    //2:Parameter DosageFormGlobalPropertyName of type String
                    resultItem.DosageFormGlobalPropertyName = reader.GetString(2);
                    //3:Parameter PackageContent_Amount of type double
                    resultItem.PackageContent_Amount = reader.GetDouble(3);
                    //4:Parameter ISOCode of type String
                    resultItem.ISOCode = reader.GetString(4);
                    //5:Parameter Quantity_Current of type double
                    resultItem.Quantity_Current = reader.GetDouble(5);
                    //6:Parameter BatchNumber of type String
                    resultItem.BatchNumber = reader.GetString(6);
                    //7:Parameter ExpirationDate of type DateTime
                    resultItem.ExpirationDate = reader.GetDate(7);
                    //8:Parameter CMN_PRO_ProductID of type Guid
                    resultItem.CMN_PRO_ProductID = reader.GetGuid(8);
                    //9:Parameter LOG_WRH_Shelf_ContentID of type Guid
                    resultItem.LOG_WRH_Shelf_ContentID = reader.GetGuid(9);
                    //10:Parameter LOG_ProductTrackingInstanceID of type Guid
                    resultItem.LOG_ProductTrackingInstanceID = reader.GetGuid(10);
                    //11:Parameter CurrentQuantityOnTrackingInstance of type double
                    resultItem.CurrentQuantityOnTrackingInstance = reader.GetDouble(11);

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

            returnStatus.Result = results.ToArray();
            return(returnStatus);
        }
Example #2
0
 ///<summary>
 /// Invokes the method for the given Connection, and Transaction, leaving them open/not commited if no exceptions occured
 ///<summary>
 public static FR_L5SG_GDfSCbSP_1104_Array Invoke(DbConnection Connection, DbTransaction Transaction, P_L5SG_GDfSCbSP_1104 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(Connection, Transaction, null, Parameter, securityTicket));
 }
Example #3
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_L5SG_GDfSCbSP_1104_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5SG_GDfSCbSP_1104 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_L5SG_GDfSCbSP_1104_Array functionReturn = new FR_L5SG_GDfSCbSP_1104_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_Data_for_StockCorrection_by_StoragePlace", ex);
            }
            return(functionReturn);
        }
Example #4
0
 ///<summary>
 /// Opens the connection/transaction for the given connectionString, and closes them when complete
 ///<summary>
 public static FR_L5SG_GDfSCbSP_1104_Array Invoke(string ConnectionString, P_L5SG_GDfSCbSP_1104 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(null, null, ConnectionString, Parameter, securityTicket));
 }