Ejemplo n.º 1
0
        /// <summary>
        /// 保存为草稿
        /// </summary>
        /// <param name="WorkID">工作ID</param>
        /// <returns>操作结果</returns>
        public ActionResult SaveAsDraft(int WorkID)
        {
            var work = NH.Session.QueryOver <WF_GenerWorkFlow>().Where(x => x.WorkID == WorkID).List().FirstOrDefault();
            var flow = NH.Session.Load <WF_Flow>(work.FK_Flow);

            if (string.IsNullOrEmpty(work.YWH))
            {
                var ywh = Sys_BH.GetBH(flow.BHID);
                work.YWH = ywh;
                work.SaveOrUpdate();
            }
            try
            {
                if (work == null)
                {
                    throw new Exception("找不到该流程");
                }

                FlowService.OnSaveAsDraft(work.FK_Flow, WorkID, work.YWH);

                BP.WF.Dev2Interface.Node_SetDraft(work.FK_Flow, work.WorkID);
            }
            catch (DomainException ex)
            {
                return(Json_Get(new { success = false, msg = ex.Message }));
            }
            catch (Exception ex)
            {
                return(Json_Get(new { success = false, msg = "保存失败,请联系管理员!" }));
            }

            return(Json_Get(new { success = true }));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 发送流程
        /// </summary>
        /// <param name="WorkID"></param>
        /// <param name="NodeID"></param>
        /// <param name="ToNodeID"></param>
        /// <param name="WFPARAMS"></param>
        /// <param name="NEXTWORKER"></param>
        /// <returns></returns>
        public ActionResult Node_SendWork(int WorkID, int NodeID, int ToNodeID = 0, List <KeyValuePair <string, string> > WFPARAMS = null, string NEXTWORKER = null)
        {
            var work = NH.Session.Load <WF_GenerWorkFlow>(WorkID);
            var flow = NH.Session.Load <WF_Flow>(work.FK_Flow);

            if (string.IsNullOrEmpty(work.YWH))
            {
                var ywh = Sys_BH.GetBH(flow.BHID);
                work.YWH = ywh;
                work.Update();
            }
            var node = new BP.WF.Node(NodeID);

            using (var trans = NH.Session.BeginTransaction())
            {
                try
                {
                    BP.WF.Dev2Interface.Port_Login(ApplicationUser.Current.Name, "dd2f628c-3f38-4c8c-aa83-1a52ebf6a45a");
                    if (node.IsEndNode)
                    {
                        FlowService.OnCompleted(work.FK_Flow, WorkID, work.YWH, NodeID);
                    }
                    else
                    {
                        FlowService.OnSend(work.FK_Flow, WorkID, work.YWH, NodeID);
                    }

                    WFPARAMS = WFPARAMS == null ? new List <KeyValuePair <string, string> >() : WFPARAMS;

                    var result = BP.WF.Dev2Interface.Node_SendWork(work.FK_Flow, WorkID, ToNodeID, NEXTWORKER);

                    trans.Commit();

                    var message = string.Format("案件【{0}】办理成功!", work.YWH);
                    return(Json(new { success = true, message = message }));
                }
                catch (DomainException ex)
                {
                    trans.Rollback();
                    return(Json(new { success = false, message = ex.Message }));
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    return(Json(new { success = false, message = ex.Message }));
                }
            }
        }