public async Task <Guid> CreateOnOpen(string sort, Guid?id = null, bool isBackOffice = false) { Guid licenseId; try { if (id == null) { licenseId = _imlLicenseService.GetLicenseGuid().Value; } else { licenseId = _imlLicenseService.GetLicenseGuid(id).Value; } } catch (Exception e) { throw new Exception(e.Message); } Guid applicationId; try { applicationId = await ProcessLicenseToApplication(licenseId, sort, isBackOffice); } catch (Exception e) { throw new Exception(e.Message); } return(applicationId); }
public async Task <List <(string type, bool isActive)> > GetActiveLicenses() { var list = new List <(string, bool)> { _trlLicenseService.GetLicenseGuid() == null ? ("TRL", false) : ("TRL", true), _prlLicenseService.GetLicenseGuid() == null ? ("PRL", false) : ("PRL", true), _imlLicenseService.GetLicenseGuid() == null ? ("IML", false) : ("IML", true) }; return(list); }
public async Task <IActionResult> AppTypes(Guid?orgId) { if (orgId == null || orgId == Guid.Empty) { return(await Task.Run(() => View($"{nameof(AppTypes)}Error"))); } ImlOrganizationExtShortDTO org; try { org = DataService.GetDto <ImlOrganizationExtShortDTO>(dto => dto.Id == orgId).Single(); } catch (Exception e) { throw new Exception("Невірно вказан id організації", e); } ViewBag.OrgId = orgId; ViewBag.OrgName = org.Name; ViewBag.Number = org.edrpouOrInn; ViewBag.ImlLicense = _imlLicenseService.GetLicenseGuid(orgId); return(await Task.Run(() => View())); }
public async Task <IActionResult> ListMessage(Guid?msgId, Guid?orgId, string messageState, IDictionary <string, string> paramList, ActionListOption <ImlMedicineListMsgDTO> options) { var licenseGuid = _imlLicenseService.GetLicenseGuid(orgId); var license = DataService.GetEntity <ImlLicense>(p => p.Id == licenseGuid).SingleOrDefault(); options.pg_PartialViewName = "ListMessage"; ViewBag.MsgId = msgId; ViewBag.AppId = license.ParentId; ViewBag.MessageState = messageState; paramList = paramList .Where(x => !string.IsNullOrEmpty(x.Value) && x.Key != "__RequestVerificationToken" && x.Key != "X-Requested-With" && !x.Key.StartsWith("pg_")) .ToDictionary(x => x.Key, x => x.Value); var medicineMsg = DataService.GetEntity <ImlMedicine>(p => p.ApplicationId == msgId).Select(p => p.ParentId).ToList(); IEnumerable <ImlMedicineListMsgDTO> medList; if (messageState == "Project") { medList = await DataService.GetDtoAsync <ImlMedicineListMsgDTO>( orderBy : options.pg_SortExpression ?? "ParentId", parameters : paramList, predicate : p => (p.ApplicationId == license.ParentId && !medicineMsg.Contains(p.Id) && (p.MessageState == "Project" || string.IsNullOrEmpty(p.MessageState))) || (p.ApplicationId == msgId), skip : (options.pg_Page - 1) *PageRowCount.Value, take : PageRowCount.Value); } else { medList = await DataService.GetDtoAsync <ImlMedicineListMsgDTO>( orderBy : options.pg_SortExpression ?? "ParentId", parameters : paramList, predicate : p => (p.ApplicationId == license.ParentId && !medicineMsg.Contains(p.Id) && (p.MessageState == "Project")) || (p.ApplicationId == msgId), skip : (options.pg_Page - 1) *PageRowCount.Value, take : PageRowCount.Value); } medList.ToList().ForEach(p => { p.NewName = DataService.GetEntity <ImlMedicine>(z => z.Id == p.ParentId).SingleOrDefault()?.SupplierName; p.OldName = DataService.GetEntity <ImlMedicine>(z => p.ParentId == z.Id).SingleOrDefault()?.SupplierName; }); var pagingList = PagingList.Create(medList, PageRowCount.Value, options.pg_Page, "ParentId", "Id", x => (x as IPagingCounted)?.TotalRecordCount, "ListMessage", true); return(PartialView(options.pg_PartialViewName, pagingList)); }
private async Task <string> ImlGetLicenseInfoRpt(Guid?orgId) { Guid?licGuid; if (orgId != null && orgId != Guid.Empty) { licGuid = _licservice.GetLicenseGuid(orgId); } else { licGuid = _licservice.GetLicenseGuid(); } if (licGuid == null) { return("Ліцензія з імпорту відсутня"); } var license = (await _dataService.GetDtoAsync <ImlLicenseDetailDTO>(dto => dto.Id == licGuid.Value)).FirstOrDefault(); if ((license == null) || (license.LicType != "IML")) { return("Ліцензія з імпорту відсутня"); } var licDescription = "Ліцензія номер: "; if (!string.IsNullOrEmpty(license.LicenseNumber)) { licDescription += "'" + license.LicenseNumber + "'"; } else { licDescription += "'без номеру'"; } if (license.LicenseDate != null) { licDescription += ", від " + license.LicenseDate.Value.ToString("«dd» MMMM yyyy", CultureInfo.CreateSpecificCulture("uk")) + "."; } else { licDescription += ", дату видачі ліцензії не збережено."; } if (!string.IsNullOrEmpty(license.OrderNumber)) { licDescription += " Видана наказом № " + license.OrderNumber; if (license.OrderDate != null) { licDescription += ", від " + license.OrderDate.Value.ToString("«dd» MMMM yyyy", CultureInfo.CreateSpecificCulture("uk")) + "."; } } else { licDescription += "Інформацію щодо наказу про видачу ліцензії не збережено."; } // var licDescription = "Інформація про ліцензію відсутня"; return(licDescription); }
public async Task <string> MsgToPDFOrgFopLocationChange(Guid id) { var pdfMessage = new Message(); var htmlFile = new StringBuilder(); BaseTemplate("Templates/Messages/PDFTemplate_OrgFopLocationChange.html", id, out htmlFile, out pdfMessage); if (pdfMessage.NewLocationId != Guid.Empty) { var subAddress = _dataService.GetDto <AtuSubjectAddressDTO>(p => p.Id == pdfMessage.NewLocationId).SingleOrDefault(); if (subAddress != null) { htmlFile.Replace("@@NewAddress@@", subAddress.Address); } } var listPath = Path.Combine(_path, "Templates/Messages/PDFTemplate_MsgList.html"); var listFile = new StringBuilder(); // TODO - добавить обработку других лицензий, когда они появятся if (pdfMessage.IsPrlLicense) { var idLic = _prlLicenseService.GetLicenseGuid(pdfMessage.OrgUnitId); var licPRL = _dataService.GetDto <LicenseRptMinDetailOrgFopLocation>(x => x.Id == idLic).FirstOrDefault(); var listTemp = new StringBuilder(File.ReadAllText(listPath)); var changeString = "Ліцензія на діяльність від " + licPRL.LicenseDate.ToString(); if (string.IsNullOrEmpty(licPRL.LicenseNumber)) { changeString += " б/н, "; } else { changeString += "№" + licPRL.LicenseNumber.ToString() + ", "; } changeString += "наказ №" + licPRL.OrderNumber.ToString() + ", від " + licPRL.OrderDate.ToString("dd MMMM yyyy", CultureInfo.CreateSpecificCulture("uk")); listTemp.Replace("@@ListItem@@", changeString); listTemp.Replace("@@OrgDir@@", " (Адреса, вказана в ліцензії: " + licPRL.Address.ToString() + ")"); listFile.Append(listTemp); } if (pdfMessage.IsImlLicense) { var idLic = _imlLicenseService.GetLicenseGuid(pdfMessage.OrgUnitId); var licIML = _dataService.GetDto <LicenseRptMinDetailOrgFopLocation>(x => x.Id == idLic).FirstOrDefault(); var listTemp = new StringBuilder(File.ReadAllText(listPath)); var changeString = "Ліцензія на діяльність від " + licIML.LicenseDate.ToString(); if (string.IsNullOrEmpty(licIML.LicenseNumber)) { changeString += " б/н, "; } else { changeString += "№" + licIML.LicenseNumber.ToString() + ", "; } changeString += "наказ №" + licIML.OrderNumber.ToString() + ", від " + licIML.OrderDate.ToString("dd MMMM yyyy", CultureInfo.CreateSpecificCulture("uk")); listTemp.Replace("@@ListItem@@", changeString); listTemp.Replace("@@OrgDir@@", " (Адреса, вказана в ліцензії: " + licIML.Address.ToString() + ")"); listFile.Append(listTemp); } htmlFile.Replace("@@LicenceList@@", listFile.ToString()); return(htmlFile.ToString()); }