/// <summary>
        /// Creates BOL for passed list of  EDI.
        /// </summary>
        /// <param name="edId"></param>
        /// <remarks>
        /// </remarks>
        internal int CreateBol(int[] ediIdList, string custId)
        {
            int count = 0;

            CustomerOrderSummaryCache.Remove(custId);
            foreach (var edIId in ediIdList)
            {
                count += _repos.CreateBol(edIId);
            }
            return(count);
        }
        /// <summary>
        /// Delete unshipped Bill of ladings.
        /// </summary>
        /// <param name="ShippingIdList"></param>
        /// <returns></returns>
        internal bool DeleteBol(string customerId, string ShippingIdList)
        {
            var shippingIdList1 = ShippingIdList.Split(',');

            try
            {
                foreach (var shippingId in shippingIdList1)
                {
                    _repos.DeleteBol(shippingId);
                }
                // Since counts for this customer have changed, remove them from the cache
                CustomerOrderSummaryCache.Remove(customerId);
                return(true);
            }
            catch (Exception) { return(false); }
        }
        /// <summary>
        /// Creates EDI753 for the passed POs on the passed ATS date.
        /// </summary>
        /// <param name="poList"></param>
        /// <param name="atsDate"></param>
        /// <returns></returns>
        /// <remarks>POs are added to existing EDI, if ATS date already exists for the customer</remarks>
        internal void AddPoToEdi(string customerId, ICollection <Tuple <string, int, string> > poList, DateTime atsDate, bool isElectronicEdi)
        {
            // Get list of ATS date already exists for the customer.
            var existingEdiId = _repos.GetExistingAtsDates(customerId, atsDate).Select(p => p.EdiId).FirstOrDefault();

            // Create new edi for POs if ATS date not exists for the customer.
            if (existingEdiId == null)
            {
                var ediId = _repos.CreateEDIforCustomer(customerId);
                _repos.AddPoToEdi(customerId, poList, atsDate, ediId, isElectronicEdi);
            }
            // POs are added to existing EDI, if ATS date already exists for the customer.
            else
            {
                _repos.AddPoToEdi(customerId, poList, atsDate, existingEdiId.Value, isElectronicEdi);
            }

            // Since counts for this customer have changed, remove them from the cache
            CustomerOrderSummaryCache.Remove(customerId);
        }
 /// <summary>
 /// unroute selected orders
 /// </summary>
 /// <param name="poList"></param>
 /// <returns></returns>
 internal void UndoRoute(RoutingKey key)
 {
     _repos.UndoRouting(key);
     CustomerOrderSummaryCache.Remove(key.CustomerId);
 }