private void LoadView(int?id, string localDate) { ViewID = id ?? userContext.Views.GetFirstViewID() ?? 0; if (viewLoader.GetView(ViewID, out tableView, out string errMsg)) { TableOptions tableOptions = GetTableOptions(); ArchiveBit = webContext.ConfigDatabase.FindArchiveBit( tableOptions.ArchiveCode, Data.Const.ArchiveBit.Hourly); ChartArgs = new HtmlString(tableOptions.ChartArgs); DateTime selectedDate = DateTime.TryParse(localDate, out DateTime dateTime) ? dateTime.Date : userContext.ConvertTimeFromUtc(DateTime.UtcNow).Date; LocalDate = selectedDate.ToString(WebUtils.InputDateFormat); InitColumnMetas(selectedDate, tableOptions.Period); } else { ErrorMessage = errMsg; } ViewData["Title"] = tableView == null ? string.Format(PluginPhrases.TableViewTitle, ViewID) : tableView.Title; }
public IActionResult PrintEventsByView(int viewID) { if (!viewLoader.GetView(viewID, out ViewBase view, out string errMsg)) { throw new ScadaException(errMsg); } return(File( PrintEvents(view, out DateTime generateTime), MediaTypeNames.Application.Octet, ReportUtils.BuildFileName("Events", generateTime, OutputFormat.Xml2003))); }
/// <summary> /// Получить свойства документа схемы. /// </summary> public Dto <DocumentPacket> GetSchemeDoc(int viewID, long viewStamp) { try { if (viewLoader.GetView(viewID, out SchemeView schemeView, out string errMsg)) { DocumentPacket documentPacket = new(schemeView); documentPacket.FillCnlProps(webContext.ConfigDatabase); return(Dto <DocumentPacket> .Success(documentPacket)); } else { return(Dto <DocumentPacket> .Fail(errMsg)); } }
public void OnGet(int?id) { int viewID = id ?? userContext.Views.GetFirstViewID() ?? 0; if (viewLoader.GetView(viewID, out WebPageView webPageView, out string errMsg)) { ViewData["Title"] = webPageView.Title; if (string.IsNullOrEmpty(webPageView.ViewEntity.Args)) { ErrorMessage = dict.UrlIsEmpty; } else { RedirectUrl = new HtmlString(webPageView.ViewEntity.Args); } }
/// <summary> /// Gets the current data by view. /// </summary> /// <remarks>Loads the specified view if it is not in the cache.</remarks> public Dto <CurData> GetCurDataByView(int viewID, long cnlListID) { try { if (viewLoader.GetView(viewID, out ViewBase view, out string errMsg)) { CurData curData = memoryCache.GetOrCreate(PluginUtils.GetCacheKey("CurData", viewID), entry => { entry.SetAbsoluteExpiration(DataCacheExpiration); return(RequestCurData(view.CnlNumList, cnlListID, true)); }); return(Dto <CurData> .Success(curData)); } else { return(Dto <CurData> .Fail(errMsg)); } }