Example #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            //根据输入插入
            if (Regex.IsMatch(txtCourseName.Text, @"^.{5,}$") == false)
            {
                return;
            }
            T_CourseDAL  dal = new T_CourseDAL();
            SqlParameter par = new SqlParameter("@courseName", SqlDbType.VarChar)
            {
                Value = txtCourseName.Text
            };

            try
            {
                var res = (int)dal.ExecuteScalar("InsertedCourse", CommandType.StoredProcedure, par);
                if (res == 1)
                {
                    FrmDialog.ShowDialog(this, "保存成功");
                }
                else
                {
                    throw new Exception();
                }
            }
            catch
            {
                FrmDialog.ShowDialog(this, "保存失败");
            }
        }
Example #2
0
        private List <T_InsertedFactionModel> LoadComCourseName(string stuid)
        {
            string       t_sql = "select ClassID from T_StudentBasicInformation where T_StudentBasicInformation.StuID = @stuid";
            SqlParameter pars  = new SqlParameter("@stuid", SqlDbType.Int)
            {
                Value = stu.StuID
            };
            T_CourseDAL dal     = new T_CourseDAL();
            int         classID = (int)dal.ExecuteScalar(t_sql, CommandType.Text, pars);

            return(dal.ExecuteT_ClassSetUpCourseTeach(classID));
        }
Example #3
0
        //删除客课程信息(即删除班级开课信息)
        private void OpenDeleteCourseDataInformation(object sender, EventArgs e)
        {
            //获取选择的dataGridView
            var rows = dataGridView1.SelectedRows;

            if (rows.Count == 0)
            {
                FrmDialog.ShowDialog(this, "请选择一行");
                return;
            }
            var row        = rows[0];
            var courseName = row.DataBoundItem as T_Course;

            if (courseName == null)
            {
                return;
            }
            string t_sql = "DeleClassSetUpCourse";

            SqlParameter[] par = new SqlParameter[] {
                new SqlParameter("@classid", SqlDbType.Int)
                {
                    Value = courseName.classID
                },
                new SqlParameter("@courseID", SqlDbType.Int)
                {
                    Value = courseName.CourseID
                }
            };
            T_CourseDAL dal = new T_CourseDAL();

            try
            {
                var res = (int)dal.ExecuteScalar(t_sql, CommandType.StoredProcedure, par);
                if (res == 1)
                {
                    FrmDialog.ShowDialog(this, "保存成功");
                }
                else
                {
                    throw new Exception();
                }
            }
            catch
            {
                FrmDialog.ShowDialog(this, "保存失败");
            }
            InitialCurIndexToLoades(modelID, curIndex);
        }
