예제 #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_flowinfor Hyoa_flowinfor = new HyoaClass.Hyoa_flowinfor();
        if (this.txtop.Value == "add")
        {
            //先判断是否已经存在
            DataTable dt = Hyoa_flowinfor.Getflowinfor(this.txtid.Text);
            if (dt.Rows.Count > 0)
            {
                Response.Write("<script>alert('该流程已存在,请重新填写!');history.back();</script>");
                return;
            }
            else
            {
                Hyoa_flowinfor.hy_flowid = this.txtid.Text;
                Hyoa_flowinfor.hy_flowname = this.txtname.Value;
                Hyoa_flowinfor.hy_sort = System.Int32.Parse(this.txtsort.Value);
                Hyoa_flowinfor.hy_mudelid = this.ddlmudelid.SelectedValue;
                Hyoa_flowinfor.Insert();
            }
        }
        else
        {
            Hyoa_flowinfor.hy_flowid = this.txtid.Text;
            Hyoa_flowinfor.hy_flowname = this.txtname.Value;
            Hyoa_flowinfor.hy_sort = System.Int32.Parse(this.txtsort.Value);
            Hyoa_flowinfor.hy_mudelid = this.ddlmudelid.SelectedValue;
            Hyoa_flowinfor.Update();
        }

        //保存时更新选中的模块对应的流程字段(hy_flowid)
        HyoaClass.DAO db = new HyoaClass.DAO();
        string sql;
        sql = "select a.id from hyt_flowfield a,hyt_tableconfig b where a.hy_tableid=b.ID  and b.hy_ifflowdoc='是' and a.hy_mudelid='"+this.ddlmudelid.SelectedValue+"'";
        DataTable dt_update = db.GetDataTable(sql);
        if (dt_update.Rows.Count > 0)
        {
            for (var i = 0; i < dt_update.Rows.Count; i++)
            {
                sql = "update hyt_flowfield set hy_flowid='" + this.txtid.Text + "' where id='" + dt_update.Rows[i]["id"].ToString()+"'";
                db.Execute(sql);
            }
        }
        db.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>");
        }
    }
예제 #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_flowinfor Hyoa_flowinfor = new HyoaClass.Hyoa_flowinfor();
        if (this.txtop.Value == "add")
        {
            //先判断是否已经存在
            DataTable dt = Hyoa_flowinfor.Getflowinfor(this.txtid.Text);
            if (dt.Rows.Count > 0)
            {
                Response.Write("<script>alert('该流程已存在,请重新填写!');history.back();</script>");
                return;
            }
            if (this.txtid.Text.Length < 5)
            {
                Response.Write("<script>alert('模块编号长度必须大于4位!');history.back();</script>");
                return;
            }
            if (this.txtid.Text.Substring(0, 4) != "Flow")
            {
                Response.Write("<script>alert('模块编号必须以Flow开头!');history.back();</script>");
                return;
            }
            Hyoa_flowinfor.hy_flowid = this.txtid.Text;
            Hyoa_flowinfor.hy_flowname = this.txtname.Value;
            Hyoa_flowinfor.hy_sort = System.Int32.Parse(this.txtsort.Value);
            Hyoa_flowinfor.hy_mudelid = this.ddlmudelid.SelectedValue;
            Hyoa_flowinfor.Insert();
        }
        else
        {
            Hyoa_flowinfor.hy_flowid = this.txtid.Text;
            Hyoa_flowinfor.hy_flowname = this.txtname.Value;
            Hyoa_flowinfor.hy_sort = System.Int32.Parse(this.txtsort.Value);
            Hyoa_flowinfor.hy_mudelid = this.ddlmudelid.SelectedValue;
            Hyoa_flowinfor.Update();
        }

        //保存时更新选中的模块对应的流程字段(hy_flowid)
        HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield();
        DataTable dt_update = Hyoa_flowfield.Getflowfieldsbymudelid_For_flowinfor(this.ddlmudelid.SelectedValue);
        if (dt_update.Rows.Count > 0)
        {
            for (var i = 0; i < dt_update.Rows.Count; i++)
            {
                Hyoa_flowfield.Updateflowid_For_flowinfor(this.txtid.Text, dt_update.Rows[i]["id"].ToString());
            }
        }

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