コード例 #1
0
ファイル: P_UserOftenBuy.cs プロジェクト: zwkjgs/LebiShop
        protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode)
        {
            if (CurrentUser.id == 0)
            {
                Response.Redirect(URL("P_Login", "" + HttpUtility.UrlEncode(RequestTool.GetRequestUrlNonDomain()) + "," + GetUrlToken(RequestTool.GetRequestUrlNonDomain()) + ""));
            }
            LoadTheme(themecode, siteid, languagecode, pcode);
            path     = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">&raquo;</em><a href=\"" + URL("P_UserCenter", "") + "\"><span>" + Tag("会员中心") + "</span></a><em>&raquo;</em><a href=\"" + URL("P_UserOftenBuy", "") + "\"><span>" + Tag("常购清单") + "</span></a>";
            key      = Rstring("key");
            dateFrom = Rstring("dateFrom");
            dateTo   = Rstring("dateTo");
            DateTime lbsql_dateFrom = RequestTool.RequestDate("dateFrom");
            DateTime lbsql_dateTo   = RequestTool.RequestDate("dateTo");

            pageindex = RequestTool.RequestInt("page", 1);
            where     = "User_id=" + CurrentUser.id + " and Type_id_UserProductType=144";
            if (key != "")
            {
                where += " and Product_id in (select id from Lebi_Product where Name like lbsql{'%" + key + "%'})";
            }
            if (dateFrom != "" && dateTo != "")
            {
                where += " and Time_Add>='" + FormatDate(lbsql_dateFrom) + "' and Time_Add<='" + FormatDate(lbsql_dateTo) + " 23:59:59'";
            }
            user_products = B_Lebi_User_Product.GetList(where, "id desc", PageSize, pageindex);
            int recordCount = B_Lebi_User_Product.Counts(where);

            PageString = Shop.Bussiness.Pager.GetPaginationStringForWeb("?page={0}&key=" + key + "&dateFrom=" + dateFrom + "&dateTo=" + dateTo + "", pageindex, PageSize, recordCount, CurrentLanguage);
            NextPage   = "?page=" + (pageindex + 1) + "&key=" + key + "&dateFrom=" + dateFrom + "&dateTo=" + dateTo + "";
        }
コード例 #2
0
        /// <summary>
        /// 侧边栏-收藏夹
        /// </summary>
        public void sidebar_userlike()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("<div class=\\\"ibar_plugin_content\\\">");
            //sb.Append(" <div class=\\\"ibar-history-head\\\">共3件产品<a href=\\\"#\\\">清空</a></div>");
            sb.Append(" <div class=\\\"ibar-moudle-product\\\">");
            List <Lebi_User_Product> pros = B_Lebi_User_Product.GetList("User_id=" + CurrentUser.id + " and Type_id_UserProductType=141", "id desc", 10, 1);

            foreach (Shop.Model.Lebi_User_Product pro in pros)
            {
                Shop.Model.Lebi_Product productmodel = GetProduct(pro.Product_id);
                if (productmodel.id == 0)
                {
                    continue;
                }
                sb.Append("     <div class=\\\"imp_item\\\">");
                sb.Append("         <a href=\\\"" + URL("P_Proudct", pro.Product_id) + "\\\" class=\\\"pic\\\"><img src=\\\"" + Image(productmodel.ImageOriginal) + "\\\" width=\\\"100\\\" height=\\\"100\\\" /></a>");
                sb.Append("         <p class=\\\"tit\\\"><a href=\\\"" + URL("P_Proudct", pro.Product_id) + "\\\">" + Lang(productmodel.Name) + "</a></p>");
                sb.Append("         <p class=\\\"price\\\">" + FormatMoney(ProductPrice(productmodel)) + "</p>");
                sb.Append("         <a href=\\\"javascript:void(0);\\\" onclick=\\\"UserProduct_Edit(" + productmodel.id + ",142,1,'','');\\\" class=\\\"imp-addCart\\\">" + Tag("加入购物车") + "</a>");
                sb.Append("     </div>");
            }

            sb.Append(" </div>");
            sb.Append("</div>");


            Response.Write("{\"title\":\"" + Tag("我的收藏") + "\",\"content\":\"" + sb.ToString() + "\"}");
        }
