コード例 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         int subjectID = int.Parse(Request.QueryString["subjectID"]);
         this.subjectID.Value = subjectID.ToString();
         SubjectMgr mgr = new SubjectMgr();
         ExamSignSystemEntity.Subject subject = mgr.ShowSingleSubject(subjectID);
         this.txtSubjectName.Value = subject.subjectName;
         this.txtAddress.Value     = subject.subjectExamAddress;
         this.txtExamTime.Value    = subject.subjectExamTime.ToString("yyyy-MM-dd");
         this.et.Value             = subject.subjectSignEndTime.ToString("yyyy-MM-dd");
         this.st.Value             = subject.subjectSignStartTime.ToString("yyyy-MM-dd");
     }
 }
コード例 #2
0
        protected void Add_Click(object sender, EventArgs e)
        {
            ExamSignSystemEntity.Subject subject = new ExamSignSystemEntity.Subject();
            SubjectMgr mgr = new SubjectMgr();

            if (this.txtSubjectName.Value == "" || this.txtExamAddress.Value == "" || this.txtEaxmTime.Value == "" || this.et.Value == "" || this.st.Value == "")
            {
                Response.Write("<script>alert('请将信息完善!');</script>");
            }
            else
            {
                subject.subjectName          = this.txtSubjectName.Value.Trim();
                subject.subjectSignStartTime = DateTime.Parse(this.st.Value.Trim());
                subject.subjectSignEndTime   = DateTime.Parse(this.et.Value.Trim());
                subject.subjectExamTime      = DateTime.Parse(this.txtEaxmTime.Value.Trim());
                subject.subjectExamAddress   = this.txtExamAddress.Value.Trim();
                mgr.AddSubject(subject);
                Response.Write("<script>alert('科目已添加成功!');</script>");
            }
        }