public AppAssigneeDetailDTO Edit(AppAssigneeDetailDTO model) { if (model.AppType == "TRL") { if (model.OrgPositionType == "Manager") { model.ListOfBranches = null; } else { model.BranchId = Guid.Empty; } } model.Id = DataService.Add <AppAssignee>(model); DataService.SaveChanges(); var assigneeBranches = DataService.GetEntity <AppAssigneeBranch>(x => x.AssigneeId == model.Id); foreach (var x in assigneeBranches) { DataService.Remove(x); } if (model.AppType == "TRL") { if (model.OrgPositionType == "Manager") { DataService.Add(new AppAssigneeBranch { AssigneeId = model.Id, BranchId = model.BranchId.Value }); } else { model.ListOfBranches?.ForEach(branchId => DataService.Add(new AppAssigneeBranch { AssigneeId = model.Id, BranchId = branchId })); } } else { model.ListOfBranches?.ForEach(branchId => DataService.Add(new AppAssigneeBranch { AssigneeId = model.Id, BranchId = branchId })); } DataService.SaveChanges(); return(model); }
private void BaseTemplate(string templatePath, Guid id, out StringBuilder htmlFile, out Message pdfMessage) { var orgExt = new OrganizationExtDetailDTO(); try { pdfMessage = _dataService.GetEntity <Message>(x => x.Id == id).FirstOrDefault(); var orgId = pdfMessage.OrgUnitId; orgExt = _dataService.GetDto <OrganizationExtDetailDTO>(x => x.Id == orgId).FirstOrDefault(); } catch { throw new Exception("Помилка при отриманні інформації про повідомлення та організацію"); } var emailPath = Path.Combine(_path, templatePath); htmlFile = new StringBuilder(File.ReadAllText(emailPath)); htmlFile.Replace("@@RegDate@@", " " + pdfMessage.MessageDate.ToString("« dd » MMMM yyyy", CultureInfo.CreateSpecificCulture("uk"))); htmlFile.Replace("@@RegNumber@@", " " + pdfMessage.MessageNumber); htmlFile.Replace("@@OrgName@@", " '" + orgExt.Name + "' "); if (string.IsNullOrEmpty(orgExt.INN)) { htmlFile.Replace("@@OrgCode@@", " (ЄДРПОУ " + orgExt.EDRPOU + ") "); } else { htmlFile.Replace("@@OrgCode@@", " (РНОКПП (Індивідуальний податковий номер) " + orgExt.INN + ") "); } if (!string.IsNullOrEmpty(pdfMessage.MessageText)) { var commentPath = Path.Combine(_path, "Templates/Messages/PDFTemplate_MessageComment.html"); var htmlCommentFile = new StringBuilder(File.ReadAllText(commentPath)); htmlCommentFile.Replace("@@MessageComment@@", pdfMessage.MessageText); htmlFile.Replace("@@MessageComment@@", htmlCommentFile.ToString()); } else { htmlFile.Replace("@@MessageComment@@", ""); } htmlFile.Replace("@@UserName@@", _userInfoService.GetCurrentUserInfo().FullName()); htmlFile.Replace("@@Date@@", DateTime.Now.ToString("« dd » MMMM yyyy", CultureInfo.CreateSpecificCulture("uk"))); }
public async Task <IEnumerable <PrlContractorListDTO> > GetAssigneeList(Guid?appId) { var contractorList = (await DataService.GetDtoAsync <PrlContractorListDTO>(extraParameters: new object[] { $"\'{appId}\'" })) .ToList(); var contractorsIds = contractorList.Select(x => x.Id); var branchList = await DataService.GetDtoAsync <BranchListDTO>(x => x.ApplicationId == appId); var branchAssignee = DataService .GetEntity <PrlBranchContractor>(x => contractorsIds.Contains(x.ContractorId)) .ToList(); foreach (var contr in contractorList) { contr.ListOfBranchsNames = new List <string>(); var branchAssigneeIds = branchAssignee.Where(x => x.ContractorId == contr.Id).Select(x => x.BranchId); var branchNamesList = branchList.Where(br => branchAssigneeIds.Contains(br.Id)) .Select(st => st.Name + ',' + st.PhoneNumber); contr.ListOfBranchsNames.AddRange(branchNamesList); } return(contractorList); }
public async Task <JsonResult> SaveSignedFiles(FilesSignViewModel model) { if (model.id == Guid.Empty) { return(new JsonResult(new { success = false, errorMessage = "Виникла помилка, спробуйте пізніше", returnUrl = Url.Action("Index", "Home", new { Area = "" }) })); } if (model.files.Count == 0) { return(new JsonResult(new { success = false, errorMessage = "Виникла помилка, спробуйте пізніше", returnUrl = Url.Action("Details", "PrlApp", new { Area = "APP" }) })); } try { await _prlApplicationService.SubmitApplication(Configuration, model); } catch (Exception) { return(new JsonResult(new { success = false, errorMessage = "Виникла помилка, спробуйте пізніше", returnUrl = Url.Action("Edit", "PrlApp", new { Area = "APP" }) })); } try { var app = _dataService.GetEntity <PrlApplication>(x => x.Id == model.id)?.FirstOrDefault(); await _notificationService.PrlCreateNotificationAppSend(app.Id, app.AppSort, DateTime.Now.ToString("«dd» MMMM yyyy", CultureInfo.CreateSpecificCulture("uk")), app.OrgUnitId); } catch (Exception) { return(new JsonResult(new { success = false, errorMessage = "Виникла помилка з відправкою сповіщення на електронну пошту", returnUrl = Url.Action("Index", "Monitoring", new { Area = "MTR" }) })); } return(new JsonResult(new { success = true, returnUrl = Url.Action("Index", "Monitoring", new { Area = "MTR" }) })); }
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 <bool> ChangeCheck(Guid sendId) { var drug = DataService.GetEntity <ResultInputControl>(x => x.Id == sendId).FirstOrDefault(); if (drug == null) { return(false); } try { drug.SendCheck = !drug.SendCheck; await DataService.SaveChangesAsync(); } catch (Exception) { return(false); } return(true); }
public IActionResult DecisionDetails(Guid appId) { var decision = _commonDataService.GetDto <AppDecisionDTO>(p => p.AppId == appId).SingleOrDefault() ?? new AppDecisionDTO { AppId = appId, Id = Guid.Empty }; if (string.IsNullOrEmpty(decision.ExpertiseResultEnum)) { var exp = _commonDataService.GetDto <TrlAppExpertiseDTO>(p => p.Id == appId).SingleOrDefault(); decision.ExpertiseResultEnum = exp?.ExpertiseResultEnum; } var reasons = _commonDataService.GetEntity <EnumRecord>(p => p.EnumType == "DecisionReason").ToList(); var decisions = decision.DecisionReasons?.Split(',').Aggregate("", (current, s) => current + (reasons.FirstOrDefault(p => p.Code == s)?.Name + ",")); decision.DecisionReasons = decisions?.Remove(decisions.Length - 1, 1); ViewBag.IsEditable = _entityStateHelper.GetAppStates(appId)[nameof(BaseApplication.BackOfficeAppState)] != "Reviewed"; return(PartialView("_trlDecisionDetails", decision)); }
public async Task <IActionResult> SubmitApplication(Guid id) { if (id == Guid.Empty) { return(await Task.Run(() => NotFound())); } var app = _commonDataService.GetEntity <ImlApplication>(x => x.Id == id)?.FirstOrDefault(); if (app == null) { return(await Task.Run(() => NotFound())); } app.AppState = "Submitted"; await _commonDataService.SaveChangesAsync(); return(RedirectToAction("Index", "Home", new { Area = "" })); }
public override async Task <IActionResult> Details(Guid id) { AppAssigneeDetailDTO model = null; if (id == Guid.Empty) { return(await Task.Run(() => NotFound())); } else { model = (await _commonDataService.GetDtoAsync <AppAssigneeDetailDTO>(x => x.Id == id)).FirstOrDefault(); if (model == null) { return(await Task.Run(() => NotFound())); } } var branchAssignee = _commonDataService.GetEntity <AppAssigneeBranch>() .Where(x => x.AssigneeId == model.Id).ToList(); var branchList = (await _commonDataService.GetDtoAsync <BranchListDTO>(x => branchAssignee.Select(y => y.BranchId) .Contains(x.Id))).ToList(); model.ListOfBranchsNames = new List <string>(); var appType = branchList.FirstOrDefault()?.AppType; model.AppType = appType; if (appType == "TRL") { HttpContext.ModifyCurrentBreadCrumb(p => p.Name = "Завідувачі/Уповноважені особи"); if (model.OrgPositionType == "Manager") { model.BranchName = branchList.Select(st => st.Name + ',' + st.PhoneNumber).FirstOrDefault(); } else { model.ListOfBranchsNames.AddRange(branchList.Select(st => st.Name + ',' + st.PhoneNumber)); } } else { model.ListOfBranchsNames.AddRange(branchList.Select(st => st.Name + ',' + st.PhoneNumber)); } return(View(model)); }
public async Task <IActionResult> Index() { var orgId = (await _userInfoService.GetCurrentUserInfoAsync())?.OrganizationId(); if (orgId == null) { return(await Task.Run(() => NotFound())); } var orgInfos = _dataService .GetEntity <OrganizationInfo>(x => x.OrganizationId == new Guid(orgId) && x.IsActualInfo); var dick = orgInfos.ToDictionary(x => x.Type, x => x.IsPendingLicenseUpdate); var licenses = await _licenseService.GetActiveLicenses(); licenses.ForEach(p => dick.Add("LIC_" + p.type, p.isActive)); ViewBag.isFop = false;//string.IsNullOrEmpty((await _userInfoService.GetCurrentUserInfoAsync()).EDRPOU()); return(View(dick)); }
public override async Task <IActionResult> List(IDictionary <string, string> paramList, Core.Mvc.Controllers.ActionListOption <MtrAppListDTO> actionListOption) { var reasons = _dataService.GetEntity <EnumRecord>(p => p.EnumType == "DecisionReason").ToList(); actionListOption.pg_SortExpression = !string.IsNullOrEmpty(actionListOption.pg_SortExpression) ? actionListOption.pg_SortExpression : "-ModifiedOn"; return(await base.List(paramList, actionListOption, async (x, y) => { var decisions = (await DataService.GetDtoAsync <MtrAppListDTO>(actionListOption.pg_SortExpression, parameters: x, skip: (actionListOption.pg_Page - 1) * PageRowCount.Value, take: PageRowCount.Value)).ToList(); decisions.ForEach(decision => { decision.DecisionReason = decision.DecisionReason? .Split(',') .Aggregate("", (current, s) => current + (reasons.FirstOrDefault(p => p.Code == s)?.Name + ", ")); }); return decisions; })); }
public async Task <bool> ChangeCheckBox(string checkBoxId, Guid appId) { var application = _commonDataService.GetEntity <T>(x => x.Id == appId && x.RecordState != RecordState.D).SingleOrDefault(); if (application == null) { return(false); } switch (checkBoxId) { case "IsCheckMPD": application.IsCheckMpd = !application.IsCheckMpd; break; case "IsPaperLicense": application.IsPaperLicense = !application.IsPaperLicense; break; case "IsCourierDelivery": application.IsCourierDelivery = !application.IsCourierDelivery; break; case "IsPostDelivery": application.IsPostDelivery = !application.IsPostDelivery; break; case "IsCourierResults": application.IsCourierResults = !application.IsCourierResults; break; case "IsPostResults": application.IsPostResults = !application.IsPostResults; break; case "IsElectricFormResults": application.IsElectricFormResults = !application.IsElectricFormResults; break; case "IsAgreeLicenseTerms": application.IsAgreeLicenseTerms = !application.IsAgreeLicenseTerms; break; case "IsAgreeProcesingData": application.IsAgreeProcessingData = !application.IsAgreeProcessingData; break; case "IsProtectionFromAggressors": application.IsProtectionFromAggressors = !application.IsProtectionFromAggressors; break; } try { await _commonDataService.SaveChangesAsync(); } catch (Exception) { return(false); } return(true); }
public void SaveExpertise(TrlAppExpertiseDTO model) { var trl = _dataService.GetEntity <TrlApplication>(p => p.Id == model.Id).SingleOrDefault(); if (trl == null) { return; } var orgUnitId = trl.OrgUnitId; _objectMapper.Map(model, trl); trl.ExpertiseResult = model.ExpertiseResultEnum; trl.PerformerOfExpertise = model.PerformerOfExpertiseId; trl.OrgUnitId = orgUnitId; _dataService.SaveChanges(); _limsExchangeService.UpdateExpertiseTRL(model); // сделал, но нет экспертизы в заяве , }
//public async Task<string> TrlCreateLicenseApp(Guid id) //{ // // Генерація pdf для TRL // var app = (await _dataService.GetDtoAsync<TrlAppDetailDTO>(x => x.Id == id)).FirstOrDefault(); // var branches = await _dataService.GetDtoAsync<BranchDetailsDTO>(x => x.ApplicationId == id); // var assigneeBranches = // _dataService.GetEntity<AppAssigneeBranch>(x => branches.Select(y => y.Id).Contains(x.BranchId)).Select(x => x.AssigneeId); // var assignees = await _dataService.GetDtoAsync<AppAssigneeDetailDTO>(x => assigneeBranches.Contains(x.Id)); // if (app == null) // { // throw new Exception("No application"); // } // //var trlActivityType = _dataService.GetEntity<EntityEnumRecords>(x => x.EntityId == id).Select(x => x.EnumRecordCode); // //var enumR = _dataService.GetEntity<EnumRecord>(x => x.EnumType == "TrlActivityType" && trlActivityType.Contains(x.Code)).ToList(); // var a = _dataService.GetDto<EntityEnumDTO>(x => x.ApplicationId == id).ToList(); // var appObject = _objectMapper.Map<RptTrlAppDTO>(app); // var checkbox = ((char)ushort.Parse("2611", NumberStyles.HexNumber)).ToString(); // var employeeList = ""; // var mpdList = ""; // var pathHtml = string.IsNullOrEmpty(app.EDRPOU) // ? "Templates/Htmls/TRL/Htmls/CreateLicenseApp/PDFTemplate_CreateLicenseAppTRL_FOP.html" // : "Templates/Htmls/TRL/Htmls/CreateLicenseApp/PDFTemplate_CreateLicenseAppTRL_ORG.html"; // var emailPath = Path.Combine(path, pathHtml); // var htmlFile = new StringBuilder(File.ReadAllText(emailPath)); // var mpdPath = Path.Combine(path, "Templates/Htmls/TRL/Htmls/PDFTemplate_TRL_MPD.html"); // var empPath = Path.Combine(path, "Templates/Htmls/TRL/Htmls/PDFTemplate_TRL_AutPersonList.html"); // foreach (var employee in assignees) // { // var empFile = new StringBuilder(File.ReadAllText(empPath)); // empFile.Replace("@@AssigneTypeName@@", employee.AssigneTypeName); // empFile.Replace("@@AutPersonPosition@@", employee.NameOfPosition); // empFile.Replace("@@AutPersonSurname@@", employee.LastName); // empFile.Replace("@@AutPersonName@@", employee.Name); // empFile.Replace("@@AutPersonMiddleName@@", employee.MiddleName); // empFile.Replace("@@AutPersonEducation@@", employee.EducationInstitution); // empFile.Replace("@@AutPersonExperience@@", employee.WorkExperience); // employeeList += empFile.ToString(); // } // foreach (var branch in branches) // { // var mpdFile = new StringBuilder(File.ReadAllText(mpdPath)); // mpdFile.Replace("@@MPDName@@", branch.Name); // mpdFile.Replace("@@AddressString@@", branch.PostIndex + ", " + branch.Address); // mpdFile.Replace("@@AddressEng@@", branch.AdressEng); // mpdFile.Replace("@@PhoneNumber@@", StandartPhone(branch.PhoneNumber)); // mpdFile.Replace("@@FaxNumber@@", StandartPhone(branch.FaxNumber)); // mpdFile.Replace("@@E-mail@@", branch.EMail); // mpdFile.Replace("@@ListOfTrlActivityTypeName@@", branch.EMail); // mpdFile.Replace("@@BranchTypeName@@", branch.EMail); // mpdFile.Replace("@@SpecialConditions@@", branch.SpecialConditions); // mpdFile.Replace("@@AsepticConditionsName@@", branch.AsepticConditions); // mpdList += mpdFile.ToString(); // } // htmlFile.Replace("@@AutPersonList@@", employeeList); // htmlFile.Replace("@@MPD@@", mpdList); // htmlFile.Replace("@@OrgName@@", appObject.OrgName); // htmlFile.Replace("@@AddressString@@", appObject.PostIndex + ", " + appObject.Address); // htmlFile.Replace("@@OrgDirector@@", appObject.OrgDirector); // htmlFile.Replace("@@LegalFormTypeName@@", appObject.LegalFormName); // htmlFile.Replace("@@EDRPOU@@", string.IsNullOrEmpty(appObject.EDRPOU) ? "</br>" : appObject.EDRPOU); // htmlFile.Replace("@@Phone@@", StandartPhone(appObject.PhoneNumber)); // htmlFile.Replace("@@FaxNumber@@", StandartPhone(appObject.FaxNumber)); // htmlFile.Replace("@@EMail@@", appObject.EMail); // htmlFile.Replace("@@EconomicClassificationTypeName@@", appObject.EconomicClassificationTypeName); // htmlFile.Replace("@@ActivityTypeName@@", appObject.ActivityTypeName); // htmlFile.Replace("@@NationalAccount@@", appObject.NationalAccount); // htmlFile.Replace("@@NationalBankRequisites@@", appObject.NationalBankRequisites); // htmlFile.Replace("@@InternationalAccount@@", appObject.InternationalAccount); // htmlFile.Replace("@@InternationalBankRequisites@@", appObject.InternationalBankRequisites); // htmlFile.Replace("@@Duns@@", appObject.Duns); // htmlFile.Replace("@@IsConditionsForControl@@", appObject.IsConditionsForControl ? checkbox : ""); // htmlFile.Replace("@@IsCheckMPD@@", appObject.IsCheckMpd ? checkbox : ""); // htmlFile.Replace("@@IsPaperLicense@@", appObject.IsPaperLicense ? checkbox : ""); // htmlFile.Replace("@@IsCourierDelivery@@", appObject.IsCourierDelivery ? checkbox : ""); // htmlFile.Replace("@@IsPostDelivery@@", appObject.IsPostDelivery ? checkbox : ""); // htmlFile.Replace("@@IsAgreeLicenseTerms@@", appObject.IsAgreeLicenseTerms ? checkbox : ""); // htmlFile.Replace("@@IsAgreeProcesingData@@", appObject.IsAgreeProcessingData ? checkbox : ""); // htmlFile.Replace("@@IsCourierResults@@", appObject.IsCourierResults ? checkbox : ""); // htmlFile.Replace("@@IsPostResults@@", appObject.IsPostResults ? checkbox : ""); // htmlFile.Replace("@@IsElectricFormResults@@", appObject.IsElectricFormResults ? checkbox : ""); // htmlFile.Replace("@@PassportSerial@@", appObject.PassportSerial); // htmlFile.Replace("@@PassportNumber@@", appObject.PassportNumber); // htmlFile.Replace("@@PassportDate@@", // appObject.PassportDate.HasValue // ? appObject.PassportDate.Value.ToString("«dd» MMMM yyyy", CultureInfo.CreateSpecificCulture("uk")) // : ""); // htmlFile.Replace("@@PassportIssueUnit@@", appObject.PassportIssueUnit); // htmlFile.Replace("@@INN@@", string.IsNullOrEmpty(appObject.INN) ? "</br>" : appObject.INN); // htmlFile.Replace("@@OrgEmployeeExt@@", employeeList); // htmlFile.Replace("@@UserName@@", _userInfoService.GetCurrentUserInfo().FullName()); // htmlFile.Replace("@@Date@@", // DateTime.Now.ToString("«dd» MMMM yyyy", CultureInfo.CreateSpecificCulture("uk"))); // var infoFile = GetAddon(); // htmlFile.Append(infoFile); // return htmlFile.ToString(); //} public async Task <string> TrlCreateLicenseApp(Guid id) { // Генерація pdf для TRL var app = (await _dataService.GetDtoAsync <TrlAppDetailDTO>(x => x.Id == id)).FirstOrDefault(); var branches = await _dataService.GetDtoAsync <BranchDetailsDTO>(x => x.ApplicationId == id); if (app == null) { throw new Exception("No application"); } var activityTypeList = _dataService.GetDto <EntityEnumDTO>(x => x.ApplicationId == id).Select(x => x.EnumCode); var appObject = _objectMapper.Map <RptTrlAppDTO>(app); var checkbox = ((char)ushort.Parse("2611", NumberStyles.HexNumber)).ToString(); var checkboxEmpty = ((char)ushort.Parse("2610", NumberStyles.HexNumber)).ToString(); var mpdList = ""; var pathHtml = "Templates/Htmls/TRL/Htmls/CreateLicenseApp/PDFTemplate_CreateLicenseAppTRL.html"; var emailPath = Path.Combine(path, pathHtml); var htmlFile = new StringBuilder(File.ReadAllText(emailPath)); var mpdPath = Path.Combine(path, "Templates/Htmls/TRL/Htmls/PDFTemplate_TRL_MPD_License.html"); foreach (var branch in branches) { var mpdFile = new StringBuilder(File.ReadAllText(mpdPath)); var activityType = _dataService.GetDto <EntityEnumDTO>(x => x.BranchId == branch.Id).FirstOrDefault()?.EnumName; if (branch.BranchType == "PharmacyItem") { var farmacyItem = _dataService.GetEntity <PharmacyItemPharmacy>(x => x.PharmacyItemId == branch.Id).ToList(); foreach (var item in farmacyItem) { var farmacy = _dataService.GetDto <BranchDetailsDTO>(x => x.Id == item.PharmacyId).ToList(); if (farmacy.Any()) { mpdFile.Replace("@@MPD@@", branch.Name + ", " + "</br>" + farmacy.FirstOrDefault()?.Name + "</br>" + (string.IsNullOrEmpty(branch.Lpz) ? "" : ", " + branch.Lpz)); } else { mpdFile.Replace("@@MPD@@", branch.Name + ", " + "</br>" + (string.IsNullOrEmpty(branch.Lpz) ? "" : ", " + branch.Lpz)); } } mpdFile.Replace("@@ActivityType@@", activityType ?? ""); mpdFile.Replace("@@MpdAddress@@", branch.PostIndex + ", " + branch.Address); } else { mpdFile.Replace("@@MPD@@", branch.Name); mpdFile.Replace("@@MpdAddress@@", branch.PostIndex + ", " + branch.Address); mpdFile.Replace("@@ActivityType@@", activityType ?? ""); } mpdList += mpdFile.ToString(); } htmlFile.Replace("@@MpdList@@", mpdList); htmlFile.Replace("@@Name@@", appObject.OrgName + ", " + appObject.Address); if (string.IsNullOrEmpty(appObject.EDRPOU)) { htmlFile.Replace("@@OrgName@@", "."); htmlFile.Replace("@@FopName@@", appObject.OrgName); htmlFile.Replace("@@PassportData@@", appObject.PassportSerial + ", " + appObject.PassportNumber + ", " + (appObject.PassportDate.HasValue ? appObject.PassportDate.Value.ToString("«dd» MMMM yyyy", CultureInfo.CreateSpecificCulture("uk")) : "")); htmlFile.Replace("@@PassportIssueUnit@@", string.IsNullOrEmpty(appObject.PassportIssueUnit) ? "." : appObject.PassportIssueUnit); htmlFile.Replace("@@INN@@", appObject.INN); htmlFile.Replace("@@EDRPOU@@", "."); } else { htmlFile.Replace("@@FopName@@", "."); htmlFile.Replace("@@OrgName@@", appObject.OrgDirector); htmlFile.Replace("@@PassportData@@", "."); htmlFile.Replace("@@PassportIssueUnit@@", "."); htmlFile.Replace("@@INN@@", "."); htmlFile.Replace("@@EDRPOU@@", appObject.EDRPOU); } htmlFile.Replace("@@EMail@@", appObject.EMail); htmlFile.Replace("@@Phone@@", StandartPhone(appObject.PhoneNumber)); var retailOfMedicines = false; var wholesaleOfMedicines = false; var prlInPharmacies = false; foreach (var activityType in activityTypeList) { switch (activityType) { case "RetailOfMedicines": retailOfMedicines = true; break; case "WholesaleOfMedicines": wholesaleOfMedicines = true; break; case "PrlInPharmacies": prlInPharmacies = true; break; } } htmlFile.Replace("@@RetailOfMedicines@@", !retailOfMedicines ? checkboxEmpty : checkbox); htmlFile.Replace("@@WholesaleOfMedicines@@", !wholesaleOfMedicines ? checkboxEmpty : checkbox); htmlFile.Replace("@@PrlInPharmacies@@", !prlInPharmacies ? checkboxEmpty : checkbox); htmlFile.Replace("@@LegalFormTypeName@@", appObject.LegalFormName); htmlFile.Replace("@@UserName@@", _userInfoService.GetCurrentUserInfo().FullName()); htmlFile.Replace("@@IsCheckMPD@@", appObject.IsCheckMpd ? checkbox : checkboxEmpty); htmlFile.Replace("@@IsCourierDelivery@@", appObject.IsCourierDelivery ? checkbox : checkboxEmpty); htmlFile.Replace("@@IsPostDelivery@@", appObject.IsPostDelivery ? checkbox : checkboxEmpty); htmlFile.Replace("@@IsCourierResults@@", appObject.IsCourierResults ? checkbox : checkboxEmpty); htmlFile.Replace("@@IsPostResults@@", appObject.IsPostResults ? checkbox : checkboxEmpty); htmlFile.Replace("@@IsElectricFormResults@@", appObject.IsElectricFormResults ? checkbox : checkboxEmpty); htmlFile.Replace("@@Date@@", DateTime.Now.ToString("«dd» MMMM yyyy", CultureInfo.CreateSpecificCulture("uk"))); htmlFile.Replace("@@RegDate@@", (appObject.RegDate != null ? appObject.RegDate.Value.ToString("«dd» MMMM yyyy", CultureInfo.CreateSpecificCulture("uk")) : " \"___\" ___________ 20___")); htmlFile.Replace("@@RegNumber@@", (!string.IsNullOrEmpty(appObject.RegNumber) ? appObject.RegNumber : "__________")); var infoFile = GetAddon(); htmlFile.Append(infoFile); return(htmlFile.ToString()); }
public async Task <IActionResult> Index(Guid appId, bool jsonData) { var application = _dataService.GetEntity <TrlApplication>(x => x.Id == appId).FirstOrDefault(); if (application == null) { return(await Task.Run(() => NotFound())); } var errorModel = new Dictionary <string, string>(); StringBuilder error = new StringBuilder(); StringBuilder code = new StringBuilder(); var branchList = (await _dataService.GetDtoAsync <BranchListDTO>(x => x.ApplicationId == appId)); var branchListIds = branchList.Select(dto => dto.Id); if (!branchList.Any()) { error.Append("<p>").Append("Місця провадження діяльності").Append("</p>") .Append("<p>") .Append("Перевіряється наявність доданого до заяви хоча б одного місця провадження діяльності") .Append("</p>"); code.Append("До заяви не додано хоча б одне місце провадження діяльності."); errorModel.Add(error.ToString(), code.ToString()); error.Clear(); code.Clear(); } else { var assigneeBranches = _dataService.GetEntity <AppAssigneeBranch>(x => branchListIds.Contains(x.BranchId) && x.RecordState != RecordState.D).ToList(); var assignees = _dataService.GetEntity <AppAssignee>(x => assigneeBranches.Select(z => z.AssigneeId).Contains(x.Id)).ToList(); var check = false; foreach (var pharmacy in branchList.Where(x => x.BranchType == "Pharmacy")) { var assigneePharmacies = assigneeBranches.Where(x => x.BranchId == pharmacy.Id); if (assignees.Where(x => assigneePharmacies.Select(z => z.AssigneeId).Contains(x.Id)).All(x => x.OrgPositionType != "Authorized")) { if (check == false) { error.Append("<p>").Append("Реєстр уповноважених осіб").Append("</p>") .Append("<p>") .Append( "Перевіряється наявність хоча б одної уповноваженої особи для кожного введеного МПД") .Append("</p>"); code.Append("Перелік зауважень по реєстру 'Уповноважені особи': ").Append("<br>"); check = true; } code.Append("Для "); code.Append("\"") .Append(pharmacy.Name) .Append("\""); code.Append(" не вказано уповноважену особу").Append("<br>"); } } if (!string.IsNullOrEmpty(error.ToString())) { errorModel.Add(error.ToString(), code.ToString()); error.Clear(); code.Clear(); } check = false; foreach (var branch in branchList) { var assigneeBranch = assigneeBranches.Where(x => x.BranchId == branch.Id); if (!assignees.Where(x => assigneeBranch.Select(z => z.AssigneeId).Contains(x.Id)) .Any(x => x.OrgPositionType == "Manager")) { if (check == false) { error.Append("<p>").Append("Реєстр уповноважених осіб").Append("</p>") .Append("<p>") .Append( "Перевіряється наявність хоча б одного завідувача для кожного введеного МПД") .Append("</p>"); code.Append("Перелік зауважень по реєстру 'Уповноважені особи': ").Append("<br>"); check = true; } code.Append("Для "); code.Append("\"") .Append(branch.Name) .Append("\""); code.Append(" не вказано завідувача").Append("<br>"); } } if (!string.IsNullOrEmpty(error.ToString())) { errorModel.Add(error.ToString(), code.ToString()); error.Clear(); code.Clear(); } //var edocBranches = _dataService.GetEntity<BranchEDocument>(x => branchListIds.Contains(x.BranchId) && x.RecordState != RecordState.D); //var edocBranchIds = edocBranches.Select(x => x.BranchId).Distinct(); //if (edocBranchIds.Count() != branchListIds.Count()) //{ // error.Append("<p>").Append("Реєстр досьє з виробництва").Append("</p>") // .Append("<p>").Append("Перевіряється наявність досьє з виробництва для кожного введеного МПД") // .Append("</p>"); // code.Append("Перелік зауважень по реєстру 'Реєстр досьє': ").Append("<br>"); // foreach (var branchId in branchListIds) // { // if (!edocBranchIds.Contains(branchId)) // { // code.Append("Для "); // code.Append("\"") // .Append(branchList.Where(x => x.Id == branchId).Select(y => y.Name).First()) // .Append("\""); // code.Append(" не додано досьє з виробництва").Append("<br>"); // } // } // errorModel.Add(error.ToString(), code.ToString()); // error.Clear(); // code.Clear(); //} } if (jsonData) { return(new JsonResult(errorModel)); } return(PartialView(model: errorModel)); }
public async Task <string> ImlCreateLicenseApp(Guid id) { // Генерація pdf для IML var app = (await _dataService.GetDtoAsync <ImlAppDetailDTO>(x => x.Id == id)).FirstOrDefault(); var branches = await _dataService.GetDtoAsync <ReportBranchFullDetailsDTO>(x => x.ApplicationId == id); var assigneeBranches = _dataService.GetEntity <AppAssigneeBranch>(x => branches.Select(y => y.Id).Contains(x.BranchId)).Select(x => x.AssigneeId); var assignees = await _dataService.GetDtoAsync <AppAssigneeDetailDTO>(x => assigneeBranches.Contains(x.Id)); if (app == null) { throw new Exception("No application"); } var appObject = _objectMapper.Map <RptImlAppDTO>(app); appObject.Branches = branches.ToList(); var checkbox = ((char)ushort.Parse("2611", NumberStyles.HexNumber)).ToString(); var employeeList = ""; var mpdList = ""; var pathHtml = string.IsNullOrEmpty(app.EDRPOU) ? "Templates/Htmls/IML/Htmls/CreateLicenseApp/PDFTemplate_CreateLicenseAppIML_FOP.html" : "Templates/Htmls/IML/Htmls/CreateLicenseApp/PDFTemplate_CreateLicenseAppIML_ORG.html"; var emailPath = Path.Combine(path, pathHtml); var htmlFile = new StringBuilder(File.ReadAllText(emailPath)); var mpdPath = Path.Combine(path, "Templates/Htmls/IML/Htmls/PDFTemplate_IML_MPD.html"); var empPath = Path.Combine(path, "Templates/Htmls/IML/Htmls/PDFTemplate_IML_AutPersonList.html"); foreach (var employee in assignees) { var empFile = new StringBuilder(File.ReadAllText(empPath)); empFile.Replace("@@AutPersonPosition@@", employee.NameOfPosition); empFile.Replace("@@AutPersonSurname@@", employee.LastName); empFile.Replace("@@AutPersonName@@", employee.Name); empFile.Replace("@@AutPersonMiddleName@@", employee.MiddleName); empFile.Replace("@@AutPersonEducation@@", employee.EducationInstitution); empFile.Replace("@@AutPersonExperience@@", employee.WorkExperience); employeeList += empFile.ToString(); } foreach (var branch in appObject.Branches) { var mpdFile = new StringBuilder(File.ReadAllText(mpdPath)); mpdFile.Replace("@@MPDName@@", branch.Name); mpdFile.Replace("@@AddressString@@", branch.PostIndex + ", " + branch.Address); mpdFile.Replace("@@AddressEng@@", branch.AdressEng); mpdFile.Replace("@@PhoneNumber@@", StandartPhone(branch.PhoneNumber)); mpdFile.Replace("@@FaxNumber@@", StandartPhone(branch.FaxNumber)); mpdFile.Replace("@@E-mail@@", branch.EMail); mpdFile.Replace("@@IMLIsAvailiableStorageZone@@", branch.IMLIsAvailiableStorageZone ? checkbox : ""); mpdFile.Replace("@@IMLIsAvailiableQuality@@", branch.IMLIsAvailiableQuality ? checkbox : ""); mpdFile.Replace("@@IMLIsAvailiablePermitIssueZone@@", branch.IMLIsAvailiablePermitIssueZone ? checkbox : ""); mpdList += mpdFile.ToString(); } htmlFile.Replace("@@AutPersonList@@", employeeList); htmlFile.Replace("@@MPD@@", mpdList); htmlFile.Replace("@@OrgName@@", appObject.OrgName); htmlFile.Replace("@@AddressString@@", appObject.PostIndex + ", " + appObject.Address); htmlFile.Replace("@@OrgDirector@@", appObject.OrgDirector); htmlFile.Replace("@@LegalFormTypeName@@", appObject.LegalFormName); htmlFile.Replace("@@EDRPOU@@", string.IsNullOrEmpty(appObject.EDRPOU) ? "</br>" : appObject.EDRPOU); htmlFile.Replace("@@Phone@@", StandartPhone(appObject.PhoneNumber)); htmlFile.Replace("@@FaxNumber@@", StandartPhone(appObject.FaxNumber)); htmlFile.Replace("@@EMail@@", appObject.EMail); htmlFile.Replace("@@NationalAccount@@", appObject.NationalAccount); htmlFile.Replace("@@NationalBankRequisites@@", appObject.NationalBankRequisites); htmlFile.Replace("@@InternationalAccount@@", appObject.InternationalAccount); htmlFile.Replace("@@InternationalBankRequisites@@", appObject.InternationalBankRequisites); htmlFile.Replace("@@Duns@@", appObject.Duns); htmlFile.Replace("@@IMLIsImportingFinished@@", appObject.IMLIsImportingFinished ? checkbox : ""); htmlFile.Replace("@@IMLIsImportingInBulk@@", appObject.IMLIsImportingInBulk ? checkbox : ""); htmlFile.Replace("@@IMLAnotherActivityBool@@", !string.IsNullOrEmpty(appObject.IMLAnotherActivity) ? checkbox : ""); htmlFile.Replace("@@IMLAnotherActivity@@", appObject.IMLAnotherActivity); htmlFile.Replace("@@IsConditionsForControl@@", appObject.IsConditionsForControl ? checkbox : ""); htmlFile.Replace("@@IsCheckMPD@@", appObject.IsCheckMpd ? checkbox : ""); htmlFile.Replace("@@IsPaperLicense@@", appObject.IsPaperLicense ? checkbox : ""); htmlFile.Replace("@@IsCourierDelivery@@", appObject.IsCourierDelivery ? checkbox : ""); htmlFile.Replace("@@IsPostDelivery@@", appObject.IsPostDelivery ? checkbox : ""); htmlFile.Replace("@@IsAgreeLicenseTerms@@", appObject.IsAgreeLicenseTerms ? checkbox : ""); htmlFile.Replace("@@IsAgreeProcesingData@@", appObject.IsAgreeProcessingData ? checkbox : ""); htmlFile.Replace("@@IsGoodManufacturingPractice@@", appObject.IsGoodManufacturingPractice ? checkbox : ""); htmlFile.Replace("@@IsCourierResults@@", appObject.IsCourierResults ? checkbox : ""); htmlFile.Replace("@@IsPostResults@@", appObject.IsPostResults ? checkbox : ""); htmlFile.Replace("@@IsElectricFormResults@@", appObject.IsElectricFormResults ? checkbox : ""); htmlFile.Replace("@@PassportSerial@@", appObject.PassportSerial); htmlFile.Replace("@@PassportNumber@@", appObject.PassportNumber); htmlFile.Replace("@@PassportDate@@", appObject.PassportDate.HasValue ? appObject.PassportDate.Value.ToString("«dd» MMMM yyyy", CultureInfo.CreateSpecificCulture("uk")) : ""); htmlFile.Replace("@@PassportIssueUnit@@", appObject.PassportIssueUnit); htmlFile.Replace("@@INN@@", string.IsNullOrEmpty(appObject.INN) ? "</br>" : appObject.INN); htmlFile.Replace("@@OrgEmployeeExt@@", employeeList); htmlFile.Replace("@@UserName@@", _userInfoService.GetCurrentUserInfo().FullName()); htmlFile.Replace("@@Date@@", DateTime.Now.ToString("«dd» MMMM yyyy", CultureInfo.CreateSpecificCulture("uk"))); var infoFile = GetAddon(); htmlFile.Append(infoFile); return(htmlFile.ToString()); }
public void SaveDecision(AppDecisionDTO model) { var decision = _dataService.GetEntity <AppDecision>(p => p.Id == model.Id).SingleOrDefault(); var isUpdate = false; if (decision == null) { decision = new AppDecision(); } else { _dataService.GetEntity <AppDecisionReason>(p => p.AppDecisionId == decision.Id).ToList() .ForEach(x => _dataService.Remove(x)); isUpdate = true; } _objectMapper.Map(model, decision); foreach (var reason in model.ListOfDecisionReason) { decision.AppDecisionReasons.Add(new AppDecisionReason { ReasonType = reason, AppDecisionId = decision.Id }); } var prl = _dataService.GetEntity <PrlApplication>(p => p.Id == decision.AppId).SingleOrDefault(); if (prl == null || string.IsNullOrEmpty(prl.ExpertiseResult) || prl.AppState == "Reviewed") { return; } prl.AppDecision = decision; _dataService.Add(decision, isUpdate); _limsExchangeService.ExportDecision(decision, isUpdate); _dataService.SaveChanges(); }
public IActionResult InfoUpdate(UserAreaDetailDTO model) { var isChangedOrg = false; var isChangedEmployee = false; var isChangedPerson = false; var userInfo = _userInfoService.GetCurrentUserInfo(); var userEmployeeEntity = new EmployeeExt(); var userPersonEntity = new Person(); var userOrgEntity = new OrganizationExt(); try { Guid personGuid = userInfo.PersonId; userEmployeeEntity = _commonDataService.GetEntity <EmployeeExt>(org_employee => (org_employee.PersonId == userInfo.PersonId)).FirstOrDefault(); userPersonEntity = _commonDataService.GetEntity <Person>(person => (person.Id == userInfo.PersonId)).FirstOrDefault(); userOrgEntity = _commonDataService.GetEntity <OrganizationExt>(org_organization => (org_organization.Id == userEmployeeEntity.OrganizationId)).FirstOrDefault(); } catch { return(NotFound()); } // должность if (!string.IsNullOrEmpty(model.Position) && (model.Position != userEmployeeEntity.Position)) { isChangedEmployee = true; userEmployeeEntity.Position = model.Position; } // мейл пользователя if (!string.IsNullOrEmpty(model.UserEmail) && (model.UserEmail != userEmployeeEntity.UserEmail)) { isChangedEmployee = true; userEmployeeEntity.UserEmail = model.UserEmail; } // мейл компании if (!string.IsNullOrEmpty(model.OrgEmail) && (model.OrgEmail != userOrgEntity.EMail)) { isChangedOrg = true; userOrgEntity.EMail = model.OrgEmail; } // телефон пользователя if (!string.IsNullOrEmpty(model.Phone) && (model.Phone != userPersonEntity.Phone)) { isChangedPerson = true; userPersonEntity.Phone = model.Phone; } // оповещение ReceiveOnChangeAllApplication if (model.ReceiveOnChangeAllApplication != userEmployeeEntity.ReceiveOnChangeAllApplication) { isChangedEmployee = true; userEmployeeEntity.ReceiveOnChangeAllApplication = model.ReceiveOnChangeAllApplication; } // оповещение ReceiveOnChangeAllMessage if (model.ReceiveOnChangeAllMessage != userEmployeeEntity.ReceiveOnChangeAllMessage) { isChangedEmployee = true; userEmployeeEntity.ReceiveOnChangeAllMessage = model.ReceiveOnChangeAllMessage; } // оповещение ReceiveOnChangeOwnApplication if (model.ReceiveOnChangeOwnApplication != userEmployeeEntity.ReceiveOnChangeOwnApplication) { isChangedEmployee = true; userEmployeeEntity.ReceiveOnChangeOwnApplication = model.ReceiveOnChangeOwnApplication; } // оповещение ReceiveOnChangeOwnMessage if (model.ReceiveOnChangeOwnMessage != userEmployeeEntity.ReceiveOnChangeOwnMessage) { isChangedEmployee = true; userEmployeeEntity.ReceiveOnChangeOwnMessage = model.ReceiveOnChangeOwnMessage; } // оповещение PersonalCabinetStatus - TODO - переименовать if (model.PersonalCabinetStatus != userEmployeeEntity.PersonalCabinetStatus) { isChangedEmployee = true; userEmployeeEntity.PersonalCabinetStatus = model.PersonalCabinetStatus; } // оповещение ReceiveOnChangeOrgInfo - TODO - добавить в модель if (model.ReceiveOnChangeOrgInfo != userEmployeeEntity.ReceiveOnChangeOrgInfo) { isChangedEmployee = true; userEmployeeEntity.ReceiveOnChangeOrgInfo = model.ReceiveOnChangeOrgInfo; } // оповещение ReceiveOnOverduePayment - TODO - добавить в модель if (model.ReceiveOnOverduePayment != userEmployeeEntity.ReceiveOnOverduePayment) { isChangedEmployee = true; userEmployeeEntity.ReceiveOnOverduePayment = model.ReceiveOnOverduePayment; } try { if (isChangedPerson) { _commonDataService.Add(userPersonEntity, true); } } catch { return(Json(new { success = false, errortext = "Помилка збереження інформації в базу даних (персона)!" })); } try { if (isChangedEmployee) { _commonDataService.Add(userEmployeeEntity, true); } } catch { return(Json(new { success = false, errortext = "Помилка збереження інформації в базу даних (співробітник)!" })); } try { if (isChangedOrg) { _commonDataService.Add(userOrgEntity, true); } } catch { return(Json(new { success = false, errortext = "Помилка збереження інформації в базу даних (організація)!" })); } if (isChangedPerson || isChangedEmployee || isChangedOrg) { _commonDataService.SaveChanges(); } return(Json(new { success = true, errortext = "Зміна даних користувача пройшла успішно!" })); }
private async Task <Guid> ProcessLicenseToApplication(Guid licenseId, string sort, bool isBackOffice) { var license = _commonDataService.GetEntity <ImlLicense>(lic => lic.Id == licenseId).FirstOrDefault(); if (license == null || license.ParentId == null) { Log.Error("license == null"); throw new NullReferenceException("Виникла помилка!"); } return(await ProcessApplicationToApplication(license.ParentId.Value, licenseId, sort, isBackOffice)); }
public IActionResult CreateNewPRLLicenseApplication() { var abjAdd = _dataService.GetEntity <SubjectAddress>().FirstOrDefault(); var userInfo = _userInfoService.GetCurrentUserInfo(); var appDTO = new PrlAppDetailDTO() { Id = Guid.Empty, Caption = null, OrgUnitId = Guid.Empty, OrganizationInfoId = Guid.Empty, OrgName = userInfo.OrganizationName(), EDRPOU = userInfo.EDRPOU(), INN = userInfo.INN(), LegalFormType = "470", PassportSerial = null, PassportNumber = null, OwnershipType = "32", PassportDate = null, PassportIssueUnit = null, OrgDirector = null, EMail = $"{CreateString(5)}@mail.com", PhoneNumber = CreateNumericString(10), FaxNumber = CreateNumericString(10), StreetId = Guid.Empty, StreetName = null, CityId = Guid.Empty, CityName = null, CityEnum = null, PostIndex = null, RegionId = Guid.Empty, RegionName = null, DistrictName = null, Building = null, AddressType = null, AddressId = abjAdd.Id, NationalAccount = $"NationalAccount:{CreateString(10)}", NationalBankRequisites = $"NationalBankRequisites:{CreateString(10)}", InternationalAccount = $"InternationalAccount:{CreateString(10)}", InternationalBankRequisites = $"InternationalBankRequisites:{CreateString(10)}", Duns = $"Duns:{CreateString(10)}", AppType = "PRL", AppSort = "GetLicenseApplication", LegalFormName = null, OwnershipTypeName = null, IsCheckMpd = true, IsPaperLicense = true, IsCourierDelivery = true, IsPostDelivery = true, IsAgreeLicenseTerms = true, IsAgreeProcessingData = true, IsProtectionFromAggressors = true, IsCourierResults = true, IsPostResults = true, IsElectricFormResults = true, AppState = "Project", BackOfficeAppState = null, Comment = $"comment{CreateString(20)}", DecisionType = null, PerformerId = null, RegNumber = null, RegDate = null, ExpertiseResultEnum = null, ExpertiseResult = null, ExpertiseDate = null, PerformerOfExpertise = null, IsCreatedOnPortal = true }; if (string.IsNullOrEmpty(userInfo?.EDRPOU())) { appDTO.OrgName = userInfo.FullName(); } var appId = _prlApplicationService.SaveApplication(appDTO).Result; var branchCount = _rand.Next(1, 3); var branchIds = new List <Guid>(); while (branchCount > 0) { branchCount--; var branch = new BranchDetailsDTO { Id = Guid.Empty, Caption = null, ApplicationId = appId, OrganizationId = Guid.Parse(userInfo.OrganizationId()), AppType = "PRL", ApplicationBranchId = default,
public async Task <IActionResult> Index(Guid appId, bool jsonData) { var application = _dataService.GetEntity <PrlApplication>(x => x.Id == appId).FirstOrDefault(); if (application == null) { return(await Task.Run(() => NotFound())); } var errorModel = new Dictionary <string, string>(); StringBuilder error = new StringBuilder(); StringBuilder code = new StringBuilder(); var branchList = (await _dataService.GetDtoAsync <BranchListDTO>(x => x.ApplicationId == appId)); var branchListIds = branchList.Select(dto => dto.Id); if (!branchList.Any()) { error.Append("<p>").Append("Місця провадження діяльності").Append("</p>") .Append("<p>") .Append("Перевіряється наявність доданого до заяви хоча б одного місця провадження діяльності") .Append("</p>"); code.Append("До заяви не додано хоча б одне місце провадження діяльності."); errorModel.Add(error.ToString(), code.ToString()); error.Clear(); code.Clear(); } else { var assigneeBranches = _dataService.GetEntity <AppAssigneeBranch>(x => branchListIds.Contains(x.BranchId) && x.RecordState != RecordState.D); var assigneeBranchIds = assigneeBranches.Select(x => x.BranchId).Distinct(); if (assigneeBranchIds.Count() != branchListIds.Count()) { error.Append("<p>").Append("Реєстр уповноважених осіб").Append("</p>") .Append("<p>") .Append("Перевіряється наявність хоча б одної уповноваженої особи для кожного введеного МПД") .Append("</p>"); code.Append("Перелік зауважень по реєстру 'Уповноважені особи': ").Append("<br>"); foreach (var branchId in branchListIds) { if (!assigneeBranchIds.Contains(branchId)) { code.Append("Для "); code.Append("\"") .Append(branchList.Where(x => x.Id == branchId).Select(y => y.Name).First()) .Append("\""); code.Append(" не вказано уповноважену особу").Append("<br>"); } } errorModel.Add(error.ToString(), code.ToString()); error.Clear(); code.Clear(); } var edocBranches = _dataService.GetEntity <BranchEDocument>(x => branchListIds.Contains(x.BranchId) && x.RecordState != RecordState.D); var edocBranchIds = edocBranches.Select(x => x.BranchId).Distinct(); if (edocBranchIds.Count() != branchListIds.Count()) { error.Append("<p>").Append("Реєстр досьє з виробництва").Append("</p>") .Append("<p>").Append("Перевіряється наявність досьє з виробництва для кожного введеного МПД") .Append("</p>"); code.Append("Перелік зауважень по реєстру 'Реєстр досьє': ").Append("<br>"); foreach (var branchId in branchListIds) { if (!edocBranchIds.Contains(branchId)) { code.Append("Для "); code.Append("\"") .Append(branchList.Where(x => x.Id == branchId).Select(y => y.Name).First()) .Append("\""); code.Append(" не додано досьє з виробництва").Append("<br>"); } } errorModel.Add(error.ToString(), code.ToString()); error.Clear(); code.Clear(); } } if (jsonData) { return(new JsonResult(errorModel)); } return(PartialView(model: errorModel)); }
public async Task <IActionResult> Details(Guid?id, Guid appId) { EDocumentDetailsDTO model = null; if (id == null) { return(await Task.Run(() => NotFound())); } else { model = (await _dataService.GetDtoAsync <EDocumentDetailsDTO>(extraParameters: new object[] { $"\'{appId}\'" })).FirstOrDefault(x => x.Id == id.Value); if (model == null) { return(await Task.Run(() => NotFound())); } } var branchContractors = _dataService.GetEntity <BranchEDocument>() .Where(x => x.EDocumentId == model.Id).ToList(); var branchList = (await _dataService.GetDtoAsync <BranchListDTO>(x => branchContractors.Select(y => y.BranchId) .Contains(x.Id))).ToList(); model.ListOfBranchsNames = new List <string>(); model.ListOfBranchsNames.AddRange(branchList.Select(st => st.Name + ',' + st.PhoneNumber)); var app = (await _dataService.GetDtoAsync <AppStateDTO>(x => x.Id == appId))?.FirstOrDefault(); ViewBag.appType = app.AppType; return(View(model)); }
public async Task <Guid> Save(BranchDetailsDTO model) { var check = model.Id == Guid.Empty; if (check) { model.IsFromLicense = false; } var branchId = _dataService.Add <Branch>(model); await _dataService.SaveChangesAsync(); if (check) { var applicationBranch = new ApplicationBranch { LimsDocumentId = model.ApplicationId, BranchId = branchId }; _dataService.Add(applicationBranch); await _dataService.SaveChangesAsync(); if (model.AppType == "TRL") { //Вид діяльності обраний в МПД var trlActivityTypeEnum = _dataService.GetEntity <EnumRecord>(x => x.Code == model.TrlActivityType)?.FirstOrDefault(); _dataService.Add(new EntityEnumRecords() { EntityId = branchId, EntityType = "BranchApplication", EnumRecordType = trlActivityTypeEnum?.EnumType, EnumRecordCode = trlActivityTypeEnum?.Code }); if (model.PharmacyId != null) { _dataService.Add(new PharmacyItemPharmacy() { PharmacyId = model.PharmacyId.Value, PharmacyItemId = branchId }); } await _dataService.SaveChangesAsync(); } } else { if (model.AppType == "TRL") { var pharmacyItem = _dataService.GetEntity <PharmacyItemPharmacy>(x => x.PharmacyItemId == branchId)?.FirstOrDefault(); if (pharmacyItem != null) { _dataService.Remove(pharmacyItem); } if (model.PharmacyId != null) { _dataService.Add(new PharmacyItemPharmacy() { PharmacyId = model.PharmacyId.Value, PharmacyItemId = branchId }); } var entityEnumRecords = _dataService.GetEntity <EntityEnumRecords>(x => x.EntityId == branchId).ToList(); if (entityEnumRecords.Count > 0) { entityEnumRecords.ForEach(x => _dataService.Remove(x)); } //Види діяльності обрані в МПД var trlActivityTypeEnum = _dataService.GetEntity <EnumRecord>(x => x.Code == model.TrlActivityType)?.FirstOrDefault(); _dataService.Add(new EntityEnumRecords() { EntityId = branchId, EntityType = "BranchApplication", EnumRecordType = trlActivityTypeEnum?.EnumType, EnumRecordCode = trlActivityTypeEnum?.Code }); await _dataService.SaveChangesAsync(); } } return(branchId); }
public override async Task <IActionResult> Details(Guid?id) { PrlContractorDetailDTO model = null; if (id == null) { return(await Task.Run(() => NotFound())); } else { model = (await _dataService.GetDtoAsync <PrlContractorDetailDTO>(x => x.Id == id.Value)).FirstOrDefault(); if (model == null) { return(await Task.Run(() => NotFound())); } } var branchContractors = _dataService.GetEntity <PrlBranchContractor>() .Where(x => x.ContractorId == model.Id).ToList(); var branchList = (await _dataService.GetDtoAsync <BranchListDTO>(x => branchContractors.Select(y => y.BranchId) .Contains(x.Id))).ToList(); model.ListOfBranchsNames = new List <string>(); model.ListOfBranchsNames.AddRange(branchList.Select(st => st.Name + ',' + st.PhoneNumber)); return(View(model)); }