Beispiel #1
0
 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());
     }
 }
Beispiel #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (!textBox1.Text.Equals(textBox2.Text))
     {
         MessageBox.Show("你两次输入的密码不一样");
         textBox1.Text = "";
         textBox2.Text = "";
         return;
     }
     MobileDao dao = new MobileDao();
     dao.modifyPassword(Int64.Parse(textBox6.Text), textBox1.Text);
     MessageBox.Show("修改密码成功");
 }
Beispiel #3
0
 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;
         }
     }
 }
Beispiel #4
0
        public string save(Mobile mobile,Customer customer,Rule rule)
        {
            MobileDao mobileDao = new MobileDao();
            if(!mobileDao.save(mobile)) return "保存mobile失败";
            CustomerDao customerDao = new CustomerDao();
            customerDao.save(customer);
            Int32 customerid = customerDao.getId();
            if (customerid == -1) return "保存Customer失败";
            RuleDao ruleDao = new RuleDao();
            if (!ruleDao.save(rule)) return "保存Rule失败";

            Account account = new Account();
            account.Mobilenumber = mobile.Mobilenumber;
            account.Customerid = customerid;
            AccountDao accountDao = new AccountDao();
            if (!accountDao.save(account)) return "保存Account失败";
            else return "开户成功";
        }
Beispiel #5
0
 private void button2_Click(object sender, EventArgs e)
 {
     Int64 num = Int64.Parse(textBox6.Text);
     MobileDao dao = new MobileDao();
     if (dao.checknumexists(num)) MessageBox.Show("此号码不存在", "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     else
     {
         AccountDao accountDao = new AccountDao();
         Int32 customerId = accountDao.getCustomerId(num);
         CustomerDao customerDao = new CustomerDao();
         label9.Text = customerDao.getName(customerId);
         MobileDao mobileDao = new MobileDao();
         Mobile mobile = mobileDao.getMobile(num);
         label11.Text = num.ToString();
         if (mobile.Mobiletype.Equals("world")) label13.Text = "全球通";
         else if (mobile.Mobiletype.Equals("music")) label13.Text = "动感地带";
         else label13.Text = "神州行";
         label15.Text = mobile.Balance.ToString() + "元";
         label18.Text = mobile.LastTimePayFor.ToString();
     }
 }
Beispiel #6
0
        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);
                        }
                    }
                }
            }
        }
Beispiel #7
0
        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);
        }
Beispiel #8
0
 private void Form6_Load(object sender, EventArgs e)
 {
     tabPage1.Text = "模拟通话";
     tabPage2.Text = "新增业务";
     this.timer1.Enabled = false;
     this.timer1.Interval = 1;
     mobileDaoCheckBalance = new MobileDao();
 }
Beispiel #9
0
        private void button3_Click(object sender, EventArgs e)
        {
            Int64 num = Int64.Parse(textBox6.Text);
            string name;
            Int32 chargepermonth;
            if (checkBox1.Checked)
            {
                name = "gprs";
                chargepermonth = 10;
            }
            else if (checkBox2.Checked)
            {
                name = "music";
                chargepermonth = 2;
            }
            else
            {

                MessageBox.Show("请选择要开通的业务类型", "warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            ChargeDao chargedao = new ChargeDao();
            Int32 chargeid = chargedao.getId(name, chargepermonth, 2);
            Test.Model.Rule rule = new Test.Model.Rule();
            rule.Chargeid = chargeid;
            rule.Mobilenumber = num;
            RuleDao ruleDao = new RuleDao();
            //首先判断是否已经开通了该业务
            if (!ruleDao.check(num,chargeid)) { MessageBox.Show("你已经开通同该业务,无需重复操作", "wrong", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; }
            MobileDao mobileDao = new MobileDao();
            //然后判断用户的余额是否足够
            if (!mobileDao.checkBalance(num,chargepermonth)) { MessageBox.Show("你的余额不足,无法开通该业务", "wrong", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; }

            ruleDao.save(rule);
            //进行扣费
            mobileDao.koufei(num,chargepermonth);
            MessageBox.Show("新业务开通成功,从即日起每个月进行相关扣费");
        }
Beispiel #10
0
 //检测号码是否被占用了
 private void button6_Click(object sender, EventArgs e)
 {
     Int64 num = Int64.Parse(textBox1.Text);
     MobileDao dao = new MobileDao();
     if (!dao.checknumexists(num)) MessageBox.Show("此号码已经被占用", "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     else MessageBox.Show("这个号码可以使用", "正确", MessageBoxButtons.OK, MessageBoxIcon.None);
 }
Beispiel #11
0
 //停机办理
 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("你输入的密码是错误的");
 }
Beispiel #12
0
        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() + ",所以扣费不成功.");

            }
        }