Ejemplo n.º 1
0
        //显示全部信息
        private void ShowAll()
        {
            SourceData.Clear();
            List <StuInfo> stus = serverCatch.queryAllStu();

            if (stus == null || stus.Count <= 0)
            {
                return;
            }
            foreach (StuInfo stu in stus)
            {
                SourceData.Add(stu.getsno(), stu.getsname(), stu.getssex(), stu.getsclass());
            }
        }
Ejemplo n.º 2
0
        //查询
        private void search()
        {
            List <StuInfo> sList = serverCatch.Search(ComboSearch.SelectedIndex, TextSearch.Text);

            if (sList == null || sList.Count <= 0)
            {
                ShowAll();
                MessageBox.Show("没有符合该信息的学生!", "查询失败!");
                return;
            }

            SourceData.Clear();

            int i = 0;

            foreach (StuInfo Info in sList)
            {
                SourceData.Add(Info.getsno(), Info.getsname(), Info.getssex(), Info.getsclass());
                StuList.Rows[i++].Cells[ComboSearch.SelectedIndex].Selected = true;
            }
            StuList.Rows[0].Cells[0].Selected = false;

            MessageBox.Show("查找完成");
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Очистить SourceData
 /// </summary>
 public void ClearSourceData()
 {
     SourceData.Clear(); this.vScrollBar.Maximum = this.SourceData.Count - 1; this.vScrollBar.Value = this.vScrollBar.Maximum; this.InvalidateVisual();
 }