Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            tea = (Teacher)Session["loginuser"];
            TitleRecordBll trbll      = new TitleRecordBll();
            PathBll        pathBll    = new PathBll();
            Teacher        teacher    = (Teacher)Session["loginuser"];
            string         teaAccount = teacher.TeaAccount;

            collegeId = teacher.college.ColID;
            string addop = Context.Request.Form["op"];
            string type  = Request.QueryString["type"];

            op = Request["op"];
            try
            {
                if (op == "add")
                {
                    string         stuAccount = Request["stuAccount"];
                    string         opinion    = Request["opinion"];
                    GuideRecordBll guideBll   = new GuideRecordBll();
                    GuideRecord    guide      = new GuideRecord();
                    DataSet        dsTR       = trbll.GetByAccount(stuAccount);
                    int            i          = dsTR.Tables[0].Rows.Count - 1;
                    guide.opinion = opinion;
                    TitleRecord titleRecord = new TitleRecord();
                    titleRecord.TitleRecordId = Convert.ToInt32(dsTR.Tables[0].Rows[i]["titleRecordId"].ToString());
                    guide.titleRecord         = titleRecord;
                    guide.dateTime            = DateTime.Now;
                    path             = pathBll.Select(titleRecord.TitleRecordId, stuAccount);
                    guide.path       = path;
                    path.titleRecord = titleRecord;
                    path.state       = 1;
                    path.type        = 0;
                    Result result = pathBll.updateState(path);
                    if (result == Result.更新成功)
                    {
                        Result row = guideBll.Insert(guide);
                        if (row == Result.添加成功)
                        {
                            StudentBll studentBll = new StudentBll();
                            Student    stu        = studentBll.GetModel(stuAccount);
                            LogHelper.Info(this.GetType(), tea.TeaAccount + " - " + tea.TeaName + " - 教师添加 - " + stuAccount + " - " + stu.RealName + " - 学生的指导记录");
                            Response.Write("提交成功");
                            Response.End();
                        }
                        else
                        {
                            Response.Write("提交失败");
                            Response.End();
                        }
                    }
                    else
                    {
                        Response.Write("提交失败");
                        Response.End();
                    }
                }
                else if (op == "download")
                {
                    download = "download";
                    string account          = Request["stuAccount"];
                    Path   getTitleRecordId = pathBll.getTitleRecordId(account);
                    int    titleRecordId    = getTitleRecordId.titleRecord.TitleRecordId;
                    paperPath = pathBll.Select(titleRecordId, account);
                    //Response.Redirect(paperPath.paperPath);
                    Response.Write("<script>$('#loadHref').href = '" + paperPath.paperPath + "';</script>");
                    //Response.End();
                }
                if (!IsPostBack)
                {
                    Search();
                    getPage(Search());
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(this.GetType(), ex);
            }
        }