コード例 #1
0
        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);
        }
コード例 #2
0
        public override async Task <IActionResult> Details(Guid?id)
        {
            var appSort = (await _dataService.GetDtoAsync <AppShortDTO>(x => x.Id == id)).Select(x => x.AppSort).FirstOrDefault();

            if (string.IsNullOrEmpty(appSort))
            {
                return(await Task.Run(() => NotFound()));
            }
            if (appSort != "GetLicenseApplication" && appSort != "AdditionalInfoToLicense" && appSort != "IncreaseToPRLApplication")
            {
                return(RedirectToAction("AltAppDetails", "PrlAppAlt", new { Area = "PRL", id = id, sort = appSort }));
            }
            if (appSort == "GetLicenseApplication")
            {
                HttpContext.ModifyCurrentBreadCrumb(x => x.Name = "Заява про отримання ліцензії на провадження діяльності");
            }
            if (appSort == "AdditionalInfoToLicense")
            {
                HttpContext.ModifyCurrentBreadCrumb(x => x.Name = "Доповнення інформації по наявній ліцензії");
            }
            if (appSort == "IncreaseToPRLApplication")
            {
                HttpContext.ModifyCurrentBreadCrumb(x => x.Name = "Заява про розширення провадження виду господарської діяльності - Розширення до виробництва лікарських засобів");
            }
            ViewBag.IsEditable = _entityStateHelper.IsEditableApp(id);

            return(await base.Details(id));
        }
コード例 #3
0
        public async Task <ImlMedicineDetailDTO> GetEditModel(Guid?id, IDictionary <string, string> paramList)
        {
            if (id != null && id != Guid.Empty)
            {
                return((await DataService.GetDtoAsync <ImlMedicineDetailDTO>(x => x.Id == id)).FirstOrDefault());
            }

            paramList.TryGetValue("appId", out var strAppId);

            var medicine = new ImlMedicineDetailDTO();

            medicine.ApplicationId = new Guid(strAppId);
            return(medicine);
        }
コード例 #4
0
ファイル: UserController.cs プロジェクト: WildGenie/diklz
        public async Task <IActionResult> PersonalCabinet()
        {
            var employeeId = (await _userInfoService.GetCurrentUserInfoAsync()).UserId;
            var model      = (await _dataService.GetDtoAsync <UserDetailsDTO>(x => x.Id == employeeId)).FirstOrDefault();

            return(PartialView(model));
        }
コード例 #5
0
        public async Task <IActionResult> AltAppDetails(Guid id, string sort)
        {
            var application = (await _commonDataService.GetDtoAsync <ImlAppDetailDTO>(x => x.Id == id)).FirstOrDefault();

            if (application == null)
            {
                return(await Task.Run(() => NotFound()));
            }

            // ATU
            if (application.AddressId != Guid.Empty)
            {
                var subAddress = _commonDataService.GetDto <AtuSubjectAddressDTO>(p => p.Id == application.AddressId).SingleOrDefault();
                if (subAddress != null)
                {
                    application.PostIndex = subAddress.PostIndex;
                    ViewBag.Address       = subAddress.Address;
                }
            }
            ViewBag.IsEditable    = _entityStateHelper.GetAppStates(id)[nameof(BaseApplication.BackOfficeAppState)] == "Project";
            ViewBag.PerformerName = _commonDataService.GetDto <UserDetailsDTO>(p => p.Id == application.PerformerId).Select(p => p.FIO).SingleOrDefault();
            switch (sort)
            {
            case "CancelLicenseApplication":
            case "DecreaseIMLApplication":
                if (sort == "CancelLicenseApplication")
                {
                    HttpContext.ModifyCurrentBreadCrumb((crumb => crumb.Name = "Заява про анулювання ліцензії(імпорт)"));
                }
                else
                {
                    HttpContext.ModifyCurrentBreadCrumb((crumb => crumb.Name = "Заява про звуження провадження виду господарської діяльності - Звуження виробництва лікарських засобів"));
                }
                return(View("Details_CancelLicenseApplication", application));

            case "ChangeAutPersonApplication":
                HttpContext.ModifyCurrentBreadCrumb((crumb => crumb.Name = "Заява про зміну інформації у додатку до ліцензії щодо особливих умов провадження діяльності - Зміна уповноважених осіб"));
                return(View("Details_ChangeAutPersonApplication", application));

            case "AddBranchApplication":
                HttpContext.ModifyCurrentBreadCrumb((crumb => crumb.Name = "Заява про внесення до ЄДР відомостей про місце провадження господарської діяльності - Додавання МПД(імпорт)"));
                return(View("Details_AddBranchApplication", application));

            case "RemBranchApplication":
                HttpContext.ModifyCurrentBreadCrumb((crumb => crumb.Name = "Заява про внесення змін до ЄДР у зв’язку з припиненням діяльності за певним місцем провадження - Видалення МПД(імпорт)"));
                return(View("Details_RemBranchApplication", application));

            case "ChangeDrugList":
                HttpContext.ModifyCurrentBreadCrumb((crumb => crumb.Name = "Заява про зміну (доповнення) переліку лікарських засобів, що імпортує ліцензіат"));
                return(View("Details_ChangeDrugList", application));

            case "ReplacementDrugList":
                HttpContext.ModifyCurrentBreadCrumb((crumb => crumb.Name = "Заява про заміну переліку лікарських засобів, що імпортує ліцензіат"));
                return(View("Details_ReplacementDrugList", application));

            default:
                return(await Task.Run(() => NotFound()));
            }
        }
