/// <summary> /// 获得查询分页数据 /// </summary> protected DataTable get_collect_list(int pageSize, int pageIndex, string strWhere, string strorder, out int totalcount) { BLL.collect bll = new BLL.collect(); return(bll.GetList(pageSize, pageIndex, strWhere, strorder, out totalcount).Tables[0]); }
private void get_collect(HttpContext context) { int id = DTRequest.GetQueryInt("id"); BLL.collect bll_collect = new BLL.collect(); Model.collect model_collect = new Model.collect(); BLL.article bll = new BLL.article(); Model.article model = bll.GetModel(id); Model.users user_model = new BasePage().GetUserInfo(); if (user_model == null) { context.Response.Write("{\"status\":0, \"msg\":\"收藏商品失败,请您先登录!\"}"); return; } //赋值 model_collect.goods_name = model.title; model_collect.img_url = model.img_url; model_collect.goods_id = model.id; model_collect.user_id = user_model.id; model_collect.add_time = DateTime.Now; if (bll_collect.Exists1(model.id)) { context.Response.Write("{\"status\":0, \"msg\":\"已收藏该商品!\"}"); return; } if (bll_collect.Add(model_collect) > 0) { context.Response.Write("{\"status\":1, \"msg\":\"收藏商品成功!\"}"); return; } else { context.Response.Write("{\"status\":0, \"msg\":\"收藏失败!\"}"); return; } }
private void batch_to_collect(HttpContext context) { string ids = DTRequest.GetQueryString("ids"); Model.users model_user = new BasePage().GetUserInfo(); if (model_user == null) { context.Response.Write("{\"status\":\"0\", \"msg\":\"请先登录!\"}"); return; } BLL.article bll_article = new BLL.article(); BLL.collect bll_collect = new BLL.collect(); string[] arr_id = ids.Split(','); foreach (string str in arr_id) { Model.article model_article = bll_article.GetModel(Convert.ToInt32(str)); DataTable dt = bll_collect.GetList("user_id=" + model_user.id + " and goods_id=" + str).Tables[0]; if (dt != null && dt.Rows.Count <= 0) { if (model_article != null) { Model.collect model_collect = new Model.collect(); model_collect.goods_id = model_article.id; model_collect.goods_name = model_article.title; model_collect.img_url = model_article.img_url; model_collect.price = Convert.ToDecimal(model_article.fields["sell_price"]); model_collect.user_id = model_user.id; model_collect.add_time = DateTime.Now; bll_collect.Add(model_collect); } } } context.Response.Write("{\"status\":\"1\", \"msg\":\"加入收藏成功!\"}"); return; }
/// <summary> /// 获得查询分页数据 /// </summary> protected DataTable get_collect_list(int pageSize, int pageIndex, string strWhere, string strorder, out int totalcount) { BLL.collect bll = new BLL.collect(); return bll.GetList(pageSize, pageIndex, strWhere, strorder, out totalcount).Tables[0]; }