Beispiel #1
0
        public virtual JObject Public(HttpContext context)
        {
            YZRequest request = new YZRequest(context);

            this.ApproveCheck(context);

            int     taskid   = request.GetInt32("TaskID");
            JObject jPost    = request.GetPostData <JObject>();
            string  comments = (string)jPost["comments"];
            BPMObjectNameCollection accounts = jPost["uids"].ToObject <BPMObjectNameCollection>();

            UserCollection users = new UserCollection();

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();

                foreach (string account in accounts)
                {
                    User user = BPMTask.Public(cn, taskid, account);
                    users.Add(user);
                }

                JObject rv = new JObject();
                rv[YZJsonProperty.success] = true;
                rv["UserNameList"]         = YZStringHelper.GetUserNameListString(users);

                return(rv);
            }
        }
Beispiel #2
0
        public virtual JObject InviteIndicate(HttpContext context)
        {
            YZRequest request = new YZRequest(context);

            this.ApproveCheck(context);

            int     taskid   = request.GetInt32("TaskID");
            JObject jPost    = request.GetPostData <JObject>();
            string  comments = (string)jPost["comments"];
            BPMObjectNameCollection accounts = jPost["uids"].ToObject <BPMObjectNameCollection>();

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();

                BPMTask        task  = BPMTask.Load(cn, taskid);
                UserCollection users = BPMTask.InviteIndicate(cn, taskid, accounts, comments);

                JObject rv = new JObject();
                rv[YZJsonProperty.success] = true;
                rv["SN"]           = task.SerialNum;
                rv["UserNameList"] = YZStringHelper.GetUserNameListString(users);

                return(rv);
            }
        }
Beispiel #3
0
        public virtual object GetTaskTraceInfo(HttpContext context)
        {
            YZRequest request = new YZRequest(context);
            int       taskid  = request.GetInt32("TaskID");

            BPMTask            task;
            NodeItemCollection nodes = new NodeItemCollection();
            LinkItemCollection links = new LinkItemCollection();
            BPMStepCollection  steps = new BPMStepCollection();

            //获得数据
            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();

                task = BPMTask.Load(cn, taskid);
                BPMProcess.GetTaskTraceInfo(cn, task.ProcessName, task.ProcessVersion, out nodes, out links);
                steps = BPMTask.GetAllSteps(cn, taskid);
            }

            return(new
            {
                Task = this.SerializeTask(task),
                Process = new
                {
                    Nodes = nodes,
                    Links = links
                },
                Steps = this.SerializeSteps(steps)
            });
        }
Beispiel #4
0
        protected virtual BPMTask GetSimulateTask(User user, string processName, Version version)
        {
            BPMTask task = new BPMTask();

            task.TaskID          = 120001;
            task.ProcessName     = processName;
            task.OwnerPositionID = 1003;
            task.OwnerAccount    = user.Account;

            task.OwnerFullName        = user.DisplayName;
            task.AgentAccount         = null;
            task.AgentFullName        = null;
            task.CreateAt             = DateTime.Now.AddDays(-1);
            task.Description          = "采购申请,总金额:¥18,888.00,事由:BPM服务。";
            task.FinishAt             = DateTime.MinValue;
            task.TaskState            = TaskState.Running;
            task.SerialNum            = String.Format("PR{0}0001", DateTime.Now.ToString("yyyyMM"));
            task.OptUser              = null;
            task.OptAt                = DateTime.MinValue;
            task.OptMemo              = null;
            task.FormDataSetID        = -1;
            task.ParentTaskID         = -1;
            task.ParentStepID         = -1;
            task.ParentStepName       = null;
            task.ProcessVersion       = version;
            task.ParentServerIdentity = null;
            task.ReturnToParent       = false;
            task.UrlParams            = null;
            return(task);
        }
Beispiel #5
0
        public virtual JObject GetTaskReadInfo(HttpContext context)
        {
            YZRequest request    = new YZRequest(context);
            int       taskid     = request.GetInt32("tid");
            string    permisions = request.GetString("Permisions", null);

            BPMTask task;
            string  formFile;
            JObject perm;

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();

                task     = BPMTask.Load(cn, taskid);
                formFile = BPMProcess.GetTaskReadForm(cn, taskid);
                perm     = this.CheckPermision(cn, taskid, -1, permisions);
            }

            JObject rv = new JObject();

            rv[YZJsonProperty.success] = true;
            rv["sn"]        = task.SerialNum;
            rv["url"]       = YZUtility.GetFormRedirectUrl(formFile).ToString();
            rv["urlParams"] = task.UrlParams;
            rv["perm"]      = perm;

            return(rv);
        }