コード例 #3
0
        /// <summary>
        /// 删除会员
        /// </summary>
        public void User_Del()
        {
            if (!EX_Admin.Power("user_del", "删除会员"))
            {
                AjaxNoPower();
                return;
            }
            string id = RequestTool.RequestString("ids");

            if (id == "")
            {
                Response.Write("{\"msg\":\"" + Tag("请选择要删除的信息") + "\"}");
                return;
            }
            if (RequestTool.GetConfigKey("IsDelFalse").ToLower() == "true")
            {
                List <Lebi_User> users = B_Lebi_User.GetList("id in (lbsql{" + id + "})", "");
                foreach (var u in users)
                {
                    u.IsDel = 1;
                    B_Lebi_User.Update(u);
                }
            }
            else
            {
                List <Lebi_Order> modellist = B_Lebi_Order.GetList("User_id in (lbsql{" + id + "})", "");
                foreach (Lebi_Order model in modellist)
                {
                    B_Lebi_Order.Delete("id = " + model.id + "");
                    B_Lebi_Order_Log.Delete("Order_id = " + model.id + "");
                    B_Lebi_Order_Product.Delete("Order_id = " + model.id + "");
                }
                B_Lebi_User.Delete("id in (lbsql{" + id + "})");
                B_Lebi_Message.Delete("User_id_To in (lbsql{" + id + "})");
                B_Lebi_User_Answer.Delete("User_id in (lbsql{" + id + "})");
                B_Lebi_User_Answer.Delete("User_id in (lbsql{" + id + "})");
                B_Lebi_User_BuyMoney.Delete("User_id in (lbsql{" + id + "})");
                B_Lebi_User_Card.Delete("User_id in (lbsql{" + id + "})");
                B_Lebi_User_Money.Delete("User_id in (lbsql{" + id + "})");
                B_Lebi_User_Point.Delete("User_id in (lbsql{" + id + "})");
                B_Lebi_User_Product.Delete("User_id in (lbsql{" + id + "})");
                B_Lebi_User_Address.Delete("User_id in (lbsql{" + id + "})");
                B_Lebi_Supplier.Delete("User_id in (lbsql{" + id + "})");
                //B_Lebi_Supplier_ProductType.Delete("Supplier_id in (lbsql{" + id + "})");
                //B_Lebi_Supplier_Verified_Log.Delete("Supplier_id in (lbsql{" + id + "})");
                B_Lebi_Agent_Area.Delete("User_id in (lbsql{" + id + "})");
                B_Lebi_Agent_Money.Delete("User_id in (lbsql{" + id + "})");
                B_Lebi_Agent_Product.Delete("User_id in (lbsql{" + id + "})");
                B_Lebi_Agent_Product_request.Delete("User_id in (lbsql{" + id + "})");
                B_Lebi_Agent_Product_User.Delete("User_id in (lbsql{" + id + "})");
                B_Lebi_Bill.Delete("User_id in (lbsql{" + id + "})");
                B_Lebi_Cash.Delete("User_id in (lbsql{" + id + "})");
                B_Lebi_Comment.Delete("User_id in (lbsql{" + id + "})");
                B_Lebi_weixin_qrcode.Delete("User_id in (lbsql{" + id + "})");
            }
            Log.Add("删除会员", "User", id.ToString(), CurrentAdmin, id.ToString());
            Response.Write("{\"msg\":\"OK\"}");
        }
コード例 #4
0
        /// <summary>
        /// 更新常购商品
        /// </summary>
        public void UserOftenBuy_Update()
        {
            string id = RequestTool.RequestSafeString("Uid");
            List <Lebi_User_Product> models = B_Lebi_User_Product.GetList("User_id=" + CurrentUser.id + " and id in (lbsql{" + id + "})", "");

            foreach (Lebi_User_Product model in models)
            {
                model.count         = RequestTool.RequestInt("Count" + model.id + "", 0);
                model.WarnDays      = RequestTool.RequestInt("WarnDays" + model.id + "", 0);
                model.Time_addemail = System.DateTime.Now.Date.AddDays(model.WarnDays);
                B_Lebi_User_Product.Update(model);
            }
            Response.Write("{\"msg\":\"OK\"}");
        }
