Beispiel #1
0
        public bool CancelSel(SelCourseModel objSelCourseModel)
        {
            //SelCourseDAL objSelCourseDALClass = new SelCourseDAL();

            ISelCourseDAL objSelCourseDALClass = new SelCourseDAL();
            return (objSelCourseDALClass.CancelSel(objSelCourseModel));
        }
Beispiel #2
0
        //返回查找结果
        public DataTable CheckStuSeletCourseResult(SelCourseModel objSelCourseModel)
        {
            SelCourseDAL objSelCourseDALClass = new SelCourseDAL();

               // ISelCourseDAL objSelCourseDALClass = new SelCourseDAL();

            return (objSelCourseDALClass.CheckStuSelectCourseResult(objSelCourseModel));
        }
Beispiel #3
0
        public DataTable CheckStuSelectCourseResult(SelCourseModel objSelCourseModel)
        {
            string SqlString = "select Student.StuNum AS 学号,Class.ClaName AS 班级,StuName AS 姓名,Course.CourseName AS 所选课程,SelCourse.CourseNum AS 课程编号,Credit AS 学分 from Student join Class on Student.ClaNum=Class.ClaNum join SelCourse on Student.StuNum=SelCourse.StuNum join Course on SelCourse.CourseNum=Course.CourseNum Where SelCourse.StuNum=@StuNum";

                SqlParameter[] parms ={
                                        new SqlParameter("@StuNum",objSelCourseModel.StuNum)
                                      };

                DataBaseOperateClass2 objDataBase = new DataBaseOperateClass2();

                DataTable objDataTable;

                return objDataTable = objDataBase.ShowTable(SqlString, parms);
        }
Beispiel #4
0
        public bool CancelSel(SelCourseModel objSelCourseClass)
        {
            string SqlString = "delete from SelCourse where StuNum=@StuNum AND CourseNum=@CourseNum";
              SqlParameter[] parms ={
                                        new SqlParameter("@StuNum",objSelCourseClass.StuNum),
                                        new SqlParameter("@CourseNum",objSelCourseClass.CourseNum)
                                     };
                        DataBaseOperaClass objDataBase = new DataBaseOperaClass();

                        if (objDataBase.GetExecute(SqlString,parms))
                            return (true);
                        else
                            return (false);
        }
Beispiel #5
0
        public bool InputScore(SelCourseModel objSelCourseModel)
        {
            string SqlString = "Update SelCourse Set Score=@Score where StuNum=@StuNum AND CourseNum=@CourseNum";
                      SqlParameter[] parms ={
                                                new SqlParameter("@Score",objSelCourseModel.Score),
                                                new SqlParameter("@StuNum",objSelCourseModel.StuNum),
                                                new SqlParameter("@CourseNum",objSelCourseModel.CourseNum)
                                             };
                     DataBaseOperaClass objDataBase = new DataBaseOperaClass();

                        if (objDataBase.GetExecute(SqlString,parms))
                            return (true);
                        else
                            return (false);
        }
Beispiel #6
0
        public bool CheckSeledCourseStu(SelCourseModel objSelCourseModel)
        {
            string SqlString = "Select * From V_SelCourse Where 学号=@StuNum AND 所选课程=@CourseName";

                SqlParameter[] parms ={
                                        new SqlParameter("@StuNum",objSelCourseModel.StuNum),
                                        new SqlParameter("@CourseName",objSelCourseModel.CourseName)
                                       };

                DataBaseOperateClass2 objDataBase = new DataBaseOperateClass2();

                if (objDataBase.GetDataRow(SqlString,parms) != null)
                    return (true);
                else
                    return (false);
        }