コード例 #6
0
        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));
        }
コード例 #7
0
        public async Task <IActionResult> AltAppDetails(Guid id, string sort)
        {
            var application = (await _commonDataService.GetDtoAsync <PrlAppDetailDTO>(x => x.Id == id)).FirstOrDefault();

            if (application == null)
            {
                return(await Task.Run(() => NotFound()));
            }
            ViewBag.IsEditable = _entityStateHelper.GetAppStates(id)[nameof(BaseApplication.AppState)] == "Project";
            switch (sort)
            {
            case "CancelLicenseApplication":
            case "DecreasePRLApplication":
                if (sort == "CancelLicenseApplication")
                {
                    HttpContext.ModifyCurrentBreadCrumb((crumb => crumb.Name = "Заява про анулювання ліцензії(імпорт)"));
                }
                else
                {
                    HttpContext.ModifyCurrentBreadCrumb((crumb => crumb.Name = "Заява про звуження провадження виду господарської діяльності - Звуження виробництва лікарських засобів"));
                }
                return(View("Details_CancelLicenseApplication", application));

            case "RemBranchApplication":
                HttpContext.ModifyCurrentBreadCrumb((crumb => crumb.Name = "Заява про внесення змін до ЄДР у зв’язку з припиненням діяльності за певним місцем провадження - Видалення МПД(виробництво)"));
                return(View("Details_RemBranchApplication", application));

            case "ChangeContrApplication":
                HttpContext.ModifyCurrentBreadCrumb((crumb => crumb.Name = "Заява про зміну інформації у додатку до ліцензії щодо особливих умов провадження діяльності - Зміна контрактних контрагентів"));
                return(View("Details_ChangeContrApplication", application));

            case "ChangeAutPersonApplication":
                HttpContext.ModifyCurrentBreadCrumb((crumb => crumb.Name = "Заява про зміну інформації у додатку до ліцензії щодо особливих умов провадження діяльності - Зміна уповноважених осіб"));
                return(View("Details_ChangeAutPersonApplication", application));

            case "AddBranchInfoApplication":
                ViewBag.AppSort = sort;
                HttpContext.ModifyCurrentBreadCrumb((crumb => crumb.Name = sort == "AddBranchInfoApplication" ? "Заява про внесення до ЄДР відомостей про місце провадження господарської діяльності - Додавання інформації про МПД(виробництво)" :
                                                                           "Заява про внесення змін до ЄДР у зв’язку з припиненням діяльності за певним місцем провадження - Видалення інформації про МПД(виробництво)"));
                return(View("Details_ChangeBranchInfoApplication", application));

            case "RemBranchInfoApplication":
                HttpContext.ModifyCurrentBreadCrumb((crumb => crumb.Name = sort == "AddBranchInfoApplication" ? "Заява про внесення до ЄДР відомостей про місце провадження господарської діяльності - Додавання інформації про МПД(виробництво)" :
                                                                           "Заява про внесення змін до ЄДР у зв’язку з припиненням діяльності за певним місцем провадження - Видалення інформації про МПД(виробництво)"));
                ViewBag.AppSort = sort;
                return(View("Details_ChangeBranchInfoApplication", application));

            case "AddBranchApplication":
                HttpContext.ModifyCurrentBreadCrumb((crumb => crumb.Name = "Заява про внесення до ЄДР відомостей про місце провадження господарської діяльності - Додавання МПД(виробництво)"));
                return(View("Details_AddBranchApplication", application));

            //case "RenewLicenseApplication":
            //    return View("Details_RenewLicenseApplication", application);
            default:
                return(await Task.Run(() => NotFound()));
            }
        }
