Ejemplo n.º 1
0
        public bool TaskHandle(string loginKey, ref ErrorInfo err, TTask inEnt)
        {
            GlobalUser gu = Global.GetUser(loginKey);

            if (gu == null)
            {
                err.IsError = true;
                err.Message = "登录超时";
                return(false);
            }
            using (DBEntities db = new DBEntities())
            {
                var allFIleId = "";
                if (!string.IsNullOrEmpty(inEnt.AllFilesStr))
                {
                    var allFile = JSON.EncodeToEntity <IList <FILES> >(inEnt.AllFilesStr);
                    allFIleId = string.Join(",", allFile.Select(x => x.ID));
                }
                if (inEnt.FLOW_ID != null)
                {
                    var reBool = FunTask.FlowSubmit(db, ref err, gu, inEnt.NowFlowId, inEnt.TaskContent, allFIleId, inEnt.UserIdArrStr, inEnt.ROLE_ID_STR, inEnt.IsStage, inEnt.NowSubmitType);
                }
                else
                {
                    var reBool = FunTask.NoFlowSubmit(db, ref err, gu, inEnt.NowFlowId, inEnt.TaskContent, allFIleId, inEnt.UserIdArrStr, inEnt.ROLE_ID_STR, inEnt.IsStage, inEnt.NowSubmitType);
                }
                if (err.IsError)
                {
                    return(false);
                }
                db.SaveChanges();
                return(true);
            }
        }
Ejemplo n.º 2
0
        public bool SupTaskNodeSave(string loginKey, ref ErrorInfo err, ProInterface.Models.TNode inEnt)
        {
            if (!UserCheckFunctioAuthority(loginKey, ref err, MethodBase.GetCurrentMethod()))
            {
                return(false);
            }
            GlobalUser gu = Global.GetUser(loginKey);

            using (DBEntities db = new DBEntities())
            {
                FunTask.SupUpDataTaskFlow(gu, ref err, db, inEnt.ID, inEnt.ToFlowNodeID, inEnt.Remark);
                if (err.IsError)
                {
                    return(false);
                }

                YL_TASK_FLOW taskFlow = db.YL_TASK_FLOW.SingleOrDefault(x => x.ID == inEnt.ID);

                try
                {
                    db.SaveChanges();
                    return(true);
                }
                catch (DbEntityValidationException error)
                {
                    err.IsError = true;
                    err.Message = error.Message;
                    return(false);
                }
            }
        }
Ejemplo n.º 3
0
        public TNode TaskNodeSingle(string loginKey, ref ErrorInfo err, int taskFlowID)
        {
            GlobalUser gu = Global.GetUser(loginKey);

            using (DBEntities db = new DBEntities())
            {
                var reEnt = db.YL_TASK_FLOW.SingleOrDefault(x => x.ID == taskFlowID);
                var ent   = new ProInterface.Models.TNode();

                FunTask.SetFlowBaseInfo(db, ent, reEnt);
                ent.FlowNodeName = db.YL_FLOW_FLOWNODE.SingleOrDefault(x => x.ID == reEnt.FLOWNODE_ID).NAME;

                //获取主流程所经过节点
                IList <YL_FLOW_FLOWNODE> arr_FLOW_FLOWNODE = reEnt.YL_TASK.YL_TASK_FLOW.Where(x => x.FLOWNODE_ID < 8888).OrderByDescending(x => x.ID).Select(p => db.YL_FLOW_FLOWNODE.SingleOrDefault(x => x.ID == p.FLOWNODE_ID)).Distinct().ToList();
                //IList<YL_FLOW_FLOWNODE> arr_FLOW_FLOWNODE = db.YL_FLOW_FLOWNODE_FLOW.Where(x => x.FLOW_ID == 1 && x.FROM_FLOWNODE_ID < 9999).Select(x => x.YL_FLOW_FLOWNODE).Distinct().ToList();
                ent.AllFlowNode = arr_FLOW_FLOWNODE.Select(p => (new SelectListItem {
                    Text = p.NAME, Value = p.ID.ToString()
                })).ToList();
                ent.ShowUrl     = reEnt.SHOW_URL;
                return(ent);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 修改任务
        /// </summary>
        /// <param name="loginKey">登录凭证</param>
        /// <param name="err">错误信息</param>
        /// <param name="inEnt">实体类</param>
        /// <param name="allPar">更新的参数</param>
        /// <returns>修改任务</returns>
        public bool TaskSave(string loginKey, ref ProInterface.ErrorInfo err, ProInterface.Models.TTask inEnt, IList <string> allPar)
        {
            if (!UserCheckFunctioAuthority(loginKey, ref err, MethodBase.GetCurrentMethod()))
            {
                return(false);
            }
            using (DBEntities db = new DBEntities())
            {
                try
                {
                    GlobalUser gu = Global.GetUser(loginKey);
                    if (gu == null)
                    {
                        err.IsError = true;
                        err.Message = "登录超时";
                        return(false);
                    }
                    var          ent       = db.YL_TASK.SingleOrDefault(a => a.ID == inEnt.ID);
                    YL_TASK_FLOW taskFlow0 = new YL_TASK_FLOW();
                    bool         isAdd     = false;
                    if (ent == null)
                    {
                        isAdd = true;
                        if (inEnt.FLOW_ID != null && inEnt.FLOW_ID.Value != 0)
                        {
                            #region 非任务工单
                            YL_FLOW flow  = db.YL_FLOW.SingleOrDefault(x => x.ID == inEnt.FLOW_ID);
                            TNode   tnode = new TNode();
                            tnode.FlowID       = inEnt.FLOW_ID.Value;
                            tnode.TaskName     = inEnt.TASK_NAME;
                            tnode.AllFilesStr  = inEnt.AllFilesStr;
                            tnode.UserIdArrStr = inEnt.UserIdArrStr;
                            tnode.Remark       = inEnt.REMARK;
                            FunTask.StartTask(db, ref err, gu, tnode, inEnt.NowSubmitType);

                            #endregion
                        }
                        else
                        {
                            #region 任务工单
                            FunTask.StartTaskNoFlow(db, ref err, gu, inEnt.TASK_NAME, inEnt.REMARK, inEnt.AllFilesStr, inEnt.UserIdArrStr, inEnt.ROLE_ID_STR);
                            #endregion
                        }
                    }
                    else
                    {
                        ent = Fun.ClassToCopy <ProInterface.Models.TASK, YL_TASK>(inEnt, ent, allPar);
                    }
                    db.SaveChanges();
                    UserWriteLog(loginKey, MethodBase.GetCurrentMethod(), StatusType.UserLogType.Edit);
                    return(true);
                }
                catch (DbEntityValidationException e)
                {
                    err.IsError = true;
                    err.Message = Fun.GetDbEntityErrMess(e);
                    return(false);
                }
                catch (Exception e)
                {
                    err.IsError = true;
                    err.Message = Fun.GetExceptionMessage(e);
                    return(false);
                }
            }
        }