Beispiel #7
0
        //删除:
        private void btnDel_Click(object sender, EventArgs e)
        {
            #region 使用SQL语句删除,已注释,改到三层架构的数据访问层了。
            //int CurrentRow = dgvSelCourse.CurrentRow.Index;
            //string StuNum = dgvSelCourse[0, CurrentRow].Value.ToString();

            //string SqlString = "delete from SelCourse where StuNum='" + StuNum + "'";

            ////objSqlCommand.CommandText = SqlString;
            ////objSqlCommand.Connection = objConn;

            //DataBaseOperaClass objDataBase = new DataBaseOperaClass();

            //if (objDataBase.GetExecute(SqlString) == true)
            //{ MessageBox.Show("退选成功!"); }
            //else
            //{ MessageBox.Show("退选失败!"); }
            #endregion

            #region  使用实体类在各层传递数据
            if (cbxStuNum.Text == "")
            {
                MessageBox.Show("学号不能为空!\n 请重新输入!");
            }
            else
            {

                SelCourseBLL objSelCourseBLLClass = new SelCourseBLL();
                SelCourseModel objSelCourseModel = new SelCourseModel();

                objSelCourseModel.StuNum = cbxStuNum.Text;

                if (objSelCourseBLLClass.CancelSel(objSelCourseModel) == true)
                {
                    MessageBox.Show("删除成功!!");
                }
                else
                {
                    MessageBox.Show("删除失败!");
                }
            }

            #endregion

            RefreshTable();
        }
Beispiel #8
0
        public bool SelOk(SelCourseModel objSelCourseModel)
        {
            string SqlString = "Insert into SelCourse(StuNum,CourseNum) Values(@StuNum ,@CourseNum)";
                DataBaseOperaClass objDataBase = new DataBaseOperaClass();

                SqlParameter[] parms = {
                                                new SqlParameter("@StuNum", objSelCourseModel.StuNum),
                                                new SqlParameter("@CourseNum",objSelCourseModel.CourseNum),
                                                //new SqlParameter("@Score",objSelCourseModel.Score)
                                        };

                if (objDataBase.GetExecute(SqlString, parms))
                {
                    return (true);
                }
                else
                {
                    return (false);
                }
        }
Beispiel #9
0
        private void SelCourse_Load(object sender, EventArgs e)
        {
            //将“成绩查询”窗体中的RefreshDataGridView()注册为事件处理程序。
            foreach (Form objForm in this.MdiParent.MdiChildren)
            {
                if (objForm is StuScoreSearch)
                {
                    StuScoreSearch objStuScoreSearch = (StuScoreSearch)objForm;
                    this.EventRefersh += new DelegateRefresh(objStuScoreSearch.RefreshDataGridView);
                }
            }

            //RefreshTable();
                ShowComboBox();

                SqlRead = objLoginUIBLL.LoginUserRead();
                if (SqlRead.Read())
                {
                    objLoginUserModel.UserId = SqlRead["UserId"].ToString();
                }

                SelCourseBLL objSelCourseBLLClass = new SelCourseBLL();

                SelCourseModel objSelCourseModel = new SelCourseModel();

                //objSelCourseModel.StuNum = txtStuNum.Text;

                //★★用当前登录的用户编号作为选课的学号!
                objSelCourseModel.StuNum = objLoginUserModel.UserId;

                //txtStuNum.Text = objLoginUserModel.UserId;
                txtStuNum.Text = objLoginUserModel.UserId;

                ShowCurrentLoginUserInfo();
        }
Beispiel #10
0
 //检查是否已经选课了:
 public bool CheckSelect(SelCourseModel objSelCourseModel)
 {
     SelCourseDAL objSelCourseDAL = new SelCourseDAL();
             return objSelCourseDAL.CheckSeledCourseStu(objSelCourseModel);
 }
Beispiel #11
0
        public bool Update(SelCourseModel objSelCourseClass)
        {
            string SqlString  = "Update V_SelCourse set 课程编号='" + objSelCourseClass.CourseNum + "'";
                           SqlString +=" Where 学号=@StuNum AND 所选课程=@CourseName";

                    SqlParameter[] parms ={
                                            new SqlParameter("@StuNum",objSelCourseClass.StuNum),
                                            new SqlParameter("@CourseName",objSelCourseClass.CourseName)
                                          };

                    DataBaseOperaClass objDataBase = new DataBaseOperaClass();

                    if (objDataBase.GetExecute(SqlString,parms))
                        return (true);
                    else
                        return (false);
        }
