public void MigrateAllForCourt(int?courtId) { Expression <Func <Court, bool> > selectedCourt = x => true; if ((courtId ?? 0) > 0) { selectedCourt = x => x.Id == courtId; } var courtList = repo.AllReadonly <Court>().Where(selectedCourt).Select(x => x.Id).ToArray(); foreach (var cId in courtList) { var court = GetCourtData(cId); caseService.CaseTransfer(court); caseService.CasePersonTransfer(court); caseService.CaseLifecycleTransfer(court); caseSessionService.SessionTransfer(court); caseSessionActService.SessionActTransfer(court); caseSessionActService.SessionActDivorceTransfer(court); caseSessionActService.SessionActComplainTransfer(court); caseSessionActService.SessionActComplainResultTransfer(court); caseSessionActService.SessionActComplainPersonTransfer(court); caseSessionActService.SessionActCoordinationTransfer(court); documentService.DocumentTransfer(court); documentService.DocumentDecisionTransfer(court); caseSelectionProtocolService.CaseSelectionProtokolTransfer(court); caseSelectionProtocolService.CaseSelectionProtocolCompartmentTransfer(court); caseSelectionProtocolService.CaseSelectionProtocolLawunitTransfer(court); } }
public void MigrateAllForCourt(int?courtId) { Expression <Func <Court, bool> > selectedCourt = x => true; if ((courtId ?? 0) > 0) { selectedCourt = x => x.Id == courtId; } var courtList = repo.AllReadonly <Court>().Where(selectedCourt).Select(x => x.Id).ToArray(); foreach (var cId in courtList) { //На колко добавени елемента да прави нов контекст if (dwRepo.TrackerCount > 10000) { dwRepo.RefreshDbContext(config.GetConnectionString("DWConnection")); } DWCourt court = new DWCourt(); int errRow = 0; try { court = GetCourtData(cId); serviceErrorLog.LogError((court.CourtId ?? 0), court.CourtName, "НАЧАЛО НА СЪД", 1, "Стартирал"); errRow = 1; caseService.CaseTransfer(court); errRow = 2; caseService.CasePersonTransfer(court); errRow = 3; caseService.CaseLifecycleTransfer(court); errRow = 4; caseSessionService.SessionTransfer(court); errRow = 5; caseSessionActService.SessionActTransfer(court); errRow = 6; caseSessionActService.SessionActDivorceTransfer(court); errRow = 7; caseSessionActService.SessionActComplainTransfer(court); errRow = 8; caseSessionActService.SessionActComplainResultTransfer(court); errRow = 9; caseSessionActService.SessionActComplainPersonTransfer(court); errRow = 10; caseSessionActService.SessionActCoordinationTransfer(court); errRow = 11; documentService.DocumentTransfer(court); errRow = 12; documentService.DocumentDecisionTransfer(court); errRow = 13; caseSelectionProtocolService.CaseSelectionProtokolTransfer(court); errRow = 14; caseSelectionProtocolService.CaseSelectionProtocolCompartmentTransfer(court); errRow = 15; caseSelectionProtocolService.CaseSelectionProtocolLawunitTransfer(court); } catch (Exception ex) { serviceErrorLog.LogError((court.CourtId ?? 0), court.CourtName, "Грешка в MigrateCases", errRow, ex.Message); } } }