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); }
public TrainPlanCourse(int?trainPlanID, int?trainCourseID, decimal?process, int?statusID, string statusName, string memo, TrainCourse trainCourseList) { _trainPlanID = trainPlanID ?? _trainPlanID; _trainCourseID = trainCourseID ?? _trainCourseID; _process = process ?? _process; _statusID = statusID ?? _statusID; _statusName = statusName; _memo = memo; _trainCourseList = trainCourseList; }
private void GetCourseInfo(string strID) { TrainCourseBLL trainCourseBLL = new TrainCourseBLL(); RailExam.Model.TrainCourse trainCourse = new RailExam.Model.TrainCourse(); trainCourse = trainCourseBLL.GetTrainCourseInfo(Convert.ToInt32(strID)); txtCourseName.Text = trainCourse.CourseName; txtDescription.Text = trainCourse.Description; txtStudyDemand.Text = trainCourse.StudyDemand; txtHour.Text = trainCourse.StudyHours.ToString(); chkExam.Checked = trainCourse.HasExam; txtExam.Text = trainCourse.ExamForm; ddlCourse.SelectedValue = trainCourse.RequireCourseID.ToString(); txtMemo.Text = trainCourse.Memo; ViewState["CourseNo"] = trainCourse.CourseNo; }
protected void tvTrainCourseMoveCallBack_Callback(object sender, CallBackEventArgs e) { TrainCourseBLL trainCourseBLL = new TrainCourseBLL(); RailExam.Model.TrainCourse trainCourse = trainCourseBLL.GetTrainCourseInfo(int.Parse(e.Parameters[0])); if (trainCourse.CourseNo != 1 && e.Parameters[1] == "CanMoveUp") { hfCanMove.Value = "true"; hfCanMove.RenderControl(e.Output); } else if (trainCourse.CourseNo != Grid1.Items.Count && e.Parameters[1] == "CanMoveDown") { hfCanMove.Value = "true"; hfCanMove.RenderControl(e.Output); } }
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); } }