Пример #1
0
    private bool AddApprovalOption(string sn, string action, string opinion, string isSign, string activityName)
    {
        string DelegateUserName  = "";
        string DelegateUserCode  = "";
        string currentActiveName = activityName;
        var    appRecord         = new Pkurg.PWorldBPM.Business.Sys.WF_Approval_Record()
        {
            ApprovalID = Guid.NewGuid().ToString(),

            FormID            = _BPMContext.ProcInst.FormId,
            InstanceID        = _BPMContext.ProcInst.ProcId,
            CurrentActiveName = currentActiveName,

            ApproveResult = action,  //审批结果
            Opinion       = opinion, //用户填写的审批意见
            ISSign        = isSign,


            OpinionType       = "",
            CurrentActiveID   = "0",
            DelegateUserName  = DelegateUserName,
            DelegateUserCode  = DelegateUserCode,
            CreateAtTime      = DateTime.Now,
            CreateByUserCode  = _BPMContext.CurrentPWordUser.EmployeeCode,
            CreateByUserName  = _BPMContext.CurrentPWordUser.EmployeeName,
            UpdateAtTime      = DateTime.Now,
            UpdateByUserCode  = _BPMContext.CurrentPWordUser.EmployeeCode,
            UpdateByUserName  = _BPMContext.CurrentPWordUser.EmployeeName,
            ApproveAtTime     = DateTime.Now,
            ApproveByUserCode = _BPMContext.CurrentPWordUser.EmployeeCode,
            ApproveByUserName = _BPMContext.CurrentPWordUser.EmployeeName,
            FinishedTime      = DateTime.Now,
            ApproveStatus     = IsFromPC ? "" : "Mobile"
        };

        bfApproval.AddApprovalRecord(appRecord);
        wf_WorkFlowInstance.UpdateNowStatus(_BPMContext.ProcInst.WorkflowId, "1", "0", currentActiveName, 0, null, _BPMContext.CurrentUser.PWordUser);
        return(true);
    }
Пример #2
0
    /// <summary>
    /// 通一增加审批意见,不涉及流程引擎
    /// </summary>
    /// <param name="action"></param>
    /// <param name="opinion"></param>
    /// <param name="isSign"></param>
    /// <param name="currentActiveName"></param>
    private void AddApprovalOption(string action, string opinion, string isSign, string currentActiveName)
    {
        string DelegateUserName = "";
        string DelegateUserCode = "";
        var    appRecord        = new Pkurg.PWorldBPM.Business.Sys.WF_Approval_Record()
        {
            ApprovalID = Guid.NewGuid().ToString(),

            FormID            = workFlowInstance.FormId,
            InstanceID        = workFlowInstance.InstanceId,
            CurrentActiveName = currentActiveName,

            ApproveResult = action,  //审批结果
            Opinion       = opinion, //用户填写的审批意见
            ISSign        = isSign,


            OpinionType = "",

            DelegateUserName  = DelegateUserName,
            DelegateUserCode  = DelegateUserCode,
            CreateAtTime      = DateTime.Now,
            CreateByUserCode  = _BPMContext.CurrentPWordUser.EmployeeCode,
            CreateByUserName  = _BPMContext.CurrentPWordUser.EmployeeName,
            UpdateAtTime      = DateTime.Now,
            UpdateByUserCode  = _BPMContext.CurrentPWordUser.EmployeeCode,
            UpdateByUserName  = _BPMContext.CurrentPWordUser.EmployeeName,
            ApproveAtTime     = DateTime.Now,
            ApproveByUserCode = _BPMContext.CurrentPWordUser.EmployeeCode,
            ApproveByUserName = _BPMContext.CurrentPWordUser.EmployeeName,
            FinishedTime      = DateTime.Now
        };

        bfApproval.AddApprovalRecord(appRecord);
        wf_WorkFlowInstance.UpdateNowStatus(workFlowInstance.WfInstanceId, "1", "0", currentActiveName, 0, null, _BPMContext.CurrentUser.PWordUser);
    }
