/// <summary> /// スクラップカテゴリに現在表示している画像を登録する /// </summary> /// <param name="category"></param> private async void addScrapbookItem(ScrapbookCategory category) { ScrapbookItem item = await this.ViewModel.CreateScrapbookItem(category); if (item == null) { Debug.WriteLine("ファイルコピー失敗"); return; } m_db.InsertScrapbookItem(item); }
public ScrapbookItem InsertScrapbookItem(string userID, string imageURL, string itemDescription, string itemType, string sourceURL, string sourceDescription) { ScrapbookItem item = new ScrapbookItem { UserID = userID, ImageURL = imageURL, ItemDescription = itemDescription, ItemType = itemType, SourceURL = sourceURL, SourceDescription = sourceDescription }; ScrapbookGateway gateway = new ScrapbookGateway(); return gateway.InsertScrapbookItem(item); }
public override void OnActionExecuting(ActionExecutingContext filterContext) { HttpContextBase httpContext = filterContext.RequestContext.HttpContext; NameValueCollection @params = httpContext.Request.Params; if (httpContext.User.Identity.IsAuthenticated && !string.IsNullOrEmpty(@params["action"])) { if (@params["action"] == "addtoscrapbook") { ScrapbookItem item = new ScrapbookItem { UserID = httpContext.User.Identity.Name, ImageURL = @params["imageURL"], ItemDescription = @params["description"], ItemType = @params["type"], SourceURL = @params["sourceUrl"], SourceDescription = @params["sourceDescription"] }; ScrapbookGateway gateway = new ScrapbookGateway(); if ((gateway.InsertScrapbookItem(item) != null) && !string.IsNullOrEmpty(@params["ReturnUrl"])) { filterContext.HttpContext.Session.Add("feedback", Helper.GetResource("Feedback_AddedToScrapbook")); filterContext.Result = new RedirectResult(@params["ReturnUrl"]); } base.OnActionExecuting(filterContext); } if (@params["action"] == "addtoshoppinglist") { string str = (@params["project"] != null) ? @params["project"] : string.Empty; int result = 0; bool flag = int.TryParse(@params["quantity"], out result); IComponent componentInfo = this.GetComponentInfo(@params["tcm-id"]); ShoppingListItem item4 = new ShoppingListItem { AddedDateTime = DateTime.Now, Brand = componentInfo.Fields["brand"].Value, ProductTcmID = @params["tcm-id"], ProductName = componentInfo.Fields["title"].Value, ProjectName = str, Quantity = result, UserID = httpContext.User.Identity.Name }; ShoppingListGateway gateway2 = new ShoppingListGateway(); if ((gateway2.InsertShoppingListItem(item4) != null) && !string.IsNullOrEmpty(@params["ReturnUrl"])) { filterContext.HttpContext.Session.Add("feedback", Helper.GetResource("Feedback_AddedToShoppingList")); filterContext.Result = new RedirectResult(@params["ReturnUrl"]); } base.OnActionExecuting(filterContext); } if (@params["action"] == "ReturnUrl") { if (!string.IsNullOrEmpty(@params["ReturnUrl"])) { filterContext.Result = new RedirectResult(@params["ReturnUrl"]); } base.OnActionExecuting(filterContext); } if (@params["action"] == "download") { if (!string.IsNullOrEmpty(@params["itemLink"])) { filterContext.Result = new RedirectResult(@params["ReturnUrl"] + "?download=" + @params["itemLink"]); } base.OnActionExecuting(filterContext); } } }