コード例 #8
0
ファイル: AppAssigneeService.cs プロジェクト: WildGenie/diklz
        public async Task <IEnumerable <AppAssigneeListDTO> > GetAssigneeList(Guid?appId)
        {
            var appAssigneeList =
                await DataService.GetDtoAsync <AppAssigneeListDTO>(extraParameters : new object[] { $"\'{appId}\'" });

            var assigneeIds = appAssigneeList.Select(x => x.Id);

            var branchList = await DataService.GetDtoAsync <BranchListDTO>(x => x.ApplicationId == appId);

            var branchAssignee = DataService.GetEntity <AppAssigneeBranch>(x => assigneeIds.Contains(x.AssigneeId));

            foreach (var assg in appAssigneeList)
            {
                var branchAssigneeIds = branchAssignee.Where(x => x.AssigneeId == assg.Id).Select(x => x.BranchId);
                assg.ListOfBranches = new List <BranchListDTO>(branchList.Where(br => branchAssigneeIds.Contains(br.Id)).ToList());
            }

            return(appAssigneeList);
        }
コード例 #9
0
        public async Task <FilesViewModel> GetEDocumentJsonFile(Guid id)
        {
            var applicationBranchesIds = _commonDataService
                                         .GetEntity <ApplicationBranch>(x => x.LimsDocumentId == id && x.RecordState != RecordState.D)
                                         .Select(x => x.BranchId)
                                         .Distinct()
                                         .ToList();
            var applicationEdocumentBranches =
                _commonDataService.GetEntity <BranchEDocument>(x => applicationBranchesIds.Contains(x.BranchId) && x.RecordState != RecordState.D);
            var applicationEdocumentIds = applicationEdocumentBranches.Select(x => x.EDocumentId).Distinct().ToList();
            var applicationEdocuments   = _commonDataService
                                          .GetEntity <EDocument>(x => applicationEdocumentIds.Contains(x.Id) && x.RecordState != RecordState.D).ToList();
            var listEDocJson = new List <EDocumentMD5Model>();

            foreach (var applicationEdocument in applicationEdocuments)
            {
                var fileStore = _commonDataService
                                .GetEntity <FileStore>(x => x.EntityName == "EDocument" && x.EntityId == applicationEdocument.Id && x.RecordState != RecordState.D)
                                .ToList();
                try
                {
                    foreach (var file in fileStore)
                    {
                        var dto = (await _commonDataService.GetDtoAsync <FileStoreDTO>(x => x.Id == file.Id)).FirstOrDefault();
                        // С новым кором переделать FileStoreDTO
                        var dtoCore = new Core.Data.DTO.Common.FileStoreDTO();
                        _objectMapper.Map(dto, dtoCore);
                        if (FileStoreHelper.LoadFile(dtoCore, out var stream, out var contentType))
                        {
                            var plainTextBytes = Encoding.UTF8.GetBytes(dto?.OrigFileName);
                            var base64Name     = Convert.ToBase64String(plainTextBytes);
                            listEDocJson.Add(new EDocumentMD5Model()
                            {
                                Id = file.Id, Name = base64Name, File = FileSignHelper.CalculateMd5(stream)
                            });
                        }
                        else
                        {
                            throw new Exception();
                        }
                    }
                }
コード例 #10
0
ファイル: BranchController.cs プロジェクト: WildGenie/diklz
        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));
            }
        }