Пример #3
0
    //批准
    protected void Agree_Click(object sender, EventArgs e)
    {
        WorkFlowInstance workFlowInstance = wf_WorkFlowInstance.GetWorkFlowInstanceByFormId(FormId);

        if (workFlowInstance != null)
        {
            uploadAttachments.SaveAttachment(FormId);

            UpdateWFParams();
            string action        = "同意";
            bool   isSuccess     = WorkflowHelper.ApproveProcess(sn.Value, action, "founder\\" + _BPMContext.CurrentUser.LoginId);
            string optionDefault = "同意";
            string Opinion       = "";
            if (GetApproveOpinion(nodeName.Value) == null || GetApproveOpinion(nodeName.Value) == "")
            {
                Opinion = optionDefault;
            }
            else
            {
                Opinion = GetApproveOpinion(nodeName.Value);
            }
            string ApproveResult    = "同意";
            string OpinionType      = "";
            string IsSign           = "0";
            string DelegateUserName = "";
            string DelegateUserCode = "";

            if (isSuccess)
            {
                var appRecord = new Pkurg.PWorldBPM.Business.Sys.WF_Approval_Record()
                {
                    ApprovalID        = Guid.NewGuid().ToString(),
                    WFTaskID          = int.Parse(taskID.Value),
                    FormID            = FormId,
                    InstanceID        = workFlowInstance.InstanceId,
                    Opinion           = Opinion,
                    ApproveAtTime     = DateTime.Now,
                    ApproveByUserCode = CurrentEmployee.EmployeeCode,
                    ApproveByUserName = CurrentEmployee.EmployeeName,
                    ApproveResult     = ApproveResult,
                    OpinionType       = OpinionType,
                    CurrentActiveName = nodeName.Value,
                    ISSign            = IsSign,
                    CurrentActiveID   = nodeID.Value,
                    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
                };

                if (bfApproval.AddApprovalRecord(appRecord))
                {
                    wf_WorkFlowInstance.UpdateNowStatus(workFlowInstance.WfInstanceId, "1", nodeID.Value, nodeName.Value, int.Parse(taskID.Value), null, CurrentEmployee);
                    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);
                }
            }
        }
    }
    /// <summary>
    /// 拒绝事件
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Reject_Click(object sender, EventArgs e)
    {
        WorkFlowInstance workFlowInstance = wf_WorkFlowInstance.GetWorkFlowInstanceByFormId(FormID);

        if (workFlowInstance != null)
        {
            UploadAttachments1.SaveAttachment(FormID);
            string action = "不同意";
            //得到节点名称
            string currentName = K2_TaskItem.ActivityInstanceDestination.Name;
            if (currentName == "集团招标委员会意见" || currentName == "招标委员会意见")
            {
                action = "同意";
                ChangeResultToNext();//在招标委员会节点上不同意时触发的函数【流程扭转到下一个招标委员会主任节点】
            }
            else
            {
                ChangeResultToUnAgree();//不同意时触发的函数
            }

            bool   isSuccess = WorkflowHelper.ApproveProcess(sn.Value, action, "founder\\" + _BPMContext.CurrentUser.LoginId);
            string Opinion   = GetApproveOpinion(nodeName.Value);
            if (string.IsNullOrEmpty(Opinion))
            {
                Opinion = "不同意";
            }
            string ApproveResult    = "不同意";
            string OpinionType      = "";
            string IsSign           = "0";
            string DelegateUserName = "";
            string DelegateUserCode = "";
            if (isSuccess)
            {
                var appRecord = new Pkurg.PWorldBPM.Business.Sys.WF_Approval_Record()
                {
                    ApprovalID        = Guid.NewGuid().ToString(),
                    WFTaskID          = int.Parse(taskID.Value),
                    FormID            = FormID,
                    InstanceID        = workFlowInstance.InstanceId,
                    Opinion           = Opinion,
                    ApproveAtTime     = DateTime.Now,
                    ApproveByUserCode = CurrentEmployee.EmployeeCode,
                    ApproveByUserName = CurrentEmployee.EmployeeName,
                    ApproveResult     = ApproveResult,
                    OpinionType       = OpinionType,
                    CurrentActiveName = nodeName.Value,
                    ISSign            = IsSign,
                    CurrentActiveID   = nodeID.Value,
                    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
                };

                bfApproval.AddApprovalRecord(appRecord);
                wf_WorkFlowInstance.UpdateNowStatus(workFlowInstance.WfInstanceId, "1", nodeID.Value, nodeName.Value, int.Parse(taskID.Value), null, CurrentEmployee);
            }
            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);
        }

        //WorkflowHelper.ApproveProcess
        //insert data to business object
    }