Beispiel #12
0
        //添加:(成绩录入)
        private void btnInput_Click(object sender, EventArgs e)
        {
            #region 使用实体类在各层传递数据:

            #region 成绩录入
                        if (cbxStuNum.Text == "")
                        {
                              MessageBox.Show("学号、课程编号、成绩都不能为空!\n 请重新输入!");

                        }
                        else
                        {
                            SelCourseBLL objSelCourseBLLClass = new SelCourseBLL();

                            SelCourseModel objSelCourseModel = new SelCourseModel();

                            objSelCourseModel.StuNum = cbxStuNum.Text;
                            objSelCourseModel.CourseNum = cbxCourseNum.Text;
                            objSelCourseModel.Score = cbxScore.Text;

                            if (objSelCourseBLLClass.InputScore(objSelCourseModel) == true) //由于与修改的逻辑相同,所以这里与修改所调用的方法是相同的
                            {
                                MessageBox.Show("成绩录入成功!");
                            }
                            else
                                MessageBox.Show("成绩录入失败!\n 该学生未进行选课");
                        }

                  #endregion

            #endregion

            RefreshTable();
        }
Beispiel #13
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            #region 已经注释
            //if (cbxStuNum.Text == "")
            //{
            //    MessageBox.Show("学号不能为空!\n 请重新输入!");
            //}
            //else
            //{
            //    SelCourseBLL objSelCourseBLLClass = new SelCourseBLL();

            //    SelCourseModel objSelCourseModel = new SelCourseModel();

            //    objSelCourseModel.StuNum = cbxStuNum.Text;          //修改条件
            //    objSelCourseModel.CourseName = cbxCourseName.Text;  //修改条件

            //    objSelCourseModel.CourseNum = cbxCourseNum.Text;    //目标内容
            //    objSelCourseModel.Score = cbxScore.Text;            //目标内容
            #endregion

            if (cbxStuNum.Text == "")
             {
                  MessageBox.Show("学号、课程编号、成绩都不能为空!\n 请重新输入!");

             }
            else
            {
                SelCourseBLL objSelCourseBLLClass = new SelCourseBLL();

                SelCourseModel objSelCourseModel = new SelCourseModel();

                objSelCourseModel.StuNum = cbxStuNum.Text;
                objSelCourseModel.CourseNum = cbxCourseNum.Text;
                objSelCourseModel.Score = cbxScore.Text;

              // if (objSelCourseBLLClass.Update(objSelCourseModel) == true)
            if (objSelCourseBLLClass.InputScore(objSelCourseModel) == true)
                {
                    MessageBox.Show("修改成功!");
                }
                else
                    MessageBox.Show("修改失败!");
            }

            RefreshTable();
        }
Beispiel #14
0
        //调用实体类的构造函数显示编辑框内容
        private void btnShowInput_Click(object sender, EventArgs e)
        {
            #region 调用实体类的构造函数显示编辑框内容
            //调用系统默认的无参构造函数:
            //SelCourseClass objSelCourseClass = new SelCourseClass();

            //调用Model实体类的构造函数:
            SelCourseModel objSelCourseModel = new SelCourseModel(cbxStuNum.Text, cbxCourseNum.Text, cbxScore.Text);

            objSelCourseModel.StuNum = cbxStuNum.Text;
            objSelCourseModel.CourseName = cbxCourseName.Text;
            objSelCourseModel.CourseNum = cbxCourseNum.Text;
            objSelCourseModel.Score = cbxScore.Text;

            string OutString = "学号:" + objSelCourseModel.StuNum + "\n";
            OutString += "课程编号:" + objSelCourseModel.CourseNum + "\n";
            OutString += "课程名称:" + objSelCourseModel.CourseName + "\n";
            OutString += "科目成绩:" + objSelCourseModel.Score + "\n";

            MessageBox.Show(OutString, "成绩信息");
            #endregion
        }
Beispiel #15
0
        //查找
        private void btnSearch_Click(object sender, EventArgs e)
        {
            #region 按学号查找已经选课的学生
            //★★进行查找前,先清空表格内容:
            cbxCourseNum.Text = "";
            dgvSelCourse.DataSource = 0;

            SelCourseBLL objSelCourseBLLClass = new SelCourseBLL();
            SelCourseModel objSelCourseModel = new SelCourseModel();

            objSelCourseModel.StuNum = cbxStuNum.Text;
            objSelCourseModel.CourseName = cbxCourseName.Text;

            if (objSelCourseBLLClass.SearchSeledCourseStu(objSelCourseModel) == true)
            {
                MessageBox.Show("数据已找到!\n请查阅!!");
                dgvSelCourse.DataSource = objSelCourseBLLClass.CheckStuSeletCourseResult(objSelCourseModel);
            }

              //▲▲▲数据查找到后,怎样接收到数据表格中?★★要在逻辑层、数据访问层定义一个返回类型为:DataTable的方法吗?怎样定义?
            //已经定义了了返回类型为bool的方法。那么应该用方法重载实现么?上面这样写好不好?

            // dgvSelCourse.DataSource=objSelCourseBLLClass.SearchSeledCourseStu();
            else
            {
                MessageBox.Show("查找完毕,没有找到相关数据。\n请检查搜索条件!\n 该学生可能还没进行选课!");
            }
            #endregion
        }