コード例 #5
0
        /// <summary>
        /// 收藏夹批量添加购物车
        /// </summary>
        public void LikeToBasket()
        {
            string ids = RequestTool.RequestSafeString("id");
            string mes = "";

            if (ids == "")
            {
                Response.Write("{\"msg\":\"" + Tag("请先选择商品") + "\"}");
                return;
            }
            else
            {
                List <Lebi_User_Product> models = B_Lebi_User_Product.GetList("(Type_id_UserProductType=141 or Type_id_UserProductType=144) and User_id=" + CurrentUser.id + " and id in (lbsql{" + ids + "})", "");
                foreach (Lebi_User_Product model in models)
                {
                    //<-{ 判断收藏夹商品是否为上架状态 by lebi.kingdge 2015-02-10
                    Lebi_Product Product = B_Lebi_Product.GetModel("id = " + model.Product_id + " and Type_id_ProductStatus = 101");
                    if (Product == null)
                    {
                        Response.Write("{\"msg\":\"" + Lang(Product.Name) + " " + Tag("该商品已经下架") + "\"}");
                        return;
                    }
                    //}->
                    int num        = model.count;
                    int levelcount = ProductLevelCount(Product);
                    if (num < levelcount)
                    {
                        num = levelcount;
                    }
                    Lebi_User_Product updatemodel = B_Lebi_User_Product.GetModel("User_id=" + CurrentUser.id + " and product_id=" + model.Product_id + " and type_id_UserProductType=142");
                    if (updatemodel != null)
                    {
                        if (updatemodel.count < num)
                        {
                            updatemodel.count = model.count;
                            B_Lebi_User_Product.Update(updatemodel);
                        }
                    }
                    else
                    {
                        model.Type_id_UserProductType = 142;
                        model.count = num;
                        B_Lebi_User_Product.Add(model);
                    }
                }
                mes = Tag("商品已加入购物车") + "<div>" + Tag("数量") + " <span>" + Basket_Product_Count() + "</span> " + Tag("件") + " <span>" + FormatMoney(Basket_Product_Price()) + "</span></div><div><a href='" + URL("P_Basket", "") + "' class='btn btn-7'><s></s>" + Tag("查看购物车") + "</a>&nbsp;&nbsp;<a href='javascript:void(0)' onclick='cloesedialog();' class='btn btn-11'><s></s>" + Tag("关闭") + "</a></div>";
            }
            Response.Write("{\"msg\":\"OK\",\"count\":\"" + Basket_Product_Count() + "\",\"amount\":\"" + FormatMoney(Basket_Product_Price()) + "\",\"mes\":\"" + mes + "\",\"url\":\"" + URL("P_AddToBasket", "") + "\"}");
        }
コード例 #6
0
ファイル: oftenbuy.aspx.cs プロジェクト: zwkjgs/LebiShop
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!EX_Admin.Power("oftenbuy_list", "常购清单列表"))
            {
                PageReturnMsg = PageNoPowerMsg();
            }

            PageSize = RequestTool.getpageSize(25);
            int user_id = RequestTool.RequestInt("user_id", 0);

            key      = RequestTool.RequestString("key");
            dateFrom = RequestTool.RequestString("dateFrom");
            dateTo   = RequestTool.RequestString("dateTo");
            type     = RequestTool.RequestInt("type", 0);
            if (type == 0)
            {
                type = 144;
            }
            DateTime lbsql_dateFrom = RequestTool.RequestDate("dateFrom");
            DateTime lbsql_dateTo   = RequestTool.RequestDate("dateTo");

            string where = "1=1";
            if (user_id > 0)
            {
                where += " and User_id=" + user_id;
            }
            if (type > 0)
            {
                where += " and Type_id_UserProductType=" + type + "";
            }
            if (key != "")
            {
                where += " and Product_id in (select id from Lebi_Product where Name like lbsql{'%" + key + "%'})";
            }
            if (dateFrom != "" && dateTo != "")
            {
                where += " and Time_Add>='" + FormatDate(lbsql_dateFrom) + "' and Time_Add<='" + FormatDate(lbsql_dateTo) + " 23:59:59'";
            }
            models = B_Lebi_User_Product.GetList(where, "id desc", PageSize, page);
            int recordCount = B_Lebi_User_Product.Counts(where);

            PageString = Pager.GetPaginationString("?page={0}&key=" + key + "&dateFrom=" + dateFrom + "&dateTo=" + dateTo + "&type = " + type, page, PageSize, recordCount);
            user       = B_Lebi_User.GetModel(user_id);
            if (user == null)
            {
                user          = new Lebi_User();
                user.UserName = Tag("全部会员");
            }
        }
