//保存
    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_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield();
        Hyoa_flowfield.hy_tableid = this.txttableid.Text;
        Hyoa_flowfield.hy_mudelid = this.txtmudelid.Text;
        Hyoa_flowfield.hy_flowid = this.txtflowid.Text;
        Hyoa_flowfield.hy_fieldid = this.txtfieldid.Text;
        Hyoa_flowfield.hy_fieldname = this.txtfieldname.Text;
        Hyoa_flowfield.hy_fieldtype = this.ddlfieldtype.SelectedValue;
        Hyoa_flowfield.hy_ifreadonly = this.ddlifreadonly.SelectedValue;
        Hyoa_flowfield.hy_defaultvaluetype = System.Int32.Parse(this.ddldefaultvaluetype.SelectedValue);
        Hyoa_flowfield.hy_defaultvalue = this.txtdefaultvalue.Text;
        Hyoa_flowfield.hy_optiontype = System.Int32.Parse(this.ddloptiontype.SelectedValue);
        Hyoa_flowfield.hy_options = this.txtoptions.Text;
        Hyoa_flowfield.hy_onclick = this.txtonclick.Text;
        Hyoa_flowfield.hy_ondblclick = this.txtondblclick.Text;
        Hyoa_flowfield.hy_onchange = this.txtonchange.Text;
        Hyoa_flowfield.hy_onkeydown = this.txtonkeydown.Text;
        Hyoa_flowfield.hy_onkeyup = this.txtonkeyup.Text;
        Hyoa_flowfield.hy_onfocus = this.txtonfocus.Text;
        Hyoa_flowfield.hy_onblur = this.txtonblur.Text;
        Hyoa_flowfield.hy_sqlfield = "";
        Hyoa_flowfield.hy_class = this.txtclass.Text;
        Hyoa_flowfield.hy_width = this.txtwidth.Text;
        Hyoa_flowfield.hy_height = this.txtheight.Text;
        Hyoa_flowfield.hy_tdnums = System.Int32.Parse(this.ddltdnums.SelectedValue);
        Hyoa_flowfield.hy_config = "";
        Hyoa_flowfield.hy_sort = float.Parse(this.txtsort.Text);
        Hyoa_flowfield.hy_wordlimit = System.Int32.Parse(this.txtwordlimit.Text);
        Hyoa_flowfield.hy_required = this.ddlrequired.SelectedValue;
        Hyoa_flowfield.hy_align = this.ddlalign.SelectedValue;
        Hyoa_flowfield.hy_ifhiddle = this.ddlifhiddle.SelectedValue;
        Hyoa_flowfield.hy_ifdbsybt = this.ddlifdbsybt.SelectedValue;
        Hyoa_flowfield.hy_field1 = "";
        Hyoa_flowfield.hy_field2 = "";
        Hyoa_flowfield.hy_field3 = "";
        Hyoa_flowfield.hy_field4 = "";
        Hyoa_flowfield.hy_field5 = "";

        //新文档时
        if (this.txtop.Value == "add")
        {
            DataTable dt = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(this.txtmudelid.Text, this.txtfieldid.Text, this.txttableid.Text);
            if (dt.Rows.Count > 0)
            {
                Response.Write("<script>alert('该字段ID在当前表单中已存在,请重新输入!');</script>");
                return;
            }
            Hyoa_flowfield.ID = Hyoa_global.GetRandom();
            Hyoa_flowfield.Insert();
            CreateSQLField();
        }
        else
        {
            Hyoa_flowfield.ID = this.txtdocid.Value;
            Hyoa_flowfield.Update();
            EditSQLField();
        }
        //处理完成后的提示及跳转
        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>");
        }
    }
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_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield();
        //新文档时
        if (this.txtop.Value == "add")
        {
            Hyoa_flowfield.ID = Hyoa_global.GetRandom();
            Hyoa_flowfield.hy_tableid = this.txttableid.Text;
            Hyoa_flowfield.hy_mudelid = this.txtmudelid.Text;
            Hyoa_flowfield.hy_flowid = this.txtflowid.Text;
            Hyoa_flowfield.hy_fieldid = this.txtfieldid.Text;
            Hyoa_flowfield.hy_fieldname = this.txtfieldname.Text;
            Hyoa_flowfield.hy_fieldtype = this.ddlfieldtype.SelectedValue;
            Hyoa_flowfield.hy_ifreadonly = this.ddlifreadonly.SelectedValue;
            Hyoa_flowfield.hy_defaultvaluetype = System.Int32.Parse(this.ddldefaultvaluetype.SelectedValue);
            Hyoa_flowfield.hy_defaultvalue = this.txtdefaultvalue.Text;
            Hyoa_flowfield.hy_optiontype = System.Int32.Parse(this.ddloptiontype.SelectedValue);

            if (ddloptiontype.SelectedValue == "1" && ddlwhichtable.SelectedIndex != 0)
            {
                if(this.ddlwhichtable.SelectedIndex==0)
                    Hyoa_flowfield.hy_options = this.txtoptions.Text;
                else
                    Hyoa_flowfield.hy_options = this.txtoptions.Text + " from hyp_flowmain where hy_tableid='" + ddlwhichtable.SelectedValue + "' order by " + this.txtsortby.Text + " " + this.ddlsorttype.SelectedValue;
            }
            else
            {
                Hyoa_flowfield.hy_options = this.txtoptions.Text;
            }

            Hyoa_flowfield.hy_onclick = this.txtonclick.Text;
            Hyoa_flowfield.hy_ondblclick = this.txtondblclick.Text;
            Hyoa_flowfield.hy_onchange = this.txtonchange.Text;
            Hyoa_flowfield.hy_onkeydown = this.txtonkeydown.Text;
            Hyoa_flowfield.hy_onkeyup = this.txtonkeyup.Text;
            Hyoa_flowfield.hy_sqlfield = this.ddlsqlfield.SelectedValue;
            Hyoa_flowfield.hy_class = this.txtclass.Text;
            Hyoa_flowfield.hy_width = this.txtwidth.Text;
            Hyoa_flowfield.hy_height = this.txtheight.Text;
            Hyoa_flowfield.hy_tdnums = System.Int32.Parse(this.ddltdnums.SelectedValue);
            Hyoa_flowfield.hy_config = "";
            Hyoa_flowfield.hy_sort = float.Parse(this.txtsort.Text);
            Hyoa_flowfield.hy_wordlimit = System.Int32.Parse(this.txtwordlimit.Text);
            Hyoa_flowfield.hy_required = this.ddlrequired.SelectedValue;
            Hyoa_flowfield.hy_align = this.ddlalign.SelectedValue;
            Hyoa_flowfield.hy_ifhiddle = this.ddlifhiddle.SelectedValue;

            Hyoa_flowfield.Insert();
        }
        else
        {
            Hyoa_flowfield.ID = this.txtdocid.Value;
            Hyoa_flowfield.hy_tableid = this.txttableid.Text;
            Hyoa_flowfield.hy_mudelid = this.txtmudelid.Text;
            Hyoa_flowfield.hy_flowid = this.txtflowid.Text;
            Hyoa_flowfield.hy_fieldid = this.txtfieldid.Text;
            Hyoa_flowfield.hy_fieldname = this.txtfieldname.Text;
            Hyoa_flowfield.hy_fieldtype = this.ddlfieldtype.SelectedValue;
            Hyoa_flowfield.hy_ifreadonly = this.ddlifreadonly.SelectedValue;
            Hyoa_flowfield.hy_defaultvaluetype = System.Int32.Parse(this.ddldefaultvaluetype.SelectedValue);
            Hyoa_flowfield.hy_defaultvalue = this.txtdefaultvalue.Text;
            Hyoa_flowfield.hy_optiontype = System.Int32.Parse(this.ddloptiontype.SelectedValue);

            if (ddloptiontype.SelectedValue == "1" && ddlwhichtable.SelectedIndex != 0)
                Hyoa_flowfield.hy_options = this.txtoptions.Text + " from hyp_flowmain where hy_tableid='" + ddlwhichtable.SelectedValue + "' order by " + this.txtsortby.Text + " " + this.ddlsorttype.SelectedValue;
            else
                Hyoa_flowfield.hy_options = this.txtoptions.Text;

            Hyoa_flowfield.hy_onclick = this.txtonclick.Text;
            Hyoa_flowfield.hy_ondblclick = this.txtondblclick.Text;
            Hyoa_flowfield.hy_onchange = this.txtonchange.Text;
            Hyoa_flowfield.hy_onkeydown = this.txtonkeydown.Text;
            Hyoa_flowfield.hy_onkeyup = this.txtonkeyup.Text;
            Hyoa_flowfield.hy_sqlfield = this.ddlsqlfield.SelectedValue;
            Hyoa_flowfield.hy_class = this.txtclass.Text;
            Hyoa_flowfield.hy_width = this.txtwidth.Text;
            Hyoa_flowfield.hy_height = this.txtheight.Text;
            Hyoa_flowfield.hy_tdnums = System.Int32.Parse(this.ddltdnums.SelectedValue);
            Hyoa_flowfield.hy_config = "";
            Hyoa_flowfield.hy_sort = float.Parse(this.txtsort.Text);
            Hyoa_flowfield.hy_wordlimit = System.Int32.Parse(this.txtwordlimit.Text);
            Hyoa_flowfield.hy_required = this.ddlrequired.SelectedValue;
            Hyoa_flowfield.hy_align = this.ddlalign.SelectedValue;
            Hyoa_flowfield.hy_ifhiddle = this.ddlifhiddle.SelectedValue;

            Hyoa_flowfield.Update();

            string lsupdate = "update hyt_flowfield set hy_flowid = '" + this.txtflowid.Text + "' where ID='" + this.txtdocid.Value + "'";
            HyoaClass.DAO dbupdate = new HyoaClass.DAO();
            dbupdate.Execute(lsupdate);
            dbupdate.Close();

        }
        //处理完成后的提示及跳转
        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>");
        }
    }