/// <summary> /// 执行选题操作 /// </summary> public void StusecltTitle() { try { //string stuId = Context.Request["stuId"].ToString(); stu = (Student)Session["loginuser"]; int titleid = int.Parse(Context.Request.QueryString["titleId"]); Title dstitle = new Title(); TitleBll titleSelect = new TitleBll(); dstitle = titleSelect.GetTitle(titleid); int limited = int.Parse(dstitle.Limit.ToString()); int selected = int.Parse(dstitle.Selected.ToString()); if (selected < limited) { Result row = isExist(); if (row == Result.记录不存在) { LogHelper.Info(this.GetType(), stu.StuAccount + " - " + stu.RealName + " - 学生选题 - " + dstitle.TitleId + dstitle.title); TitleRecord titleRecord = new TitleRecord(); titleRecord.student = stu; Title title = new Title(); title.TitleId = titleid; titleRecord.title = title; int rows = pbll.AddTitlerecord(titleRecord); if (rows > 0) { Response.Write("选题成功"); Response.End(); } else { Response.Write("选题失败"); Response.End(); } } else { Response.Write("已选题"); Response.End(); } } else { Response.Write("已达上限"); Response.End(); } } catch (Exception ex) { LogHelper.Error(this.GetType(), ex); } }
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(); } }
protected void Page_Load(object sender, EventArgs e) { state = Session["state"].ToString(); string op = Context.Request.QueryString["op"]; titleid = Request.QueryString["titleId"].ToString(); TitleBll nb = new TitleBll(); titleId = nb.GetTitle(int.Parse(titleid)); if (state == "3") { if (op == "selectTitle") { StusecltTitle(); } } }
/// <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; } } } } }
protected void Page_Load(object sender, EventArgs e) { string op = Context.Request["op"]; article = Request.QueryString["article"]; //调用下拉菜单数据 TeacherBll teabll = new TeacherBll(); //TODO 获取当前登录的教师账号 Teacher tea = (Teacher)Session["loginuser"]; //加载登录教师所在分院的专业 TableBuilder tabuilderPro = new TableBuilder(); tabuilderPro.StrTable = "T_Profession"; tabuilderPro.StrWhere = "collegeId = '" + tea.college.ColID + "'"; tabuilderPro.IntColType = 0; tabuilderPro.IntOrder = 0; tabuilderPro.IntPageNum = 1; tabuilderPro.IntPageSize = 100; tabuilderPro.StrColumn = "proId"; tabuilderPro.StrColumnlist = "*"; prods = probll.SelectBypage(tabuilderPro, out count); //加载登录教师所在分院的批次 TableBuilder tabuilderPlan = new TableBuilder(); tabuilderPlan.StrTable = "T_Plan"; tabuilderPlan.StrWhere = "collegeId = '" + tea.college.ColID + "'"; tabuilderPlan.IntColType = 0; tabuilderPlan.IntOrder = 0; tabuilderPlan.IntPageNum = 1; tabuilderPlan.IntPageSize = 100; tabuilderPlan.StrColumn = "planId"; tabuilderPlan.StrColumnlist = "*"; plands = pbll.SelectBypage(tabuilderPlan, out count); if (article == "edit") { string titleId = Request.QueryString["titleId"]; Session["titleId"] = titleId; TitleBll titBll = new TitleBll(); titleEdit = titBll.GetTitle(Convert.ToInt32(titleId)); //string ti = title.Limit.ToString(); } else { TitleBll titlebll = new TitleBll(); Title title = new Title(); if (op == "new") { try { string paperTitle = Request["paperTitle"].ToString(); string profession = Request["profession"].ToString(); string plans = Request["plan"].ToString(); string numMax = Request["numMax"].ToString(); string paperContent = Request["paperContent"].ToString(); title.title = paperTitle; title.TitleContent = HttpUtility.UrlDecode(paperContent); title.CreateTime = DateTime.Now; //TODO 专业批次选定人数为固定值,需重新改动 title.Selected = 0; title.Limit = int.Parse(numMax); title.teacher = (Teacher)Session["loginuser"]; title.plan = new Plan { PlanId = Convert.ToInt32(plans) }; title.profession = new Profession { ProId = Convert.ToInt32(profession) }; Result result = titlebll.Insert(title); if (result == Result.添加成功) { LogHelper.Info(this.GetType(), tea.TeaAccount + " - " + tea.TeaName + " - 发布论文"); Response.Write("添加成功"); Response.End(); } else { Response.Write("添加失败"); Response.End(); } }catch (Exception ex) { LogHelper.Error(this.GetType(), ex); } } else if (op == "edit") { try { string paperTitle = Request["paperTitle"].ToString(); string profession = Request["profession"].ToString(); string plans = Request["plan"].ToString(); string numMax = Request["numMax"].ToString(); string paperContent = Request["paperContent"].ToString(); title.TitleId = Convert.ToInt32(Session["titleId"].ToString()); title.title = paperTitle; title.TitleContent = HttpUtility.UrlDecode(paperContent); title.CreateTime = DateTime.Now; //TODO 专业批次选定人数为固定值,需重新改动 title.Selected = 0; title.Limit = int.Parse(numMax); title.teacher = tea; title.plan = new Plan { PlanId = 1 }; title.profession = new Profession { ProId = 1 }; Result result = titlebll.Update(title); if (result == Result.更新成功) { LogHelper.Info(this.GetType(), tea.TeaAccount + " - " + tea.TeaName + " - 修改" + Session["titleId"].ToString() + "论文"); Response.Write("更新成功"); Response.End(); } else { Response.Write("更新失败"); Response.End(); } }catch (Exception ex) { LogHelper.Error(this.GetType(), ex); } } } }
/// <summary> /// 执行选题操作 /// </summary> public void StusecltTitle() { //string stuId = Context.Request["stuId"].ToString(); int titleid = int.Parse(Context.Request.QueryString["titleId"]); Title dstitle = new Title(); Plan plan = new Plan(); TitleBll titleSelect = new TitleBll(); PlanBll planBll = new PlanBll(); dstitle = titleSelect.GetTitle(titleid); int limited = int.Parse(dstitle.Limit.ToString()); int selected = int.Parse(dstitle.Selected.ToString()); //获取截止时间 int pid = dstitle.plan.PlanId; plan = planBll.Select(pid); string now = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); DateTime nowTime = Convert.ToDateTime(now); string end = plan.EndTime.ToString("yyyy-MM-dd HH:mm:ss"); DateTime endTime = Convert.ToDateTime(end); try { if (nowTime <= endTime) { if (selected < limited) { Result row = isExist(); if (row == Result.记录不存在) { TitleRecord titleRecord = new TitleRecord(); titleRecord.student = stu; Title title = new Title(); title.TitleId = titleid; titleRecord.title = title; int rows = pbll.AddTitlerecord(titleRecord); if (rows > 0) { LogHelper.Info(this.GetType(), stu.StuAccount + " - " + stu.RealName + " - 学生选题 - " + dstitle.TitleId + dstitle.title); Response.Write("选题成功"); Response.End(); } else { Response.Write("选题失败"); Response.End(); } } else { Response.Write("已选题"); Response.End(); } } else { Response.Write("已达上限"); Response.End(); } } else { Response.Write("选题时间已截止"); Response.End(); } } catch (Exception ex) { LogHelper.Error(this.GetType(), ex); } }