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 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);
            }
        }