Beispiel #6
0
        public virtual JObject GetTaskRejectedInfo(HttpContext context)
        {
            YZRequest request = new YZRequest(context);
            int       stepid  = request.GetInt32("stepid");

            //获得数据
            BPMProcStep step = new BPMProcStep();
            BPMTask     task = new BPMTask();

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();
                step.Open(cn, stepid);
                task.Open(cn, step.TaskID);

                JObject rv = new JObject();
                rv["taskid"]      = task.TaskID;
                rv["processName"] = task.ProcessName;
                rv["sn"]          = task.SerialNum;
                rv["desc"]        = task.Description;
                rv["rejectBy"]    = YZStringHelper.GetUserShortName(step.HandlerAccount, step.HandlerDisplayName);
                rv["rejectAt"]    = step.FinishAt;
                rv["comments"]    = step.Comments;

                return(rv);
            }
        }
Beispiel #7
0
        public virtual object GetTaskSummaryInfo(HttpContext context)
        {
            YZRequest request = new YZRequest(context);
            int       taskid  = request.GetInt32("TaskID");

            BPMTask task = new BPMTask();

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();
                task.Open(cn, taskid);
            }

            return(new
            {
                success = true,
                ProcessVersion = task.ProcessVersion.ToString(2),
                SerialNum = task.SerialNum,
                OwnerAccount = task.OwnerAccount,
                OwnerDisplayName = task.OwnerFullName,
                AgentAccount = task.AgentAccount,
                AgentDisplayName = task.AgentFullName,
                TaskState = task.TaskState.ToString()
            });
        }
Beispiel #8
0
        public virtual JObject GetTaskHumenSteps(HttpContext context)
        {
            YZRequest request = new YZRequest(context);
            int       taskid  = request.GetInt32("TaskID");

            //获得数据
            NodeCollection humanNodes = null;

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();
                humanNodes = BPMTask.GetAllHumanNodesInProcessDefine(cn, taskid);
            }

            //将数据转化为Json集合
            JObject rv = new JObject();

            rv[YZJsonProperty.total] = humanNodes.Count;

            JArray children = new JArray();

            rv[YZJsonProperty.children] = children;

            foreach (ProcessNode node in humanNodes)
            {
                JObject item = new JObject();
                children.Add(item);
                item["NodeName"] = node.Name;
            }

            //输出数据
            rv[YZJsonProperty.success] = true;
            return(rv);
        }
Beispiel #9
0
    public static JsonItem GetTaskStateJsonItem(BPMConnection cn, TaskState state, int taskid)
    {
        JsonItem rv = new JsonItem();

        rv.Attributes.Add("State", state.ToString().ToLower());

        if (state == TaskState.Running)
        {
            JsonItemCollection children = new JsonItemCollection();
            rv.Attributes.Add("children", children);

            BPMStepCollection steps = BPMTask.GetInProcessSteps(cn, taskid);
            foreach (BPMProcStep step in steps)
            {
                JsonItem item = new JsonItem();
                item.Attributes.Add("StepName", step.StepDisplayName);
                item.Attributes.Add("Share", step.Share);
                item.Attributes.Add("RecipientAccount", step.RecipientAccount);
                item.Attributes.Add("RecipientDisplayName", step.RecipientFullName);
                children.Add(item);
            }
        }

        return(rv);
    }
Beispiel #10
0
        public virtual JObject GetProcessRemindInfo(HttpContext context)
        {
            YZRequest request = new YZRequest(context);
            int       stepid  = request.GetInt32("stepid");

            //获得数据
            BPMProcStep step = new BPMProcStep();
            BPMTask     task = new BPMTask();

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();
                step.Open(cn, stepid);
                task.Open(cn, step.TaskID);

                JObject rv = new JObject();
                rv["stepid"]           = step.StepID;
                rv["finished"]         = step.Finished;
                rv["finishat"]         = step.FinishAt;
                rv["stepName"]         = step.RegularNodeName;
                rv["taskid"]           = task.TaskID;
                rv["processName"]      = task.ProcessName;
                rv["sn"]               = task.SerialNum;
                rv["desc"]             = task.Description;
                rv["ownerAccount"]     = task.OwnerAccount;
                rv["ownerDisplayName"] = task.OwnerDisplayName;
                rv["createat"]         = task.CreateAt;

                return(rv);
            }
        }
