public void DeadLineMotive(CaseSessionAct sessionAct) { if (sessionAct.ActTypeId != NomenclatureConstants.ActType.Sentence) { return; } var deadline = DeadLineMotiveStart(sessionAct); if (deadline != null) { SaveDeadLine(deadline); return; } deadline = DeadLineMotiveExpire(sessionAct); if (deadline != null) { SaveDeadLine(deadline); return; } deadline = DeadLineMotiveComplete(sessionAct); if (deadline != null) { SaveDeadLine(deadline); return; } }
private ActType FillActType(CaseSessionAct sessionAct, CaseSession session, List <CaseMigration> migrations) { (var newId, var action) = AppendUpdateIntegrationKeyAction(SourceTypeSelectVM.CaseSessionAct, sessionAct.Id, sessionAct.DateExpired != null); if (string.IsNullOrEmpty(newId)) { return(null); } /* CdnDownloadResult actFile = cdnService.MongoCdn_Download(new CdnFileSelect() * { * SourceType = SourceTypeSelectVM.CaseSessionActDepersonalized, * SourceId = sessionAct.Id.ToString() * }).Result; */ int[] reason = sessionAct.ActISPNDebtorStateId > 0 ? new int[1] { sessionAct.ActISPNDebtorStateId ?? 0 } : new int[0]; return(new ActType() { act_action = ServiceMethodToAction(action), act_date = (session.DateTo ?? session.DateFrom).Date, act_id = newId, act_kind = GetNomValueInt(EpepConstants.Nomenclatures.ActTypes, sessionAct.ActTypeId), act_no = int.Parse(sessionAct.RegNumber), act_text = sessionAct.Description, act_debtor_status = sessionAct.ActISPNDebtorStateId ?? 0, act_reason = reason, Appeal = FillAppealArray(sessionAct.CaseSessionActComplains.ToList(), migrations.Where(x => x.CaseSessionActId == sessionAct.Id).ToList(), sessionAct), //act_image = Convert.FromBase64String(actFile.FileContentBase64) }); }
private DateTime?MotiveDateStart(CaseSessionAct sessionAct) { var dateStart = sessionAct.ActDate?.AddDays(1).Date;// ActDeclaredDate if (dateStart != null) { while (!workingDaysService.IsWorkingDay(userContext.CourtId, dateStart.Value)) { dateStart = dateStart.Value.AddDays(1).Date; } } return(dateStart); }
private SendToType[] FillSendToArray(List <CaseMigration> migrations, CaseSessionAct sessionAct) { List <SendToType> appeals = new List <SendToType>(); for (int i = 0; i < migrations.Count; i++) { SendToType itemAdd = FillSendTo(migrations[i], sessionAct); if (itemAdd != null) { appeals.Add(itemAdd); } } return(appeals.ToArray()); }
public bool Counter_GetActCounter(CaseSessionAct model, int caseGroupId, int courtId) { try { var sessionActGroupId = repo.AllReadonly <SessionActType>() .Include(x => x.SessionActGroup) .Where(x => x.ActTypeId == model.ActTypeId && x.SessionActGroup.CaseGroupId == caseGroupId) .Select(x => x.SessionActGroupId) .FirstOrDefault(); if (sessionActGroupId < 1) { throw new Exception($"Няма настроена група за номериране на актове. ActTypeId={model.ActTypeId },Court={courtId}"); } var counterId = repo.AllReadonly <CounterSessionAct>() .Include(x => x.Counter) .Where(x => x.Counter.CourtId == courtId && x.SessionActGroupId == sessionActGroupId) .Select(x => x.CounterId) .FirstOrDefault(); if (counterId > 0) { var counterResult = Counter_GetValueMulti(counterId); if (counterResult.intValue > 0) { model.RegNumber = counterResult.stringValue; model.RegDate = DateTime.Now; model.ActDate = model.RegDate; return(true); } else { throw new Exception($"Грешка вземане на стойност от брояч CounterId={counterId}. CaseGroupId={caseGroupId },Court={courtId}"); } } else { throw new Exception($"Няма настроен брояч за актове. CaseGroupId={caseGroupId },Court={courtId}"); } } catch (Exception ex) { logger.LogError(ex, $"Грешка при запис на Counter. CaseGroupId={caseGroupId },Court={courtId}"); } return(false); }
public CaseDeadline DeadLineMotiveStart(CaseSessionAct sessionAct) { if (sessionAct.DateExpired != null || MotiveDateStart(sessionAct) == null || MotiveDateEnd(sessionAct) != null) { return(null); } var deadline = repo.AllReadonly <CaseDeadline>() .Where(x => x.SourceType == SourceTypeSelectVM.CaseSessionAct && x.SourceId == sessionAct.Id && x.DeadlineTypeId == NomenclatureConstants.DeadlineType.Motive) .FirstOrDefault(); var aCase = sessionAct.CaseSession?.Case; if (aCase == null) { var caseSession = sessionAct.CaseSession; if (caseSession == null) { caseSession = repo.AllReadonly <CaseSession>().Where(x => x.Id == sessionAct.CaseSessionId).FirstOrDefault(); } aCase = repo.AllReadonly <Case>().Where(x => x.Id == caseSession.CaseId).FirstOrDefault(); } var deadlineType = repo.AllReadonly <DeadlineType>().Where(x => x.Id == NomenclatureConstants.DeadlineType.Motive).FirstOrDefault(); if (deadline != null) { if (deadline.StartDate != MotiveDateStart(sessionAct)) { setUnExpired(deadline); deadline.StartDate = MotiveDateStart(sessionAct) ?? DateTime.Now; setDateEnd(deadline, deadlineType); } } else { deadline = new CaseDeadline(); deadline.CaseId = aCase.Id; deadline.SourceType = SourceTypeSelectVM.CaseSessionAct; deadline.SourceId = sessionAct.Id; deadline.DeadlineTypeId = NomenclatureConstants.DeadlineType.Motive; deadline.DeadlineGroupId = deadlineType.DeadlineGroupId; deadline.StartDate = MotiveDateStart(sessionAct) ?? DateTime.Now; setDateEnd(deadline, deadlineType); } return(deadline); }
public CaseDeadline DeadLineMotiveComplete(CaseSessionAct sessionAct) { if (MotiveDateStart(sessionAct) == null || MotiveDateEnd(sessionAct) == null) { return(null); } var deadline = repo.AllReadonly <CaseDeadline>() .Where(x => x.SourceType == SourceTypeSelectVM.CaseSessionAct && x.SourceId == sessionAct.Id && x.DeadlineTypeId == NomenclatureConstants.DeadlineType.Motive) .FirstOrDefault(); if (deadline != null && deadline.DateComplete == null) { deadline.DateComplete = MotiveDateEnd(sessionAct); return(deadline); } return(null); }
private SendToType FillSendTo(CaseMigration migration, CaseSessionAct sessionAct) { (var newId, var action) = AppendUpdateIntegrationKeyAction(SourceTypeSelectVM.CaseMigration, migration.Id, migration.DateExpired != null); if (string.IsNullOrEmpty(newId)) { return(null); } SendToType result = new SendToType(); result.sendto_id = newId; result.sendto_action = ServiceMethodToAction(action); result.sendto_kind = GetNomValueInt(EpepConstants.Nomenclatures.OutgoingDocumentTypes, migration.OutDocument.DocumentTypeId); result.sendto_no = migration.OutDocument.DocumentNumberValue ?? 0; result.sendto_year = migration.OutDocument.DocumentDate.Year.ToString(); result.sendto_date = migration.OutDocument.DocumentDate; result.sendto_court = GetNomValueInt(EpepConstants.Nomenclatures.Courts, migration.SendToCourtId); result.@return = new ReturnType(); [email protected]_result = sessionAct.ActComplainIndex?.Code ?? ""; return(result); }
public bool Counter_GetActCounter(CaseSessionAct model, int caseGroupId, int courtId) { throw new NotImplementedException(); }
/// <summary> /// Връща инфо на акт тип/номер/дата /// </summary> /// <param name="model">Обект CaseSessionAct с изчетен ActType</param> /// <returns></returns> public static string GetCaseSessionActNameBreadcrumbs(CaseSessionAct model) { return(((model.ActType != null) ? model.ActType.Label + " " : string.Empty) + ((!string.IsNullOrEmpty(model.RegNumber)) ? model.RegNumber + "/" + (model.RegDate ?? DateTime.Now).ToString("dd.MM.yyyy") : string.Empty)); }
private DateTime?MotiveDateEnd(CaseSessionAct sessionAct) { return(sessionAct.ActMotivesDeclaredDate); }
private DateTime?MotiveDateStart(CaseSessionAct sessionAct) { return(sessionAct.ActDate);// ActDeclaredDate }
private AppealType[] FillAppealArray(List <CaseSessionActComplain> actComplains, List <CaseMigration> migrations, CaseSessionAct sessionAct) { AppealType[] appeals = new AppealType[actComplains.Count]; for (int i = 0; i < actComplains.Count; i++) { appeals[i] = FillAppeal(actComplains[i]); //Тъй като имаме изпращане на друг съд на ниво акт, а не на ниво жалене на акт - закачам само на първият входящ документ с който се жали if (i == 0) { appeals[i].SendTo = FillSendToArray(migrations, sessionAct); } } return(appeals); }