예제 #1
0
 /// <summary>
 /// 检查购物车是否满足代金券使用条件
 /// </summary>
 /// <param name="basket"></param>
 /// <param name="card"></param>
 /// <returns></returns>
 public static bool CheckCard(Basket basket, Lebi_Card card)
 {
     if (card.Time_Begin > System.DateTime.Now)
     {
         return(false);
     }
     if (card.Time_End <= System.DateTime.Now)
     {
         card.Type_id_CardStatus = 204;
         B_Lebi_Card.Update(card);
         return(false);
     }
     if ((basket.Money_Product - basket.Money_Cut) < card.Money_Buy)
     {
         return(false);
     }
     if (card.Pro_Type_ids == "")
     {
         return(true);
     }
     foreach (Lebi_User_Product p in basket.Products)
     {
         Lebi_Product  pro  = B_Lebi_Product.GetModel(p.Product_id);
         Lebi_Pro_Type type = EX_Product.TopProductType(pro);
         if (("," + card.Pro_Type_ids + ",").Contains("," + type.id + ","))
         {
             return(true);
         }
     }
     return(false);
 }
예제 #2
0
 protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode)
 {
     LoadTheme(themecode, siteid, languagecode, pcode);
     if (CurrentUser.id == 0)
     {
         //未登录
         if (SYS.IsAnonymousUser != "1")
         {
             Response.Redirect(URL("P_Login", "" + HttpUtility.UrlEncode(RequestTool.GetRequestUrlNonDomain()) + "," + GetUrlToken(RequestTool.GetRequestUrlNonDomain()) + ""));
         }
     }
     if (SYS.IsSupplierCash == "1")
     {
         int sid = Rint_Para("0");
         supplier = B_Lebi_Supplier.GetModel(sid);
     }
     if (supplier == null)
     {
         supplier = new Lebi_Supplier();
     }
     CookieTool.SetCookieString("supplier", supplier.id.ToString(), 60);
     path   = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">&raquo;</em><a href=\"" + URL("P_Basket", "") + "\"><span>" + Tag("购物车") + "</span></a><em>&raquo;</em><a href=\"" + URL("P_CheckOut", "") + "\"><span>" + Tag("收银台") + "</span></a>";
     basket = new Basket();
     if (basket.Products.Count == 0)
     {
         Response.Redirect(URL("P_Basket", ""));
     }
     if (CurrentUser.id > 0)
     {
         cards      = B_Lebi_Card.GetList("User_id=" + CurrentUser.id + " and Type_id_CardType=312 and Type_id_CardStatus in (201,203) and Time_End>'" + FormatTime(System.DateTime.Now) + "'", "id asc");//状态为已发放或部分使用
         moneycards = B_Lebi_Card.GetList("User_id=" + CurrentUser.id + " and Type_id_CardType=311 and Type_id_CardStatus in (201,203) and Time_End>'" + FormatTime(System.DateTime.Now) + "'", "id asc");
     }
     ProPerty135 = B_Lebi_ProPerty.GetList("Type_id_ProPertyType=135", "Sort desc");
 }
예제 #3
0
        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_UserCard", "") + "\"><span>" + Tag("我的卡券") + "</span></a>";
            cardtype  = RequestTool.RequestInt("cardtype", 312);
            pageindex = RequestTool.RequestInt("page", 1);
            where     = "User_id=" + CurrentUser.id + "";
            if (cardtype > 0)
            {
                where += " and Type_id_CardType=" + cardtype;
            }
            cards = B_Lebi_Card.GetList(where, "id desc", PageSize, pageindex);
            int recordCount = B_Lebi_Card.Counts(where);

            PageString = Shop.Bussiness.Pager.GetPaginationStringForWeb("?page={0}&cardtype=" + cardtype, pageindex, PageSize, recordCount, CurrentLanguage);
        }