示例#1
0
    protected void addPaper_Click(object sender, EventArgs e)
    {
        ProjectPaperBll    problemPaperBll    = new ProjectPaperBll();
        ProjectPaperEntity problemPaperEntity = new ProjectPaperEntity();

        problemPaperEntity.Name = this.Name.Text.Trim();
        if (this.PRKIDList.SelectedIndex <= 0)
        {
            this.Page.ClientScript.RegisterStartupScript(base.GetType(), "alert", "<script>alert('必须选择试卷类型');</script>");
            return;
        }

        if (this.PaperType.SelectedIndex <= 0)
        {
            this.Page.ClientScript.RegisterStartupScript(base.GetType(), "alert", "<script>alert('必须选择试卷来源类型');</script>");
            return;
        }
        problemPaperEntity.PTID = Convert.ToInt32(this.PaperType.SelectedValue);

        if (this.FCKeditor1.Value != null && this.FCKeditor1.Value != "")
        {
            problemPaperEntity.PPDesc = this.FCKeditor1.Value;
        }
        else
        {
            problemPaperEntity.PPDesc = "";
        }

        problemPaperEntity.SelfResource = "";
        problemPaperEntity.FhdateTime   = DateTime.Now;
        if (problemPaperBll.Add(problemPaperEntity))
        {
            this.Page.ClientScript.RegisterStartupScript(base.GetType(), "alert", "<script>alert('项目添加成功');</script>");
            this.bindPaperType();
            this.bindPRKIDList();
            this.FCKeditor1.Value = "";
            this.Name.Text        = "";
            base.Response.Redirect("ProjectInternetion.aspx");
            return;
        }
        this.Page.ClientScript.RegisterStartupScript(base.GetType(), "alert", "<script>alert('添加失败');</script>");
    }
    protected void addPaper_Click(object sender, EventArgs e)
    {
        ProjectPaperBll    projectPaperBll    = new ProjectPaperBll();
        ProjectPaperEntity projectPaperEntity = new ProjectPaperEntity();

        projectPaperEntity.Name = this.Name.Text.Trim();

        if (this.PaperType.SelectedIndex <= 0)
        {
            this.Page.ClientScript.RegisterStartupScript(base.GetType(), "alert", "<script>alert('必须选择项目类型');</script>");
            return;
        }
        projectPaperEntity.PTID = int.Parse(this.PaperType.SelectedValue);

        if (this.txtDes.Value != null && this.txtDes.Value != "")
        {
            projectPaperEntity.PPDesc = this.txtDes.Value;
        }
        else
        {
            projectPaperEntity.PPDesc = "";
        }
        projectPaperEntity.ClientID     = base.Session["ClientID"].ToString();
        projectPaperEntity.SelfResource = "";
        projectPaperEntity.RegisterDate = DateTime.Parse(TextBox1.Text);
        projectPaperEntity.OverDate     = DateTime.Parse(TextBox2.Text);

        if (projectPaperBll.Add(projectPaperEntity))
        {
            this.Page.ClientScript.RegisterStartupScript(base.GetType(), "alert", "<script>alert('项目添加成功');</script>");
            this.bindPaperType();

            this.txtDes.Value = "";
            this.Name.Text    = "";
            base.Response.Redirect("ProjectInternection.aspx");
            return;
        }
        this.Page.ClientScript.RegisterStartupScript(base.GetType(), "alert", "<script>alert('添加失败');</script>");
    }