예제 #1
0
    /// <summary>
    /// 提交
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Submit_Click(object sender, EventArgs e)
    {
        if (!VertifyOverTime())
        {
            return;
        }

        if (!BeforeSubmit())
        {
            return;
        }
        string id = ViewState["FormID"].ToString();

        var dataInfo = SaveFormData();

        Countersign1.SaveData(true);//会签数据保存
        Countersign_Group1.SaveData(true);
        if (dataInfo != null)
        {
            uploadAttachments.SaveAttachment(FormId);
            // Countersign1.SaveAndSubmit();//会签数据保存

            #region 工作流参数
            NameValueCollection dataFields = SetWFParams();
            if (dataFields == null)
            {
                return;
            }
            #endregion


            WorkflowHelper.CurrentUser = "******" + _BPMContext.CurrentUser.LoginId;
            AppDict appInfo = new Pkurg.BPM.Services.AppDictService().GetByAppId("10109");
            if (appInfo == null)
            {
                Alert("提交失败");
                return;
            }
            int wfInstanceId = 0; //process instance id
            WorkflowHelper.StartProcess(appInfo.WorkFlowName, FormId, dataFields, ref wfInstanceId);
            if (wfInstanceId > 0)
            {
                string instId = SaveWorkFlowInstance("1", DateTime.Now, wfInstanceId.ToString());
                if (!string.IsNullOrEmpty(instId))
                {
                    SaveWorkItem();
                    if (!AfterWorkflowStart(wfInstanceId))
                    {
                        return;
                    }
                    IFrameHelper.DownloadLocalFileUrl(instId);
                    ScriptManager.RegisterClientScriptBlock(this, typeof(string), "1", "alert('提交成功');window.opener.location.href=window.opener.location.href;", true);
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ajax", " window.opener=null;window.open('', '_self', '');window.close();", true);
                    return;
                }
            }
        }

        Alert("提交失败");
    }
예제 #2
0
    protected void Submit_Click(object sender, EventArgs e)
    {
        int    wfInstanceId = 0; //process instance id
        string id           = ViewState["FormID"].ToString();

        if (!BeforeSubmit())
        {
            return;
        }
        PaymentApplicationInfo dataInfo = SaveFormData();

        //Countersign1.SaveData(true);//会签数据保存

        if (dataInfo != null)
        {
            UploadAttachments1.SaveAttachment(FormId);
            // Countersign1.SaveAndSubmit();//会签数据保存

            #region 工作流参数
            NameValueCollection dataFields = SetWFParams();
            if (dataFields == null)
            {
                return;
            }
            #endregion



            WorkflowHelper.CurrentUser = "******" + _BPMContext.CurrentUser.LoginId;
            AppDict appInfo = new Pkurg.BPM.Services.AppDictService().GetByAppId("10105");
            if (appInfo == null)
            {
                Alert("提交失败");
                return;
            }
            WorkflowHelper.StartProcess(appInfo.WorkFlowName, FormId, dataFields, ref wfInstanceId);
            if (wfInstanceId > 0)
            {
                if (SaveWorkFlowInstance("1", DateTime.Now, wfInstanceId.ToString()))
                {
                    SaveWorkItem();
                    //发布时释放代码
                    if (!AfterWorkflowStart(wfInstanceId))
                    {
                        return;
                    }
                    ScriptManager.RegisterClientScriptBlock(this, typeof(string), "1", "alert('提交成功');window.opener.location.href=window.opener.location.href;", true);
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ajax", " window.opener=null;window.open('', '_self', '');window.close();", true);

                    return;
                }
            }
        }

        Alert("提交失败");

        //WorkflowHelper.ApproveProcess
        //insert data to business object
    }
예제 #3
0
    /// <summary>
    /// 提交事件
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Submit_Click(object sender, EventArgs e)
    {
        string id       = ViewState["FormID"].ToString();
        var    dataInfo = SaveFormData();

        //如果起始部门为空,则弹出对话框
        if (dataInfo.StartDeptId == null)
        {
            Alert("人力系统中缺少部门信息,请联系人力同事完善!");
        }

        if (dataInfo != null)
        {
            UploadAttachments1.SaveAttachment(FormId);

            #region 工作流参数
            NameValueCollection dataFields = SetWFParams();
            if (dataFields == null)
            {
                return;
            }
            #endregion

            WorkflowHelper.CurrentUser = "******" + _BPMContext.CurrentUser.LoginId;
            AppDict appInfo = new Pkurg.BPM.Services.AppDictService().GetByAppId("10113");
            if (appInfo == null)
            {
                Alert("提交失败");
                return;
            }
            int wfInstanceId = 0; //process instance id
            WorkflowHelper.StartProcess(appInfo.WorkFlowName, FormId, dataFields, ref wfInstanceId);
            if (wfInstanceId > 0)
            {
                if (SaveWorkFlowInstance("1", DateTime.Now, wfInstanceId.ToString()))
                {
                    //保存工作流条目
                    SaveWorkItem();
                    DisplayMessage.ExecuteJs("alert('提交成功');");
                    AfterWorkflowStart();
                    ScriptManager.RegisterClientScriptBlock(this, typeof(string), "1", "alert('提交成功');window.opener.location.href=window.opener.location.href;", true);
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ajax", " window.opener=null; window.open('', '_self', '');window.close();", true);
                    return;
                }
            }
        }

        Alert("提交失败");
    }
