zoukankan      html  css  js  c++  java
  • 【毕设】班级管理系统——易搜

    【模块介绍】

    在易搜中,系统提供了4中搜索方式,按学号搜索,按姓氏搜索,按性别搜索和按全部搜索。若搜索结果单一,系统会跳转到InformationFrm窗体;若搜索结果若干,则系统会跳转到MulInformationFrm窗体。易搜界面设计如下图5.7所示,搜索结果界面如图5.8(a)和图5.8(b)所示。

    【界面设计】

    【部分代码(这里以按姓氏搜索为例,代码有删改)】

    if (txtSearch.Text == "" && cboSearch.SelectedIndex != 3)
    {  MainFrm.str = "请填写需要搜索的信息";}
    else
    {   string sqlSurnameExist = String.Format("select count(*) from UserInfo where Uname like '{0}'", txtSearch.Text+'%');//姓氏存在性检测
        if(cboSearch.SelectedIndex==2)
       {  
         SqlCommand comSurname = new SqlCommand(sqlSurnameExist, conCon);
            int Surname = (int)comSurname.ExecuteScalar();//记录查询结果
            if (Surname > 0)//若搜索结果存在
            {
                if (Surname > 1)//若搜索结果多个,则显示全部信息,调用窗体MulInformationFrm
                {  bool fo = true;
                  //判断MulInformationFrm是否已经打开
                  foreach (Form f in MainFrm.FormList)              
      {   if (f is MulInformationFrm)
                     {  f.Show();//显示MulInformationFrm窗体
                        fo = false;
                     }}
                  if (fo)//如果MulInformationFrm未打开则打开
                  {
                       MulInformationFrm tp = new MulInformationFrm();
                       tp.MdiParent = this.MdiParent;
       //将信息传递给MulInformationFrm窗体下的的Search字段 
                       MulInformationFrm.Search = txtSearch.Text + '%';
                       MainFrm.str = "显示全部搜索信息";
                       MainFrm.FormList.Add(temp);
                       this.Close();//关闭现有窗体
                       tp.Show();//打开MulInformationFrm窗体
                  }else
                  {MainFrm.str = "您已打开此页面";}
              }
              else  //若搜索结果只有一个,则显示详细信息,调用窗体InformationFrm
              {    bool fom = true;
       //判断InformationFrm窗体是否打开
                   foreach (Form f in MainFrm.FormList)               
      {
                      if (f is InformationFrm)//如果已打开InformationFrm窗体
                      {
                          f.Show();//显示InformationFrm窗体
                          fo = false;
                      }
                  }
                  if (fom)
                  {
                      InformationFrm tp = new InformationFrm();
                      tp.MdiParent = this.MdiParent;
                      MainFrm.str = "搜寻结果只有一个";
      //将信息传递给InformationFrm窗体下的的typeString字段
                      InformationFrm.typeString = txtSearch.Text+'%';
                      MainFrm.FormList.Add(temp);
                      this.Close();//关闭现有窗体
                      tp.Show();//打开InformationFrm窗体
                  }
                  else
                  {  MainFrm.str = "您已打开此页面";}
               }
            }
            else//若搜索结果没有,则状态栏显示该姓氏不存在
           {    txtSearch.Text = "";
                txtSearch.Focus();
                MainFrm.str = "该姓氏不存在!";
           }}
  • 相关阅读:
    CentOS7- 配置阿里镜像源
    MySQL学习笔记
    OSI&TCP/IP模型
    加密算法学习
    golang学习笔记
    Redis学习总结整理
    TCP
    HTTP/HTTPS
    HTTP2
    MVCC
  • 原文地址:https://www.cnblogs.com/xuhang/p/3782579.html
Copyright © 2011-2022 走看看