예제 #1
0
        protected static FR_L5SG_GDfSRbSP_1141 Execute(DbConnection Connection, DbTransaction Transaction, P_L5SG_GDfSRbSP_1141 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L5SG_GDfSRbSP_1141();
            //Put your code here

            var getStorageDetailsParameter = new CL5_APOLogistic_Storage.Atomic.Retrieval.P_L5SG_GSDfPIDoSID_1612();
            getStorageDetailsParameter.ShelfID = Parameter.ShelfID;
            var storageDetails = CL5_APOLogistic_Storage.Atomic.Retrieval.cls_Get_StorageDetails_for_ProductIDorShelfID.Invoke(Connection, Transaction, getStorageDetailsParameter, securityTicket).Result;

            //remove articles with 0 quantity
            storageDetails = storageDetails.Where(x => x.Quantity_Current > 0).ToArray();


            List <Guid> articlesList = new List <Guid>();

            foreach (var storageDetail in storageDetails)
            {
                articlesList.Add(storageDetail.Product_RefID);
            }

            var getArticlesParameter = new CL3_Articles.Atomic.Retrieval.P_L3AR_GAfAL_0942();
            getArticlesParameter.ProductID_List = articlesList.ToArray();

            if (getArticlesParameter.ProductID_List != null && getArticlesParameter.ProductID_List.Length == 0)
            {
                // simulation because db query generator cannot do with empty param list
                getArticlesParameter.ProductID_List = new Guid[] { Guid.Empty };
            }

            var articles = CL3_Articles.Atomic.Retrieval.cls_Get_Articles_for_ArticleList.Invoke(Connection, Transaction, getArticlesParameter, securityTicket).Result;

            List <L5SG_GDfSRbSP_1141a> articleStorageDetails = new List <L5SG_GDfSRbSP_1141a>();

            foreach (var storageDetail in storageDetails)
            {
                L5SG_GDfSRbSP_1141a temporaryDetail = new L5SG_GDfSRbSP_1141a();
                temporaryDetail.StorageDetails = storageDetail;
                temporaryDetail.Article        = articles.Where(ar => ar.CMN_PRO_ProductID == storageDetail.Product_RefID).First();

                articleStorageDetails.Add(temporaryDetail);
            }

            returnValue.Result = new L5SG_GDfSRbSP_1141();
            returnValue.Result.ArticleStorageDetails = articleStorageDetails.ToArray();

            return(returnValue);

            #endregion UserCode
        }
예제 #2
0
 ///<summary>
 /// Ivokes the method with the given Connection, leaving it open if no exceptions occured
 ///<summary>
 public static FR_L5SG_GDfSRbSP_1141 Invoke(DbConnection Connection, P_L5SG_GDfSRbSP_1141 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(Connection, null, null, Parameter, securityTicket));
 }
예제 #3
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_L5SG_GDfSRbSP_1141 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5SG_GDfSRbSP_1141 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_L5SG_GDfSRbSP_1141 functionReturn = new FR_L5SG_GDfSRbSP_1141();

            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_StockRelocation_by_StoragePlace", ex);
            }
            return(functionReturn);
        }