Esempio n. 1
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 "开户成功";
        }
Esempio n. 2
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();
     }
 }