Пример #1
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_link Hyoa_link = new HyoaClass.Hyoa_link();
        if (this.txtop.Value == "add")
        {
            Hyoa_link.ID = Hyoa_global.GetRandom();
            Hyoa_link.hy_linkname = this.txtname.Value;
            Hyoa_link.hy_linkurl = this.txtlink.Value;
            Hyoa_link.hy_sort = System.Int32.Parse(this.txtsort.Value);
            Hyoa_link.Insert();
        }
        else
        {
            Hyoa_link.ID = this.txtdocid.Value;
            Hyoa_link.hy_linkname = this.txtname.Value;
            Hyoa_link.hy_linkurl = this.txtlink.Value;
            Hyoa_link.hy_sort = System.Int32.Parse(this.txtsort.Value);
            Hyoa_link.Update();
        }

        //处理完成后的提示及跳转
        if (this.txtifpop.Value == "")
        {
            Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>");
        }
        else
        {
            Response.Write("<script>alert('" + ls_tip + "');self.close();</script>");
        }
    }