private void 注册_Click(object sender, EventArgs e) { ulong stuno = Convert.ToUInt64(reg_stuNo.Text); ushort cardno = Convert.ToUInt16(reg_cardNo.Text); DAO dao = new DAO(); MySql.Data.MySqlClient.MySqlDataReader rdr = (MySql.Data.MySqlClient.MySqlDataReader)dao.Excute("select stuName from students where stuNo = " + stuno); if (rdr.Read() == false) { MessageBox.Show("没有该学号"); return; } if (Card.IssueCard(stuno, cardno, rdr["stuName"] as string, (byte)(underGraduate.Focused ? 1 : 2)) == false) { MessageBox.Show("发卡失败"); return; } ushort predepoist = Convert.ToUInt16(reg_preDeposit.Text); if (predepoist > 0) { Card.Charge(cardno, (ushort)(predepoist * 10)); } }
private void 挂失_Click(object sender, EventArgs e) { Net send = new Net(restaurantServer, restaurantPort); DAO dao = new DAO(); MySql.Data.MySqlClient.MySqlDataReader rdr = (MySql.Data.MySqlClient.MySqlDataReader)dao.Excute( "select cardNo from cards where StuNo='" + sub_stuNo.Text + "'" ); if (rdr.Read()==false) { MessageBox.Show("不存在该学号"); return; } if (send.Send(rdr["cardNo"] as string) == false) { MessageBox.Show("发送挂失信息失败"); return; } MessageBox.Show("挂失成功"); }