private void InsertWishList(DataListCommandEventArgs e) { LoadProducts(categoryId); IWishListBussinessService wishListBussinessService = null; string userId = Session["UserName"].ToString();; string productId = ProductDataList.DataKeys[e.Item.ItemIndex].ToString(); try { wishListBussinessService = BizDelegateFactory.Current.WishListBussinessService; int result = wishListBussinessService.AddToWishList(new WishListDAO { ProductId = productId, UserId = userId }); if (result > 0) { ShowMessage("Details added to wish list", MessageInfo.Information); } else { ShowMessage("Error in updation", MessageInfo.Error); } } catch (Exception ex) { ShowMessage(ex.Message, MessageInfo.Error); } finally { wishListBussinessService = null; } }
private void AddToWishList() { IWishListBussinessService wishListBussinessService = null; string userId = Session["UserName"].ToString();; string productId = ProductFormView.DataKey[0].ToString(); try { wishListBussinessService = BizDelegateFactory.Current.WishListBussinessService; int result = wishListBussinessService.AddToWishList(new WishListDAO { UserId = userId, ProductId = productId }); if (result > 0) { ShowMessage("Details added to wish list", MessageInfo.Information); } else { ShowMessage("Error in updation", MessageInfo.Error); } } catch (Exception ex) { ShowMessage(ex.Message, MessageInfo.Error); } finally { wishListBussinessService = null; } }