Beispiel #1
0
    private void DataPlay()
    {
        HyoaClass.Hyoa_bq Hyoa_bq = new HyoaClass.Hyoa_bq();

        if (this.Request.QueryString["op"] != null)
        {
            this.txtop.Value = this.Request.QueryString["op"].ToString();           //新增还是修改

            if (this.Request.QueryString["op"] == "modify")
            {
                //根据id得到信息

                DataTable dt = Hyoa_bq.Getbqbyuserid(this.txtdjrid.Value);
                if (dt.Rows.Count > 0)
                {
                    this.txtbody.Text = dt.Rows[0]["hy_body"].ToString();
                }
                dt.Clear();
            }
        }
        else
        {
            //跳转一下
            //判读是否有数据
            DataTable dt = Hyoa_bq.Getbqbyuserid(this.txtdjrid.Value);
            if(dt.Rows.Count>0)
                Response.Write("<script>window.location='main_bq.aspx?op=modify'</script>");
        }
    }
Beispiel #2
0
    //保存
    protected void Button_Save_Click(object sender, EventArgs e)
    {
        if (this.Session["hyuid"].ToString() == "")
            this.Response.Redirect("../login.aspx");

        string ls_tip = "保存成功!";

        //新文档时
        HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
        HyoaClass.Hyoa_bq Hyoa_bq = new HyoaClass.Hyoa_bq();
        if (this.txtop.Value == "modify")
        {
            Hyoa_bq.hy_userid = this.txtdjrid.Value;
            Hyoa_bq.hy_body = this.txtbody.Text;
            Hyoa_bq.hy_datetime = System.DateTime.Now.ToString();
            Hyoa_bq.hy_tag = "";
            Hyoa_bq.Update();
        }else{
            Hyoa_bq.hy_userid = this.txtdjrid.Value;
            Hyoa_bq.hy_body = this.txtbody.Text;
            Hyoa_bq.hy_datetime = System.DateTime.Now.ToString();
            Hyoa_bq.hy_tag = "";
            Hyoa_bq.Insert();
        }

        Response.Write("<script>alert('" + ls_tip + "');window.location='main_bq.aspx?op=modify'</script>");
    }