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

            FR_L3PR_GAwSPfT_1002_Array functionReturn = new FR_L3PR_GAwSPfT_1002_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_ArticleStorages_for_ArticleIDListComplex", ex);
            }
            return(functionReturn);
        }
Example #2
0
        protected static FR_L3PR_GAwSPfT_1002_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L3PR_GAwSPfT_1002 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L3PR_GAwSPfT_1002_Array();

            //Put your code here
            List <L3PR_GAwSPfT_1002> retVal = new List <L3PR_GAwSPfT_1002>();

            P_L3WH_GASfA_1924 par = new P_L3WH_GASfA_1924();
            par.ArticleID_List = Parameter.ArticleID_List.Select(i => i).ToArray();
            var articleStorages = cls_Get_ArticleStorages_for_ArticleIDList.Invoke(Connection, Transaction, par, securityTicket).Result.Where(i => i.ShelfID != Guid.Empty).ToList();

            #region Get All StoragePlaces for TenantID

            var shelfIDs       = articleStorages.Select(i => i.ShelfID).Distinct().ToArray();
            var productIDs     = articleStorages.Select(i => i.ArticleID).Distinct().ToArray();
            var filterCriteria = new P_L3WH_GSPfFC_1504()
            {
                WarehouseGroupID    = null,
                WarehouseID         = null,
                AreaID              = null,
                RackID              = null,
                UseShelfIDList      = shelfIDs.Length != 0,
                ShelfIDs            = shelfIDs.Length == 0 ? new Guid[] { Guid.Empty } : shelfIDs,
                UseProductIDList    = productIDs.Length != 0,
                ProductIDs          = productIDs.Length == 0 ? new Guid[] { Guid.Empty } : productIDs,
                BottomShelfQuantity = null,
                TopShelfQuantity    = null,
                UseProductTrackingInstanceIDList = false,
                ProductTrackingInstanceIDs       = new Guid[] { Guid.Empty },
                StartExpirationDate = null,
                EndExpirationDate   = null
            };
            var allStoragePlacesForTenant = cls_Get_StoragePlaces_for_FilterCriteria.Invoke(Connection, Transaction, filterCriteria, securityTicket).Result;
            #endregion

            L3PR_GAwSPfT_1002 retValItem;
            L3WH_GSPfFC_1504  storagePlace;
            foreach (var storage in articleStorages)
            {
                retValItem              = new L3PR_GAwSPfT_1002();
                retValItem.ArticleID    = storage.ArticleID;
                retValItem.ShelfID      = storage.ShelfID;
                retValItem.StoragePlace = "-";

                storagePlace = allStoragePlacesForTenant.Where(i => i.LOG_WRH_ShelfID == storage.ShelfID).FirstOrDefault();
                if (storagePlace != null && !String.IsNullOrEmpty(storagePlace.Area_Name) &&
                    !String.IsNullOrEmpty(storagePlace.Rack_Name) &&
                    !String.IsNullOrEmpty(storagePlace.Shelf_Name))
                {
                    retValItem.StoragePlace = String.Format("{0}-{1}-{2}-{3}",
                                                            storagePlace.WarehouseCoordinateCode,
                                                            storagePlace.AreaCoordinateCode,
                                                            storagePlace.RackCoordinateCode,
                                                            storagePlace.ShelfCoordinateCode);
                }

                retVal.Add(retValItem);
            }

            returnValue.Result = retVal.ToArray();

            return(returnValue);

            #endregion UserCode
        }