Beispiel #1
0
 public static void Read()
 {
     FileStream file = new FileStream(@"operator.txt", FileMode.OpenOrCreate);
     StreamReader Read = new StreamReader(file);
     Operator ope = null;
     while (!Read.EndOfStream)
     {
         ope = new Operator();
         ope.type = Read.ReadLine();
         ope.M_account = Read.ReadLine();
         ope.M_money = Convert.ToDouble(Read.ReadLine());
         ope.m_time = Read.ReadLine();
         operato.Add(ope);
     }
     Read.Close();
 }
Beispiel #2
0
 private void button500_Click(object sender, EventArgs e)
 {
     Operator op = new Operator();
     if (ch.m_user.Money <= 500)
     {
         MessageBox.Show("余额不足!");
     }
     else
     {
         ch.m_user.Money -= 500;
         op.type = "取款";
         op.M_account = ch.m_user.Account;
         op.M_money =500;
         op.m_time = DateTime.Now.ToString();    
         Program.operato.Add(op);
         MessageBox.Show("取款成功!");
     }
 }
Beispiel #3
0
  private void sure_Click(object sender, EventArgs e)
  {
      if (Convert.ToDouble(m_money.Text) <= 0)
      {
          MessageBox.Show("存款金额必须大于零!");
          return;
      }
      if ((Convert.ToDouble(m_money.Text))%100.0!=0)
      {
          MessageBox.Show("存钱必须是100整数倍");
          return;
       } 
      cho.m_user.Money += Convert.ToDouble(m_money.Text);
      Operator op=new Operator();
      op.type ="存款";
      op.M_account = cho.m_user.Account;
      op.M_money = Convert.ToDouble(m_money.Text);
      op.m_time = DateTime.Now.ToString();
      textBox1.Text = DateTime.Now.ToString();
      Program.operato.Add(op);
 
      MessageBox.Show("存款成功!");
  }
Beispiel #4
0
 //public static string Account = "";
 private void Transfer_OK_Click(object sender, EventArgs e)
 {
     foreach (UserInfo user1 in Program.users)
     {
         if (Transfer_account.Text == user1.Account)
         {
            // Account = Transfer_account.Text;
             if (chos.m_user.Money <= Convert.ToDouble(Transfer_money.Text)) 
             {
                 MessageBox.Show("余额不足!");
                 return;
             }
               
             else if (Convert.ToDouble(Transfer_money.Text)<=0)
             {
                 MessageBox.Show("输入的转账金额不能为负数");
                 return;
             }
             else
             {
                 chos.m_user.Money -= Convert.ToDouble(Transfer_money.Text);
                 Operator op = new Operator(); 
                 op.type="转账";
                 op.M_account=Transfer_account.Text;
                 op.M_money=Convert.ToDouble(Transfer_money.Text);
                 op.m_time=DateTime.Now.ToString();
                 Program.operato.Add(op);
                 user1.Money += Convert.ToDouble(Transfer_money.Text);
                 MessageBox.Show("转账成功!");
                 return;
             }
         }
    }
     MessageBox.Show("此帐号不存在");
     return;
 }
Beispiel #5
0
 private void Draw_OK_Click(object sender, EventArgs e)
 {
     Operator op = new Operator();
     if (Convert.ToDouble(money.Text)<=0)
     {
         MessageBox.Show("取款不能为负数!重新输入");
         return;
     }
     if (ch.m_user.Money <= Convert.ToDouble(money.Text))
     {
         MessageBox.Show("余额不足!");
     }
     else
     {
         ch.m_user.Money -= Convert.ToDouble(money.Text);
         op.type = "取款";
         op.M_account = ch.m_user.Account;
         op.M_money = Convert.ToDouble(money.Text);
         op.m_time = DateTime.Now.ToString();
         Program.operato.Add(op);
         MessageBox.Show("取款成功!");
     }
     
 }