Пример #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            TrainCourseBLL trainCourseBLL = new TrainCourseBLL();

            RailExam.Model.TrainCourse trainCourse = new RailExam.Model.TrainCourse();

            trainCourse.CourseName      = txtCourseName.Text;
            trainCourse.Description     = txtDescription.Text;
            trainCourse.StudyDemand     = txtStudyDemand.Text;
            trainCourse.StudyHours      = Convert.ToDecimal(txtHour.Text);
            trainCourse.HasExam         = chkExam.Checked;
            trainCourse.ExamForm        = txtExam.Text;
            trainCourse.RequireCourseID = Convert.ToInt32(ddlCourse.SelectedValue);
            trainCourse.Memo            = txtMemo.Text;

            string strID = Request.QueryString.Get("id");

            if (strID != null && strID != "")
            {
                trainCourse.TrainCourseID = Convert.ToInt32(strID);
                trainCourse.CourseNo      = Convert.ToInt32(ViewState["CourseNo"].ToString());

                trainCourseBLL.UpdateTrainCourse(trainCourse);
            }
            else
            {
                trainCourse.StandardID = 0;

                trainCourseBLL.AddTrainCourse(trainCourse);
            }

            Response.Redirect("TrainCourseBook.aspx?CourseID=" + trainCourse.TrainCourseID + "&CourseName=" + trainCourse.CourseName);
        }
Пример #2
0
        protected void tvTrainCourseChangeCallBack_Callback(object sender, CallBackEventArgs e)
        {
            TrainCourseBLL trainCourseBLL = new TrainCourseBLL();

            RailExam.Model.TrainCourse trainCourse = trainCourseBLL.GetTrainCourseInfo(int.Parse(e.Parameters[0]));

            string str = Request.QueryString.Get("id");

            if (e.Parameters[1] == "MoveUp")
            {
                IList <RailExam.Model.TrainCourse> trainCourseList =
                    trainCourseBLL.GetTrainCourseInfo(0, Convert.ToInt32(str), trainCourse.CourseNo - 1, "", "", "",
                                                      0, false, "", 0, "", 0, 200, "");

                foreach (RailExam.Model.TrainCourse course in trainCourseList)
                {
                    course.CourseNo++;
                    trainCourseBLL.UpdateTrainCourse(course);
                }

                trainCourse.CourseNo--;
                trainCourseBLL.UpdateTrainCourse(trainCourse);
            }
            if (e.Parameters[1] == "MoveDown")
            {
                IList <RailExam.Model.TrainCourse> trainCourseList =
                    trainCourseBLL.GetTrainCourseInfo(0, Convert.ToInt32(str), trainCourse.CourseNo + 1, "", "", "",
                                                      0, false, "", 0, "", 0, 200, "");

                foreach (RailExam.Model.TrainCourse course in trainCourseList)
                {
                    course.CourseNo--;
                    trainCourseBLL.UpdateTrainCourse(course);
                }

                trainCourse.CourseNo++;
                trainCourseBLL.UpdateTrainCourse(trainCourse);
            }
        }