Beispiel #11
0
        public virtual JObject GetTaskProcessingSteps(HttpContext context)
        {
            YZRequest request = new YZRequest(context);
            int       taskid  = request.GetInt32("TaskID");
            JObject   rv      = new JObject();

            //获得数据
            BPMStepCollection steps = null;

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();
                steps = BPMTask.GetUnFinishedHumanSteps(cn, taskid);

                //将数据转化为Json集合
                rv[YZJsonProperty.total] = steps.Count;

                JArray children = new JArray();
                rv[YZJsonProperty.children] = children;

                foreach (BPMProcStep step in steps)
                {
                    children.Add(this.Serialize(cn, step));
                }
            }

            //输出数据
            rv[YZJsonProperty.success] = true;
            return(rv);
        }
Beispiel #12
0
        public virtual JObject LoadTask(HttpContext context)
        {
            YZRequest request = new YZRequest(context);
            int       taskid  = request.GetInt32("TaskID");
            JObject   rv      = new JObject();

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();

                rv[YZJsonProperty.total] = 1;
                JArray children = new JArray();
                rv["children"] = children;

                BPMTask task = BPMTask.Load(cn, taskid);
                JObject item = new JObject();
                children.Add(item);

                item["TaskID"]           = task.TaskID;
                item["SerialNum"]        = task.SerialNum;
                item["ProcessName"]      = task.ProcessName;
                item["ProcessVersion"]   = task.ProcessVersion.ToString(2);
                item["OwnerAccount"]     = task.OwnerAccount;
                item["OwnerDisplayName"] = task.OwnerFullName;
                item["AgentAccount"]     = task.AgentAccount;
                item["AgentDisplayName"] = task.AgentFullName;
                item["CreateAt"]         = task.CreateAt;
                item["State"]            = YZJsonHelper.GetTaskStateJObject(cn, task.TaskState, task.TaskID);
                item["Description"]      = String.IsNullOrEmpty(task.Description) ? Resources.YZStrings.All_None : task.Description;
            }

            rv["success"] = true;
            return(rv);
        }
Beispiel #13
0
        public virtual JObject ReActive(HttpContext context)
        {
            YZRequest  request   = new YZRequest(context);
            int        taskid    = request.GetInt32("TaskID");
            JObject    jPost     = request.GetPostData <JObject>();
            string     comments  = (string)jPost["comments"];
            List <int> toStepIDs = jPost["toStepIDs"].ToObject <List <int> >();

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();

                BPMStepCollection newSteps = BPMTask.ReActive(cn, taskid, toStepIDs.ToArray(), comments);

                List <string> to = new List <string>();
                foreach (BPMProcStep step in newSteps)
                {
                    to.Add(String.Format("{0}[{1}]", step.NodeName, YZStringHelper.GetUserFriendlyName(step.RecipientAccount, step.RecipientFullName)));
                }

                JObject rv = new JObject();
                rv[YZJsonProperty.success] = true;
                rv["tosteps"] = String.Join(";", to.ToArray());

                return(rv);
            }
        }
Beispiel #14
0
        public virtual JObject ReturnToInitiator(HttpContext context)
        {
            YZRequest request = new YZRequest(context);

            this.ApproveCheck(context);

            int     taskid   = request.GetInt32("TaskID");
            JObject jPost    = request.GetPostData <JObject>();
            string  comments = (string)jPost["comments"];
            string  formdata = (string)jPost["formdata"];

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();

                //移动审批不保存表单数据
                if (!String.IsNullOrEmpty(formdata))
                {
                    BPMProcess.Post(cn, formdata);
                }

                User user = BPMTask.RecedeRestart(cn, taskid, comments);

                JObject rv = new JObject();
                rv[YZJsonProperty.success] = true;
                rv["UserFriendlyName"]     = user.FriendlyName;
                return(rv);
            }
        }
Beispiel #15
0
        public virtual object GetTaskLastSteps(HttpContext context)
        {
            YZRequest request    = new YZRequest(context);
            int       taskid     = request.GetInt32("TaskID");
            int       lastStepId = request.GetInt32("LastStepID");

            BPMStepCollection steps;

            //获得数据
            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();
                steps = BPMTask.GetAllSteps(cn, taskid);
            }

            BPMStepCollection newSteps = new BPMStepCollection();

            foreach (BPMProcStep step in steps)
            {
                if (step.StepID > lastStepId)
                {
                    newSteps.Add(step);
                }
            }

            return(new
            {
                Steps = this.SerializeSteps(newSteps)
            });
        }
