/// <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); }