コード例 #11
0
        private async Task <IActionResult> Details <T>(Guid id, string sort, string appType) where T : BaseAppDetailDTO
        {
            if (id == Guid.Empty)
            {
                return(await Task.Run(() => NotFound()));
            }

            var application = (await _dataService.GetDtoAsync <T>(x => x.Id == id)).FirstOrDefault();

            if (application == null)
            {
                return(await Task.Run(() => NotFound()));
            }

            var appTypeEnum = appType == "PRL" ? "(Виробництво)" : appType == "IML" ? "(Імпорт)" : "(Торгівля)";

            switch (sort)
            {
            case "GetLicenseApplication":
            case "IncreaseToPRLApplication":
            case "IncreaseToIMLApplication":
            case "IncreaseToTRLApplication":
                HttpContext.ModifyCurrentBreadCrumb((crumb => crumb.Name = "Заява про отримання ліцензії на провадження діяльності " + appTypeEnum));
                return(View(application));

            case "AdditionalInfoToLicense":
                HttpContext.ModifyCurrentBreadCrumb((crumb => crumb.Name = "Доповнення інформації по наявній ліцензії " + appTypeEnum));
                return(View(application));

            case "CancelLicenseApplication":
            case "DecreasePRLApplication":
            case "DecreaseIMLApplication":
            case "DecreaseTRLApplication":
                HttpContext.ModifyCurrentBreadCrumb((crumb => crumb.Name = "Заява про анулювання ліцензії " + appTypeEnum));
                return(View("Details_CancelLicenseApplication", application));

            case "RemBranchApplication":
                HttpContext.ModifyCurrentBreadCrumb((crumb => crumb.Name = "Заява про внесення змін до ЄДР у зв’язку з припиненням діяльності за певним місцем провадження - Видалення МПД " + appTypeEnum));
                return(View("Details_RemBranchApplication", application));

            case "ChangeContrApplication":
                HttpContext.ModifyCurrentBreadCrumb((crumb => crumb.Name = "Заява про зміну інформації у додатку до ліцензії щодо особливих умов провадження діяльності - Зміна контрактних контрагентів"));
                return(View("Details_ChangeContrApplication", application));

            case "ChangeAutPersonApplication":
                HttpContext.ModifyCurrentBreadCrumb((crumb => crumb.Name = "Заява про зміну інформації у додатку до ліцензії щодо особливих умов провадження діяльності - Зміна уповноважених осіб " + appTypeEnum));
                return(View("Details_ChangeAutPersonApplication", application));

            case "AddBranchInfoApplication":
            case "RemBranchInfoApplication":
                ViewBag.AppSort = sort;
                HttpContext.ModifyCurrentBreadCrumb((crumb => crumb.Name = sort == "AddBranchInfoApplication" ? "Заява про внесення до ЄДР відомостей про місце провадження господарської діяльності - Додавання інформації про МПД" + appTypeEnum :
                                                                           "Заява про внесення змін до ЄДР у зв’язку з припиненням діяльності за певним місцем провадження - Видалення інформації про МПД " + appTypeEnum));
                return(View("Details_ChangeBranchInfoApplication", application));

            case "AddBranchApplication":
                HttpContext.ModifyCurrentBreadCrumb((crumb => crumb.Name = "Заява про внесення до ЄДР відомостей про місце провадження господарської діяльності - Додавання МПД " + appTypeEnum));
                return(View("Details_AddBranchApplication", application));

            case "RenewLicenseApplication":
                HttpContext.ModifyCurrentBreadCrumb((crumb => crumb.Name = "Заява про отримання ліцензії на провадження діяльності " + appTypeEnum));
                return(View("Details_RenewLicenseApplication", application));

            case "ChangeDrugList":
                HttpContext.ModifyCurrentBreadCrumb((crumb => crumb.Name = "Заява про зміну (доповнення) переліку лікарських засобів, що імпортує ліцензіат" + appTypeEnum));
                return(View("Details_ChangeDrugList", application));

            case "ReplacementDrugList":
                HttpContext.ModifyCurrentBreadCrumb((crumb => crumb.Name = "Заява про заміну переліку лікарських засобів, що імпортує ліцензіат" + appTypeEnum));
                return(View("Details_ReplacementDrugList", application));

            default:
                return(await Task.Run(() => NotFound()));
            }
        }