Beispiel #16
0
 //成绩录入:
 public bool InputScore(SelCourseModel objSelCourseModel)
 {
     SelCourseDAL objSelCourseDAL = new SelCourseDAL();
     return (objSelCourseDAL.InputScore(objSelCourseModel));
 }
Beispiel #17
0
 //SelCourseModel objSelCourseModel = new SelCourseModel();
 public bool SelOk(SelCourseModel objSelCourseClass)
 {
     SelCourseDAL objSelCourseDALClass = new SelCourseDAL();
             //SelCourseModel objSelCourseModel=new SelCourseModel();
             //if (objSelCourseDALClass.SearchSeledCourseStu(objSelCourseClass) == true)
             //{
             //    MessageBox.Show("已经选了该课程,不能重复选择!\n请检查后重新选择", "温馨提醒", MessageBoxButtons.OK, MessageBoxIcon.Error);
             //    return (false);
             //}
             //else
             //{
                 return (objSelCourseDALClass.SelOk(objSelCourseClass));
             //}
 }
Beispiel #18
0
 //单击网格,显示结果在文本框:
 private void dgvSelCourse_Click(object sender, EventArgs e)
 {
     SelCourseModel objSelCourseClass = new SelCourseModel();
     int CurrentRow = dgvSelCourse.CurrentRow.Index;
     cbxCourseNum.Text = dgvSelCourse[4, CurrentRow].Value.ToString();    //这个作为修改课程的条件
 }
Beispiel #19
0
        //修改
        private void btnUpdate_Click_1(object sender, EventArgs e)
        {
            #region 使用数组作为参数,已注释。
            //private void btnUpdate_Click_1(object sender, EventArgs e)
            //{
            //    #region 使用SQL语句修改,已注释,改到三层架构的数据访问层了。
            //    //int CurrentRow = dgvSelCourse.CurrentRow.Index;
            //    //string StuNum = dgvSelCourse[0, CurrentRow].Value.ToString();

            //    //string SqlString = "Update SelCourse Set StuNum='" + txtStuNum.Text + "',CourseNum='" + cbxCourseNum.Text + "',Score='" + cbxScore.Text + "' where StuNum='" + StuNum + "'";
            //    ////objSqlCommand.CommandText = SqlString;
            //    ////objSqlCommand.Connection = objConn;

            //    //DataBaseOperaClass objDataBase = new DataBaseOperaClass();

            //    //if (objDataBase.GetExecute(SqlString) == true)
            //    //{ MessageBox.Show("修改成功!"); }
            //    //else
            //    //{ MessageBox.Show("修改失败!"); }
            //    #endregion

            //    if (txtStuNum.Text == "")
            //    {
            //        MessageBox.Show("学号不能为空!\n 请重新输入!");
            //    }
            //    else
            //    {
            //        SelCourseBLLClass objSelCourseBLLClass = new SelCourseBLLClass();

            //        #region 已注释掉,改为使用数组作为参数
            //        //if (objSelCourseBLLClass.Update(txtStuNum.Text, cbxScore.Text, cbxCourseNum.Text) == true)
            //        #endregion

            //        string[] SelCourse = new string[3];
            //        SelCourse[0] = txtStuNum.Text;
            //        SelCourse[1] = cbxCourseNum.Text;
            //        SelCourse[2] = cbxScore.Text;

            //        if (objSelCourseBLLClass.Update(SelCourse) == true)
            //        {
            //            MessageBox.Show("修改成功!");
            //        }
            //        else
            //        { MessageBox.Show("修改失败!"); }
            //    }

            //    RefreshTable();
            //}
            #endregion

            #region 使用实体类在各层传递数据
            //if (txtStuNum.Text == "")
            if(txtStuNum.Text=="")
            {
                MessageBox.Show("学号不能为空!\n 请重新输入!");
            }
            else
            {
                SelCourseBLL objSelCourseBLLClass = new SelCourseBLL();
                SelCourseModel objSelCourseClass = new SelCourseModel();

                //objSelCourseClass.StuNum = txtStuNum.Text;
                objSelCourseClass.StuNum = txtStuNum.Text;              //修改条件,必须要再加一个条件,否则,改一个它就会全部被修改
                objSelCourseClass.CourseNum = cbxCourseNum.Text;

             //objSelCourseClass.CourseName = cbxCourseName.Text;       //这个也要作为修改条件,但由于点击表格后,会发生变化,造成可能修改失败,要改进!  已解决,见下一行:
            //这个【objSelCourseClass.CourseName】作为修改条件,不能因点击网格了而发生变化!所以文本内容不再赋值给实体类了,由点击网络后赋值给实体类!

                //objSelCourseClass.Score = cbxScore.Text;

                int CurrentRow = dgvSelCourse.CurrentRow.Index;

                objSelCourseClass.CourseName = dgvSelCourse[3, CurrentRow].Value.ToString();    //这个作为修改课程的条件

                if (objSelCourseBLLClass.Update(objSelCourseClass) == true)
                {
                    MessageBox.Show("修改成功!");
                }
                else
                    MessageBox.Show("修改失败!");
            }
            #endregion

            ShowCurrentLoginUserInfo();

            //触发事件,即执行“显示成绩窗体中”的RefreshDataGridView()的代码
            #region 触发事件,即执行“显示成绩窗体中”的RefreshDataGridView()的代码
            if (this.EventRefersh == null)
            {
                foreach (Form objForm in this.MdiParent.MdiChildren)
                {
                    if (objForm is StuScoreSearch)
                    {
                        StuScoreSearch objStuScoreSearch = (StuScoreSearch)objForm;
                        this.EventRefersh += new DelegateRefresh(objStuScoreSearch.RefreshDataGridView);
                    }
                }
            }
            if (this.EventRefersh != null)
            {
                this.EventRefersh(this, null);
            }
            #endregion
        }
