Exemple #1
0
 private void EndProcess()
 {
     try
     {
         timer.Stop();
         foreach (Form frm in Application.OpenForms)
         {
             if (frm.Name == "ProveYouAreHuman")
             {
                 frm.Close();
                 break;
             }
         }
         foreach (Form frm in Application.OpenForms)
         {
             if (frm.Name == "InforBox")
             {
                 frm.Close();
                 break;
             }
         }
         tbxPriceAdd.Enabled = false;
         tbxPriceBid.Enabled = false;
         btnAdd.Enabled      = false;
         btnBid.Enabled      = false;
         button1.Enabled     = false;
         button2.Enabled     = false;
         button3.Enabled     = false;
         button4.Enabled     = false;
         button5.Enabled     = false;
         button6.Enabled     = false;
         MessageBox.Show("模拟结束,点击查看拍卖结果!");
         if (BidPrice >= AcceptPrice)
         {
             InforBox ifb = new InforBox(this);
             ifb.OutputInfor("恭喜您成交了,\n中标价格:" + BidPrice.ToString());
         }
         else
         {
             InforBox ifb = new InforBox(this);
             ifb.OutputInfor("对不起您没有成交,\n最低价格:" + AcceptPrice.ToString() + "\n您的出价:" + BidPrice.ToString());
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemple #2
0
        private void btnBid_Click(object sender, EventArgs e)
        {
            // check price validity
            if (tbxPriceBid.Text == "")
            {
                return;
            }
            int data = Convert.ToInt32(tbxPriceBid.Text);

            if (data % 100 != 0)
            {
                return;
            }

            // limit two biding
            if (cntBid > 2)
            {
                InforBox ifb = new InforBox(this);
                ifb.OutputInfor("三次出价机会已用完!");
                return;
            }

            // anti robot check
            if (true == fAntiRobot)
            {
                InforBox ifb = new InforBox(this);
                ifb.OutputInfor("操作过于频繁!");
                return;
            }

            try
            {
                // check the verification code
                if (false == fInVerify)
                {
                    ProveYouAreHuman vbp = new ProveYouAreHuman(this);
                    vbp.Init(data);
                }
            }
            catch (Exception ex)
            {
            }

            if (true == fAntiRobot)
            {
                return;
            }

            // check random code verification
            if (false == fVerifyResult)
            {
                InforBox ifb = new InforBox(this);
                ifb.OutputInfor("验证码输入错误");
            }
            else
            {
                // check the price is validated
                if (data >= (AcceptPrice - 300) && data <= (AcceptPrice + 300))
                {
                    InforBox ifb = new InforBox(this);
                    ifb.OutputInfor("出价有效");
                    BidPrice = data;
                    cntBid  += 1;
                    BidTime  = FlowSequence.ToString("HH:mm:ss");
                    DisplayBidStatus();
                }
                else
                {
                    InforBox ifb = new InforBox(this);
                    ifb.OutputInfor("您的出价不在目前数据库接受处理价格区间");
                }
            }
        }