Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if(string.IsNullOrEmpty(Request.Params["id"]))
        {
            throw new Exception("card id未提供");
        }

        WeixinServiceProvider provider = new WeixinServiceProvider("wx314cb0c63e89ad5f", "22d1a7039fd99765ad7e92d78f83f7df");

        card_info cardinfo = provider.GetCardInfoById(Request.Params["id"]);

        if (cardinfo == null)
            throw new Exception("card id对应的数据未找到");
    }
Ejemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        WeixinServiceProvider data_provider = new WeixinServiceProvider("wx314cb0c63e89ad5f", "22d1a7039fd99765ad7e92d78f83f7df");

        List<card_info> card_list = data_provider.GetCardlist(card_status.CARD_STATUS_ALL, 0, 20);

        List<card_info_base> base_card_list = new List<card_info_base>(card_list.Count);

        for(int i = 0; i < card_list.Count; i++)
        {
            card_info cardinfo = card_list[i];

            switch(cardinfo.card_type)
            {
                case card_type.GENERAL_COUPON:
                    cardinfo.general_coupon.base_info.type = card_type.GENERAL_COUPON;
                    base_card_list.Add(cardinfo.general_coupon.base_info);
                    break;

                case card_type.GIFT:
                    cardinfo.gift.base_info.type = card_type.GIFT;
                    base_card_list.Add(cardinfo.gift.base_info);
                    break;

                case card_type.CASH:
                    cardinfo.cash.base_info.type = card_type.CASH;
                    base_card_list.Add(cardinfo.cash.base_info);
                    break;

                case card_type.DISCOUNT:
                    cardinfo.discount.base_info.type = card_type.DISCOUNT;
                    base_card_list.Add(cardinfo.discount.base_info);
                    break;

                case card_type.GROUPON:
                    cardinfo.groupon.base_info.type = card_type.GROUPON;
                    base_card_list.Add(cardinfo.groupon.base_info);
                    break;
            }
        }

        this.Repeater1.DataSource = base_card_list;
        this.Repeater1.DataBind();
    }
Ejemplo n.º 3
0
    protected virtual object GetSnsUserInfo(HttpContext context, string code, bool isBaseInfo)
    {
        string secret = "22d1a7039fd99765ad7e92d78f83f7df";
        string appid = "wx314cb0c63e89ad5f";

        WeixinServiceProvider service = new WeixinServiceProvider(appid, secret);

        user_info_base usertoken = service.GetOAuthUserInfoBase(code);

        if (usertoken == null)
            throw new Exception("user_info_base无法获取");

        user_info userinfo = service.GetOAuthUserInfo(usertoken);

        if (userinfo == null)
            throw new Exception("user_info无法获取");

        return userinfo;
    }