예제 #1
0
 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);
 }
예제 #2
0
 public bool TryDeleteScrapbookItem(Guid itemID, string userID)
 {
     ScrapbookGateway gateway = new ScrapbookGateway();
     return gateway.DeleteScrapbookItem(itemID, userID);
 }
예제 #3
0
 public ScrapbookItem GetScrapbookItem(Guid itemID)
 {
     ScrapbookGateway gateway = new ScrapbookGateway();
     return gateway.GetScrapbookItem(itemID);
 }
예제 #4
0
 public List<ScrapbookItem> GetScrapbookItemsForUser(string userID)
 {
     ScrapbookGateway gateway = new ScrapbookGateway();
     return gateway.GetScrapbookItemsForUser(userID);
 }
예제 #5
0
 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);
         }
     }
 }