Пример #1
0
    protected void NextStep(object sender, EventArgs e)
    {
        try
        {
            int id = int.Parse(Request.QueryString["id"]);
            CourseServiceImpl courseServiceImpl = new CourseServiceImpl();
            Course            course            = (Course)courseServiceImpl.GetById(id);
            course.Description = Description.Value.Replace("\n", "<br/>");

            //之后再验证数据
            courseServiceImpl.Modify(course);

            Response.Redirect("CourseSchedule.aspx?id=" + id);
        }catch (Exception ex)
        {
            Label.Text = "填写错误";
        }
    }
Пример #2
0
    protected void NextStep(object sender, EventArgs e)
    {
        try
        {
            Teacher teacher = (Teacher)Session["user"];
            string  Path    = null;
            if (CourseImage.PostedFile != null && CourseImage.PostedFile.FileName != "")
            {
                var savePath = Request.MapPath("~/TeacherUpload/CourseImage/") +
                               teacher.JobNumber +
                               "\\";
                if (!Directory.Exists(savePath))
                {
                    Directory.CreateDirectory(savePath);
                }
                var millisecond = DateTime.Now.Millisecond;
                CourseImage.SaveAs(savePath + millisecond + CourseImage.FileName);
                Path = "/TeacherUpload/CourseImage/" + teacher.JobNumber + "/" + millisecond + CourseImage.FileName;
            }


            int CourseId = int.Parse(Request.QueryString["id"]);
            CourseServiceImpl courseServiceImpl = new CourseServiceImpl();
            Course            course            = (Course)courseServiceImpl.GetById(CourseId);
            course.Name = CourseName.Value;
            course.ShortIntroduction = ShortCourseIntro.Value;
            course.TeacherId         = teacher.TeacherId;
            course.SchoolYear        = SchoolYear.Text;
            course.Semester          = Semester.Text;
            course.IntroImage        = Path == null ? null : Path;
            course.ClassId           = int.Parse(DropDownList1.Text);
            //之后再验证数据

            course = (Course)courseServiceImpl.Modify(course);

            Response.Redirect("EditIntroDetail.aspx?id=" + course.CourseId);
        }
        catch (Exception ex)
        {
            Label.Text = "填写错误";
        }
    }
Пример #3
0
    protected void NextStep(object sender, EventArgs e)
    {
        try
        {
            int id = int.Parse(Request.QueryString["id"]);
            CourseServiceImpl courseServiceImpl = new CourseServiceImpl();
            Course            course            = (Course)courseServiceImpl.GetById(id);
            course.CourseId            = id;
            course.BeginDate           = DateTime.Parse(BeginDate.Value);
            course.EndDate             = DateTime.Parse(EndDate.Value);
            course.TheoryClassHour     = int.Parse(TheoryClassHour.Value);
            course.ExperimentClassHour = int.Parse(ExperimentClassHour.Value);

            //之后再验证数据

            courseServiceImpl.Modify(course);

            Response.Redirect("UploadCourseware.aspx?id=" + id);
        }catch (Exception ex)
        {
            Label.Text = "填写有误";
        }
    }