Exemple #1
0
 public virtual bool AddSign(string fromUserCode, string toUserCode, string sn, string instanceId, string remark)
 {
     try
     {
         string action = "加签";
         //if (string.IsNullOrWhiteSpace(remark))
         //{
         //    remark = action;
         //}
         //置为空不显示
         activityName = GetCurrentActiveName(sn);
         WorkflowHelper.ForwardToNextApprover(_BPMContext.Sn, fromUserCode, toUserCode);
         return(AddApprovalOption(sn, action, remark, "2", activityName) && AfterAddOrChangeSign(fromUserCode, toUserCode, instanceId, action, remark));
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemple #2
0
    protected void lbSelected_Command(object sender, CommandEventArgs e)
    {
        int result = 0;

        try
        {
            string userDomainName = e.CommandArgument.ToString();
            //DisplayMessage.ExecuteJs("alert('" + userDomainName + "')");
            //return;
            if (userDomainName.ToLower().Contains("founder\\"))
            {
                userDomainName = "founder\\" + userDomainName;
            }

            WorkflowHelper.ForwardToNextApprover(_BPMContext.Sn, _BPMContext.CurrentUser.LoginId, userDomainName);

            string Opinion = Request["optionTxt"];

            //2015-1-26 对加签的已办做增加Item处理,去掉为空意见优化
            string ApproveResult    = "加签";
            string OpinionType      = "";
            string IsSign           = "1";
            string DelegateUserName = "";
            string DelegateUserCode = "";

            WorkFlowInstance workFlowInstance = new WF_WorkFlowInstance().GetWorkFlowInstanceById(_BPMContext.ProcID);
            var appRecord = new Pkurg.PWorldBPM.Business.Sys.WF_Approval_Record()
            {
                ApprovalID        = Guid.NewGuid().ToString(),
                WFTaskID          = K2_TaskItem.ID,
                FormID            = workFlowInstance.FormId,
                InstanceID        = workFlowInstance.InstanceId,
                Opinion           = Opinion,
                ApproveAtTime     = DateTime.Now,
                ApproveByUserCode = _BPMContext.CurrentPWordUser.EmployeeCode,
                ApproveByUserName = _BPMContext.CurrentPWordUser.EmployeeName,
                ApproveResult     = ApproveResult,
                OpinionType       = OpinionType,
                CurrentActiveName = CustomWorkflowHelper.SuperNodeName == K2_TaskItem.ActivityInstanceDestination.Name ? CustomWorkflowDataProcess.GetCurrentStepNameById(_BPMContext.ProcID, K2_TaskItem.ActivityInstanceDestination.Name) : K2_TaskItem.ActivityInstanceDestination.Name,
                ISSign            = IsSign,
                CurrentActiveID   = K2_TaskItem.ActivityInstanceDestination.ActID.ToString(),
                DelegateUserName  = DelegateUserName,
                DelegateUserCode  = DelegateUserCode,
                CreateAtTime      = K2_TaskItem.ActivityInstanceDestination.StartDate,
                CreateByUserCode  = _BPMContext.CurrentPWordUser.EmployeeCode,
                CreateByUserName  = _BPMContext.CurrentPWordUser.EmployeeName,
                UpdateAtTime      = DateTime.Now,
                UpdateByUserCode  = _BPMContext.CurrentPWordUser.EmployeeCode,
                UpdateByUserName  = _BPMContext.CurrentPWordUser.EmployeeName,
                FinishedTime      = DateTime.Now
            };

            if (new BFApprovalRecord().AddApprovalRecord(appRecord))
            {
                if (new WF_WorkFlowInstance().UpdateStatus(workFlowInstance.WfInstanceId,
                                                           "1", K2_TaskItem.ActivityInstanceDestination.ID.ToString(),
                                                           K2_TaskItem.ActivityInstanceDestination.Name, K2_TaskItem.ID, null,
                                                           _BPMContext.CurrentPWordUser))
                {
                    result = 1;
                }
            }

            //if (string.IsNullOrEmpty(Opinion))
            //{
            //    result = 1;
            //}
            //else
            //{
            //    string ApproveResult = "加签";
            //    string OpinionType = "";
            //    string IsSign = "1";
            //    string DelegateUserName = "";
            //    string DelegateUserCode = "";

            //    WorkFlowInstance workFlowInstance = new WF_WorkFlowInstance().GetWorkFlowInstanceById(_BPMContext.ProcID);
            //    var appRecord = new Pkurg.PWorldBPM.Business.Sys.WF_Approval_Record()
            //    {
            //        ApprovalId = Guid.NewGuid().ToString(),
            //        WfTaskId = K2_TaskItem.ID,
            //        FormId = workFlowInstance.FormId,
            //        InstanceId = workFlowInstance.InstanceId,
            //        Opinion = Opinion,
            //        ApproveAtTime = DateTime.Now,
            //        ApproveByUserCode = _BPMContext.CurrentPWordUser.EmployeeCode,
            //        ApproveByUserName = _BPMContext.CurrentPWordUser.EmployeeName,
            //        ApproveResult = ApproveResult,
            //        OpinionType = OpinionType,
            //        CurrentActiveName = K2_TaskItem.ActivityInstanceDestination.Name,
            //        IsSign = IsSign,
            //        CurrentActiveId = K2_TaskItem.ActivityInstanceDestination.ActID.ToString(),
            //        DelegateUserName = DelegateUserName,
            //        DelegateUserCode = DelegateUserCode,
            //        CreateAtTime = K2_TaskItem.ActivityInstanceDestination.StartDate,
            //        CreateByUserCode = _BPMContext.CurrentPWordUser.EmployeeCode,
            //        CreateByUserName = _BPMContext.CurrentPWordUser.EmployeeName,
            //        UpdateAtTime = DateTime.Now,
            //        UpdateByUserCode = _BPMContext.CurrentPWordUser.EmployeeCode,
            //        UpdateByUserName = _BPMContext.CurrentPWordUser.EmployeeName,
            //        FinishedTime = DateTime.Now
            //    };

            //    if (new BFApprovalRecord().AddApprovalRecord(appRecord))
            //    {
            //        if (new WF_WorkFlowInstance().UpdateStatus(workFlowInstance.WfInstanceId,
            //            "1", K2_TaskItem.ActivityInstanceDestination.ID.ToString(),
            //            K2_TaskItem.ActivityInstanceDestination.Name, K2_TaskItem.ID, null,
            //            _BPMContext.CurrentPWordUser))
            //        {
            //            result = 1;
            //        }
            //    }
            //}
        }
        catch (Exception)
        {
        }
        DisplayMessage.ExecuteJs(string.Format("window.returnValue = {0};window.close();", result));
    }