Ejemplo n.º 1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (FU_Upload.HasFile)
            {
                string StrsavePath = Server.MapPath("..//..//..//dataUser//FlowFile"); //路径
                StrsavePath = StrsavePath + "//" + FU_Upload.FileName;
                FU_Upload.SaveAs(StrsavePath);                                         //保存文件
                BP.WF.Flow flow                  = new BP.WF.Flow(this.Request.QueryString["FK_Flow"]);
                int        SpecifiedNumber       = 0;
                BP.WF.ImpFlowTempleteModel model = BP.WF.ImpFlowTempleteModel.AsNewFlow;
                //作为新流程导入(由ccbpm自动生成新的流程编号)
                if (Import_1.Checked)
                {
                    model = BP.WF.ImpFlowTempleteModel.AsNewFlow;
                }
                //作为新流程导入(使用流程模版里面的流程编号,如果该编号已经存在系统则会提示错误)
                if (Import_2.Checked)
                {
                    model = BP.WF.ImpFlowTempleteModel.AsTempleteFlowNo;
                }
                //作为新流程导入(使用流程模版里面的流程编号,如果该编号已经存在系统则会覆盖此流程)
                if (Import_3.Checked)
                {
                    model = BP.WF.ImpFlowTempleteModel.OvrewaiteCurrFlowNo;
                }
                //导入并覆盖当前的流程
                if (Import_4.Checked)
                {
                    String StrSpecifiedNumber = this.SpecifiedNumber.Text;
                    if (StrSpecifiedNumber == null)
                    {
                        this.Alert("请输入指定流程编号。");
                        return;
                    }

                    SpecifiedNumber = Convert.ToInt32(StrSpecifiedNumber);
                    model           = BP.WF.ImpFlowTempleteModel.AsSpecFlowNo;
                }
                //执行导入
                flow = BP.WF.Flow.DoLoadFlowTemplate(flow.FK_FlowSort, StrsavePath, model, SpecifiedNumber);
                if (flow.No != "")
                {
                    this.Alert("导入成功");
                }
                else
                {
                    this.Alert("导入失败");
                }
            }
            else
            {
                this.Alert("请您选择上传的文件 文件格式为xml");
            }
        }
Ejemplo n.º 2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                string guid = this.Request.QueryString["GUID"];
                BP.WF.CloudWS.WSSoapClient ccflowCloud = BP.WF.Cloud.Glo.GetSoap();
                DataTable dt = ccflowCloud.GetFlowTemplateByGuid(guid);


                byte[] bytes = ccflowCloud.GetFlowXML(true, guid);

                string path = BP.Sys.SystemConfig.PathOfDataUser + "CloundFlow\\Public";
                if (!System.IO.Directory.Exists(path))
                {
                    System.IO.Directory.CreateDirectory(path);
                }

                string xmlStr = System.Text.Encoding.UTF8.GetString(bytes);
                System.Xml.XmlDocument xml = new System.Xml.XmlDocument();
                xml.LoadXml(xmlStr);

                string fileName = dt.Rows[0]["NAME"].ToString() +
                                  DateTime.Now.ToString("yyyyMMddHHmmss") + ".xml";

                fileName = fileName.Replace("/", "、");
                xml.Save(path + "\\" + fileName);

                path = BP.Sys.SystemConfig.PathOfDataUser + "CloundFlow\\Public\\" + fileName;

                int SpecifiedNumber = 0;
                BP.WF.ImpFlowTempleteModel model = BP.WF.ImpFlowTempleteModel.AsNewFlow;
                //作为新流程导入(由ccbpm自动生成新的流程编号)
                if (this.RB_Import_1.Checked)
                {
                    model = BP.WF.ImpFlowTempleteModel.AsNewFlow;
                }
                //作为新流程导入(使用流程模版里面的流程编号,如果该编号已经存在系统则会提示错误)
                if (this.RB_Import_2.Checked)
                {
                    model = BP.WF.ImpFlowTempleteModel.AsTempleteFlowNo;
                }
                //作为新流程导入(使用流程模版里面的流程编号,如果该编号已经存在系统则会覆盖此流程)
                if (this.RB_Import_3.Checked)
                {
                    model = BP.WF.ImpFlowTempleteModel.OvrewaiteCurrFlowNo;
                }

                //导入并覆盖当前的流程
                if (this.RB_Import_4.Checked)
                {
                    String StrSpecifiedNumber = this.SpecifiedNumber.Text;
                    if (StrSpecifiedNumber == null)
                    {
                        this.Alert("请输入指定流程编号。");
                        return;
                    }

                    SpecifiedNumber = Convert.ToInt32(StrSpecifiedNumber);
                    model           = BP.WF.ImpFlowTempleteModel.AsSpecFlowNo;
                }

                //执行导入
                BP.WF.Flow flow = BP.WF.Flow.DoLoadFlowTemplate(this.DropDownList1.SelectedValue, path, model, SpecifiedNumber);

                if (flow.No != "")
                {
                    //调用客户端脚本, 是否在设计器中打开流程
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "<script>openFlow('" + flow.DType + "','" +
                                                           flow.Name + "','" + flow.No + "','" + WebUser.No + "','" + WebUser.SID + "');</script>");

                    //导入成功禁用导入按钮
                    this.Button1.Enabled = false;
                }
                else
                {
                    this.Alert("导入失败");
                }
            }
            catch (Exception ex)
            {
                this.Response.Write("导入失败:" + ex.Message);
            }
        }