Beispiel #20
0
        //读取model的字段,属性,把输入的文本框内容显示在消息框中:
        private void btnShowInput_Click(object sender, EventArgs e)
        {
            #region 调用实体类的构造函数显示编辑框内容
            SelCourseModel objSelCourseClass = new SelCourseModel();

            //objSelCourseClass.StuNum = txtStuNum.Text;
            objSelCourseClass.StuNum = (string)txtStuNum.Text;
            objSelCourseClass.CourseNum = cbxCourseNum.Text;
            objSelCourseClass.CourseName = cbxCourseName.Text;
            // objSelCourseClass.Score = cbxScore.Text;

            string OutString = "学号:" + objSelCourseClass.StuNum + "\n";
            OutString += "课程编号:" + objSelCourseClass.CourseNum + "\n";
            //OutString += "科目成绩:" + objSelCourseClass.Score + "\n";
            OutString += "课程名称:" + objSelCourseClass.CourseName + "\n";

            MessageBox.Show(OutString, "选课信息");
            #endregion
        }
Beispiel #21
0
        //添加:
        private void btnSelOk_Click(object sender, EventArgs e)
        {
            #region 使用数组作为参数,已注释。
            //private void btnSelOk_Click(object sender, EventArgs e)
            //{
            //    #region 使用Sql语句添加,已注释,改到三层架构的数据访问层了。
            //    //string SqlString = "Insert into SelCourse(StuNum,CourseNum,Score) Values('" + txtStuNum.Text + "','" + cbxCourseNum.Text + "','" + cbxScore.Text + "')";

            //    ////objSqlCommand.CommandText = Sqlstring;
            //    ////objSqlCommand.Connection = objConn;

            //    //DataBaseOperaClass objDataBase = new DataBaseOperaClass();

            //    //if (objDataBase.GetExecute(SqlString) == true)
            //    //{ MessageBox.Show("选课成功!"); }
            //    //else
            //    //{ MessageBox.Show("选课失败!"); }
            //    #endregion

            //    if (txtStuNum.Text == "")
            //    {
            //        MessageBox.Show("学号不能为空!\n 请重新输入!");
            //    }
            //    else
            //    {
            //        SelCourseBLLClass objSelCourseBLLClass = new SelCourseBLLClass();
            //        #region 已注释掉,改为使用数组作为参数
            //      //  if (objSelCourseBLLClass.SelOk(txtStuNum.Text, cbxCourseNum.Text, cbxScore.Text) == true)
            //        #endregion
            //        string[] SelCourse=new string[3];
            //        SelCourse[0]=txtStuNum.Text;
            //        SelCourse[1]=cbxCourseNum.Text;
            //        SelCourse[2]=cbxScore.Text;

            //        if(objSelCourseBLLClass.SelOk(SelCourse)==true)
            //        {
            //            MessageBox.Show("选课成功!");
            //        }
            //        else
            //            MessageBox.Show("选课失败!");
            //    }

            //    RefreshTable();
            //}
            #endregion

            #region 使用实体类在各层传递数据:
            //if (txtStuNum.Text == "")
            if (txtStuNum.Text == "" || cbxCourseNum.Text == "")
            {
                MessageBox.Show("学号、课程号都不能为空!\n 请重新输入!");
            }
            else
            {
                SqlRead = objLoginUIBLL.LoginUserRead();
                if (SqlRead.Read())
                {
                    objLoginUserModel.UserId = SqlRead["UserId"].ToString();
                }

                SelCourseBLL objSelCourseBLLClass = new SelCourseBLL();
                SelCourseModel objSelCourseModel = new SelCourseModel();

                //objSelCourseModel.StuNum = txtStuNum.Text;

                //★★用当前登录的用户编号作为选课的学号!
                objSelCourseModel.StuNum = objLoginUserModel.UserId;

                objSelCourseModel.CourseNum = cbxCourseNum.Text;
                objSelCourseModel.CourseName = cbxCourseName.Text;
                //int CurrentRow = dgvSelCourse.CurrentRow.Index;
                //objSelCourseModel.CourseName = dgvSelCourse[3, CurrentRow].Value.ToString();    //这个作为修改课程的条件

                if (objSelCourseBLLClass.SelOk(objSelCourseModel) == true)
                {
                    MessageBox.Show("选课成功!");
                }
                else
                    MessageBox.Show("选课失败!");
                ShowCurrentLoginUserInfo();
            }
            #endregion

            //触发事件,即执行“显示成绩窗体中”的RefreshDataGridView()的代码
            #region 触发事件,即执行“显示成绩窗体中”的RefreshDataGridView()的代码
            if (this.EventRefersh == null)
            {
                foreach (Form objForm in this.MdiParent.MdiChildren)
                {
                    if (objForm is StuScoreSearch)
                    {
                        StuScoreSearch objStuScoreSearch = (StuScoreSearch)objForm;
                        this.EventRefersh += new DelegateRefresh(objStuScoreSearch.RefreshDataGridView);
                    }
                }
            }
            if (this.EventRefersh != null)
            {
                this.EventRefersh(this, null);
            }
            #endregion
        }