Beispiel #16
0
        public virtual JObject Jump(HttpContext context)
        {
            YZRequest request = new YZRequest(context);

            this.ApproveCheck(context);

            int        stepid      = request.GetInt32("StepID", -1);
            int        taskid      = request.GetInt32("TaskID");
            string     toStepName  = request.GetString("ToStepName");
            JObject    jPost       = request.GetPostData <JObject>();
            string     comments    = (string)jPost["comments"];
            string     formdata    = (string)jPost["formdata"];
            List <int> fromStepIDs = jPost["fromStepIDs"].ToObject <List <int> >();

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();

                //移动审批不保存表单数据
                if (!String.IsNullOrEmpty(formdata))
                {
                    BPMProcess.Post(cn, formdata);
                }

                BPMProcStep step = BPMTask.Jump(cn, taskid, stepid, fromStepIDs.ToArray(), toStepName, comments);

                JObject rv = new JObject();
                rv[YZJsonProperty.success] = true;
                rv["StepName"]             = step.NodeName;
                rv["UserFriendlyName"]     = YZStringHelper.GetUserFriendlyName(step.RecipientAccount, step.RecipientFullName);

                return(rv);
            }
        }
Beispiel #17
0
    public static JObject GetTaskStateJObject(BPMConnection cn, TaskState state, int taskid)
    {
        JObject rv = new JObject();

        rv["State"] = state.ToString().ToLower();

        if (state == TaskState.Running)
        {
            JArray children = new JArray();
            rv.Add(YZJsonProperty.children, children);

            BPMStepCollection steps = BPMTask.GetUnFinishedHumanSteps(cn, taskid);
            foreach (BPMProcStep step in steps)
            {
                JObject item = new JObject();
                item["StepName"]             = step.StepDisplayName;
                item["Share"]                = step.Share;
                item["RecipientAccount"]     = step.RecipientAccount;
                item["RecipientDisplayName"] = step.RecipientFullName;
                children.Add(item);
            }
        }

        return(rv);
    }
Beispiel #18
0
 protected virtual object SerializeTask(BPMTask task)
 {
     return(new
     {
         ProcessName = task.ProcessName,
         ProcessVersion = task.ProcessVersion.ToString(2)
     });
 }
Beispiel #19
0
    protected TableCell CreateCheckCell(BPMTask taskitem)
    {
        TableCell cell = new TableCell();

        cell.Text       = "<input id=\"" + taskitem.TaskID.ToString() + "\" taskid=\"" + taskitem.TaskID.ToString() + "\" type=\"checkbox\" onclick=\"checkrow(this);\">";
        cell.CssClass   = "CHK";
        cell.ColumnSpan = 2;

        return(cell);
    }
Beispiel #20
0
    public static string GetTaskStateDisplayString(BPMConnection cn, TaskState state, int taskid)
    {
        if (state != TaskState.Running)
        {
            return(YZStringHelper.GetTaskStateDisplayName(state));
        }

        Dictionary <string, BPMObjectNameCollection> results = new Dictionary <string, BPMObjectNameCollection>();
        BPMStepCollection steps = BPMTask.GetInProcessSteps(cn, taskid);

        foreach (BPMProcStep step in steps)
        {
            string stepName = step.StepDisplayName;
            if (step.Share && String.IsNullOrEmpty(step.RecipientAccount))
            {
                stepName = stepName + "(等待获取)";
            }

            BPMObjectNameCollection users = null;
            if (results.ContainsKey(stepName))
            {
                users = results[stepName];
            }
            else
            {
                users = new BPMObjectNameCollection();
                results.Add(stepName, users);
            }

            string userName = YZStringHelper.GetUserShortName(step.RecipientAccount, step.RecipientFullName);

            if (!String.IsNullOrEmpty(userName) && !users.Contains(userName))
            {
                users.Add(userName);
            }
        }

        List <string> rvs = new List <string>();

        foreach (KeyValuePair <string, BPMObjectNameCollection> kv in results)
        {
            string users = String.Join(",", kv.Value.ToArray());
            if (String.IsNullOrEmpty(users))
            {
                rvs.Add(kv.Key);
            }
            else
            {
                rvs.Add(String.Format("{0}:{1}", kv.Key, users));
            }
        }

        return(String.Join(";", rvs.ToArray()));
    }
