protected void Page_Load(object sender, EventArgs e) { TitleRecordBll titleRecordBll = new TitleRecordBll(); TitleBll titleBll = new TitleBll(); //获取登录学生学号 stu = (Student)Session["loginuser"]; string stuAccount = stu.StuAccount.ToString(); ds = titleRecordBll.Select(); if (ds != null) { if (ds.Tables[0].Rows.Count != 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { if (stuAccount == ds.Tables[0].Rows[i]["stuAccount"].ToString()) { string tId = ds.Tables[0].Rows[i]["titleId"].ToString(); Title title = titleBll.GetTitle(int.Parse(tId)); string showTitle = title.title.ToString(); if (showTitle != "") { Response.Write("<a href='../PaperDtailStu.aspx'>你已选过题目,请点击跳转到题目详情界面 </a>"); Response.End(); } } } } } //获取op titiId string op = Context.Request.QueryString["op"]; string titleid = Context.Request.QueryString["titleId"]; //获取学生专业id string proId = stu.profession.ProId.ToString(); if (!Page.IsPostBack) { if (proId != null) { proId = "proId=" + proId; getPage(proId); } } if (op == "selectTitle") { StusecltTitle(); } }
protected void Page_Load(object sender, EventArgs e) { stu = (Student)Session["loginuser"]; stuAccount = stu.StuAccount.ToString(); ds = titleRecordBll.Select(); if (ds != null) { if (ds.Tables[0].Rows.Count != 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { int j = ds.Tables[0].Rows.Count - 1; string account = ds.Tables[0].Rows[i]["stuAccount"].ToString(); if (stuAccount == ds.Tables[0].Rows[i]["stuAccount"].ToString()) { string tId = ds.Tables[0].Rows[i]["titleId"].ToString(); title = titleBll.GetTitle(int.Parse(tId)); showTitle = title.title.ToString(); if (showTitle == "") { Response.Write("<a href='paperList.aspx'>你还没有选题,请点击跳转到选题界面 </a>"); Response.End(); } showTitleContent = title.TitleContent.ToString(); // teaAccount = title.teacher.TeaAccount; teacher = tbll.GetModel(teaAccount); teaName = teacher.TeaName; sex = teacher.Sex; college = teacher.college.ColName; phone = teacher.Phone; email = teacher.Email; teaAccount = teacher.TeaAccount; // showTeaName = title.teacher.TeaName.ToString(); break; } } } } string op = Context.Request.QueryString["op"]; if (op == "selectTitle") { StusecltTitle(); } }
//获取表格数据 public void getPage(String strWhere) { string currentPage = Request.QueryString["currentPage"]; if (currentPage == null || currentPage.Length <= 0) { currentPage = "1"; } CrossBll crossBll = new CrossBll(); Teacher tea = (Teacher)Session["loginuser"]; teaAccount = tea.TeaAccount; TitleRecordBll trbll = new TitleRecordBll(); DataSet ds = trbll.GetByAccount(teaAccount); if (ds != null) { int i = ds.Tables[0].Rows.Count - 1; int titleRecoreId = Convert.ToInt32(ds.Tables[0].Rows[i]["titleRecordId"].ToString()); } DataSet dsTRAll = trbll.Select(); string where1 = "teaAccount = " + teaAccount; string where2 = "teaAccount = " + teaAccount + " and " + strWhere; TableBuilder tabuilder = new TableBuilder() { StrTable = "V_Cross", StrWhere = strWhere == null || strWhere == "" ? where1 : where2, IntColType = 0, IntOrder = 0, IntPageNum = int.Parse(currentPage), IntPageSize = pagesize, StrColumn = "titleRecordId", StrColumnlist = "*" }; getCurrentPage = int.Parse(currentPage); dsTR = crossBll.SelectBypage(tabuilder, out count); }
/// <summary> /// 根据登录者判断加载公告 /// </summary> public void loadNewsList() { state = Session["state"].ToString(); if (state == "0" || state == "2")//根据登录的管理员只显示相关公告 { admin = (Teacher)Session["user"]; colId = admin.college.ColID; teaId = admin.TeaAccount; } else if (state == "1")//根据登录的教师只显示相关公告 { teacher = (Teacher)Session["loginuser"]; colId = teacher.college.ColID; teaId = teacher.TeaAccount; } else//根据登录的学生只显示相关公告 { stu = (Student)Session["loginuser"]; col = stu.college; colId = col.ColID; stuAccount = stu.StuAccount; TitleRecordBll recordBll = new TitleRecordBll(); ds = recordBll.Select(); if (ds != null) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { if (stuAccount == ds.Tables[0].Rows[i]["stuAccount"].ToString()) { TitleBll titleBll = new TitleBll(); titleId = int.Parse(ds.Tables[0].Rows[i]["titleId"].ToString()); title = titleBll.GetTitle(titleId); teaId = title.teacher.TeaAccount; } } } } }