Пример #1
0
        //代理方法,负责定时检查用户手机余额,如果用户余额不够,则挂机.并且登记通话记录.
        private void proxy(Object obj)
        {
            Mobile p = (Mobile)obj;
            p.Mobilenumber = Int64.Parse(textBox2.Text);
            //简单测试,每分钟扣费0.2元
            if (!mobileDaoCheckBalance.checkBalance(Int64.Parse(textBox2.Text), 0f,0.2f))
            {
                //停止计时

                this.timer2.Dispose();
                this.timer1.Enabled = false;
                //记录通话信息
                CallRecord callRecord = new CallRecord();
                callRecord.FPhoneNumber = Int64.Parse(textBox2.Text);
                callRecord.TPhoneNumber = Int64.Parse(textBox1.Text);
                string record = on + "-" + DateTime.Now + " time:" + this.label2.Text;
                CallRecordDao dao = new CallRecordDao();
                callRecord.T_from = on;
                callRecord.T_to = DateTime.Now;
                dao.saveRecord(callRecord);
                MessageBox.Show("你的余额不足,已经挂机.", "wrong", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
        }
Пример #2
0
 private void button2_Click(object sender, EventArgs e)
 {
     //停止计时
     this.timer1.Enabled = false;
     this.timer2.Dispose();
     //记录通话信息
     CallRecord callRecord = new CallRecord();
     callRecord.FPhoneNumber = Int64.Parse(textBox2.Text);
     callRecord.TPhoneNumber = Int64.Parse(textBox1.Text);
     string record = on + "-" + DateTime.Now + " time:" + this.label2.Text;
     CallRecordDao dao = new CallRecordDao();
     callRecord.T_from = on;
     callRecord.T_to = DateTime.Now;
     dao.saveRecord(callRecord);
 }