private void BindCourse(string strID) { TrainCourseBLL objTrainCourseBll = new TrainCourseBLL(); IList <RailExam.Model.TrainCourse> trainCourseList = objTrainCourseBll.GetTrainCommondCourseInfo(); ListItem item = new ListItem(); item.Value = "0"; item.Text = "--请选择--"; ddlCourse.Items.Add(item); if (trainCourseList.Count > 0) { foreach (RailExam.Model.TrainCourse trainCourse in trainCourseList) { if (trainCourse.StandardID == 0) { if (trainCourse.TrainCourseID.ToString() != strID) { ListItem items = new ListItem(); items.Value = trainCourse.TrainCourseID.ToString(); items.Text = trainCourse.CourseName; ddlCourse.Items.Add(items); } } } } }
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); }
private void BindCourse(string strID) { TrainCourseBLL objTrainCourseBll = new TrainCourseBLL(); IList <RailExam.Model.TrainCourse> objList = objTrainCourseBll.GetTrainCourseInfo(0, Convert.ToInt32(ViewState["StandardID"].ToString()), 0, "", "", "", 0, true, "", 0, "", 0, 200, "");; ListItem item = new ListItem(); item.Value = "0"; item.Text = "--请选择--"; ddlCourse.Items.Add(item); if (objList.Count > 0) { foreach (RailExam.Model.TrainCourse trainCourse in objList) { if (trainCourse.TrainCourseID.ToString() != strID) { ListItem items = new ListItem(); items.Value = trainCourse.TrainCourseID.ToString(); items.Text = trainCourse.CourseName; ddlCourse.Items.Add(items); } } } }
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); } }
private static void DeleteCourse(string strID) { TrainCourseBLL objTrainCourseBllBll = new TrainCourseBLL(); objTrainCourseBllBll.DeleteTrainCourse(Convert.ToInt32(strID)); }