protected void Page_Load(object sender, EventArgs e) { if (!EX_Admin.Power("cardtype_list", "优惠券列表")) { PageReturnMsg = PageNoPowerMsg(); } su = new SearchCard(CurrentAdmin, CurrentLanguage.Code); type = RequestTool.RequestInt("type", 311); PageSize = RequestTool.getpageSize(25); string where = "1=1"; key = RequestTool.RequestString("key"); user_id = RequestTool.RequestInt("user_id"); if (key != "") { where += " and Code like lbsql{'%" + key + "%'} or User_UserName like lbsql{'%" + key + "%'}"; } if (user_id > 0) { where += " and User_id=" + user_id + ""; } where += su.SQL; models = B_Lebi_Card.GetList(where, "id desc", PageSize, page); int recordCount = B_Lebi_Card.Counts(where); PageString = Pager.GetPaginationString("?page={0}&key=" + key + "&user_id=" + user_id + "&" + su.URL, page, PageSize, recordCount); }
/// <summary> /// 发放卡券 /// </summary> public void CardGet() { int id = RequestTool.RequestInt("id", 0); string verifycode = RequestTool.RequestString("verifycode"); if (CurrentCheckCode != verifycode) { Response.Write("{\"msg\":\"" + Tag("验证码错误") + "\"}"); return; } //Lebi_CardOrder order = B_Lebi_CardOrder.GetModel("Type_id_CardType=312 and id = " + id + ""); //if (order == null) //{ // Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); // return; //} //int count = B_Lebi_Card.Counts("Type_id_CardType=312 and CardOrder_id=" + id + " and Type_id_CardStatus=200 and User_id=0"); //if (count == 0) //{ // Response.Write("{\"msg\":\"" + Tag("卡券数量不足") + "\"}"); // return; //} int getcount = B_Lebi_Card.Counts("Type_id_CardType=312 and CardOrder_id=" + id + " and User_id=" + CurrentUser.id + ""); if (getcount > 0) { Response.Write("{\"msg\":\"" + Tag("不可以重复领取") + "\"}"); return; } Lebi_Card c = B_Lebi_Card.GetModel("Type_id_CardType=312 and CardOrder_id=" + id + " and Type_id_CardStatus=200 and User_id=0"); if (c == null) { Response.Write("{\"msg\":\"" + Tag("卡券数量不足") + "\"}"); return; } c.User_id = CurrentUser.id; c.Type_id_CardStatus = 201;//已发放 c.User_UserName = CurrentUser.UserName; B_Lebi_Card.Update(c); Response.Write("{\"msg\":\"OK\"}"); }
protected void Page_Load(object sender, EventArgs e) { if (!EX_Admin.Power("card_edit", "修改卡券")) { WindowNoPower(); } int user_id = RequestTool.RequestInt("user_id", 0); card_ids = RequestTool.RequestString("ids"); su = new SearchCard(CurrentAdmin, CurrentLanguage.Code); if (card_ids != "") { models = B_Lebi_Card.GetList("id in (lbsql{" + card_ids + "})", ""); count = models.Count; } else { count = B_Lebi_Card.Counts("1=1" + su.SQL); } }
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\">»</em><a href=\"" + URL("P_UserCenter", "") + "\"><span>" + Tag("会员中心") + "</span></a><em>»</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); NextPage = "?page=" + (pageindex + 1) + "&cardtype=" + cardtype + ""; }
public int count_card_no(int oid) { int count = B_Lebi_Card.Counts("CardOrder_id=" + oid + " and Type_id_CardStatus=200"); return(count); }
/// <summary> /// 卡券总数 /// </summary> /// <param name="oid"></param> /// <returns></returns> public int count_card(int oid) { int count = B_Lebi_Card.Counts("CardOrder_id=" + oid + ""); return(count); }
/// <summary> /// 发放卡券 /// </summary> public void SendCard() { if (!EX_Admin.Power("user_card_add", "发放卡券")) { AjaxNoPower(); return; } string User_Name_To = RequestTool.RequestString("User_Name_To"); string User_ids = RequestTool.RequestString("User_ids"); int orderid = RequestTool.RequestInt("orderid", 0); Lebi_CardOrder co = B_Lebi_CardOrder.GetModel(orderid); if (co == null) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } SearchUser su = new SearchUser(CurrentAdmin, CurrentLanguage.Code); int count = B_Lebi_Card.Counts("CardOrder_id=" + orderid + " and Type_id_CardStatus=200 and User_id=0"); string where = ""; if (User_Name_To != "") { where = "UserName = lbsql{'" + User_Name_To + "'}"; } else if (User_ids != "") { where = "id in (lbsql{" + User_ids + "})"; } else { where = "1=1 " + su.SQL; } if (count < B_Lebi_User.Counts(where)) { Response.Write("{\"msg\":\"" + Tag("卡券数量不足") + "\"}"); return; } List <Lebi_User> users = B_Lebi_User.GetList(where, ""); if (users.Count == 0) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } foreach (Lebi_User user in users) { Lebi_Card c = B_Lebi_Card.GetModel("CardOrder_id=" + orderid + " and Type_id_CardStatus=200 and User_id=0"); if (c == null) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } c.User_id = user.id; c.Type_id_CardStatus = 201;//已发放 c.User_UserName = user.UserName; B_Lebi_Card.Update(c); } Log.Add("发送" + EX_Type.TypeName(co.Type_id_CardType) + "", "card", "", CurrentAdmin, su.Description + User_Name_To + User_ids); Response.Write("{\"msg\":\"OK\"}"); }