Beispiel #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_flowinfor Hyoa_flowinfor = new HyoaClass.Hyoa_flowinfor();
        HyoaClass.Hyoa_flowtache Hyoa_flowtache = new HyoaClass.Hyoa_flowtache();
        HyoaClass.Hyoa_flowwork Hyoa_flowwork = new HyoaClass.Hyoa_flowwork();
        HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield();
        HyoaClass.Hyoa_flowtachefield Hyoa_flowtachefield = new HyoaClass.Hyoa_flowtachefield();
        HyoaClass.Hyoa_flowtacheuser Hyoa_flowtacheuser = new HyoaClass.Hyoa_flowtacheuser();

        //先判断流程是否已经存在
        DataTable dt = Hyoa_flowinfor.Getflowinfor(this.txtFlowID.Value);
        if (dt.Rows.Count > 0)
        {
            Response.Write("<script>alert('该流程已存在,请重新填写!');history.back();</script>");
            return;
        }
        else
        {
            //添加流程信息
            Hyoa_flowinfor.hy_flowid = this.txtFlowID.Value;
            Hyoa_flowinfor.hy_flowname = this.txtFlowCh.Value;
            Hyoa_flowinfor.hy_sort = System.Int32.Parse(this.txtFlowSort.Value);
            Hyoa_flowinfor.hy_mudelid = this.ddlmudelid.SelectedValue;
            Hyoa_flowinfor.Insert();
            //添加环节信息
            DataTable dtflowtache = Hyoa_flowtache.Getflowtachebyflowid(this.txtSrcFlowID.Value);
            if (dtflowtache.Rows.Count > 0)
            {
                for (var i = 0; i < dtflowtache.Rows.Count; i++)
                {
                    //复制到新流程中
                    Hyoa_flowtache.ID = Hyoa_global.GetRandom();
                    Hyoa_flowtache.hy_flowid = this.txtFlowID.Value;
                    Hyoa_flowtache.hy_tacheid = dtflowtache.Rows[i]["hy_tacheid"].ToString();
                    Hyoa_flowtache.hy_tachename = dtflowtache.Rows[i]["hy_tachename"].ToString();
                    Hyoa_flowtache.hy_sort = System.Int32.Parse(dtflowtache.Rows[i]["hy_sort"].ToString());
                    Hyoa_flowtache.hy_ifshowcurdept = dtflowtache.Rows[i]["hy_ifshowcurdept"].ToString();
                    Hyoa_flowtache.hy_XValue = dtflowtache.Rows[i]["hy_XValue"].ToString();
                    Hyoa_flowtache.hy_YValue = dtflowtache.Rows[i]["hy_YValue"].ToString();
                    Hyoa_flowtache.hy_rdDoIsSendSms = dtflowtache.Rows[i]["hy_rdDoIsSendSms"].ToString();
                    Hyoa_flowtache.hy_rdDoIsSendMessage = dtflowtache.Rows[i]["hy_rdDoIsSendMessage"].ToString();
                    Hyoa_flowtache.hy_rdPassIsSendSms = dtflowtache.Rows[i]["hy_rdPassIsSendSms"].ToString();
                    Hyoa_flowtache.hy_rdPassIsSendMessage = dtflowtache.Rows[i]["hy_rdPassIsSendMessage"].ToString();
                    Hyoa_flowtache.Insert();
                }
            }
            //添加流转信息
            DataTable dtflowwork = Hyoa_flowwork.Getflowworksbyflowid(this.txtSrcFlowID.Value);
            if (dtflowwork.Rows.Count > 0)
            {
                for (var i = 0; i < dtflowwork.Rows.Count; i++)
                {
                    //复制到新流程中
                    Hyoa_flowwork.ID = Hyoa_global.GetRandom();
                    Hyoa_flowwork.hy_flowid = this.txtFlowID.Value;
                    Hyoa_flowwork.hy_curtacheid = dtflowwork.Rows[i]["hy_curtacheid"].ToString();
                    Hyoa_flowwork.hy_curtachename = dtflowwork.Rows[i]["hy_curtachename"].ToString();
                    Hyoa_flowwork.hy_nexttacheid = dtflowwork.Rows[i]["hy_nexttacheid"].ToString();
                    Hyoa_flowwork.hy_nexttachename = dtflowwork.Rows[i]["hy_nexttachename"].ToString();
                    Hyoa_flowwork.hy_sort = System.Int32.Parse(dtflowwork.Rows[i]["hy_sort"].ToString());
                    Hyoa_flowwork.hy_actiontype = dtflowwork.Rows[i]["hy_actiontype"].ToString();
                    Hyoa_flowwork.Insert();
                }
            }
            //添加流程对应的域
            DataTable dtflowfield = Hyoa_flowfield.Getflowfieldsbyflowid(this.txtSrcFlowID.Value);
            if (dtflowfield.Rows.Count > 0)
            {
                for (var i = 0; i < dtflowfield.Rows.Count; i++)
                {
                    //复制到新流程中
                    Hyoa_flowfield.ID = Hyoa_global.GetRandom();
                    Hyoa_flowfield.hy_flowid = this.txtFlowID.Value;
                    Hyoa_flowfield.hy_fieldid = dtflowfield.Rows[i]["hy_fieldid"].ToString();
                    Hyoa_flowfield.hy_fieldname = dtflowfield.Rows[i]["hy_fieldname"].ToString();
                    Hyoa_flowfield.hy_fieldtype = dtflowfield.Rows[i]["hy_fieldtype"].ToString();
                    Hyoa_flowfield.hy_config = dtflowfield.Rows[i]["hy_config"].ToString();
                    Hyoa_flowfield.hy_sort = System.Int32.Parse(dtflowfield.Rows[i]["hy_sort"].ToString());
                    Hyoa_flowfield.Insert();
                }
            }
            //添加流程环节对应的域
            DataTable dtflowtachefield = Hyoa_flowtachefield.Getflowtachefieldbyflowid(this.txtSrcFlowID.Value);
            if (dtflowtachefield.Rows.Count > 0)
            {
                for (var i = 0; i < dtflowtachefield.Rows.Count; i++)
                {
                    //复制到新流程中
                    Hyoa_flowtachefield.ID = Hyoa_global.GetRandom();
                    Hyoa_flowtachefield.hy_flowid = this.txtFlowID.Value;
                    Hyoa_flowtachefield.hy_tacheid = dtflowtachefield.Rows[i]["hy_tacheid"].ToString();
                    Hyoa_flowtachefield.hy_fieldid = dtflowtachefield.Rows[i]["hy_fieldid"].ToString();
                    Hyoa_flowtachefield.Insert();
                }
            }
            //添加流程环节对应的人员
            DataTable dtflowtacheuser = Hyoa_flowtacheuser.Getflowtacheuserbyflowid(this.txtSrcFlowID.Value);
            if (dtflowtacheuser.Rows.Count > 0)
            {
                for (var i = 0; i < dtflowtacheuser.Rows.Count; i++)
                {
                    //复制到新流程中
                    Hyoa_flowtacheuser.ID = Hyoa_global.GetRandom();
                    Hyoa_flowtacheuser.hy_flowid = this.txtFlowID.Value;
                    Hyoa_flowtacheuser.hy_tacheid = dtflowtacheuser.Rows[i]["hy_tacheid"].ToString();
                    Hyoa_flowtacheuser.hy_userid = dtflowtacheuser.Rows[i]["hy_userid"].ToString();
                    Hyoa_flowtacheuser.Insert();
                }
            }
        }

        //处理完成后的提示及跳转
        Response.Write("<script>alert('" + ls_tip + "');window.opener.location.reload();self.close();</script>");
    }