示例#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
文件: Form3.cs 项目: kutang/mobile
 private void button2_Click(object sender, EventArgs e)
 {
     checkBox1.Checked = false;
     checkBox2.Checked = false;
     checkBox3.Checked = false;
     checkBox1.Enabled = true;
     checkBox2.Enabled = true;
     button3.Enabled = true;
     if (textBox1.Text == "")
     {
         MessageBox.Show("请你输入你的电话号码", "wrong", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     Int64 num = Int64.Parse(textBox1.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;
         }
         //查找该用户已经开通的套餐
         RuleDao ruleDao = new RuleDao();
         IEnumerable<Test.Model.Rule> ie = ruleDao.getRule(num);
         foreach (Test.Model.Rule r in ie)
         {
             if (r.Chargeid == 4) checkBox1.Checked = true;
             else if (r.Chargeid == 5) checkBox2.Checked = true;
             else continue;
         }
         if (checkBox1.Checked) MessageBox.Show("你已经开通了GPRS服务");
         else checkBox1.Enabled = false;
         if (checkBox2.Checked) MessageBox.Show("你已经开通了铃声服务");
         else checkBox2.Enabled = false;
         if (!checkBox1.Checked && !checkBox2.Checked)
         {
             MessageBox.Show("你没有开通以下服务");
             checkBox1.Checked = false;
             checkBox2.Checked = false;
             button3.Enabled = false;
         }
     }
 }
示例#3
0
文件: Form3.cs 项目: kutang/mobile
        private void button4_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "")
            {
                MessageBox.Show("请你输入你的电话号码", "wrong", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            Int64 num = Int64.Parse(textBox1.Text);
            MobileDao dao = new MobileDao();
            if (dao.checknumexists(num))
            {
                MessageBox.Show("此号码不存在", "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if(dao.checkState(num))
            {
                MessageBox.Show("你的号码处于停机或者欠费状态,无法进行该业务.");
                return;
            }
            //修改基本套餐
            else
            {
                RuleDao ruleDao = new RuleDao();
                //id表示用户基本套餐类型,1表示10元每月,2表示20月每月,3表示30元每月
                Int32 id = ruleDao.getId(num);
                if (id == 0)
                {
                    MessageBox.Show("系统出错");
                    return;
                }
                //MessageBox.Show(id.ToString());
                if (!radioButton4.Checked && !radioButton5.Checked && !radioButton4.Checked)
                {
                    MessageBox.Show("请选择套餐类型");
                    return;
                }
                if (radioButton4.Checked && id == 1)
                {
                    MessageBox.Show("你原来的套餐就是这个,不能重复选择.");
                    return;
                }
                if (radioButton5.Checked && id == 2)
                {
                    MessageBox.Show("你原来的套餐就是这个,不能重复选择.");
                    return;
                }
                if (radioButton6.Checked && id == 3)
                {
                    MessageBox.Show("你原来的套餐就是这个,不能重复选择.");
                    return;
                }
                //如果radioButton4被选择了,表示用户选择的套餐为10元每月的
                if (radioButton4.Checked)
                {
                    if (id == 2)
                    {
                        //查询余额
                        if (!dao.checkBalance(num, 10))
                        {
                            MessageBox.Show("你卡上的余额不足10块钱,不能修改成该业务.");
                            return;
                        }
                        //修改基本套餐类型,马上进行扣费,并且修改扣费日期
                        else
                        {
                            //更改为10元/月套餐
                            RuleDao d = new RuleDao();
                            d.update(num,1);
                            //扣费和修改日期
                            dao.koufei(num, 10,1);
                        }
                    }
                    else if (id == 3)
                    {
                        //查询余额
                        if (!dao.checkBalance(num, 10))
                        {
                            MessageBox.Show("你卡上的余额不足10块钱,不能修改成该业务.");
                            return;
                        }
                        //修改基本套餐类型,马上进行扣费,并且修改扣费日期
                        else
                        {
                            //更改为10元/月套餐
                            RuleDao d = new RuleDao();
                            d.update(num, 1);
                            //扣费和修改日期
                            dao.koufei(num, 10, 1);
                        }
                    }
                }

                //如果radioButton5被选择了,表示用户选择的套餐为20月每月的
                if (radioButton5.Checked)
                {
                    if (id == 1)
                    {
                        //查询余额
                        if (!dao.checkBalance(num, 20))
                        {
                            MessageBox.Show("你卡上的余额不足20块钱,不能修改成该业务.");
                            return;
                        }
                        //修改基本套餐类型,马上进行扣费,并且修改扣费日期
                        else
                        {
                            //更改为10元/月套餐
                            RuleDao d = new RuleDao();
                            d.update(num, 2);
                            //扣费和修改日期
                            dao.koufei(num, 20, 1);
                        }
                    }
                    else if (id == 3)
                    {
                        //查询余额
                        if (!dao.checkBalance(num, 20))
                        {
                            MessageBox.Show("你卡上的余额不足20块钱,不能修改成该业务.");
                            return;
                        }
                        //修改基本套餐类型,马上进行扣费,并且修改扣费日期
                        else
                        {
                            //更改为10元/月套餐
                            RuleDao d = new RuleDao();
                            d.update(num, 2);
                            //扣费和修改日期
                            dao.koufei(num, 20, 1);
                        }
                    }
                }
                //radioButton6表示选择的套餐为30元每月的
                if (radioButton6.Checked)
                {
                    if (id == 1)
                    {
                        //查询余额
                        if (!dao.checkBalance(num, 30))
                        {
                            MessageBox.Show("你卡上的余额不足30块钱,不能修改成该业务.");
                            return;
                        }
                        //修改基本套餐类型,马上进行扣费,并且修改扣费日期
                        else
                        {
                            //更改为10元/月套餐
                            RuleDao d = new RuleDao();
                            d.update(num, 3);
                            //扣费和修改日期
                            dao.koufei(num, 30, 1);
                        }
                    }
                    else if (id == 2)
                    {
                        //查询余额
                        if (!dao.checkBalance(num, 30))
                        {
                            MessageBox.Show("你卡上的余额不足30块钱,不能修改成该业务.");
                            return;
                        }
                        //修改基本套餐类型,马上进行扣费,并且修改扣费日期
                        else
                        {
                            //更改为10元/月套餐
                            RuleDao d = new RuleDao();
                            d.update(num, 3);
                            //扣费和修改日期
                            dao.koufei(num, 30, 1);
                        }
                    }
                }
            }
        }
示例#4
0
文件: Form6.cs 项目: kutang/mobile
        private void button1_Click(object sender, EventArgs e)
        {
            on = DateTime.Now;
            if (textBox1.Text == "")
            {
                MessageBox.Show("请输入要拨打的电话号码", "wrong", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (textBox2.Text == "")
            {
                MessageBox.Show("请输入用户自己的电话号码", "wrong", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            //判断该手机号码是否存在
            MobileDao mobileDao = new MobileDao();
            if (mobileDao.checknumexists(Int64.Parse(textBox1.Text)))
            {
                MessageBox.Show("你要拨打的号码不存在,请再次输入.", "wrong", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (mobileDao.checknumexists(Int64.Parse(textBox2.Text)))
            {
                MessageBox.Show("请准确输入你的手机号码", "wrong", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (mobileDao.checkState(Int64.Parse(textBox1.Text)))
            {
                MessageBox.Show("你要拨打的号码已经停机或者欠费", "wrong", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (mobileDao.checkState(Int64.Parse(textBox2.Text)))
            {
                MessageBox.Show("你的手机已经处于停机或者欠费状态", "wrong", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            //拨打电话前先检查用户手机余额(>=0.2)
            if (!mobileDao.checkBalance(Int64.Parse(textBox2.Text), 0.2f))
            {
                MessageBox.Show("用户余额不足0.2元是没有办法通信的", "wrong", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            this.timer1.Enabled = true;

            //拨打电话每分钟检查一次用户手机的余额
            TimerCallback timerDelegate = new TimerCallback(proxy);
            Mobile mobile = new Mobile();
            timer2 = new System.Threading.Timer(timerDelegate, mobile, 0, 60000);
        }
示例#5
0
文件: Form1.cs 项目: ryanyau/mobile
 //停机办理
 private void button4_Click(object sender, EventArgs e)
 {
     Int64 num = Int64.Parse(textBox6.Text);
     MobileDao mobileDao = new MobileDao();
     if (textBox7.Text == "")
     {
         MessageBox.Show("输入你的密码才能办理停机业务", "wrong", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     if (textBox7.Text == mobileDao.getPassword(num))
     {
         if(mobileDao.checkState(num))
         {
             MessageBox.Show("已经处于停机状态,不用重复该操作","wrong",MessageBoxButtons.OK,MessageBoxIcon.Warning);
             return;
         }
         //MessageBox.Show("你输入的密码是正确的");
         if(!mobileDao.checkBalance(num,5))
         {
             MessageBox.Show("你的卡需要预存至少5块钱才能进行停机业务办理");
             return;
         }
         mobileDao.changeState(num);
         mobileDao.tingjikoufei(num);
         MessageBox.Show("你已经办理了停机业务,我们每个月会收取你5块钱的服务费.");
     }
     else
         MessageBox.Show("你输入的密码是错误的");
 }
示例#6
0
文件: Form1.cs 项目: kutang/mobile
        private void button5_Click(object sender, EventArgs e)
        {
            Int64 num=Int64.Parse(textBox6.Text);
            MobileDao dao = new MobileDao();
            //判断用户是否是停机用户或者是欠费用户
            if (dao.checkState(num))
            {
                MessageBox.Show("你是停机或者欠费用户,我们不再对你进行月租扣费.");
                return;
            }

            Mobile mobile=dao.getMobile(num);
            TimeShedule timeShedule=new TimeShedule();
            if (timeShedule.isPayTime(mobile.LastTimePayFor))
            {
                RuleDao rd = new RuleDao();
                Int32 chargeid=rd.getId(num);
                ChargeDao chargeDao = new ChargeDao();
                Int32 chargePermonth=chargeDao.getCharge(chargeid).Chargepermonth;
                dao.koufei(num, chargePermonth, 1);
                MessageBox.Show("扣费成功");
            }
            else
            {
                MessageBox.Show("你上次扣费时间是:" + mobile.LastTimePayFor.ToString() + ",今天的日期是" + DateTime.Now.ToString() + ",所以扣费不成功.");

            }
        }