public async Task <IActionResult> List(Guid?appId, string sort, string appType) { if (appId == null) { return(NotFound()); } List <BranchListDTO> branchList; if (sort == "AddBranchApplication") { branchList = (await _dataService.GetDtoAsync <BranchListDTO>(x => x.ApplicationId == appId && x.IsFromLicense != true)).ToList(); } else { branchList = (await _dataService.GetDtoAsync <BranchListDTO>(x => x.ApplicationId == appId)).ToList(); } if (appType == "TRL") { var branchDlsList = (await _dataService.GetDtoAsync <BranchListDTO>(x => x.ApplicationId == appId && x.CreateTds == false && x.CreateDls == false && x.IsFromLicense != true)).ToList(); ViewBag.multiSelectBranchList = new MultiSelectList(branchDlsList, nameof(EnumRecord.Id), nameof(EnumRecord.Name)); ViewBag.Expertise = false; // для появления кнопок доручень var expertise = _entityStateHelper.GetAppStates(appId)[nameof(BaseApplication.PerformerOfExpertise)]; if (!string.IsNullOrEmpty(expertise)) { ViewBag.Expertise = true; } ViewBag.Decision = false; // для появления кнопок доручень var decision = _dataService.GetEntity <TrlApplication>(x => x.Id == appId) .Select(x => x.AppDecisionId)?.SingleOrDefault().ToString(); if (!string.IsNullOrEmpty(decision)) { ViewBag.Decision = true; } } ViewBag.ApplicationId = appId.Value; ViewBag.IsAddable = _entityStateHelper.ApplicationAddability(appId.Value).IsBranch; ViewBag.sort = sort; ViewBag.appState = _entityStateHelper.GetAppStates(appId)[nameof(BaseApplication.BackOfficeAppState)]; ViewBag.appType = appType; branchList.ForEach(dto => dto.isEditable = _entityStateHelper.IsEditableBranch(dto.Id)); switch (sort) { case "RemBranchApplication": branchList.ForEach(x => x.isEditable = _entityStateHelper.GetAppStates(appId)[nameof(BaseApplication.BackOfficeAppState)] == "Project"); return(PartialView("List_RemBranchApplication", branchList.Where(x => x.RecordState != RecordState.D))); case "ChangeInfoApplication": return(PartialView("List_ChangeInfo", branchList)); default: return(PartialView(branchList)); } }
public async Task <IActionResult> List(Guid?ApplicationId, IDictionary <string, string> paramList, Core.Mvc.Controllers.ActionListOption <ImlMedicineListDTO> options) { if (ApplicationId == null) { return(NotFound()); } ViewBag.IsAddable = _entityStateHelper.ApplicationAddability(ApplicationId.Value).IsMedicine; ViewBag.ApplicationId = ApplicationId; var file = DataService.GetEntity <FileStore>(x => x.EntityId == ApplicationId && x.EntityName == nameof(ImlApplication) && x.Description == "Medicines").FirstOrDefault(); if (file == null) { ViewBag.FileCheck = false; } else { ViewBag.FileCheck = true; } return(await base.PartialList(paramList, options, (dictionary, option) => DataService.GetDtoAsync <ImlMedicineListDTO>( orderBy: options.pg_SortExpression ?? "-MedicineName", predicate: p => p.IsFromLicense == false, parameters: dictionary, skip: (options.pg_Page - 1) * PageRowCount.Value, take: PageRowCount.Value))); }
public async Task <IActionResult> List(Guid?appId, string sort, string appType) { if (appId == null) { return(await Task.Run(() => NotFound())); } var appAssigneeList = await _service.GetAssigneeList(appId); ViewBag.AppType = appType; ViewBag.appId = appId; ViewBag.appType = appType; ViewBag.IsAddable = _entityStateHelper.ApplicationAddability(appId.Value).IsAssignee; foreach (var dto in appAssigneeList) { dto.IsEditable = _entityStateHelper.IsEditableAuth(dto.Id) ?? false; } if (sort == "AddBranchApplication") { appAssigneeList = appAssigneeList.OrderBy(x => x.IsFromLicense == true); return(PartialView("List_AddBranchApplication", appAssigneeList)); } ViewBag.Sort = sort; return(PartialView(appAssigneeList)); }
public async Task <IActionResult> List(Guid?appId, string sort) { if (appId == null) { return(NotFound()); } List <BranchListDTO> branchList; if (sort == "AddBranchApplication") { branchList = (await _dataService.GetDtoAsync <BranchListDTO>(x => x.ApplicationId == appId && x.IsFromLicense != true)).ToList(); } else { branchList = (await _dataService.GetDtoAsync <BranchListDTO>(x => x.ApplicationId == appId)).ToList(); } ViewBag.ApplicationId = appId.Value; ViewBag.IsAddable = _entityStateHelper.ApplicationAddability(appId.Value).IsBranch; ViewBag.sort = sort; branchList.ForEach(dto => dto.isEditable = _entityStateHelper.IsEditableBranch(dto.Id)); switch (sort) { case "RemBranchApplication": return(PartialView("List_RemBranchApplication", branchList.Where(x => x.RecordState != RecordState.D))); case "ChangeInfoApplication": return(PartialView("List_ChangeInfo", branchList)); default: return(PartialView(branchList)); } }
public async Task <IActionResult> List(Guid?appId, string sort) { if (appId == null) { return(NotFound()); } var contractorList = (await _dataService.GetDtoAsync <PrlContractorListDTO>(extraParameters: new object[] { $"\'{appId}\'" })).Where(x => x.RecordState != RecordState.D).ToList(); var contractorIds = contractorList.Select(x => x.Id); var branchList = (await _dataService.GetDtoAsync <BranchListDTO>(x => x.ApplicationId == appId)).ToList(); var branchContractors = _dataService.GetEntity <PrlBranchContractor>() .Where(x => contractorIds.Contains(x.ContractorId) && x.RecordState != RecordState.D).ToList(); foreach (var contr in contractorList) { contr.ListOfBranchsNames = new List <string>(); contr.ListOfBranchsNames.AddRange(branchList.Where(br => branchContractors.Where(x => x.ContractorId == contr.Id).Select(x => x.BranchId).Contains(br.Id)).Select(st => st.Name + ',' + st.PhoneNumber)); } ViewBag.appId = appId; ViewBag.AppSort = sort; ViewBag.IsAddable = _entityStateHelper.ApplicationAddability(appId.Value).IsContractor; contractorList.ForEach(x => x.IsEditable = _entityStateHelper.IsEditableContractor(x.Id) ?? false); if (sort == "AddBranchApplication") { contractorList = contractorList.OrderBy(x => x.IsFromLicense == true).ToList(); return(PartialView("List_AddBranchApplication", contractorList)); } if (sort == "ChangeContrApplication") { contractorList = contractorList.OrderBy(x => x.IsFromLicense == true).ToList(); return(PartialView("List_ChangeContrApplication", contractorList)); } return(PartialView(contractorList)); }
public async Task <IActionResult> List(Guid?appId) { if (appId == null) { return(NotFound()); } var eDocumentList = (await _dataService.GetDtoAsync <EDocumentListDTO>(extraParameters: new object[] { $"\'{appId}\'" })).ToList(); var eDocumentIds = eDocumentList.Select(x => x.Id); var branchList = (await _dataService.GetDtoAsync <BranchListDTO>(x => x.ApplicationId == appId)).ToList(); var branchContractors = _dataService.GetEntity <BranchEDocument>() .Where(x => eDocumentIds.Contains(x.EDocumentId)).ToList(); foreach (var contr in eDocumentList) { contr.ListOfBranches = new List <string>(); contr.ListOfBranches.AddRange(branchList.Where(br => branchContractors.Where(x => x.EDocumentId == contr.Id).Select(x => x.BranchId).Contains(br.Id)).Select(st => st.Name + ',' + st.PhoneNumber)); } ViewBag.appId = appId; var app = (await _dataService.GetDtoAsync <AppStateDTO>(x => x.Id == appId))?.FirstOrDefault(); if (app == null) { return(NotFound()); } ViewBag.appId = appId; ViewBag.AppSort = app.AppSort; string eDocType; switch (app.AppType) { case "PRL": eDocType = "ManufactureDossier"; break; case "IML": eDocType = "ImportDossier"; break; case "TRL": eDocType = ""; break; default: return(NotFound()); } ViewBag.eDocType = eDocType; ViewBag.IsAddable = _entityStateHelper.ApplicationAddability(appId.Value).IsEdocument; ViewBag.appType = app.AppType; eDocumentList.ForEach(dto => dto.IsEditable = _entityStateHelper.IsEditableEdoc(dto.Id) ?? false); if (app.AppSort == "AddBranchApplication") { eDocumentList = eDocumentList.OrderBy(x => x.IsFromLicense).ToList(); return(PartialView("List_AddBranchApplication", eDocumentList)); } if (app.AppSort == "AddBranchInfoApplication") { return(PartialView("List_AddBranchInfoApplication", eDocumentList)); } return(PartialView(eDocumentList)); }