public static List <ICounterparty> GetDuplicateCounterparties(string tin, string trrc, string name, int?excludedCounterpartyId, bool excludeClosed) { var counterparties = Counterparties.GetAll(); if (excludedCounterpartyId.HasValue) { counterparties = counterparties.Where(x => x.Id != excludedCounterpartyId.Value); } return(GetDuplicateCounterparties(counterparties, tin, trrc, name, excludeClosed)); }
public static string GetEmailByTinTrrc(string tin, string trrc) { var counterparties = Counterparties.GetAll().Where(c => c.TIN == tin).ToList(); if (!string.IsNullOrWhiteSpace(trrc)) { counterparties = counterparties.Where(t => Companies.Is(t) && Companies.As(t).TRRC == trrc).ToList(); } var counterparty = counterparties.FirstOrDefault(); return(counterparty != null ? counterparty.Email : string.Empty); }
public static List <ICounterparty> GetExchangeCounterparty(Sungero.Company.IBusinessUnit businessUnit) { // TODO Пока отправляем только тем, с кем установлен обмен. var parties = Counterparties.GetAll() .Where(x => x.ExchangeBoxes.Any(b => Equals(b.Status, Sungero.Parties.CounterpartyExchangeBoxes.Status.Active) && b.IsDefault == true)) .ToList(); if (businessUnit != null) { parties = parties.Where(x => x.ExchangeBoxes.Any(b => Equals(b.Box.BusinessUnit, businessUnit))).ToList(); } return(parties); }
public static List <ICounterparty> FindCounterparty(string uuid, string tin, string trrc, string sysid) { // Найти контрагента среди синхронизированных ранее. if (!string.IsNullOrWhiteSpace(uuid)) { var linkedIds = Commons.PublicFunctions.Module.GetExternalEntityLinks(uuid, sysid).Select(x => x.EntityId).ToList(); var result = Counterparties.GetAll().Where(x => linkedIds.Contains(x.Id)); if (result.Any()) { return(result.ToList()); } } // Найти контрагентов, удовлетворяющих критериям ИНН/КПП, если не найдено синхронизированных ранее. return(GetDuplicateCounterparties(tin, trrc, string.Empty, null, false)); }
public IQueryable <ICounterparty> CounterpartiesAvailableForExchange() { return(Counterparties.GetAll(x => x.CanExchange == true)); }
public static ICounterparty FindCounterpartyByOrganizationId(ExchangeCore.IBusinessUnitBox box, string organizationId) { return(Counterparties.GetAll().Where(c => c.ExchangeBoxes.Any(b => Equals(b.Box, box) && b.OrganizationId == organizationId)).FirstOrDefault()); }