示例#1
0
        /// <summary>
        /// approve process
        /// </summary>
        /// <param name="action">approval action</param>
        /// <returns></returns>
        public bool ApproveProcess(ProcessAction action)
        {
            if (SaveData(action))
            {
                if (WorkflowHelper.ApproveProcess(ProcessSN, action.ToString()))
                {
                    ProcessLog(action.ToString());
                    #region refresh my work
                    //int count = 0;
                    //if (Request.Cookies["MyWork"] != null)
                    //{
                    //    HttpCookie cookie = Request.Cookies["MyWork"];
                    //    Response.Cookies.Remove("MyWork");
                    //    count = Convert.ToInt32(cookie.Values["Count"]) - 1;
                    //    //count = Convert.ToInt32(SqlHelper.ExecuteScalar(Database.K2Server, "GetMyWorkCount", new SqlParameter[] { new SqlParameter("@nvchrMUID", Page.User.Identity.Name) }));
                    //    cookie.Values["Count"] = count.ToString();
                    //    Response.Cookies.Add(cookie);
                    //}
                    //ClientScript.RegisterStartupScript(this.GetType(), "", "if(window.opener!=null)\nwindow.opener.ReGetMyWork();", true);
                    #endregion

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
示例#2
0
        /// <summary>
        /// 发起流程(POC)
        /// </summary>
        /// <param name="action"></param>
        /// <param name="flowName"></param>
        /// <returns></returns>
        public bool StartProcess(ProcessAction action, string flowName, ref int ProcInstID)
        {
            if (SaveData(action))
            {
                string fullName = flowName;

                ProcInstID = -1;             //added by lee

                ProcControl.GetDataFields(); //取得datafields
                ProcControl.GetXmlFields();  //取得xmlfields

                if (WorkflowHelper.StartProcess(fullName, FormID, DataFields, XmlFields, ref ProcInstID))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
示例#3
0
        /// <summary>
        /// start process
        /// </summary>
        /// <param name="action">process action</param>
        /// <returns></returns>
        public bool StartProcess(ProcessAction action)
        {
            if (SaveData(action))
            {
                ProcControl.GetDataFields();
                string fullName = "SohuBPMFlow\\OAF"; //SqlHelper.ExecuteScalar(Database.MerckHRWorkFlow, "GetWorkflowFullName", new SqlParameter[] { new SqlParameter("@intWorkflowID", WorkflowID) }).ToString();

                int ProcInstID = -1;                  //added by lee

                //if (WorkflowHelper.StartProcess(MUID, Password, fullName, ClaimID, DataFields))//FBA to AD
                //if (WorkflowHelper.StartProcess(fullName, ClaimID, DataFields))
                if (WorkflowHelper.StartProcess(fullName, FormID, DataFields, ref ProcInstID))
                {
                    //流程启动成功,得到K2返回的 ProcessInstance ID,通过FormID来更改这个表单的ProcessID
                    UpdateProcInstID(ProcInstID, FormID);//edit by lee 2011-5-31
                    return(ProcessLog(ProcessAction.Submit.ToString()));
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
示例#4
0
 public bool ApproveProcess(ProcessAction action, bool result, string activityName)
 {
     if (result)
     {
         if (WorkflowHelper.ApproveProcess(ProcessSN, action.ToString()))
         {
             ProcessLog(action.ToString(), activityName);
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
示例#5
0
 /// <summary>
 /// 通过接口进行审批
 /// </summary>
 /// <param name="action"></param>
 /// <param name="currentUser"></param>
 /// <param name="activityXML"></param>
 /// <returns></returns>
 public bool ApproveProcess(ProcessAction action, string activityXML, string currentUser)
 {
     if (SaveData(action))
     {
         if (WorkflowHelper.ApproveProcess(ProcessSN, action.ToString(), CurrentUser, activityXML))
         {
             ProcessLog(action.ToString());
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
示例#6
0
        public bool StartProcess(ProcessAction action, string flowName)
        {
            if (SaveData(action))
            {
                ProcControl.GetDataFields();
                string fullName = "";
                if (WorkflowID == 3)
                {
                    fullName = flowName;
                }
                else
                {
                    fullName = "SohuBPMFlow\\TAF";
                }//SqlHelper.ExecuteScalar(Database.MerckHRWorkFlow, "GetWorkflowFullName", new SqlParameter[] { new SqlParameter("@intWorkflowID", WorkflowID) }).ToString();

                int ProcInstID = -1;//added by lee


                if (WorkflowHelper.StartProcess(fullName, FormID, DataFields, ref ProcInstID))
                {
                    //流程启动成功,得到K2返回的 ProcessInstance ID,通过FormID来更改这个表单的ProcessID
                    if (WorkflowID != 3)
                    {
                        return(UpdateProcInstID(ProcInstID, FormID, "TAF"));//edit by lee 2011-5-31
                    }
                    else
                    {
                        return(true);//edit by lee
                    }
                    // return ProcessLog(ProcessAction.Submit.ToString());
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
示例#7
0
        /// <summary>
        /// 初始化ProcessLog操作者
        /// </summary>
        //private Biz.Biz_ProcessLog processlogOP = new Biz.Biz_ProcessLog();
        #endregion

        #region page methods

        #region save data
        public bool SaveData(ProcessAction action)
        {
            bool result = false;

            #region save form data
            if (ProcControl.EnabledModify || action == ProcessAction.Confirm || ProcControl.IsEnableEditPage)
            {
                if (action == ProcessAction.Reject || action == ProcessAction.Cancel)
                {
                    result = true;
                }
                else if (ProcControl.SaveData(action))
                {
                    if (action == ProcessAction.Rework)
                    {
                        IsReWorkPage = true;
                    }
                    if (action == ProcessAction.Rework)
                    {
                        ProcControl.UpdateDataFields();
                        //FBA to AD
                        //result = WorkflowHelper.UpdateDataFields(MUID, Password, ProcessSN, DataFields);
                        result = WorkflowHelper.UpdateDataFields(ProcessSN, DataFields);
                    }
                    else
                    {
                        result = true;
                    }
                }
                else
                {
                    result = false;
                }
            }
            else if (action == ProcessAction.Approve || action == ProcessAction.Reject || action == ProcessAction.ApproveSave || IsHRSubmitPage)
            {
                //姚骁然修改(因为当审批人选择拒绝时,所作修改均无效)
                if (WorkflowID != 3)
                {
                    ProcControl.SaveData(action);
                    if (IsHRSubmitPage)
                    {
                        ActivityName = "HR C&B";//Test by lee
                    }
                }
                result = true;
            }
            else if (IsOnBoardSubmitPage)
            {
                result = true;
            }
            else
            {
                ProcControl.UpdateDataFields();
                //FBA to AD
                //WorkflowHelper.UpdateDataFields(MUID, Password, ProcessSN, DataFields);
                WorkflowHelper.UpdateDataFields(ProcessSN, DataFields);
                result = true;
            }
            #endregion

            if (action == ProcessAction.SubmitHRBP || action == ProcessAction.SaveHRDraft || action == ProcessAction.SubmitHRBPDraft || action == ProcessAction.Reject || action == ProcessAction.Submit || action == ProcessAction.SubmitDraft || action == ProcessAction.Cancel || action == ProcessAction.Rework || action == ProcessAction.SaveDraft || action == ProcessAction.SubmitHRCB)
            {
                UpdateProcessStatus(GetProcessStatus(action).ToString());
            }
            //HR BP在员工录入时虽然没有启动流程,但是此时需要计入操作历史记录中
            if (action == ProcessAction.SubmitHRBP || action == ProcessAction.SubmitHRBPDraft)
            {
                if (WorkflowID == 2 && IsStartPage == true)
                {
                    ProcessLog(ProcessAction.SubmitHRCB.ToString(), "HRBP");
                    ProcessLog(ProcessAction.SubmitHRBP.ToString(), "HRBP");
                }
                else
                {
                    ProcessLog(ProcessAction.SubmitHRBP.ToString(), "HRBP");
                }
            }
            if (action == ProcessAction.SubmitHRCB)
            {
                ProcessLog(ProcessAction.SubmitHRCB.ToString(), "HRBP");
            }

            //判断是否是自定义流程
            if (WorkflowID == 3)
            {
                //自定义流程提交处理
                if (action == ProcessAction.SubmitCF)   //提交
                {
                    ProcControl.SaveData(action);
                    //UpdateProcessStatus(GetProcessStatus(action).ToString(), FormID, "CustomFlow");
                    ProcessLog(ProcessAction.SubmitCF.ToString(), "提交");
                }
                if (action == ProcessAction.Rework)     //重提交
                {
                    ProcControl.SaveData(action);
                    ProcessLog(ProcessAction.SubmitCF.ToString(), "重提交");
                }
                if ((action == ProcessAction.SaveDraft || action == ProcessAction.Save) && IsHRSubmitPage != true)  //保存
                {
                    ProcControl.SaveData(action);
                }
                if (action == ProcessAction.Approve)     //审批
                {
                    ProcControl.SaveData(action);
                    ProcControl.UpdateDataFields();
                    WorkflowHelper.UpdateDataFields(ProcessSN, DataFields);
                }
                if (action == ProcessAction.ApproveSave)    //审批保存
                {
                    ProcControl.SaveData(action);
                    //还要保存审批记录
                }
                if (action == ProcessAction.Reject)      //拒绝
                {
                }
                if (action == ProcessAction.SubmitDraft)     //从草稿箱提交
                {
                    ProcControl.SaveData(action);
                    ProcessLog(action.ToString(), "提交");
                }
                if (action == ProcessAction.StartCounter)
                {
                    ProcControl.SaveData(action);
                }
            }
            return(result);
        }
示例#8
0
        protected override void OnLoad(EventArgs e)
        {
            if (!IsPostBack)
            {
                #region approval page

                if (!string.IsNullOrEmpty(Request.QueryString["SN"]))
                {
                    ProcessSN = Request.QueryString["SN"];
                    string formID       = string.Empty;
                    string activityName = string.Empty;
                    string processID    = string.Empty;
                    string approveXML   = string.Empty;     //取得审批XML
                    //FBA to AD
                    //WorkflowHelper.GetProcessInfo(MUID, Password, ProcessSN, ref processID, ref activityName);
                    //任务占用提示 edit by lee
                    try
                    {
                        //WorkflowHelper.GetProcessInfo(ProcessSN, ref formID, ref processID, ref activityName, ref approveXML);//,StaffNo);
                        WorkflowHelper.GetSCFProcessInfo(ProcessSN, ref formID, ref processID, ref activityName, ref approveXML);
                        FormID = formID;
                        //ProcessID = processID;
                        string FName = FormID.Substring(0, 3);
                        ActivityName = activityName;
                        ActivityXml  = approveXML;
                    }
                    catch (Exception ex)
                    {
                        //is not allowed to open the worklist item with
                        if (ex.Message.Contains("26030"))
                        {
                            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "js", "try{ymPrompt=top.ymPrompt}catch(e){} ymPrompt.alert({ message: '此任务已被他人处理或占用,您已无法处理!', title: '任务提示', handler:function() {window.location.href='/WorkSpace/MyWorklist.aspx ';}});", true);
                            return;
                        }
                        else
                        {
                            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "js", "try{ymPrompt=top.ymPrompt}catch(e){} ymPrompt.alert({ message: '此任务已被他人处理或被占用!', title: '任务提示', handler:function() {window.location.href='/WorkSpace/MyWorklist.aspx ';}});", true);
                            return;
                        }
                    }

                    //if (ActivityPageName(FName) != GetPageName())
                    //    throw new Exception("00001 You have no permission to open this process.");
                }
                #endregion

                #region HR C&B
                if (!string.IsNullOrEmpty(Request.QueryString["FormID"]))
                {
                    FormID = Request.QueryString["FormID"];
                }
                #endregion


                #region draft page
                if (!string.IsNullOrEmpty(Request.QueryString["FormID"]) && IsDraftPage)
                {
                    FormID = Request.QueryString["FormID"];
                }
                #endregion
            }
            base.OnLoad(e);
        }