Пример #1
0
 /// <summary>
 /// Извличане на данни за последно движение
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int GetLastMigrationAcceptToUse(CaseMigrationFindCaseVM model)
 {
     return(repo.AllReadonly <CaseMigration>()
            .Include(x => x.InCaseMigrations)
            .Where(x => x.CaseId == model.FromCaseId)
            .Where(FilterExpireInfo <CaseMigration>(false))
            .Where(x => CaseMigrationTypes.SendCaseTypesCanAccept.Contains(x.CaseMigrationTypeId))
            .Where(x => !x.InCaseMigrations.Any())
            .Select(x => x.Id)
            .DefaultIfEmpty(0)
            .FirstOrDefault());
 }
Пример #2
0
        /// <summary>
        /// Приемане на дело
        /// </summary>
        /// <param name="caseId"></param>
        /// <returns></returns>
        public IActionResult AcceptToUse(int caseId)
        {
            var model = new CaseMigrationFindCaseVM()
            {
                CaseId = caseId
            };

            var caseInfo = caseService.Case_GetById(caseId);

            model.CaseInfo = $"{caseInfo.RegNumber} ({caseInfo.CaseTypeCode})";
            SetViewBag(model);
            return(View(model));
        }
Пример #3
0
        public IActionResult AcceptToUse(CaseMigrationFindCaseVM model)
        {
            int lastMigrationId = migService.GetLastMigrationAcceptToUse(model);

            if (lastMigrationId == 0)
            {
                ModelState.AddModelError(nameof(CaseMigrationFindCaseVM.FromCaseId), "По избраното дело не съществува неприето движение към текущия съд.");
            }
            if (!ModelState.IsValid)
            {
                SetViewBag(model);
                return(View(model));
            }

            if (migService.AcceptCaseMigration(lastMigrationId, model.CaseId, model.Description))
            {
                SetSuccessMessage(MessageConstant.Values.SaveOK);
            }
            else
            {
                SetErrorMessage("Проблем при приемане на движение на дело.");
            }
            return(RedirectToAction(nameof(Index), new { caseId = model.CaseId }));
        }
Пример #4
0
 public bool AcceptToUse(CaseMigrationFindCaseVM model, int lastMigrationId)
 {
     throw new NotImplementedException();
 }
Пример #5
0
 void SetViewBag(CaseMigrationFindCaseVM model)
 {
     ViewBag.caseId      = model.CaseId;
     ViewBag.breadcrumbs = commonService.Breadcrumbs_GetForCase(model.CaseId);
     SetHelpFile(HelpFileValues.CaseMigration);
 }