コード例 #12
0
        public async Task <ResultInputControlDetailsDTO> GetEditFunction(Guid?id, IDictionary <string, string> paramList)
        {
            ResultInputControlDetailsDTO model;

            if (id == null)
            {
                var licenseIml = (await DataService.GetDtoAsync <ImlLicenseDetailDTO>(x =>
                                                                                      x.OrgUnitId == new Guid(_userInfoService.GetCurrentUserInfo().OrganizationId()) && x.LicState == "Active" && x.IsRelevant == true)).FirstOrDefault();
                if (licenseIml != null)
                {
                    model = new ResultInputControlDetailsDTO
                    {
                        State         = "Project",
                        LicenseId     = licenseIml.Id,
                        LicenseString = licenseIml.LicenseNumber,
                        DistrictName  = licenseIml.DistrictName,
                        CityName      = licenseIml.CityName,
                        CityEnum      = licenseIml.CityEnum,
                        AddressId     = licenseIml.AddressId,
                        AddressType   = licenseIml.AddressType,
                        RegionName    = licenseIml.RegionName,
                        StreetName    = licenseIml.StreetName,
                        Building      = licenseIml.Building,
                        Edrpou        = licenseIml.EDRPOU,
                        OrgName       = licenseIml.OrgName,
                        OrgUnitId     = licenseIml.OrgUnitId
                    };
                    return(model);
                }

                var licensePrl = (await DataService.GetDtoAsync <PrlLicenseDetailDTO>(x =>
                                                                                      x.OrgUnitId == new Guid(_userInfoService.GetCurrentUserInfo().OrganizationId()) && x.LicState == "Active" && x.IsRelevant == true)).FirstOrDefault();
                if (licensePrl != null)
                {
                    model = new ResultInputControlDetailsDTO
                    {
                        State         = "Project",
                        LicenseId     = licensePrl.Id,
                        LicenseString = licensePrl.LicenseNumber,
                        DistrictName  = licensePrl.DistrictName,
                        CityName      = licensePrl.CityName,
                        CityEnum      = licensePrl.CityEnum,
                        AddressId     = licensePrl.AddressId,
                        AddressType   = licensePrl.AddressType,
                        RegionName    = licensePrl.RegionName,
                        StreetName    = licensePrl.StreetName,
                        Building      = licensePrl.Building,
                        Edrpou        = licensePrl.EDRPOU,
                        OrgName       = licensePrl.OrgName,
                        OrgUnitId     = licensePrl.OrgUnitId
                    };
                    return(model);
                }

                var licenseTrl = (await DataService.GetDtoAsync <TrlLicenseDetailDTO>(x =>
                                                                                      x.OrgUnitId == new Guid(_userInfoService.GetCurrentUserInfo().OrganizationId()) && x.LicState == "Active" && x.IsRelevant == true)).FirstOrDefault();
                if (licenseTrl != null)
                {
                    model = new ResultInputControlDetailsDTO
                    {
                        State         = "Project",
                        LicenseId     = licenseTrl.Id,
                        LicenseString = licenseTrl.LicenseNumber,
                        DistrictName  = licenseTrl.DistrictName,
                        CityName      = licenseTrl.CityName,
                        CityEnum      = licenseTrl.CityEnum,
                        AddressId     = licenseTrl.AddressId,
                        AddressType   = licenseTrl.AddressType,
                        RegionName    = licenseTrl.RegionName,
                        StreetName    = licenseTrl.StreetName,
                        Building      = licenseTrl.Building,
                        Edrpou        = licenseTrl.EDRPOU,
                        OrgName       = licenseTrl.OrgName,
                        OrgUnitId     = licenseTrl.OrgUnitId
                    };
                    return(model);
                }
                throw new InvalidOperationException("User don't have license");
            }
            else
            {
                return((await DataService.GetDtoAsync <ResultInputControlDetailsDTO>(x => x.Id == id.Value)).FirstOrDefault());
            }
        }
コード例 #13
0
        //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());
        }
コード例 #14
0
        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));
        }
コード例 #15
0
ファイル: HomeController.cs プロジェクト: WildGenie/diklz
        public async Task <IActionResult> Index()
        {
            var model = (await _dataService.GetDtoAsync <WidgetBackDTO>()).FirstOrDefault();

            return(View(model));
        }
コード例 #16
0
ファイル: ImlReportService.cs プロジェクト: WildGenie/diklz
        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());
        }
