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>"); } }
private void btn_Create_Click(object sender, EventArgs e) { if (tb_StdNum.Text != "" && tb_Name.Text != "") { StdInfoBLL sib = new StdInfoBLL(); int result = sib.AddInfo(tb_StdNum.Text, tb_Name.Text, tb_Sex.Text, tb_Nation.Text, tb_Email.Text, tb_PN.Text); MessageBox.Show($"已添加{result}条数据"); } else { MessageBox.Show("请输入基本信息"); } }
private void tb_Update_Click(object sender, EventArgs e) { if (tb_Name.Text != "" && tb_PN.Text != "") { StdInfoBLL sib = new StdInfoBLL(); int result = sib.UpdatePN(tb_PN.Text, tb_Name.Text); MessageBox.Show($"已更新{result}条数据"); tb_Name.Text = tb_PN.Text = ""; } else { MessageBox.Show($"请输入姓名与新手机号"); } }
private void btn_Delete_Click(object sender, EventArgs e) { if (tb_StdNum.Text != "") { StdInfoBLL sib = new StdInfoBLL(); int result = sib.DeleteInfoByNum(tb_StdNum.Text); MessageBox.Show($"已删除{result}条数据"); tb_StdNum.Text = ""; } else { MessageBox.Show($"请输入学号"); } }
protected void btn_Create_Click(object sender, EventArgs e) { if (tb_StdNum.Text != "" && tb_Name.Text != "" && tb_Sex.Text != "" && tb_Nation.Text != "" && tb_Email.Text != "" && tb_PN.Text != "") { StdInfoBLL sib = new StdInfoBLL(); sib.AddInfo(tb_StdNum.Text, tb_Name.Text, tb_Sex.Text, tb_Nation.Text, tb_Email.Text, tb_PN.Text); Response.Write(@"<script>alert('成功创建1条学生信息');</script>"); Response.Write(@"<script>location.href='Handler_ShowStdInfo.ashx';</script>"); } else { Response.Write(@"请输入基本信息"); } }
private void btn_Retrieve_Click(object sender, EventArgs e) { if (tb_StdNum.Text != "") { StdInfoBLL sib = new StdInfoBLL(); 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 { MessageBox.Show("请输入学号"); } }
protected void btn_Update_Click(object sender, EventArgs e) { StdInfoBLL sib = new StdInfoBLL(); if (tb_StdNum.Text != "" && tb_OldName.Text != "" && tb_Name.Text != "" && tb_Email.Text != "" && tb_PN.Text != "") { if (sib.UpdateInfo(tb_OldName.Text, tb_StdNum.Text, tb_Name.Text, tb_Email.Text, tb_PN.Text) > 0) { Response.Write("<script>alert('更新成功');location.href='Handler_ShowStdInfo.ashx';</script>"); } } else { Response.Write("<script>alert('请将信息填写完整');</script>"); } }