コード例 #7
0
        /// <summary>
        /// 删除常购商品
        /// </summary>
        public void UserOftenBuy_Del()
        {
            string ids = RequestTool.RequestSafeString("id");

            if (ids == "")
            {
                Response.Write("{\"msg\":\"OK\"}");
                return;
            }
            List <Lebi_User_Product> models = B_Lebi_User_Product.GetList("User_id=" + CurrentUser.id + " and id in (lbsql{" + ids + "})", "");

            foreach (Lebi_User_Product model in models)
            {
                B_Lebi_User_Product.Delete(model.id);
            }
            Response.Write("{\"msg\":\"OK\"}");
        }
コード例 #8
0
ファイル: ajax_user.aspx.cs プロジェクト: yzbjack/LebiShop
        /// <summary>
        /// 修改购物车产品
        /// </summary>
        public void UserBasket_Edit()
        {
            int t = 142;
            //int num = RequestTool.RequestInt("num", 1);//默认数量1
            string property               = RequestTool.RequestSafeString("property");
            string CookieName             = "UserProduct" + t;
            List <Lebi_User_Product> pros = Basket.UserProduct(CurrentUser, t);

            foreach (Lebi_User_Product pro in pros)
            {
                pro.count = RequestTool.RequestInt("BasketCount" + pro.Product_id, 1);//默认数量1
                pro.count = pro.count < 1 ? 1 : pro.count;
            }
            if (CurrentUser.id > 0 && CurrentUser.IsAnonymous == 0)//已经登录
            {
                foreach (Lebi_User_Product pro in pros)
                {
                    B_Lebi_User_Product.Update(pro);
                }
            }
            else//未登录
            {
                NameValueCollection nv = CookieTool.GetCookie(CookieName);
                string key, userproduct;
                foreach (Lebi_User_Product pro in pros)
                {
                    key         = "p" + pro.Product_id.ToString();
                    userproduct = nv.Get(key);
                    if (string.IsNullOrEmpty(userproduct))
                    {
                        //nv.Add(key, pro.count.ToString());
                        nv.Add(key, pro.count.ToString() + "|" + property);
                    }
                    else
                    {
                        nv.Set(key, pro.count.ToString() + "|" + property);
                    }
                }

                CookieTool.WriteCookie(CookieName, nv, 365);
            }
            Response.Write("{\"msg\":\"OK\"}");
        }
コード例 #9
0
ファイル: ajax_user.aspx.cs プロジェクト: yzbjack/LebiShop
        /// <summary>
        /// 购物车或收藏夹中删除一个商品
        /// 141购物车
        /// 142收藏
        /// 143浏览记录
        /// </summary>
        public void UserProduct_Del()
        {
            int t = RequestTool.RequestInt("type", 141);//默认收藏

            if (t != 141 && t != 142 && t != 143)
            {
                Response.Write("OK");
                return;
            }
            string productid = RequestTool.RequestSafeString("pid");

            if (productid == "all")
            {
                //清空购物车/收藏夹
                Basket.Clear(CurrentUser, t);
            }
            else
            {
                int pid = RequestTool.RequestInt("pid", 0);
                if (EX_User.LoginStatus(CurrentUser))//已经登录
                {
                    B_Lebi_User_Product.Delete("user_id=" + CurrentUser.id + " and product_id=" + pid + " and type_id_UserProductType=" + t + "");
                }
                else//未登录
                {
                    string CookieName      = "UserProduct" + t;
                    NameValueCollection nv = CookieTool.GetCookie(CookieName);
                    string key             = "p" + pid.ToString();
                    string userproduct     = nv.Get(key);
                    if (!string.IsNullOrEmpty(userproduct))
                    {
                        nv.Remove(key);
                    }
                    CookieTool.WriteCookie(CookieName, nv, 365);
                }
            }
            Response.Write("{\"msg\":\"OK\",\"mes\":\"" + Tag("操作成功") + "\"}");
        }