示例#1
0
    protected void btnUpLoad_Click(object sender, EventArgs e)
    {
        Student student = (Student)Session["student"];

        if (student.Title.TitleName != null && student.Title.TitleName != "")
        {
            string wordtype = FileUpload1.PostedFile.ContentType;
            string name     = this.FileUpload1.PostedFile.FileName;
            int    n        = FileUpload1.PostedFile.InputStream.Read(new byte[FileUpload1.PostedFile.ContentLength], 0, FileUpload1.PostedFile.ContentLength);
            Thesis thesis   = new Thesis();
            thesis.Student     = student;
            thesis.PublishDate = DateTime.Now.ToString();
            thesis.Content     = (new byte[FileUpload1.PostedFile.ContentLength]);
            thesis.Title       = titlemanage.GetTilteByTitleID(student.Title.TitleID);
            if (string.IsNullOrEmpty(thesisManage.GetThesisByStuID(student.SID).PublishDate))
            {
                int isUpLoadOk = thesisManage.InsertThesis(thesis);
                if (isUpLoadOk > 0)
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('论上传成功!');</script>");
                }
                else
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('论文上传失败!');</script>");
                }
            }
            else
            {
                btnUpLoad.Attributes.Add("onclick", "return confirm('你已上传论文,确定要重新上传吗?');");
                thesisManage.DeleteThesisByStudentID(student.SID);
                if (thesisManage.InsertThesis(thesis) > 0)
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('论文重新上传成功!');</script>");
                }
                else
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('论文重新上传失败!');</script>");
                }
            }
        }
        else
        {
            this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('你还没有选题,请选题!');</script>");
        }
    }
示例#2
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        Student     stu         = (Student)Session["student"];
        TitleManage titleManage = new TitleManage();

        titleManage.ModifiyTitleChooseNum(stu.Title.TitleID);
        int num = studentManage.EscTitleByStudentId(stu.SID);

        ThesisManage.BLL.ThesisManage thesisManage = new ThesisManage.BLL.ThesisManage();
        int num2 = thesisManage.DeleteThesisByStudentID(stu.SID);

        if (num > 0)
        {
            Student student = studentManage.GetStudentBySID(stu.SID);
            Session.Remove("student");
            Session["student"] = student;
            this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('退选成功!');window.location.href='StudentMessage.aspx';</script>");
        }
        else
        {
            this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('退选失败!');</script>");
        }
    }