예제 #1
0
        /// <summary>
        /// 校验充值码
        /// </summary>
        /// <param name="context"></param>
        private void veriMoneyCode(HttpContext context)
        {
            //充值码
            string card = WeiSha.Common.Request.Form["card"].String;

            //没有传入充值码
            if (string.IsNullOrWhiteSpace(card))
            {
                this.Response.Write("0");
                this.Response.End();
                return;
            }
            //开始验证
            try
            {
                Song.Entities.RechargeCode code = Business.Do <IRecharge>().CouponCheckCode(card);
                if (code != null)
                {
                    Song.Entities.Accounts st = Extend.LoginState.Accounts.CurrentUser;
                    code.Ac_ID      = st.Ac_ID;
                    code.Ac_AccName = st.Ac_AccName;
                    Business.Do <IRecharge>().CouponUseCode(code);
                    this.Response.Write("1");
                }
            }
            catch (Exception ex)
            {
                this.Response.Write(ex.Message);
            }
            this.Response.End();
        }
예제 #2
0
        /// <summary>
        /// 充值码充值
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnCode_Click(object sender, EventArgs e)
        {
            string moneyCode = tbCode.Text.Trim();

            //没有传入充值码
            if (string.IsNullOrWhiteSpace(moneyCode))
            {
                return;
            }
            try
            {
                Song.Entities.RechargeCode code = Business.Do <IRecharge>().CouponCheckCode(moneyCode);
                if (code != null)
                {
                    Song.Entities.Accounts st = Extend.LoginState.Accounts.CurrentUser;
                    code.Ac_ID      = st.Ac_ID;
                    code.Ac_AccName = st.Ac_AccName;
                    Business.Do <IRecharge>().CouponUseCode(code);
                    //当前学员的卡券
                    int stid = st == null ? -1 : st.Ac_ID;
                    ltCoupon.Text = Business.Do <IAccounts>().CouponClac(stid, -1, null, null).ToString();
                    this.Alert("充值成功!成功充值" + code.Rc_Price + "元。");
                }
            }
            catch (Exception ex)
            {
                this.cv3.ErrorMessage = ex.Message;
                this.cv3.IsValid      = false;
            }
        }