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 ICounterparty GetDistributionListCounterparty() { var guid = Sungero.Parties.Constants.Counterparty.DistributionListCounterpartyGuid; var link = Docflow.PublicFunctions.Module.GetExternalLink(Company.ClassTypeGuid, guid); if (link != null && link.EntityId.HasValue) { var companyId = link.EntityId.Value; // HACK mukhachev: использование внутренней сессии для обхода фильтрации. Logger.DebugFormat("CreateDefaultDistributionListCounterpartyIgnoreFiltering: companyId {0}", companyId); using (var session = new Sungero.Domain.Session()) { var innerSession = (Sungero.Domain.ISession)session.GetType() .GetField("InnerSession", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(session); return(Companies.As((Sungero.Domain.Shared.IEntity)innerSession.Get(typeof(ICompany), companyId))); } } return(null); }