コード例 #1
0
        public virtual void PickbackRestart(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.PickBackRestart(cn, taskid, comments);
            }
        }
コード例 #2
0
ファイル: TaskOpt.cs プロジェクト: radtek/EMIP
        public virtual JObject PickbackRestart(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();
                BPMProcStep step = BPMTask.PickBackRestart(cn, taskid, comments);

                JObject rv = new JObject();
                rv[YZJsonProperty.success] = true;
                rv["StepName"]             = step.NodeName;
                rv["UserFriendlyName"]     = YZStringHelper.GetUserFriendlyName(step.RecipientAccount, step.RecipientFullName);
                return(rv);
            }
        }
コード例 #3
0
ファイル: TaskOpt.Batch.cs プロジェクト: denisding/EMIP
        public virtual JObject PickbackRestartExt(HttpContext context)
        {
            JArray processedItems = new JArray();

            try
            {
                YZRequest request  = new YZRequest(context);
                JObject   jPost    = request.GetPostData <JObject>();
                string    comments = (string)jPost["comments"];
                JArray    items    = (JArray)jPost["items"];

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

                    foreach (JObject item in items)
                    {
                        int id     = (int)item["ID"];
                        int taskid = (int)item["TaskID"];
                        BPMTask.PickBackRestart(cn, taskid, 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);
            }
        }
コード例 #4
0
ファイル: Mobile.ashx.cs プロジェクト: JosonJiang/SSO
        //FormData格式如下
        //<FormData>
        //    <Purchase>
        //        <SN></SN>
        //        <Amount>26000.00</Amount>
        //        <Reason>dddd</Reason>
        //        <Attachments></Attachments>
        //    </Purchase>
        //    <PurchaseDetail>
        //        <RelationRowGuid>1</RelationRowGuid>
        //        <RowPrimaryKeys></RowPrimaryKeys>
        //        <ItemCode>001</ItemCode>
        //        <Price>10000.00</Price>
        //        <Qty>1</Qty>
        //        <SubTotal>10000.00</SubTotal>
        //    </PurchaseDetail>
        //    <PurchaseDetail>
        //        <RelationRowGuid>2</RelationRowGuid>
        //        <RowPrimaryKeys></RowPrimaryKeys>
        //        <ItemCode>002</ItemCode>
        //        <Price>8000.00</Price>
        //        <Qty>2</Qty>
        //        <SubTotal>16000.00</SubTotal>
        //    </PurchaseDetail>
        //</FormData>
        //RelationRowGuid是在这个文件里自增的字段,不管几个子表不管几行数据,永远自增1。
        private JObject PostTask(BPMConnection cn, string ProcessName, string UserAccount, string Action, string Comment, bool Draft, int ExistTaskID, string FormData)
        {
            JObject result = new JObject();

            //处理ExistTask参数
            StringBuilder sb = new StringBuilder();

            if (ExistTaskID != -1)
            {
                BPMProcStep startStep = null;
                try
                {
                    startStep = BPMTask.PickBackRestart(cn, ExistTaskID, "");
                }
                catch (BPMException e)
                {
                    if (e.ExceptionType == BPMExceptionType.TaskPickBackErrNeedNot)
                    {
                        BPMStepCollection temp = BPMTask.GetAllSteps(cn, ExistTaskID);
                        startStep = temp.Find(delegate(BPMProcStep item) { return(item.IsHumanStep == true && item.Finished == false); });
                        if (startStep == null)
                        {
                            throw new Exception("当前任务没有待审批步骤");
                        }
                    }
                    else
                    {
                        throw e;
                    }
                }

                if (startStep == null)
                {
                    throw new Exception("获取当前审批步骤失败");
                }

                sb.Append(String.Format("<?xml version=\"1.0\"?>"));
                sb.Append(String.Format("<XForm>"));
                sb.Append(String.Format(@"
                            <Header>
                                <Method>Process</Method>
                                <PID>{0}</PID>
                                <Action>{1}</Action>
                                <Comment>{2}</Comment>
                            </Header>", startStep.StepID, Action, Comment));
                sb.Append(FormData);
                sb.Append(String.Format("</XForm>"));
            }
            else
            {
                sb.Append(String.Format("<?xml version=\"1.0\"?>"));
                sb.Append(String.Format("<XForm>"));
                sb.Append(String.Format(@"
                            <Header>
                                <Method>{0}</Method>
                                <ProcessName>{1}</ProcessName>
                                <OwnerMemberFullName>{2}</OwnerMemberFullName>
                                <Action>{3}</Action>
                                <Comment>{4}</Comment>
                            </Header>", Draft ? "SaveAsDraft" : "Post", ProcessName, GetMember(cn, UserAccount).FullName, Action, Comment));
                sb.Append(FormData);
                sb.Append(String.Format("</XForm>"));
            }

            MemoryStream xmlStream  = new MemoryStream(Encoding.UTF8.GetBytes(sb.ToString()));
            PostResult   postResult = BPMProcess.Post(cn, xmlStream);

            string requestUrl      = HttpContext.Current.Request.Url.ToString();
            string RedirectURLBase = requestUrl.Substring(0, requestUrl.IndexOf("YZSoft", StringComparison.OrdinalIgnoreCase)) + "YZSoft/Forms/";
            string openUrl         = String.Empty;

            if (Draft)
            {
                openUrl = String.Format(RedirectURLBase + "Post.aspx?pn={0}&did={1}", ProcessName, postResult.SN);
            }
            else
            {
                openUrl = String.Format(RedirectURLBase + "Read.aspx?tid={0}", postResult.TaskID);
            }

            result["success"] = true;
            result["TaskID"]  = postResult.TaskID;
            result["SN"]      = postResult.SN;
            result["OpenUrl"] = openUrl;

            return(result);
        }