public IActionResult LawUnits_AddNew(string lawUnitTypeId) { var model = new CaseSelectionProtokolLawUnitVM() { IsLoaded = false, Index = 0, StateId = NomenclatureConstants.SelectionProtokolLawUnitState.AddedManually, LoadIndex = 100, SelectedFromCaseGroup = false, EnableState = true, LawUnitTypeId = lawUnitTypeId }; ViewData.TemplateInfo.HtmlFieldPrefix = model.GetPath; SetViewBagLawUnits(NomenclatureConstants.SelectionMode.ManualSelect); if (lawUnitTypeId == NomenclatureConstants.LawUnitTypes.Judge.ToString()) { ViewBag.RoleId = NomenclatureConstants.JudgeRole.Judge; } else { ViewBag.RoleId = NomenclatureConstants.JudgeRole.Jury; } var result = new List <CaseSelectionProtokolLawUnitVM>() { model }; // return PartialView("_LawUnitsItem", model); return(PartialView("_LoadedLawUnits", result)); }
//Изчислява коефициентите за всеки един съдия в рамките на група или дежурство public void CalculateLawUnitDataInGroup(CaseSelectionProtokolLawUnitVM caseSelectionProtokolLawUnit, int courtLoadPeriodId, List <CourtLoadPeriodLawUnit> courtLoadPeriodLawunitsList) { //var courtLoadPeriodLawunits = repo.AllReadonly<CourtLoadPeriodLawUnit>().Where(x => x.LawUnitId == caseSelectionProtokolLawUnit.LawUnitId) // .Where(x => x.CourtLoadPeriodId == courtLoadPeriodId).ToList(); var courtLoadPeriodLawunits = courtLoadPeriodLawunitsList.Where(x => x.LawUnitId == caseSelectionProtokolLawUnit.LawUnitId); //Optimisacia2020.01.09 s //foreach (var courtLoadPeriodLawunit in courtLoadPeriodLawunits) //{ // caseSelectionProtokolLawUnit.TotalCaseCount = caseSelectionProtokolLawUnit.TotalCaseCount + courtLoadPeriodLawunit.TotalDayCases; // caseSelectionProtokolLawUnit.CaseCount = caseSelectionProtokolLawUnit.CaseCount + (int)courtLoadPeriodLawunit.DayCases; //} caseSelectionProtokolLawUnit.TotalCaseCount = courtLoadPeriodLawunits.Sum(x => x.TotalDayCases); caseSelectionProtokolLawUnit.CaseCount = courtLoadPeriodLawunits.Sum(x => (int)x.DayCases); //Optimisacia2020.01.09 e if (caseSelectionProtokolLawUnit.TotalCaseCount > 0) { caseSelectionProtokolLawUnit.Koef = caseSelectionProtokolLawUnit.LoadIndex / caseSelectionProtokolLawUnit.TotalCaseCount; } else //Когато разпределените дела са 0 на някой се т.к деление на 0 е невъзможно даваме вместо 0 малка стойноат 0.01 { caseSelectionProtokolLawUnit.Koef = caseSelectionProtokolLawUnit.LoadIndex * 100; } }
//Изчислява коефициентите за всеки един съдия в рамките на група или дежурство public void CalculateLawUnitDataInGroup(CaseSelectionProtokolLawUnitVM caseSelectionProtokolLawUnit, int courtLoadPeriodId) { var courtLoadPeriodLawunits = repo.AllReadonly <CourtLoadPeriodLawUnit>().Where(x => x.LawUnitId == caseSelectionProtokolLawUnit.LawUnitId) .Where(x => x.CourtLoadPeriodId == courtLoadPeriodId).ToList(); foreach (var courtLoadPeriodLawunit in courtLoadPeriodLawunits) { caseSelectionProtokolLawUnit.TotalCaseCount = caseSelectionProtokolLawUnit.TotalCaseCount + courtLoadPeriodLawunit.TotalDayCases; caseSelectionProtokolLawUnit.CaseCount = caseSelectionProtokolLawUnit.CaseCount + (int)courtLoadPeriodLawunit.DayCases; } if (caseSelectionProtokolLawUnit.TotalCaseCount > 0) { caseSelectionProtokolLawUnit.Koef = caseSelectionProtokolLawUnit.LoadIndex / caseSelectionProtokolLawUnit.TotalCaseCount; } else //Когато разпределените дела са 0 на някой се т.к деление на 0 е невъзможно даваме вместо 0 малка стойноат 0.01 { caseSelectionProtokolLawUnit.Koef = caseSelectionProtokolLawUnit.LoadIndex * 100; } }