예제 #4
0
    private void InitWorkFlowForm()
    {
        string appId = "";

        if (_BPMContext.ProcInst == null)
        {
            appId = Request["appid"];
            if (string.IsNullOrEmpty(appId))
            {
                //appid
                //ExceptionHander.GoToErrorPage();
                return;
            }
        }
        else
        {
            appId = _BPMContext.ProcInst.AppCode;
        }
        //新建流程
        Pkurg.BPM.Entities.AppDict appInfo = new Pkurg.BPM.Services.AppDictService().GetByAppId(appId);
        if (appInfo == null)
        {
            //appID错误
            ExceptionHander.GoToErrorPage();
            return;
        }

        AppInfo = appInfo;
        string appControlPath = "";

        if (Request.Url.AbsoluteUri.Contains("Start.aspx"))
        {
            appControlPath = "~/Workflow/EditPage/Forms/" + AppInfo.FormName;
        }
        else
        {
            appControlPath = "~/Workflow/ViewPage/Forms/" + AppInfo.FormName;
        }

        UWorkflowFormBase control = LoadControl(appControlPath) as UWorkflowFormBase;

        FromControl = control;
    }
예제 #5
0
    /// <summary>
    /// 开始发起流程
    /// </summary>
    /// <returns></returns>
    protected bool StartWorkFlow()
    {
        //验证APPID
        AppDict appInfo = new Pkurg.BPM.Services.AppDictService().GetByAppId(AppID);

        if (appInfo == null)
        {
            Alert("APPID不正确,提交失败");
            return(false);
        }

        #region 工作流参数
        NameValueCollection dataFields = SetWFParams();
        if (dataFields == null)
        {
            return(false);
        }
        #endregion

        int wfInstanceId = 0; //process instance id
        WorkflowHelper.StartProcess(appInfo.WorkFlowName, FormId, dataFields, ref wfInstanceId, _BPMContext.CurrentUser.LoginId);
        if (wfInstanceId > 0)
        {
            string instId = ChangeWorkFlowInstanceStart(wfInstanceId);
            if (!string.IsNullOrEmpty(instId))
            {
                if (!AfterWorkflowStart(wfInstanceId))
                {
                    return(false);
                }
                ScriptManager.RegisterClientScriptBlock(this, typeof(string), "1", "alert('提交成功');window.opener.location.href=window.opener.location.href;", true);
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ajax", " window.opener=null;window.open('', '_self', '');window.close();", true);
                return(true);
            }
        }
        return(false);
    }
    protected void Submit_Click(object sender, EventArgs e)
    {
        string id = ViewState["FormID"].ToString();
        string SaveVerification = SaveWFParams();

        if (string.IsNullOrEmpty(SaveVerification))
        {
            return;
        }
        #region 工作流参数
        NameValueCollection dataFields = SetWFParams();
        if (dataFields == null)
        {
            return;
        }
        #endregion

        InstructionOfPKURGIInfo obj = SaveData(id, "02");
        if (obj != null)
        {
            //开启流程
            WorkflowHelper.CurrentUser = "******" + _BPMContext.CurrentUser.LoginId;
            AppDict appInfo = new Pkurg.BPM.Services.AppDictService().GetByAppId("3001");
            if (appInfo == null)
            {
                Alert("提交失败");
                return;
            }
            int wfInstanceId = 0; //process instance id
            WorkflowHelper.StartProcess(@"K2Workflow\OA_InstructionOfPKURGI", id, dataFields, ref wfInstanceId);
            if (wfInstanceId > 0)
            {
                if (SaveWorkFlowInstance(obj, "1", DateTime.Now, wfInstanceId.ToString()))
                {
                    if (Eitems.UpdateStatus(id, "02"))
                    {
                        string           Opinion          = "";
                        string           ApproveResult    = "同意";
                        string           OpinionType      = "";
                        string           IsSign           = "0";
                        string           DelegateUserName = "";
                        string           DelegateUserCode = "";
                        WorkFlowInstance workFlowInstance = wf_WorkFlowInstance.GetWorkFlowInstanceByFormId(obj.FormID);

                        var appRecord = new Pkurg.PWorldBPM.Business.Sys.WF_Approval_Record()
                        {
                            ApprovalID = Guid.NewGuid().ToString(),

                            FormID            = id,
                            InstanceID        = workFlowInstance.InstanceId,
                            Opinion           = Opinion,
                            ApproveAtTime     = DateTime.Now,
                            ApproveByUserCode = CurrentEmployee.EmployeeCode,
                            ApproveByUserName = CurrentEmployee.EmployeeName,
                            ApproveResult     = ApproveResult,
                            OpinionType       = OpinionType,
                            CurrentActiveName = "拟稿",
                            ISSign            = IsSign,

                            DelegateUserName = DelegateUserName,
                            DelegateUserCode = DelegateUserCode,
                            CreateAtTime     = DateTime.Now,
                            CreateByUserCode = CurrentEmployee.EmployeeCode,
                            CreateByUserName = CurrentEmployee.EmployeeName,
                            UpdateAtTime     = DateTime.Now,
                            UpdateByUserCode = CurrentEmployee.EmployeeCode,
                            UpdateByUserName = CurrentEmployee.EmployeeName,
                            FinishedTime     = DateTime.Now
                        };
                        BFApprovalRecord bfApproval = new BFApprovalRecord();
                        bfApproval.AddApprovalRecord(appRecord);
                    }
                    ScriptManager.RegisterClientScriptBlock(this, typeof(string), "1", "alert('提交成功');", true);
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ajax", " window.opener=null; window.open('', '_self', '');window.close();", true);
                }
            }
        }
        Alert("提交失败");
    }