Beispiel #22
0
        //查找:
        private void btnSearch_Click(object sender, EventArgs e)
        {
            #region 按学号查找已经选课的学生的选课信息:
            //★★进行查找前,先清空表格内容:
            cbxCourseNum.Text = "";
            dgvSelCourse.DataSource = 0;

            SelCourseBLL objSelCourseBLLClass = new SelCourseBLL();
            SelCourseModel objSelCourseModel = new SelCourseModel();

            objSelCourseModel.StuNum = txtStuNum.Text;

            dgvSelCourse.DataSource = objSelCourseBLLClass.CheckStuSeletCourseResult(objSelCourseModel);

            #endregion
        }
Beispiel #23
0
        //刷新网格:★改为按当前登录用户来显示选课信息:
        private void ShowCurrentLoginUserInfo()
        {
            #region 使用SQL语句刷新表格的方法,已注释。改到三层架构的数据访问层了。
            //    string SqlString = "select Student.StuNum AS 学号,Class.ClaName AS 班级,StuName AS 姓名,Course.CourseName AS 所选课程,SelCourse.CourseNum AS 课程编号,Credit AS 学分,Score AS 成绩 from Student join Class on Student.ClaNum=Class.ClaNum join SelCourse on Student.StuNum=SelCourse.StuNum join Course on SelCourse.CourseNum=Course.CourseNum";

            //    DataBaseOperaClass objDataBase = new DataBaseOperaClass();
            //    dgvSelCourse.DataSource = objDataBase.ShowTable(SqlString);
            //

            #endregion

            //SelCourseBLL objSelCourseBLL = new SelCourseBLL();
            //dgvSelCourse.DataSource = objSelCourseBLL.ShowSelCourse();

            #region 按学号查找已经选课的学生的选课信息:
            //★★进行查找前,先清空表格内容:
            cbxCourseNum.Text = "";
            dgvSelCourse.DataSource = 0;

            SelCourseBLL objSelCourseBLLClass = new SelCourseBLL();
            SelCourseModel objSelCourseModel = new SelCourseModel();

            objSelCourseModel.StuNum = txtStuNum.Text;

            dgvSelCourse.DataSource = objSelCourseBLLClass.CheckStuSeletCourseResult(objSelCourseModel);

            #endregion
        }
