//取款 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); } //取款成功 }
//查询余额 public string money_select(string ID) { DAL.dal dal = new DAL.dal(); model mm = dal.money_select(ID); return(mm.money); //余额 }
/*交易明细*/ public string Record(string ID) { DAL.dal dal = new DAL.dal(); model mm = dal.record(ID); return(mm.record); }
//修改密码 public int update(string ID, string SFZ, string PWD) { DAL.dal dal = new DAL.dal(); model mm = dal.update(ID, SFZ, PWD); if (mm != null && mm.id == ID) { if (mm.sfz == SFZ) { return(0); } return(1); } return(2); }
//登录方法 public int select(string ID, string PWD) { DAL.dal dal = new DAL.dal(); model mm = dal.select(ID, PWD); if (mm != null && mm.id == ID) { if (mm.pwd == PWD) { return(0); //登陆成功 } return(1); //密码错误 } return(2); //没有这个账号 }
/*储存*/ 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); } }
/*转账*/ 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); //没有这个账号 }