public DWCaseSession CaseSessionLawUnitTransfer(DWCourt court, DWCaseSession session) { IEnumerable <DWCaseSessionLawUnit> dw = SelectCaseSessionLawUnitTransfer(court, session.Id); DWCaseSession lu_session = new DWCaseSession(); int JudgeReporterId = 0; string JudgeReporterName = ""; string JudgeReporterStaff = ""; string SessionFullJudgeStaff = ""; string SessionJudgeStaff = ""; string SessionJuriStaff = ""; foreach (var current in dw) { bool insertRow = CaseSessionLawUnitInsertUpdate(current); if (current.DateTo == null) { if (current.JudgeRoleId == NomenclatureConstants.JudgeRole.JudgeReporter) { JudgeReporterId = current.LawUnitId; JudgeReporterName = current.LawUnitFullName; SessionFullJudgeStaff = SessionFullJudgeStaff + $"{current.LawUnitFullName}({current.JudgeRoleName}); "; } if (current.JudgeRoleId != NomenclatureConstants.JudgeRole.JudgeReporter && NomenclatureConstants.JudgeRole.JudgeRolesList.Contains(current.JudgeRoleId)) { SessionJudgeStaff = SessionJudgeStaff + $"{current.LawUnitFullName}({current.JudgeRoleName}); "; } if (NomenclatureConstants.JudgeRole.JuriRolesList.Contains(current.JudgeRoleId)) { SessionJuriStaff = SessionJuriStaff + $"{current.LawUnitFullName}({current.JudgeRoleName}); "; } } } lu_session.JudgeReporterId = JudgeReporterId; lu_session.JudgeReporterName = JudgeReporterName; lu_session.SessionJudgeStaff = SessionJudgeStaff; SessionFullJudgeStaff = SessionFullJudgeStaff + SessionJudgeStaff; lu_session.SessionFullJudgeStaff = SessionFullJudgeStaff; lu_session.SessionJuriStaff = SessionJuriStaff; lu_session.SessionFullStaff = SessionFullJudgeStaff + SessionJuriStaff; return(lu_session); }
public bool SessionInsertUpdate(DWCaseSession current, DWCourt court) { bool result = false; try { DWCaseSession saved = dwRepo.All <DWCaseSession>().Where(x => x.Id == current.Id).FirstOrDefault(); if (saved == null) { current.DateTransferedDW = DateTime.Now; // caseService.MergeTransferedlawUnits(current.CaseId, current.Id); var lu_session = CaseSessionLawUnitTransfer(court, current); current.JudgeReporterId = lu_session.JudgeReporterId; current.JudgeReporterName = lu_session.JudgeReporterName; current.SessionJudgeStaff = lu_session.SessionJudgeStaff; current.SessionJudgeStaff = lu_session.SessionJudgeStaff; current.SessionFullJudgeStaff = lu_session.SessionFullJudgeStaff; current.SessionJuriStaff = lu_session.SessionJuriStaff; current.SessionFullStaff = lu_session.SessionFullStaff; dwRepo.Add <DWCaseSession>(current); result = true; } else { saved.Id = current.Id; saved.CompartmentId = current.CompartmentId; saved.CompartmentName = current.CompartmentName; saved.CourtHallId = current.CourtHallId; saved.CourtHallName = current.CourtHallName; saved.DateExpired = current.DateExpired; saved.DateExpiredStr = current.DateExpiredStr; saved.DescriptionExpired = current.DescriptionExpired; saved.DateFrom = current.DateFrom; saved.DateFromStr = current.DateFromStr; saved.DateTo = current.DateTo; saved.DateToStr = current.DateToStr; saved.SessionStateId = current.SessionStateId; saved.SessionStateName = current.SessionStateName; saved.SessionTypeId = current.SessionTypeId; saved.SessionTypeName = current.SessionTypeName; saved.UserExpiredId = current.UserExpiredId; saved.UserExpiredName = current.UserExpiredName; saved.CaseId = current.CaseId; saved.DateTransferedDW = current.DateTransferedDW; saved.DateWrt = current.DateWrt; saved.Description = current.Description; saved.UserId = current.UserId; saved.DateReturned = current.DateReturned; saved.CourtId = current.CourtId; saved.DwCount = current.DwCount; saved.CourtName = current.CourtName; saved.CourtRegionId = current.CourtRegionId; saved.CourtRegionName = current.CourtRegionName; saved.CourtTypeId = current.CourtTypeId; saved.CourtTypeName = current.CourtTypeName; saved.ParentCourtId = current.ParentCourtId; saved.ParentCourtName = current.ParentCourtName; saved.EcliCode = current.EcliCode; saved.EISPPCode = current.EISPPCode; saved.CityCode = current.CityCode; saved.CityName = current.CityName; //caseService.MergeTransferedlawUnits(current.CaseId, current.Id); var lu_session = CaseSessionLawUnitTransfer(court, current); saved.JudgeReporterId = lu_session.JudgeReporterId; saved.JudgeReporterName = lu_session.JudgeReporterName; saved.SessionJudgeStaff = lu_session.SessionJudgeStaff; saved.SessionJudgeStaff = lu_session.SessionJudgeStaff; saved.SessionFullJudgeStaff = lu_session.SessionFullJudgeStaff; saved.SessionJuriStaff = lu_session.SessionJuriStaff; saved.SessionFullStaff = lu_session.SessionFullStaff; dwRepo.Update <DWCaseSession>(saved); result = true; } if (result) { CaseSessionResultTransfer(court, current.Id); } } catch (Exception ex) { serviceErrorLog.LogError((court.CourtId ?? 0), court.CourtName, "case_session", current.Id, ex.Message); } return(result); }