Esempio n. 1
0
        private void btn_search_Click(object sender, EventArgs e)
        {
            if (cB_Search_Item.Text == string.Empty)
            {
                dGV_Search.DataSource = StudentInfoBLL.GetAllContactsInfo(StudentInfoBLL.Return_BasePath());
                InitHeadTitle();
            }
            else
            {
                if (textBox_Searchtext.Text != string.Empty)
                {
                    StudentInfo contactSearch = new StudentInfo();
                    switch (cB_Search_Item.SelectedIndex)
                    {
                    case 0: contactSearch.ContactId = Int32.Parse(textBox_Searchtext.Text); break;

                    case 1: contactSearch.Name = textBox_Searchtext.Text; break;
                    }
                    dGV_Search.DataSource = StudentInfoBLL.GetContactsList(contactSearch);
                    InitHeadTitle();
                }
                else
                {
                    MessageBox.Show("请输入要查询的" + cB_Search_Item.Text);
                }
            }
        }
Esempio n. 2
0
        public FormSearch()
        {
            InitializeComponent();
            dGV_Search.DataSource = StudentInfoBLL.GetAllContactsInfo(StudentInfoBLL.Return_BasePath());

            InitHeadTitle();
        }
Esempio n. 3
0
        void InitContacts()//初始化,获取文件信息
        {
            if (File.Exists(AppDomain.CurrentDomain.SetupInformation.ApplicationBase + @"//myContacts.xml"))
            {
                dataGridView1.DataSource = StudentInfoBLL.GetAllContactsInfo(StudentInfoBLL.Return_BasePath());
            }
            else
            {
                StudentInfoBLL.CreateXml(StudentInfoBLL.Return_BasePath());
                dataGridView1.DataSource = StudentInfoBLL.GetAllContactsInfo(StudentInfoBLL.Return_BasePath());
            }

            dataGridView1.Columns[0].HeaderText = "学生编号";
            dataGridView1.Columns[1].HeaderText = "学生姓名";
            dataGridView1.Columns[2].HeaderText = "学生性别";
            dataGridView1.Columns[3].HeaderText = "专业";
            dataGridView1.Columns[4].HeaderText = "学生年龄";
            dataGridView1.Columns[5].HeaderText = "出生日期";
            dataGridView1.Columns[6].HeaderText = "手机号码";
            dataGridView1.Columns[7].HeaderText = "电子邮箱";
            dataGridView1.Columns[8].HeaderText = "家庭住址";
        }