コード例 #17
0
        public async Task <Guid> ProcessApplicationToApplication(Guid appId, Guid?licenseId = null, string sort = "", bool isBackOffice = false)
        {
            var licenseApplication = _commonDataService.GetEntity <ImlApplication>(x => x.Id == appId)
                                     .FirstOrDefault();

            if (licenseApplication == null)
            {
                Log.Error("licenseApplication == null");
                throw new NullReferenceException("Виникла помилка");
            }

            var newApplication = new ImlApplication();

            _objectMapper.Map(licenseApplication, newApplication);
            newApplication.Id = Guid.NewGuid();

            //ссылка на дочернюю заяву, из которой создана лицензия
            if (licenseId == null || licenseId == Guid.Empty)
            {
                newApplication.ParentId = licenseApplication.ParentId;
            }
            else
            {
                newApplication.ParentId = licenseId;
            }

            if (!string.IsNullOrEmpty(sort))
            {
                newApplication.AppSort = sort;
            }
            else
            {
                newApplication.AppSort = licenseApplication.AppSort;
            }

            if (isBackOffice)
            {
                newApplication.IsCreatedOnPortal  = false;
                newApplication.AppState           = null;
                newApplication.BackOfficeAppState = "Project";
            }
            else
            {
                newApplication.AppState           = "Project";
                newApplication.BackOfficeAppState = null;
                newApplication.IsCreatedOnPortal  = true;
            }

            newApplication.AppType                    = "IML";
            newApplication.ModifiedOn                 = DateTime.Now;
            newApplication.IsCheckMpd                 = false;
            newApplication.IsPaperLicense             = false;
            newApplication.IsCourierDelivery          = false;
            newApplication.IsPostDelivery             = false;
            newApplication.IsAgreeLicenseTerms        = false;
            newApplication.IsAgreeProcessingData      = false;
            newApplication.IsCourierResults           = false;
            newApplication.IsPostResults              = false;
            newApplication.IsElectricFormResults      = false;
            newApplication.IsProtectionFromAggressors = false;
            newApplication.Comment                    = "";

            newApplication.ErrorProcessingLicense = null;
            newApplication.PerformerOfExpertise   = null;
            newApplication.ExpertiseDate          = null;
            newApplication.ExpertiseResult        = null;
            newApplication.AppPreLicenseCheckId   = null;
            newApplication.AppLicenseMessageId    = null;
            newApplication.AppDecisionId          = null;
            newApplication.PerformerId            = null;
            newApplication.RegDate     = null;
            newApplication.RegNumber   = null;
            newApplication.Description = null;
            newApplication.OldLimsId   = 0;

            var organizationInfo = _commonDataService.GetEntity <OrganizationInfo>(x => x.Id == licenseApplication.OrganizationInfoId)
                                   .FirstOrDefault();

            if (organizationInfo == null)
            {
                Log.Error("organizationInfo == null");
                throw new NullReferenceException("Виникла помилка");
            }

            var newOrganizationInfo = new OrganizationInfo();

            _objectMapper.Map(organizationInfo, newOrganizationInfo);
            newOrganizationInfo.Id = Guid.NewGuid();
            if (licenseId != null)
            {
                newOrganizationInfo.IsActualInfo = false;
            }
            else
            {
                newOrganizationInfo.IsActualInfo = true;
                _commonDataService.GetEntity <OrganizationInfo>(
                    x => x.OrganizationId == licenseApplication.OrgUnitId).ToList().ForEach(x => x.IsActualInfo = false);
            }

            newApplication.OrganizationInfoId = newOrganizationInfo.Id;
            _commonDataService.Add(newOrganizationInfo);

            var licenseBranches = new List <Branch>();
            var licenseBranch   = new List <ApplicationBranch>();

            var applicationBranchesIds = _commonDataService
                                         .GetEntity <ApplicationBranch>(x => x.LimsDocumentId == licenseApplication.Id)
                                         .Select(x => x.BranchId)
                                         .Distinct()
                                         .ToList();
            var applicationBranches = _commonDataService.GetEntity <Branch>(br => applicationBranchesIds.Contains(br.Id))
                                      .ToList();

            foreach (var branch in applicationBranches)
            {
                var licBr = _objectMapper.Map <Branch>(branch);
                licBr.Id = Guid.NewGuid();
                //ссылка на дочерний обьект мпд
                licBr.ParentId      = branch.Id;
                licBr.IsFromLicense = true;
                licenseBranches.Add(licBr);

                licenseBranch.Add(new ApplicationBranch
                {
                    BranchId       = licBr.Id,
                    LimsDocumentId = newApplication.Id
                });
            }

            var applicationAssigneeBranches =
                _commonDataService.GetEntity <AppAssigneeBranch>(x => applicationBranchesIds.Contains(x.BranchId));
            var applicationAssigneeIds = applicationAssigneeBranches.Select(x => x.AssigneeId).Distinct().ToList();
            var applicationAssignee    =
                _commonDataService.GetEntity <AppAssignee>(x => applicationAssigneeIds.Contains(x.Id));
            var licenseAssigneeBranches = new List <AppAssigneeBranch>();
            var licenseAssignees        = new List <AppAssignee>();

            foreach (var assignee in applicationAssignee)
            {
                var licAssignee = _objectMapper.Map <AppAssignee>(assignee);
                licAssignee.Id            = Guid.NewGuid();
                licAssignee.IsFromLicense = true;
                licenseAssignees.Add(licAssignee);

                var assBranches = applicationAssigneeBranches.Where(x => x.AssigneeId == assignee.Id);
                foreach (var appAssigneeBranch in assBranches)
                {
                    licenseAssigneeBranches.Add(new AppAssigneeBranch
                    {
                        AssigneeId = licAssignee.Id,
                        BranchId   = licenseBranches.FirstOrDefault(br => br.ParentId == appAssigneeBranch.BranchId).Id
                    });
                }
            }


            var applicationEdocumentBranches =
                _commonDataService.GetEntity <BranchEDocument>(x => applicationBranchesIds.Contains(x.BranchId));
            var applicationEdocumentIds = applicationEdocumentBranches.Select(x => x.EDocumentId).Distinct().ToList();
            var applicationEdocuments   = _commonDataService
                                          .GetEntity <EDocument>(x => applicationEdocumentIds.Contains(x.Id)).ToList();
            var licenseEdocumentBranches = new List <BranchEDocument>();
            var licenseEdocuments        = new List <EDocument>();
            var licenseFiles             = new List <FileStore>();

            foreach (var applicationEDocument in applicationEdocuments)
            {
                var licEDocument = _objectMapper.Map <EDocument>(applicationEDocument);
                licEDocument.Id            = Guid.NewGuid();
                licEDocument.IsFromLicense = true;
                licenseEdocuments.Add(licEDocument);

                var edocBranches = applicationEdocumentBranches.Where(x => x.EDocumentId == applicationEDocument.Id);
                foreach (var branchEdocument in edocBranches)
                {
                    licenseEdocumentBranches.Add(new BranchEDocument()
                    {
                        EDocumentId = licEDocument.Id,
                        BranchId    = licenseBranches.FirstOrDefault(br => br.ParentId == branchEdocument.BranchId).Id
                    });
                }
                var fileStore = _commonDataService
                                .GetEntity <FileStore>(x => x.EntityName == "EDocument" && x.EntityId == applicationEDocument.Id).ToList();
                fileStore.ForEach(x =>
                {
                    x.EntityId = licEDocument.Id;
                    x.Id       = Guid.NewGuid();
                    licenseFiles.Add(x);
                });
            }

            var imlMedicine  = (await _commonDataService.GetDtoAsync <ImlMedicineDetailDTO>(x => x.ApplicationId == appId)).ToList();
            var imlMedicines = new List <ImlMedicine>();

            foreach (var med in imlMedicine)
            {
                var imlMed = _objectMapper.Map <ImlMedicine>(med);
                imlMed.Id            = Guid.NewGuid();
                imlMed.ApplicationId = newApplication.Id;
                imlMed.IsFromLicense = true;
                imlMedicines.Add(imlMed);
            }

            _commonDataService.Add(newApplication, false);
            licenseBranches.ForEach(branch => _commonDataService.Add(branch, false));
            licenseBranch.ForEach(appBranch => _commonDataService.Add(appBranch, false));
            licenseAssignees.ForEach(assignee => _commonDataService.Add(assignee, false));
            licenseAssigneeBranches.ForEach(assigneeBr => _commonDataService.Add(assigneeBr, false));
            licenseEdocuments.ForEach(eDoc => _commonDataService.Add(eDoc, false));
            licenseEdocumentBranches.ForEach(eDocBra => _commonDataService.Add(eDocBra, false));
            licenseFiles.ForEach(x => _commonDataService.Add(x, false));
            await _commonDataService.SaveChangesAsync();

            await _imlMedicineService.SaveMedicines(imlMedicines);

            return(newApplication.Id);
        }
コード例 #18
0
        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));
        }
コード例 #19
0
        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));
            }
        }
コード例 #20
0
        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));
        }
コード例 #21
0
        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));
        }