protected void Query_Click(object sender, EventArgs e) { this.AllSubject.Visible = true; string subjectName = this.txtSubjectName.Value.Trim(); if (subjectName == "") { this.hint.InnerHtml = "请输入科目名称"; this.AllSubject.Visible = false; this.showPager.Visible = true; } else { SubjectMgr mgr = new SubjectMgr(); List <Subject> subject = mgr.FindSingleSubject(subjectName); if (subject != null) { this.Repeater1.DataSource = subject; this.Repeater1.DataBind(); this.showPager.Visible = false; this.hint.InnerHtml = ""; } else { this.hint.InnerHtml = "科目名称输入错误"; this.AllSubject.Visible = false; this.showPager.Visible = true; } } }
public static int DeleteSubject(int subjectID) { SubjectMgr sm = new SubjectMgr(); if (sm.DeleteSubject(subjectID)) { return(1); } else { return(0); } }
//分页显示 private void LoadPage() { SubjectMgr msg = new SubjectMgr(); Pager <Subject> allSubject = msg.ShowPagerAdminMessageList(this.pager.CurrentPageIndex - 1, this.pager.PageSize); this.Repeater1.DataSource = allSubject.rows; this.Repeater1.DataBind(); this.pager.RecordCount = allSubject.total; if (allSubject == null) { string warn = "暂时没有报名科目"; this.subWarn.InnerHtml = warn; } }
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"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.stuName.InnerText = ContextObjects.CurrentStudent.stuName; SubjectMgr mgr = new SubjectMgr(); string subjectName = mgr.ShowSubjectName(); if (subjectName == "") { this.showSign.Attributes.Add("style", "display:block"); this.move.Visible = false; } else { this.subName.InnerText = subjectName; } } }
public static int StartSign(int subjectID) { SubjectMgr mgr = new SubjectMgr(); SignMgr sm = new SignMgr(); Sign sign = new Sign(); sign.subjectID = subjectID; sign.stuNo = ContextObjects.CurrentStudent.stuNo; sign.signEndTime = DateTime.Parse(mgr.ShowSignEndTime(subjectID)); if (sm.AddSign(sign)) { return(1); } else { return(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>"); } }
public void Test() { SubjectMgr sm = new SubjectMgr(); A1 a1 = new A1(); A2 a2 = new A2(); A3 a3 = new A3(); Stopwatch sw = new Stopwatch(); sw.Start(); for (int i = 0; i < 10000; i++) { AA aa = new AA("AA" + i); sm.AddObserver(aa); } sw.Stop(); TimeSpan ts2 = sw.Elapsed; Console.WriteLine("Stopwatch1总共花费{0}ms.", ts2.TotalMilliseconds); sw = new Stopwatch(); sw.Start(); sm.Publish(a1); sw.Stop(); ts2 = sw.Elapsed; Console.WriteLine("Stopwatch2总共花费{0}ms.", ts2.TotalMilliseconds); sw = new Stopwatch(); sw.Start(); sm.Publish(a2); sw.Stop(); ts2 = sw.Elapsed; Console.WriteLine("Stopwatch3总共花费{0}ms.", ts2.TotalMilliseconds); sw = new Stopwatch(); sw.Start(); sm.Publish(a3); sw.Stop(); ts2 = sw.Elapsed; Console.WriteLine("Stopwatch4总共花费{0}ms.", ts2.TotalMilliseconds); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SubjectMgr mgr = new SubjectMgr(); List <Subject> list = mgr.FindOldSubject(); if (list.Count == 0) { this.adminShow.Attributes.Add("style", "display:block"); this.move.Visible = false; } else if (list.Count == 1) { this.subName.InnerText = list[0].subjectName; this.name.InnerText = ""; } else { this.subName.InnerText = list[0].subjectName; this.name.InnerText = list[1].subjectName; } } }