protected void btnAdd2Collction_OnClick(object sender, ImageClickEventArgs e) { if (Session["YeUser"] == null) { WebUtil.AlertAndRedirect("Please login first.", "UserLogin.aspx"); } else { var user = (Ye_User)Session["YeUser"]; if (UserBll.GetUserCollectionsByUserId(user.UserID).Count(p => p.ShopID == VisitingShop.ShopID) > 0) { WebUtil.AlertAndReload("You had collected the shop."); } else { if (UserBll.AddUserCollection(new Ye_UserCollection() { UserID = user.UserID, ShopID = VisitingShop.ShopID, IsCollecting = true })) { WebUtil.AlertAndReload("Collect the shop successfully"); } else { WebUtil.AlertAndReload("Failed to Collect the shop "); } } } }