/// <summary>
    /// 批准事件
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Agree_Click(object sender, EventArgs e)
    {
        WorkFlowInstance workFlowInstance = wf_WorkFlowInstance.GetWorkFlowInstanceByFormId(FormID);
        bool             IsSubmit         = true;

        if (nodeName.Value == "流程审核员审核")
        {
            SaveWFParams();
            UpdateWFParams();
            SaveData(ViewState["FormID"].ToString(), "");
        }

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

                if (isSuccess && !(bool)ViewState["IsSubmit"])
                {
                    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))
                    {
                        ViewState["IsSubmit"] = true;
                        wf_WorkFlowInstance.UpdateStatus(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);
                    }
                }
            }
        }
    }
Пример #2
0
    //批准
    protected void Save_Click(object sender, EventArgs e)
    {
        string           id = ViewState["FormID"].ToString();
        WorkFlowInstance workFlowInstance = wf_WorkFlowInstance.GetWorkFlowInstanceByFormId(id);

        if (workFlowInstance != null)
        {
            UploadAttachments1.SaveAttachment(id);
            Countersign1.SaveAndSubmit();
            //
            string action    = "同意";
            bool   isSuccess = WorkflowHelper.ApproveProcess(sn.Value, action);

            string 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            = id,
                    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))
                {
                    if (WorkflowHelper.GetProcessInstance(int.Parse(workFlowInstance.WfInstanceId)).Status1 == ProcessInstance.Status.Completed)
                    {
                        wf_WorkFlowInstance.UpdateStatus(workFlowInstance.WfInstanceId, "2", nodeID.Value, nodeName.Value, int.Parse(taskID.Value), DateTime.Now, CurrentEmployee);

                        if (wf_Instruction.UpdateStatus(id, "04", workFlowInstance.WfInstanceId))
                        {
                            WebCommon.Show(this, Resources.Message.ApplicationReviewSucess);
                            Response.Redirect("~/Workflow/ToDoWorkList.aspx", false);
                        }
                    }
                    else
                    {
                        wf_WorkFlowInstance.UpdateStatus(workFlowInstance.WfInstanceId, "1", nodeID.Value, nodeName.Value, int.Parse(taskID.Value), null, CurrentEmployee);

                        if (wf_Instruction.UpdateStatus(id, "03", workFlowInstance.WfInstanceId))
                        {
                            WebCommon.Show(this, Resources.Message.ApplicationReviewSucess);
                            Response.Redirect("~/Workflow/ToDoWorkList.aspx", false);
                        }
                    }
                }
            }
        }
    }
    /// <summary>
    /// 批准事件
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Agree_Click(object sender, EventArgs e)
    {
        string           id = ViewState["FormID"].ToString();
        WorkFlowInstance workFlowInstance = wf_WorkFlowInstance.GetWorkFlowInstanceByFormId(id);

        if (workFlowInstance != null)
        {
            UploadAttachments1.SaveAttachment(id);
            string action      = "同意";
            string currentName = K2_TaskItem.ActivityInstanceDestination.Name;
            if (currentName == "招标委员会主任意见" || currentName == "集团招标委员会主任意见")
            {
                //如果招标委员会意见是同意,则之前的意见可以忽略,只看招标委员会主任的意见
                ChangeResultToAgree();
            }
            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 && !(bool)ViewState["IsSubmit"])
            {
                var appRecord = new Pkurg.PWorldBPM.Business.Sys.WF_Approval_Record()
                {
                    //????
                    ApprovalID        = Guid.NewGuid().ToString(),
                    WFTaskID          = int.Parse(taskID.Value),
                    FormID            = id,
                    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
                };
                ViewState["IsSubmit"] = true;
                if (bfApproval.AddApprovalRecord(appRecord))
                {
                    wf_WorkFlowInstance.UpdateStatus(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);
                }
            }
        }
    }
Пример #4
0
    //批准
    protected void Agree_Click(object sender, EventArgs e)
    {
        string           id = ViewState["FormID"].ToString();
        WorkFlowInstance workFlowInstance = wf_WorkFlowInstance.GetWorkFlowInstanceByFormId(id);

        if (workFlowInstance != null)
        {
            UploadAttachments1.SaveAttachment(id);
            Countersign1.SaveAndSubmit();
            //
            string action    = "同意";
            bool   isSuccess = WorkflowHelper.ApproveProcess(sn.Value, action);
            string Opinion   = "";
            if (GetApproveOpinion(nodeName.Value) == null || GetApproveOpinion(nodeName.Value) == "")
            {
                Opinion = "同意";
            }
            else
            {
                Opinion = GetApproveOpinion(nodeName.Value);
            }
            string ApproveResult    = "同意";
            string OpinionType      = "";
            string IsSign           = "0";
            string DelegateUserName = "";
            string DelegateUserCode = "";

            if (isSuccess && !(bool)ViewState["IsSubmit"])
            {
                var appRecord = new Pkurg.PWorldBPM.Business.Sys.WF_Approval_Record()
                {
                    ApprovalID        = Guid.NewGuid().ToString(),
                    WFTaskID          = int.Parse(taskID.Value),
                    FormID            = id,
                    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
                };
                ViewState["IsSubmit"] = true;
                if (bfApproval.AddApprovalRecord(appRecord))
                {
                    wf_WorkFlowInstance.UpdateStatus(workFlowInstance.WfInstanceId, "1", nodeID.Value, nodeName.Value, int.Parse(taskID.Value), null, CurrentEmployee);

                    if (wf_Instruction.UpdateStatus(id, "03", workFlowInstance.WfInstanceId))
                    {
                        ScriptManager.RegisterClientScriptBlock(this, typeof(string), "1", "alert('审批成功'); window.close();", true);
                    }
                }
            }

            Countersign1.SaveAndSubmit();
        }
    }
Пример #5
0
    //批准
    protected void Agree_Click(object sender, EventArgs e)
    {
        string id = ViewState["FormID"].ToString();
        WorkFlowInstance workFlowInstance = wf_WorkFlowInstance.GetWorkFlowInstanceByFormId(id);

        if (workFlowInstance != null)
        {
            //修改合同编号 2015-08-05 by yanghechun
            //2015-8-5 经办人确认生效
            //更新合同编号
            if (nodeName.Value == "经办人确认生效")
            {
                if (txtContract_No.Text.Trim() == "")
                {
                    Alert(Page, "合同编号不能为空,请输入!");
                    txtContract_No.Focus();
                    return;
                }
                try
                {
                    ContractClass contractClass = new ContractClass();
                    int biz_type = Convert.ToInt16(hf_biz_type.Value);
                    int biz_id = Convert.ToInt16(hf_biz_id.Value);
                    contractClass.UpdateContractNo(biz_type, biz_id, txtContract_No.Text.Trim());
                }
                catch
                {
                }
            }

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

            if (isSuccess && !(bool)ViewState["IsSubmit"])
            {
                var appRecord = new Pkurg.PWorldBPM.Business.Sys.WF_Approval_Record()
                {
                     ApprovalID = Guid.NewGuid().ToString(),
                     WFTaskID = int.Parse(taskID.Value),
                    FormID = id,
                    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))
                {
                    ViewState["IsSubmit"] = true;
                    wf_WorkFlowInstance.UpdateStatus(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);
                }
            }
        }
    }