public async Task <IActionResult> GetItemByUPC(string UPC) { User user = await _auth.GetUser(this.User.Identity.Name); Permissions permissions = await _auth.GetPermissions(user.Id); if (permissions.ViewInventory == false) { return(Unauthorized()); } Inventory inventory = await _repo.GetItemByUPC(UPC); JSItem item = new JSItem(); if (inventory != null) { item.Id = inventory.Id; item.Name = inventory.Name; item.Description = inventory.Description; item.Price = inventory.Price; item.Quantity = inventory.Quantity; item.UPC = inventory.UPC; //item.LocationId = inventory.InventoryLocationID; //item.AlertId = inventory.InventoryAlertID; } return(Ok(item)); }
private void InitOverrides() { CSSTemplateItem cssTemplate = PageItem.InnerItem; string cssInsert = "<link href=\"{0}\" rel=\"stylesheet\" />"; var css = this.FindControl("headerSectionCSS") as Literal; if (css != null && cssTemplate != null && cssTemplate.CSSInclude.ListItems.Count > 0) { foreach (var item in cssTemplate.CSSInclude.ListItems) { CSSItem cssItem = item; if (cssItem != null && !string.IsNullOrEmpty(cssItem.CSSFilename.Text) && !string.IsNullOrEmpty(cssItem.CSSFilepath.Text)) { css.Text += string.Format(cssInsert, cssItem.CSSFilepath.Text + cssItem.CSSFilename.Text); } } } JSTemplateItem jsTemplate = PageItem.InnerItem; string jsInsert = "<script src=\"{0}\"></script>"; var js = this.FindControl("footerSectionJS") as Literal; if (js != null && jsTemplate != null && jsTemplate.JSInclude.ListItems.Count > 0) { foreach (var item in jsTemplate.JSInclude.ListItems) { JSItem jsItem = item; if (jsItem != null && !string.IsNullOrEmpty(jsItem.JSFilename.Text) && !string.IsNullOrEmpty(jsItem.JSFilepath.Text)) { js.Text += string.Format(jsInsert, jsItem.JSFilepath.Text + jsItem.JSFilename.Text); } } } }
public void SettigsVKbotReadJson() //Загрузка сохранение json { try { JSItem item = JsonConvert.DeserializeObject <JSItem>(File.ReadAllText(JsonSettingsVKbot)); using (StreamReader reader = File.OpenText(JsonSettingsVKbot)) { JSItem item2 = (JSItem) new JsonSerializer().Deserialize(reader, typeof(JSItem)); jsinfo = item2.INFO; jsimg = item2.IMG; jsbackward = item2.BACKWARD; jsstat = item2.STAT; reader.Close(); reader.Dispose(); } } catch (Exception e) { MessageBox.Show("Не удалось загрузить файл. error: SVRJ1"); MessageBox.Show(e.ToString()); } }