Exemplo n.º 1
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();
     }
 }
Exemplo n.º 2
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() + ",所以扣费不成功.");

            }
        }