Beispiel #21
0
 /// <summary>
 /// 拒绝事件
 /// </summary>
 /// <param name="TaskID">任务号</param>
 /// <param name="Comment">意见</param>
 private void RejectProcess(BPMConnection cn, int TaskID, string Comment)
 {
     try
     {
         BPMTask.Reject(cn, TaskID, Comment);
     }
     catch (Exception e)
     {
         throw new Exception("拒绝失败");
     }
 }
Beispiel #22
0
        public virtual void CancelIndicateInvite(HttpContext context)
        {
            YZRequest request = new YZRequest(context);
            int       stepid  = request.GetInt32("StepID");

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();
                BPMTask.CancelInviteIndicate(cn, stepid);
            }
        }
Beispiel #23
0
        public virtual void Abort(HttpContext context)
        {
            YZRequest request  = new YZRequest(context);
            int       taskid   = request.GetInt32("TaskID");
            string    comments = request.GetString("Comments", null);

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();
                BPMTask.Abort(cn, taskid, comments);
            }
        }
Beispiel #24
0
        public virtual JArray GetRemindTarget(HttpContext context)
        {
            YZRequest request = new YZRequest(context);
            int       taskid  = request.GetInt32("TaskID");
            JArray    rv      = new JArray();

            //获得数据
            BPMStepCollection steps = null;

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();
                steps = BPMTask.GetUnFinishedHumanSteps(cn, taskid);

                foreach (BPMProcStep step in steps)
                {
                    if (step.Share && String.IsNullOrEmpty(step.OwnerAccount))
                    {
                        UserCollection users = BPMProcStep.GetShareUsers(cn, step.StepID);
                        foreach (User user in users)
                        {
                            JObject jStep = new JObject();
                            rv.Add(jStep);

                            jStep["StepID"]          = step.StepID;
                            jStep["Share"]           = true;
                            jStep["NodeDisplayName"] = step.StepDisplayName;
                            jStep["Account"]         = user.Account;
                            jStep["ShortName"]       = user.ShortName;
                            jStep["ElapsedMinutes"]  = (DateTime.Now - step.ReceiveAt).TotalMinutes;
                        }
                    }
                    else
                    {
                        JObject jStep = new JObject();
                        rv.Add(jStep);

                        jStep["StepID"]          = step.StepID;
                        jStep["Share"]           = false;
                        jStep["NodeDisplayName"] = step.StepDisplayName;
                        jStep["Account"]         = step.RecipientAccount;
                        jStep["ShortName"]       = step.RecipientDisplayName;
                        jStep["ElapsedMinutes"]  = (DateTime.Now - step.ReceiveAt).TotalMinutes;
                    }
                }
            }

            return(rv);
        }
Beispiel #25
0
        protected virtual JObject CheckPermision(BPMConnection cn, int taskid, int stepid, string permString)
        {
            JObject rv = new JObject();

            NodePermision[] perms = YZSecurityHelper.ParseNodePermisions(permString);

            bool[] allows = BPMTask.TaskOptPermCheckExt(cn, taskid, stepid, perms);

            for (int i = 0; i < perms.Length; i++)
            {
                rv[perms[i].ToString()] = allows[i];
            }

            return(rv);
        }
Beispiel #26
0
        public virtual JObject GetReActiveSteps(HttpContext context)
        {
            YZRequest request = new YZRequest(context);
            int       taskid  = request.GetInt32("TaskID");

            JArray children = new JArray();

            //获得数据
            BPMStepCollection steps = null;

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();
                steps = BPMTask.GetAllSteps(cn, taskid);

                BPMObjectNameCollection stepNames = new BPMObjectNameCollection();
                for (int i = steps.Count - 1; i >= 0; i--)
                {
                    BPMProcStep step = steps[i];

                    if (!step.IsHumanStep)
                    {
                        continue;
                    }

                    if (step.IsTaskOptStep || step.IsIndicateStep || step.IsInformStep || step.IsConsignStep)
                    {
                        continue;
                    }

                    if (stepNames.Contains(step.NodeName))
                    {
                        continue;
                    }

                    stepNames.Add(step.NodeName);
                    children.Add(Serialize(cn, step));
                }
            }

            //输出数据
            JObject rv = new JObject();

            rv[YZJsonProperty.success]  = true;
            rv[YZJsonProperty.total]    = children.Count;
            rv[YZJsonProperty.children] = children;
            return(rv);
        }
