コード例 #1
0
ファイル: TaskOpt.Batch.cs プロジェクト: denisding/EMIP
        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);
            }
        }