Пример #1
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        ChongzhiKaAct chongAct = new ChongzhiKaAct();
        ChongzhiKa ka = chongAct.GetNew();
        if (TextBox1.Text.Trim().Length == 0)
        {
            MessageBox("请输入充值卡号");
            return;
        }
        if (ka != null && ka.Number == TextBox1.Text.Trim())
        {
            MessageBox("充值卡号没有变化!");
            return;
        }

        try
        {
            chongAct.Add(TextBox1.Text.Trim());
            MessageBox("修改成功!");
        }
        catch (Exception ex)
        {
            MessageBox(ex.Message);
        }
    }
Пример #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         ChongzhiKaAct chongAct = new ChongzhiKaAct();
         ChongzhiKa ka = chongAct.GetNew();
         if (ka != null)
         {
             TextBox1.Text = ka.Number;
         }
     }
 }
Пример #3
0
    protected void BTsubmit_Click(object sender, EventArgs e)
    {
        if (Request.QueryString["idd"] != null)
        {
            string qq = Request.QueryString["idd"];
            ChongzhiRecardAct act = new ChongzhiRecardAct();
            ChongzhiKaAct kaAct = new ChongzhiKaAct();
            string ka = txtChongzhika.Text.Trim();
            ChongzhiKa chongzhika = kaAct.GetNew();
            if (chongzhika.Number != ka)
            {
                MessageBox("充值卡有误!请重新输入");
                return;
            }
            ChongzhiRecard recard = act.GetByQQAndChongzhika(qq, ka);
            if (recard != null)
            {
                MessageBox("您的账户已经用该充值卡充过值了!无法重复充值!");
                return;
            }
            try
            {
                act.Add(qq, ka);
                UserAct userAct = new UserAct();
                User user = userAct.GetByid(qq);
                user.Jifen++;
                userAct.Edit(user);
                JifenChangeAct jifenAct = new JifenChangeAct();
                jifenAct.Add(qq, 1, JifenChangeType.优惠, true);
                MessageBox("充值成功!");
            }
            catch (Exception ex)
            {

                MessageBox(ex.Message);
            }
        }
    }