public static void Deletar(ContingenciaInstrucional contingenciaInstrucional) { List <ContingenciaColateral> CCsComEssaCI = ContingenciaColateralService.GetAllByCI(contingenciaInstrucional); if (CCsComEssaCI.Count > 0) { throw new System.Exception($"Esse EC está cadastrada nos seguintes MTSs: {ListUtils.Join(CCsComEssaCI.Select(it => it.Nome).Cast<string>().ToList(), ", ")}. Delete primeiro esses MTSs ou os associe a outro EC"); } DeletarObjetosFilhos(contingenciaInstrucional); AbstractService.Deletar(contingenciaInstrucional, "ContingenciaInstrucional"); }
public static List <ContingenciaColateral> GetAllCCBySessaoId(long id) { if (id == 0) { return(null); } List <CCPorSessao> CCsPS = GetPropriedadeByMembroId(id, "SessaoId"); if (CCsPS == null) { return(null); } List <ContingenciaColateral> CCs = new List <ContingenciaColateral>(); CCsPS.OrderBy(it => it.OrdemApresentacao); foreach (CCPorSessao CCPS in CCsPS) { CCs.Add(ContingenciaColateralService.GetById(CCPS.CCId)); } return(CCs); }