示例#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_gwk_class Hyoa_gwk_class = new HyoaClass.Hyoa_gwk_class();
        if (this.txtop.Value == "add")
        {
            Hyoa_gwk_class.id = this.hy_id.Text;
            Hyoa_gwk_class.hy_name = this.hy_name.Text;
            Hyoa_gwk_class.hy_type = this.hy_type.Value;
            Hyoa_gwk_class.hy_sort = System.Int32.Parse(this.hy_sort.Text.ToString());
            Hyoa_gwk_class.Insert();

        }
        else
        {
            Hyoa_gwk_class.id = this.hy_id.Text;
            Hyoa_gwk_class.hy_name = this.hy_name.Text;
            Hyoa_gwk_class.hy_type = this.hy_type.Value;
            Hyoa_gwk_class.hy_sort = System.Int32.Parse(this.hy_sort.Text.ToString());
            Hyoa_gwk_class.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>");
        }
    }