Ejemplo n.º 1
0
        private void button3_Click(object sender, EventArgs e)
        {
            //实例化创建BLL层的工厂
            FactoryBLL factBLL = new FactoryBLL();
            //调用上机记录业务接口和创建BLL层工厂,实例化BLL层类
            LineStudentIBLL LinStudentIBLL = (LineStudentIBLL)factBLL.CreateUser("LineStudentBLL");
            //获取上机记录
            string    StrMsg           = "";//接受返信息
            DataTable LineStudentTable = LinStudentIBLL.SelectLineStudent(txtcardno.Text, this, ref StrMsg);

            #region 显示数据到DataGridView上
            //防止多次点击查询按钮显示相同内容
            if (txtcardno.Text == oldCardno)
            {
                MessageBox.Show("已经没有可查询信息!");
            }
            else
            {
                //创建表和填充数据
                for (int i = 0; i <= LineStudentTable.Rows.Count - 1; i++)        //获取行数
                {
                    int index = this.dataGridView2.Rows.Add();                    //添加一行
                    for (int j = 0; j <= LineStudentTable.Columns.Count - 1; j++) //获取列数
                    {
                        //添加数据
                        dataGridView2.Rows[index].Cells[j].Value = LineStudentTable.Rows[i][j].ToString();
                    }
                }
            }//end if
            //给oldCardno赋值
            oldCardno = txtcardno.Text;
            #endregion
            //提示,改变窗体标题栏内容
            this.Text = StrMsg;
        }
Ejemplo n.º 2
0
        private void LineStudent_Load_1(object sender, EventArgs e)
        {
            //实例化创建BLL层的工厂
            FactoryBLL factBLL = new FactoryBLL();
            //调用上机记录业务接口和创建BLL层工厂,实例化BLL层类
            LineStudentIBLL LinStudentIBLL = (LineStudentIBLL)factBLL.CreateUser("LineStudentBLL");
            //获取上机记录
            string    StrMsg           = "";//接受返信息
            DataTable LineStudentTable = LinStudentIBLL.SelectLineStudent(UserLevel.UserIdall.ToString(), this, ref StrMsg);

            #region 显示数据到DataGridView上
            #region 创建表
            //创建表
            //for (int i = 0; i <= LineStudentTable.Rows.Count - 1; i++)// 增加行数
            //{
            //    int index = this.dataGridView1.Rows.Add();
            //    for (int j = 0; j <= LineStudentTable.Columns.Count - 1; j++)// 增加列数
            //    {
            //        dataGridView1.Rows[index].Cells[j].Value = "";
            //    }

            //}
            #endregion
            //创建表和填充数据
            for (int i = 0; i <= LineStudentTable.Rows.Count - 1; i++)        //获取行数
            {
                int index = this.dataGridView2.Rows.Add();                    //添加一行
                for (int j = 0; j <= LineStudentTable.Columns.Count - 1; j++) //获取列数
                {
                    //添加数据
                    dataGridView2.Rows[index].Cells[j].Value = LineStudentTable.Rows[i][j].ToString();
                }
            }
            #endregion
            //提示,改变窗体标题栏内容
            this.Text = StrMsg;
        }