Beispiel #27
0
        protected virtual JObject Serialize(BPMTask task)
        {
            JObject rv = new JObject();

            rv["ProcessName"]    = task.ProcessName;
            rv["OwnerAccount"]   = task.OwnerAccount;
            rv["OwnerShortName"] = task.OwnerDisplayName;
            rv["AgentAccount"]   = task.AgentAccount;
            rv["AgentShortName"] = task.AgentDisplayName;
            rv["ProcessVersion"] = task.ProcessVersion.ToString(2);
            rv["SerialNum"]      = task.SerialNum;
            rv["TaskID"]         = task.TaskID;
            rv["TaskState"]      = task.TaskState.ToString();

            return(rv);
        }
Beispiel #28
0
        /// <summary>
        /// 判断任务是否是当前待办
        /// </summary>
        /// <param name="UserAccount">帐号</param>
        /// <param name="StepID">步骤id</param>
        /// <returns></returns>
        private bool IsCurrentStep(BPMConnection cn, string UserAccount, int StepID, int TaskID)
        {
            BPMStepCollection _steps = BPMTask.GetAllSteps(cn, TaskID);

            foreach (BPMProcStep item in _steps)
            {
                if (item.IsHumanStep)
                {
                    if (item.StepID == StepID && item.RecipientAccount.Equals(UserAccount, StringComparison.OrdinalIgnoreCase))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Beispiel #29
0
        public virtual JObject PublicExt(HttpContext context)
        {
            JArray processedItems = new JArray();

            try
            {
                YZRequest request = new YZRequest(context);
                JObject   jPost   = request.GetPostData <JObject>();
                JArray    items   = jPost["items"] as JArray;
                BPMObjectNameCollection accounts = jPost["accounts"].ToObject <BPMObjectNameCollection>();

                using (BPMConnection cn = new BPMConnection())
                {
                    cn.WebOpen();

                    foreach (JObject item in items)
                    {
                        int id     = (int)item["ID"];
                        int taskid = (int)item["TaskID"];

                        foreach (string account in accounts)
                        {
                            BPMTask.Public(cn, taskid, account);
                        }

                        JObject processedItem = new JObject();
                        processedItem["ID"] = id;
                        processedItems.Add(processedItem);
                    }

                    JObject rv = new JObject();
                    rv[YZJsonProperty.success]        = true;
                    rv[YZJsonProperty.processedItems] = processedItems;

                    return(rv);
                }
            }
            catch (Exception exp)
            {
                JObject rv = new JObject();
                rv[YZJsonProperty.success]        = false;
                rv[YZJsonProperty.errorMessage]   = exp.Message;
                rv[YZJsonProperty.processedItems] = processedItems;

                return(rv);
            }
        }
Beispiel #30
0
        public virtual JObject HandoverRequests(HttpContext context)
        {
            JArray processedItems = new JArray();

            try
            {
                YZRequest request        = new YZRequest(context);
                string    leavingUid     = request.GetString("uid");
                string    memberFullName = request.GetString("MemberFullName");
                JObject   jPost          = request.GetPostData <JObject>();
                string    comments       = (string)jPost["comments"];
                JArray    items          = jPost["items"] as JArray;

                using (BPMConnection cn = new BPMConnection())
                {
                    cn.WebOpen();

                    foreach (JObject item in items)
                    {
                        int taskid = (int)item["TaskID"];
                        int id     = (int)item["ID"];

                        BPMTask.HandOverRequest(cn, taskid, leavingUid, memberFullName, comments);

                        JObject processedItem = new JObject();
                        processedItem["ID"] = id;
                        processedItems.Add(processedItem);
                    }

                    JObject rv = new JObject();
                    rv[YZJsonProperty.success]        = true;
                    rv[YZJsonProperty.processedItems] = processedItems;

                    return(rv);
                }
            }
            catch (Exception exp)
            {
                JObject rv = new JObject();
                rv[YZJsonProperty.success]        = false;
                rv[YZJsonProperty.errorMessage]   = exp.Message;
                rv[YZJsonProperty.processedItems] = processedItems;

                return(rv);
            }
        }
Beispiel #31
0
 public JsonItem(BPMTask task)
 {
     this.Attributes["TaskID"] = task.TaskID;
     this.Attributes["SerialNum"] = task.SerialNum;
     this.Attributes["ProcessName"] = task.ProcessName;
 }