protected void btn_Delete_Click(object sender, EventArgs e) { StdInfoBLL sib = new StdInfoBLL(); List <StdInfoModel> lSib = sib.GetAllInformation(); SuperAdminInfoBLL saib = new SuperAdminInfoBLL(); List <SuperAdminInfoModel> lSaim = saib.GetSuperAdminInfo(); bool isSAdminExit = false; if (tb_StdNum.Text != "" && tb_SAdminName.Text != "" && tb_SPassword.Text != "")//信息完整 { for (int i = 0; i < lSaim.Count; i++) { if (tb_SAdminName.Text == lSaim[i].SAdminName && tb_SPassword.Text == lSaim[i].SPassword) { isSAdminExit = true; } } if (isSAdminExit) { sib.DeleteInfoByNum(tb_StdNum.Text); Response.Write(@"<script>alert('删除成功');</script>"); Response.Write(@"<script>location.href='Handler_ShowStdInfo.ashx';</script>"); } else { Response.Write(@"<script>alert('超级管理员用户或密码错误');</script>"); } } else//信息不完整 { Response.Write(@"<script>alert('请输入信息');</script>"); } }
protected void btn_Retrieve_Click(object sender, EventArgs e) { StdInfoBLL sib = new StdInfoBLL(); List <StdInfoModel> lSim = sib.GetAllInformation(); bool isStdExit = false; if (tb_StdNum.Text != "") //信息完整 { for (int i = 0; i < lSim.Count; i++) { if (tb_StdNum.Text == lSim[i].StdNum) { isStdExit = true; } } if (isStdExit) //学生存在 { StdInfoModel sim = sib.GetInfoByNum(tb_StdNum.Text); string result = $"{sim.StdNum}/{sim.Name}/{sim.Sex}/{sim.Nation}/{sim.E_Mail}/{sim.PhoneNumber}"; listBox_Result.Items.Add(result); tb_StdNum.Text = ""; } else //学生不存在 { Response.Write(@"<script>alert('查无此人');</script>"); } } else //信息不完整 { Response.Write(@"<script>alert('请输入学号');</script>"); } }