//取款 public int draw(string ID, string DRAW) { DAL.dal dal = new DAL.dal(); model mm = dal.draw(ID, DRAW); if (DRAW == "") { return(2);//不能为空 } else { BLL.bll bll = new BLL.bll(); if (DRAW != null) { if (Convert.ToInt32(DRAW) > Convert.ToInt32(mm.money))//100>1 { return(1); } return(0); //要取款的金额不能大于余额或小于负数 } return(2); } //取款成功 }
private void button1_Click(object sender, EventArgs e) { label1.Text = "卡号:"; label2.Text = "密码:"; button1.Text = "登陆"; button2.Text = "找回"; string ID = textBox1.Text; string PWD = textBox2.Text; //BLL.USERADO bb = new BLL.USERADO();//先实例化逻辑层 BLL.bll bb = new BLL.bll(); int uu = bb.select(ID, PWD); if (uu == 0) { Form3 f3 = new Form3(textBox1.Text); label1.Visible = false; label2.Visible = false; button1.Visible = false; button2.Visible = false; textBox1.Visible = false; textBox2.Visible = false; f3.MdiParent = this; f3.Show(); MessageBox.Show("登陆成功"); } else if (uu == 1) { MessageBox.Show("密码错误"); } else if (uu == 2) { MessageBox.Show("没有这个账号"); } }
/*取款*/ private void button2_Click(object sender, EventArgs e) { label1.Text = "卡号:"; label2.Text = "金额:"; label2.Visible = true; label1.Visible = true; textBox1.Visible = true; textBox1.Text = txt; string ID = textBox1.Text; string DRAW = textBox2.Text; BLL.bll bll = new BLL.bll(); int uu = bll.draw(ID, DRAW); if (uu == 0) { MessageBox.Show("取款成功"); } if (uu == 1) { MessageBox.Show("输入的金额不能大于余额"); } if (uu == 2) { MessageBox.Show("要取款的金额不能为空"); } }
private void button5_Click(object sender, EventArgs e) { //textBox3.Size=(201, 67); string ID = textBox1.Text; model mm = new model(); BLL.bll bll = new BLL.bll(); string uu = bll.Record(ID); textBox3.Text = uu; }
/*查询余额*/ private void button1_Click(object sender, EventArgs e) { label1.Text = "卡号:"; label2.Text = "余额:"; label2.Visible = true; string ID = textBox1.Text; textBox2.Visible = true; label3.Visible = false; textBox3.Visible = false; BLL.bll bll = new BLL.bll(); string uu = bll.money_select(ID); textBox2.Text = uu; }
/*储存*/ public int Storage(string ID, string Money) { DAL.dal dal = new DAL.dal(); model mm = dal.Storage(ID, Money); if (Money == "") { return(1);//不能为空 } else { //int i = Convert.ToInt32(mm.money); BLL.bll bll = new BLL.bll(); //int m = Convert.ToInt32(bll.money_select(ID)); return(0); } }
/*存款*/ private void button3_Click(object sender, EventArgs e) { string ID = textBox1.Text; string Money = textBox2.Text; BLL.bll bll = new BLL.bll(); int uu = bll.Storage(ID, Money); if (uu == 0) { MessageBox.Show("存款成功"); } if (uu == 1) { MessageBox.Show("请输入要储存的金额"); } //int uu=bll. }
/*转账*/ private void button4_Click(object sender, EventArgs e) { string ID = textBox1.Text; string YouID = textBox2.Text; string Ta = textBox3.Text; BLL.bll bll = new BLL.bll(); int uu = bll.T_accounts(ID, YouID, Ta); if (uu == 0) { MessageBox.Show("要转账的金额不能大于余额"); } if (uu == 1) { MessageBox.Show("转账成功"); } if (uu == 2) { MessageBox.Show("不存在这个卡号或金额不能为空"); } }
private void button1_Click(object sender, EventArgs e) { //textBox1.Text = txt; //textBox1.ReadOnly = true; string ID = textBox1.Text; string PWD = textBox3.Text; string SFZ = textBox2.Text; BLL.bll bb = new BLL.bll(); int uu = bb.update(ID, SFZ, PWD); if (uu == 0) { MessageBox.Show("修改成功"); } if (uu == 1) { MessageBox.Show("身份证错误"); } if (uu == 2) { MessageBox.Show("没有这个账号"); } }
/*转账*/ public int T_accounts(string ID, string YouID, string Ta) { DAL.dal dal = new DAL.dal(); model mm = dal.T_accounts(ID, YouID, Ta); if (Ta == "" && YouID == "") { return(2);//对方帐号和要转账的金额不能为空 } //int i = Convert.ToInt32(mm.money); BLL.bll bll = new BLL.bll(); int m = Convert.ToInt32(bll.money_select(ID));//查询余额 if (mm != null && mm.id == YouID && Ta != null & YouID != null) { if (Convert.ToInt32(Ta) > m) { return(0); //要转账的金额不能大于余额 } return(1); //转账成功 } return(2); //没有这个账号 }