Beispiel #24
0
        //删除:
        private void btnCancelSel_Click(object sender, EventArgs e)
        {
            strTrans ="更新时间"+DateTime.Now.ToString();

            #region 使用SQL语句删除,已注释,改到三层架构的数据访问层了。
            //    //int CurrentRow = dgvSelCourse.CurrentRow.Index;
            //    //string StuNum = dgvSelCourse[0, CurrentRow].Value.ToString();

            //    //string SqlString = "delete from SelCourse where StuNum='" + StuNum + "'";

            //    ////objSqlCommand.CommandText = SqlString;
            //    ////objSqlCommand.Connection = objConn;

            //    //DataBaseOperaClass objDataBase = new DataBaseOperaClass();

            //    //if (objDataBase.GetExecute(SqlString) == true)
            //    //{ MessageBox.Show("退选成功!"); }
            //    //else
            //    //{ MessageBox.Show("退选失败!"); }
            //    #endregion

            //    if (txtStuNum.Text == "")
            //    {
            //        MessageBox.Show("学号不能为空!\n 请重新输入!");
            //    }
            //    else
            //    {

            //        SelCourseBLLClass objSelCourseBLLClass = new SelCourseBLLClass();
            //        if (objSelCourseBLLClass.CancelSel(txtStuNum.Text) == true)
            //        {
            //            MessageBox.Show("已退选!");
            //        }
            //        else
            //        {
            //            MessageBox.Show("退选失败!");
            //        }
            //    }

            //    RefreshTable();
            //}
            #endregion

            #region 使用实体类在各层传递数据
            //if (txtStuNum.Text == "")
            if (txtStuNum.Text == "")
            {
                MessageBox.Show("学号不能为空!\n 请重新输入!");
            }
            else
            {
                SelCourseBLL objSelCourseBLLClass = new SelCourseBLL();
                SelCourseModel objSelCourseClass = new SelCourseModel();

                //objSelCourseClass.StuNum = txtStuNum.Text;
                objSelCourseClass.StuNum = txtStuNum.Text;
                objSelCourseClass.CourseNum = cbxCourseNum.Text;

                if (objSelCourseBLLClass.CancelSel(objSelCourseClass) == true)
                {
                    MessageBox.Show("已退选!");
                }
                else
                {
                    MessageBox.Show("退选失败!");
                }
            }
            #endregion

            ShowCurrentLoginUserInfo();

            //触发事件,即执行“显示成绩窗体中”的RefreshDataGridView()的代码
            #region 触发事件,即执行“显示成绩窗体中”的RefreshDataGridView()的代码
            if (this.EventRefersh == null)
            {
                foreach (Form objForm in this.MdiParent.MdiChildren)
                {
                    if (objForm is StuScoreSearch)
                    {
                        StuScoreSearch objStuScoreSearch = (StuScoreSearch)objForm;
                        this.EventRefersh += new DelegateRefresh(objStuScoreSearch.RefreshDataGridView);
                    }
                }
            }
            if (this.EventRefersh != null)
            {
                //e.Name = "test";
                this.EventRefersh(this, null);
            }
            #endregion
        }
Beispiel #25
0
 //查找方法:
 public bool SearchSeledCourseStu(SelCourseModel objSelCourseModel)
 {
     SelCourseDAL objSelCourseDALClass = new SelCourseDAL();
     return (objSelCourseDALClass.CheckSeledCourseStu(objSelCourseModel));
 }
Beispiel #26
0
 public bool Update(SelCourseModel objSelCourseClass)
 {
     //SelCourseDAL objSelCourseDALClass = new SelCourseDAL();
     SelCourseDAL objSelCourseDALClass = new SelCourseDAL();
     return (objSelCourseDALClass.Update(objSelCourseClass));
 }