Example #4
0
        private void ucBtnExt1_BtnClick(object sender, EventArgs e)
        {
            if (Regex.IsMatch(txtFaction.Text, @"^^\d{1,3}\.*5{0,1}$") == false)
            {
                return;
            }
            else if (courseTeach == null)
            {
                return;
            }
            T_CourseDAL dal = new T_CourseDAL();

            SqlParameter[] pars = new SqlParameter[] {
                new SqlParameter("@courseID", SqlDbType.Int)
                {
                    Value = courseTeach.CourseID
                },
                new SqlParameter("@teachID", SqlDbType.Int)
                {
                    Value = courseTeach.TeacherID
                },
                new SqlParameter("@faction", SqlDbType.Float)
                {
                    Value = txtFaction.Text
                },
                new SqlParameter("@stuID", SqlDbType.Int)
                {
                    Value = stu.StuID
                }
            };
            try
            {
                var res = (int)dal.ExecuteScalar("InserintoCourseFaction", CommandType.StoredProcedure, pars);
                if (res == 1)
                {
                    FrmDialog.ShowDialog(this, "保存成功");
                }
                else
                {
                    throw new Exception();
                }
            }
            catch
            {
                FrmDialog.ShowDialog(this, "保存失败!请检查是否重复插入");
            }
        }
        private void ComCollege_SelectedIndexChanged(object sender, EventArgs e)
        {
            var college = comCollege.SelectedItem as T_College;
            var @class  = comCollege.SelectedItem as T_Class;
            var course  = comCollege.SelectedItem as T_Course;
            var teach   = comCollege.SelectedItem as T_Teach;

            if (college == null || @class == null || course == null || teach == null)
            {
                return;
            }
            string      t_sql = "InsertedClassSetUpCourse";
            T_CourseDAL dal   = new T_CourseDAL();

            SqlParameter[] pars = new SqlParameter[] {
                new SqlParameter()
                {
                    Value = @class.ClassID
                },
                new SqlParameter()
                {
                    Value = course.CourseID
                },
                new SqlParameter()
                {
                    Value = teach.TeachID
                }
            };
            try
            {
                var res = (int)dal.ExecuteScalar(t_sql, CommandType.StoredProcedure, pars);
                if (res == 1)
                {
                    FrmDialog.ShowDialog(this, "保存成功");
                }
                else
                {
                    throw new Exception();
                }
            }
            catch
            {
                FrmDialog.ShowDialog(this, "保存失败!请确保录入数据正确且不重复");
            }
        }
        private void ucBtnExt1_BtnClick(object sender, EventArgs e)
        {
            //保存
            if (teach == null)
            {
                return;
            }
            T_CourseDAL dal = new T_CourseDAL();

            SqlParameter[] pars = new SqlParameter[] {
                new SqlParameter("@classid", SqlDbType.Int)
                {
                    Value = course.classID
                },
                new SqlParameter("@courseid", SqlDbType.Int)
                {
                    Value = course.CourseID
                },
                new SqlParameter("@teachid", SqlDbType.Int)
                {
                    Value = teach.TeachID
                }
            };
            try {
                var res = (int)dal.ExecuteScalar("ModifyClassSetUpCourse", CommandType.StoredProcedure, pars);
                if (res == 1)
                {
                    FrmDialog.ShowDialog(this, "保存成功");
                    course.teachID   = teach.TeachID;
                    course.TeachName = teach.TeachName;
                }
                else
                {
                    throw new Exception();
                }
            }
            catch
            {
                FrmDialog.ShowDialog(this, "保存失败!");
            }
        }
Example #7
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            bool res = Regex.IsMatch(txtCourseName.Text, @"^.{5,}$");

            if (res == false)
            {
                return;
            }
            T_CourseDAL dal   = new T_CourseDAL();
            string      t_sql = "ModifyCourseName";

            SqlParameter[] pars = new SqlParameter[] {
                new SqlParameter("@courseID", SqlDbType.Int)
                {
                    Value = txtCourseID.Text
                },
                new SqlParameter("@courseName", SqlDbType.VarChar)
                {
                    Value = txtCourseName.Text
                }
            };
            try
            {
                int modifyRes = (int)dal.ExecuteScalar(t_sql, CommandType.StoredProcedure, pars);
                if (modifyRes == 1)
                {
                    FrmDialog.ShowDialog(this, "保存成功");
                    course.CourseName = txtCourseName.Text;
                }
                else
                {
                    throw new Exception();
                }
            }
            catch
            {
                FrmDialog.ShowDialog(this, "保存失败");
            }
        }
Example #8
0
        private void ucBtnExt1_BtnClick(object sender, EventArgs e)
        {
            if (Regex.IsMatch(txtFaction.Text, @"^^\d{1,3}\.*5{0,1}$") == false)
            {
                return;
            }
            T_CourseDAL dal = new T_CourseDAL();

            SqlParameter[] pars = new SqlParameter[] {
                new SqlParameter("@faction", SqlDbType.Int)
                {
                    Value = txtFaction.Text
                },
                new SqlParameter("@id", SqlDbType.Int)
                {
                    Value = faction.ID
                }
            };
            try
            {
                var res = (int)dal.ExecuteScalar("UpdateStudentFaction", CommandType.StoredProcedure, pars);
                if (res == 1)
                {
                    FrmDialog.ShowDialog(this, "保存成功");
                    faction.Faction = float.Parse(txtFaction.Text);
                }
                else
                {
                    throw new Exception();
                }
            }
            catch
            {
                FrmDialog.ShowDialog(this, "保存失败!请检查是否重复插入");
            }
        }