예제 #1
0
파일: Form2.cs 프로젝트: kutang/mobile
 private void button2_Click(object sender, EventArgs e)
 {
     if (textBox6.Text == "")
     {
         MessageBox.Show("请输入手机号码");
         return;
     }
     if (textBox3.Text == "" || textBox4.Text == "" || textBox5.Text == "")
     {
         MessageBox.Show("请输入完整的三个号码");
         return;
     }
     //三个不同的电话号码
     if (textBox3.Text.Equals(textBox4.Text)||textBox3.Text.Equals(textBox5.Text)||textBox4.Text.Equals(textBox5.Text))
     {
         MessageBox.Show("请输入不同的电话号码");
         return;
     }
     Int64 mobile1=Int64.Parse(textBox3.Text);
     Int64 mobile2=Int64.Parse(textBox4.Text);
     Int64 mobile3=Int64.Parse(textBox5.Text);
     Int64 num = Int64.Parse(textBox6.Text);
     MobileDao dao = new MobileDao();
     if (dao.checknumexists(num))
     {
         MessageBox.Show("此号码不存在", "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     else
     {
         if (dao.checkState(num))
         {
             MessageBox.Show("已经停机或者出于欠费阶段,你是无法进行下一步操作的.非常抱歉.", "wrong", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return;
         }
         CallRecordDao d = new CallRecordDao();
         if (d.checkMobile(num, mobile1) == 0)
         {
             MessageBox.Show("你输入的号码1不正确");
             return;
         }
         if (d.checkMobile(num, mobile2) == 0)
         {
             MessageBox.Show("你输入的号码2不正确");
             return;
         }
         if (d.checkMobile(num, mobile3) == 0)
         {
             MessageBox.Show("你输入的号码3不正确");
             return;
         }
         randNum= rand.Next(10);
         MessageBox.Show(randNum.ToString());
     }
 }
예제 #2
0
파일: Form6.cs 프로젝트: kutang/mobile
        //代理方法,负责定时检查用户手机余额,如果用户余额不够,则挂机.并且登记通话记录.
        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;
            }
        }
예제 #3
0
파일: Form6.cs 프로젝트: kutang/mobile
        //高级查询
        private void button4_Click(object sender, EventArgs e)
        {
            richTextBox1.Text = "";
            CallRecordDao callRecordDao = new CallRecordDao();
            if (textBox3.Text == "") { MessageBox.Show("请输入你的手机号码", "wrong", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; }
            if (textBox4.Text == "") { MessageBox.Show("请输入开始月份", "wrong", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; }
            if (textBox5.Text == "") { MessageBox.Show("请输入结束月份", "wrong", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; }

            ArrayList list = callRecordDao.findByMonth(textBox4.Text, textBox5.Text);
            bool flag = false;
            foreach (CallRecord record1 in list)
            {
                richTextBox1.AppendText(record1.FPhoneNumber.ToString() + "\t");
                richTextBox1.AppendText(record1.TPhoneNumber.ToString() + "\t");
                richTextBox1.AppendText(record1.T_from.ToString() + "\t");
                richTextBox1.AppendText(record1.T_to.ToString() + "\n");
                flag = true;
            }
            if (!flag) richTextBox1.AppendText("无记录");
        }
예제 #4
0
파일: Form6.cs 프로젝트: kutang/mobile
        //基本查询
        private void button3_Click(object sender, EventArgs e)
        {
            richTextBox1.Text = "";
            if (textBox3.Text == "") { MessageBox.Show("请输入你的手机号码", "wrong", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; }
            CallRecordDao callRecallDao = new CallRecordDao();
            IEnumerable<CallRecord> list = callRecallDao.listCallRecord(Int64.Parse(textBox3.Text));
            Int32 flag = 0;
            foreach(CallRecord record in list)
            {
                richTextBox1.AppendText(record.FPhoneNumber.ToString()+"\t");
                richTextBox1.AppendText(record.TPhoneNumber.ToString()+"\t");
                richTextBox1.AppendText(record.T_from.ToString() + "\t");
                richTextBox1.AppendText(record.T_to.ToString()+"\n");
                flag = 1;

            }
            if (flag == 0) richTextBox1.AppendText("无记录");
        }
예제 #5
0
파일: Form6.cs 프로젝트: kutang/mobile
 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);
 }