예제 #1
0
        protected void update_Click(object sender, AjaxEventArgs e)
        {
            RowSelectionModel sm = this.mpgList.SelectionModel.Primary as RowSelectionModel;

            if (sm != null && sm.SelectedRows.Count == 1)
            {
                WorkflowDefinition wd = RuntimeContextExamples.GetRuntimeContext().PersistenceService.FindWorkflowDefinitionById(sm.SelectedRows[0].RecordID);
                if (wd != null)
                {
                    this.state.SetValue(wd.State.ToString());
                    this.HProcessId.SetValue(wd.Id);
                    WorkflowEdit.SetTitle("修改流程=" + wd.ProcessId);
                    WorkflowEdit.Show();
                }
            }
            else
            {
                Ext.Msg.Show(new MessageBox.Config
                {
                    Buttons = MessageBox.Button.OK,
                    Icon    = MessageBox.Icon.INFO,
                    Title   = "Success",
                    Message = "请先选择修改的流程文件."
                });
            }
        }
        public void Store1_Refresh(object sender, StoreRefreshDataEventArgs e)
        {
            IPersistenceService ips = RuntimeContextExamples.GetRuntimeContext().PersistenceService;

            Store1.DataSource = ips.FindTaskInstancesForProcessInstanceByStepNumber(HId.Value.ToString(), -1);
            Store1.DataBind();
        }
예제 #3
0
        public void complete(String workItemId)
        {
            IWorkflowSession wflsession = RuntimeContextExamples.GetRuntimeContext().getWorkflowSession();
            IWorkItem        wi         = wflsession.findWorkItemById(workItemId);

            try
            {
                if (wi != null)
                {
                    if (wi.ActorId == this.User.Identity.Name)
                    {
                        if (wi.TaskInstance.Task is FormTask)
                        {
                            String formUri = this.ResolveUrl(((FormTask)wi.TaskInstance.Task).EditForm.Uri + "?WorkItemId=" + workItemId);

                            WindowView.AutoLoad.Url     = formUri;
                            WindowView.AutoLoad.Mode    = LoadMode.IFrame;
                            WindowView.AutoLoad.NoCache = true;
                            WindowView.LoadContent();

                            //WindowView.Reload();
                            //WindowView.AutoLoad.SaveViewState();
                            WindowView.Show();
                        }
                    }
                }
            }
            catch
            {
                throw;
            }
        }
예제 #4
0
        public void Sdate_Refresh(object sender, StoreRefreshDataEventArgs e)
        {
            List <IWorkItem> iwis = RuntimeContextExamples.GetRuntimeContext().PersistenceService.FindHaveDoneWorkItems(this.User.Identity.Name);

            Sdate.DataSource = iwis;
            Sdate.DataBind();
        }
예제 #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.IsPostBack)
     {
         if (this.Request.QueryString["WorkItemId"] != null)
         {
             string           workItemId = this.Request.QueryString["WorkItemId"];
             IWorkflowSession wflsession = RuntimeContextExamples.GetRuntimeContext().getWorkflowSession();
             IWorkItem        wi         = wflsession.findWorkItemById(workItemId);
             String           sn         = (String)wi.TaskInstance.AliveProcessInstance.getProcessInstanceVariable("sn");
             TradeInfo        ti         = tradeInfoDao.findById(sn);
             if (ti != null)
             {
                 HWorkItemId.Value     = workItemId;
                 Sn.Text               = ti.Sn;
                 GoodsName.Text        = ti.GoodsName;
                 UnitPrice.Text        = ti.UnitPrice.ToString();
                 Quantity.Text         = ti.Quantity.ToString();
                 Amount.Text           = ti.Amount.ToString();
                 CustomerName.Text     = ti.CustomerName;
                 CustomerMobile.Text   = ti.CustomerMobile;
                 CustomerPhoneFax.Text = ti.CustomerPhoneFax;
             }
         }
     }
 }
예제 #6
0
        public void Save_Click(object sender, AjaxEventArgs e)
        {
            string           workItemId = HWorkItemId.Value.ToString();
            IWorkflowSession wflsession = RuntimeContextExamples.GetRuntimeContext().getWorkflowSession();
            IWorkItem        wi         = wflsession.findWorkItemById(workItemId);

            String      sn       = (String)wi.TaskInstance.AliveProcessInstance.getProcessInstanceVariable("sn");
            LoanInfoDAO lid      = new LoanInfoDAO();
            LoanInfo    loanInfo = lid.findBySn(sn);

            loanInfo.RejectInfoInputTime = DateTime.Parse(rejectInfoInputTime.Text);//lendMoneyInfo
            loanInfo.RejectInfo          = comments.Text;

            //4、完成工单
            try
            {
                if (wi != null)
                {
                    if (wi.ActorId == this.User.Identity.Name)
                    {
                        wi.complete(comments.Text);
                    }
                }
            }
            catch
            {
                throw;
            }
        }
예제 #7
0
        public void Sdate_Refresh(object sender, StoreRefreshDataEventArgs e)
        {
            List <IWorkItem> iwis = RuntimeContextExamples.GetRuntimeContext().getWorkflowSession().findMyTodoWorkItems(this.User.Identity.Name);

            Sdate.DataSource = iwis;
            Sdate.DataBind();
        }
예제 #8
0
        public bool claim(String workItemId)
        {
            IWorkflowSession wflsession = RuntimeContextExamples.GetRuntimeContext().getWorkflowSession();
            IWorkItem        wi         = wflsession.findWorkItemById(workItemId);

            try
            {
                if (wi != null)
                {
                    if (wi.ActorId == this.User.Identity.Name)
                    {
                        wi.claim();
                        Sdate_Refresh(null, null);
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            catch
            {
                throw;
            }
            return(false);
        }
예제 #9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.IsPostBack)
     {
         if (this.Request.QueryString["WorkItemId"] != null)
         {
             string           workItemId = this.Request.QueryString["WorkItemId"];
             IWorkflowSession wflsession = RuntimeContextExamples.GetRuntimeContext().getWorkflowSession();
             IWorkItem        wi         = wflsession.findWorkItemById(workItemId);
             String           sn         = (String)wi.TaskInstance.AliveProcessInstance.getProcessInstanceVariable("sn");
             LoanInfoDAO      lid        = new LoanInfoDAO();
             LoanInfo         ti         = lid.findBySn(sn);
             if (ti != null)
             {
                 HWorkItemId.Value        = workItemId;
                 applicantName.Text       = ti.ApplicantName;
                 applicantId.Text         = ti.ApplicantId;
                 address.Text             = ti.Address;
                 salary.Text              = ti.Salary.ToString();
                 loanValue.Text           = ti.LoanValue.ToString();
                 returnDate.Text          = ti.ReturnDate;
                 loanteller.Text          = ti.Loanteller;
                 appInfoInputDate.Text    = ti.AppInfoInputDate.ToString("yyyy-MM-dd hh:mm:ss");
                 salaryIsReal.Text        = ti.SalaryIsReal ? "属实" : "不属实";
                 creditStatus.Text        = ti.CreditStatus ? "合格" : "不合格";
                 riskEvaluator.Text       = ti.RiskEvaluator;
                 riskInfoInputDate.Text   = ti.RiskInfoInputDate.ToString("yyyy-MM-dd hh:mm:ss");
                 rejectInfoInputTime.Text = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
             }
         }
     }
 }
        public void Store2_Refresh(object sender, StoreRefreshDataEventArgs e)
        {
            IPersistenceService ips = RuntimeContextExamples.GetRuntimeContext().PersistenceService;

            Store2.DataSource = ips.FindProcessInstanceVariable(HId.Value.ToString());
            Store2.DataBind();
        }
예제 #11
0
        public void Save_Click(object sender, AjaxEventArgs e)
        {
            string           workItemId = HWorkItemId.Value.ToString();
            IWorkflowSession wflsession = RuntimeContextExamples.GetRuntimeContext().getWorkflowSession();
            IWorkItem        wi         = wflsession.findWorkItemById(workItemId);
            String           sn         = (String)wi.TaskInstance.AliveProcessInstance.getProcessInstanceVariable("sn");
            LoanInfoDAO      lid        = new LoanInfoDAO();
            LoanInfo         loanInfo   = lid.findBySn(sn);

            loanInfo.SalaryIsReal      = Boolean.Parse(salaryIsReal.SelectedItem.Value);
            loanInfo.CreditStatus      = Boolean.Parse(creditStatus.SelectedItem.Value);
            loanInfo.RiskEvaluator     = riskEvaluator.Text;
            loanInfo.RiskInfoInputDate = DateTime.Parse(riskInfoInputDate.Text);


            //1、首先通过"收入状况是否属实"和"信用状况是否合格"这两项指标来设置RiskFlag流程变量
            if (loanInfo.SalaryIsReal && loanInfo.CreditStatus)
            {
                loanInfo.RiskFlag = false;//false表示风险评估通过
            }
            else
            {
                loanInfo.RiskFlag = true;//表示有风险
            }
            //2、将RiskFlag设置到流程变量
            try
            {
                wi.TaskInstance.AliveProcessInstance.setProcessInstanceVariable("RiskFlag", loanInfo.RiskFlag);
            }
            catch
            {
                throw;
            }

            //3、保存业务数据
            lid.attachDirty(loanInfo);
            try
            {
                if (wi != null)
                {
                    if (wi.ActorId == this.User.Identity.Name)
                    {
                        wi.complete(comments.Text);
                    }
                }
            }
            catch
            {
                throw;
            }
        }
        protected void BeforeExpand(object sender, AjaxEventArgs e)
        {
            IPersistenceService ips        = RuntimeContextExamples.GetRuntimeContext().PersistenceService;
            List <IWorkItem>    IWorkItems = ips.FindWorkItemsForTaskInstance(e.ExtraParams["id"]);
            StringBuilder       sb         = new StringBuilder();

            foreach (IWorkItem item in IWorkItems)
            {
                if (sb.Length > 0)
                {
                    sb.Append("<br />");
                }
                sb.AppendFormat("<pre>操作者:{0}\t 状态:{1}\t 开始时间:{2}\t 签收时间:{3}\t 结束时间:{4}\r\n\t完成说明:{5}</pre>",
                                item.ActorId, GetStateToString(item.State), item.CreatedTime, item.ClaimedTime, item.EndTime, item.Comments);
            }
            e.ExtraParamsResponse["content"] = sb.ToString();
        }
        public void Sdate_Refresh(object sender, StoreRefreshDataEventArgs e)
        {
            IPersistenceService ips = RuntimeContextExamples.GetRuntimeContext().PersistenceService;
            string username         = this.User.Identity.Name;

            if (username == "admin")
            {
                username = "";
            }
            List <IProcessInstance> pis = ips.FindProcessInstanceListByCreatorId(username, "", 100, 0);

            foreach (IProcessInstance item in pis)
            {
                ((ProcessInstance)item).RuntimeContext = ips.RuntimeContext;
            }
            Sdate.DataSource = pis;
            Sdate.DataBind();
        }
예제 #14
0
        public void Save_Click(object sender, AjaxEventArgs e)
        {
            string           workItemId = HWorkItemId.Value.ToString();
            IWorkflowSession wflsession = RuntimeContextExamples.GetRuntimeContext().getWorkflowSession();
            IWorkItem        wi         = wflsession.findWorkItemById(workItemId);

            try
            {
                if (wi != null)
                {
                    if (wi.ActorId == this.User.Identity.Name)
                    {
                        wi.complete(comments.Text);
                    }
                }
            }
            catch
            {
                throw;
            }
        }
예제 #15
0
        public void Save_Click(object sender, AjaxEventArgs e)
        {
            // 一、执行业务业务操作,保存业务数据
            paymentInfo = new TradeInfo()
            {
                Sn               = Sn.Text,
                GoodsName        = GoodsName.SelectedItem.Value,
                UnitPrice        = UnitPrice.Number,
                Quantity         = (long)Quantity.Number,
                Amount           = Amount.Number,
                CustomerName     = CustomerName.Text,
                CustomerMobile   = CustomerMobile.Text,
                CustomerPhoneFax = CustomerPhoneFax.Text
            };
            tradeInfoDao.save(paymentInfo);

            // 二、开始执行流程操作
            IWorkflowSession workflowSession = RuntimeContextExamples.GetRuntimeContext().getWorkflowSession();//.workflowRuntimeContext.getWorkflowSession();

            try
            {
                // 1、创建流程实例
                IProcessInstance procInst = workflowSession.createProcessInstance("Goods_Deliver_Process", this.User.Identity.Name);
                // 2、设置流程变量/业务属性字段
                procInst.setProcessInstanceVariable("sn", paymentInfo.Sn);                 // 设置交易顺序号
                procInst.setProcessInstanceVariable("goodsName", paymentInfo.GoodsName);   // 货物名称
                procInst.setProcessInstanceVariable("quantity", paymentInfo.Quantity);     // 数量
                procInst.setProcessInstanceVariable("mobile", paymentInfo.CustomerMobile); // 客户电话
                procInst.setProcessInstanceVariable("customerName", paymentInfo.CustomerName);

                // 3、启动流程实例,run()方法启动实例并创建第一个环节实例、分派任务
                procInst.run();
            }
            catch
            {
                throw;
            }

            paymentInfo = new TradeInfo();
        }
        public void Save_Click(object sender, AjaxEventArgs e)
        {
            LoanInfoDAO loanInfoDAO = new LoanInfoDAO();
            LoanInfo    loanInfo    = new LoanInfo()
            {
                ApplicantName    = applicantName.Text,
                ApplicantId      = applicantId.Text,
                Address          = address.Text,
                Salary           = int.Parse(salary.Text),
                LoanValue        = int.Parse(loanValue.Text),
                ReturnDate       = returnDate.SelectedDate.ToString("yyyy-MM-dd"),
                Loanteller       = loanteller.Text,
                AppInfoInputDate = DateTime.Parse(appInfoInputDate.Text)
            };

            // 一、执行业务业务操作,保存业务数据
            loanInfoDAO.attachDirty(loanInfo);

            // 二、开始执行流程操作
            IWorkflowSession workflowSession = RuntimeContextExamples.GetRuntimeContext().getWorkflowSession();

            try
            {
                // 1、创建流程实例
                IProcessInstance procInst =
                    workflowSession.createProcessInstance("LoanProcess", this.User.Identity.Name);
                // 2、设置流程变量/业务属性字段
                procInst.setProcessInstanceVariable("sn", loanInfo.Sn);                       // 设置流水号
                procInst.setProcessInstanceVariable("applicantName", loanInfo.ApplicantName); //贷款人姓名
                procInst.setProcessInstanceVariable("loanValue", loanInfo.LoanValue);         // 贷款数额

                // 3、启动流程实例,run()方法启动实例并创建第一个环节实例、分派任务
                procInst.run();
            }
            catch
            {
                throw;
            }
        }
예제 #17
0
        public void Save_Click(object sender, AjaxEventArgs e)
        {
            string           workItemId = HWorkItemId.Value.ToString();
            IWorkflowSession wflsession = RuntimeContextExamples.GetRuntimeContext().getWorkflowSession();
            IWorkItem        wi         = wflsession.findWorkItemById(workItemId);
            String           sn         = (String)wi.TaskInstance.AliveProcessInstance.getProcessInstanceVariable("sn");

            ApproveInfoDAO aid = new ApproveInfoDAO();

            WebDemo.Example.LoanProcess.Persistence.ApproveInfo approveInfo = aid.findBySnAndUserId(sn, this.User.Identity.Name);
            if (approveInfo == null)
            {
                approveInfo          = new WebDemo.Example.LoanProcess.Persistence.ApproveInfo();
                approveInfo.Sn       = sn;
                approveInfo.Approver = this.User.Identity.Name;
            }
            approveInfo.Detail   = comments.Text;
            approveInfo.Decision = my_decision.SelectedItem.Value == "True";


            //3、保存业务数据
            aid.attachDirty(approveInfo);
            //4、完成工单
            try
            {
                if (wi != null)
                {
                    if (wi.ActorId == this.User.Identity.Name)
                    {
                        wi.complete(comments.Text);
                    }
                }
            }
            catch
            {
                throw;
            }
        }
예제 #18
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.IsPostBack)
     {
         if (this.Request.QueryString["WorkItemId"] != null)
         {
             string           workItemId = this.Request.QueryString["WorkItemId"];
             IWorkflowSession wflsession = RuntimeContextExamples.GetRuntimeContext().getWorkflowSession();
             IWorkItem        wi         = wflsession.findWorkItemById(workItemId);
             String           sn         = (String)wi.TaskInstance.AliveProcessInstance.getProcessInstanceVariable("sn");
             LoanInfoDAO      lid        = new LoanInfoDAO();
             LoanInfo         ti         = lid.findBySn(sn);
             if (ti != null)
             {
                 HWorkItemId.Value      = workItemId;
                 applicantName.Text     = ti.ApplicantName;
                 applicantId.Text       = ti.ApplicantId;
                 address.Text           = ti.Address;
                 salary.Text            = ti.Salary.ToString();
                 loanValue.Text         = ti.LoanValue.ToString();
                 returnDate.Text        = ti.ReturnDate;
                 loanteller.Text        = ti.Loanteller;
                 salaryIsReal.Text      = ti.SalaryIsReal ? "属实" : "不属实";
                 creditStatus.Text      = ti.CreditStatus ? "合格" : "不合格";
                 riskEvaluator.Text     = ti.RiskEvaluator;
                 riskInfoInputDate.Text = ti.RiskInfoInputDate.ToString("yyyy-MM-dd hh:mm:ss");
             }
             ApproveInfoDAO aid = new ApproveInfoDAO();
             WebDemo.Example.LoanProcess.Persistence.ApproveInfo approveInfo = aid.findBySnAndUserId(sn, this.User.Identity.Name);
             if (approveInfo != null)
             {
                 comments.Text = approveInfo.Detail;
                 my_decision.SelectedItem.Value = approveInfo.Decision.ToString();
             }
         }
     }
 }
예제 #19
0
 public void query_Click(object sender, AjaxEventArgs e)
 {
     Sdate.DataSource = RuntimeContextExamples.GetRuntimeContext().DefinitionService.GetAllLatestVersionsOfWorkflowDefinition();
     Sdate.DataBind();
 }
예제 #20
0
        public void ok_Click(object sender, AjaxEventArgs e)
        {
            WorkflowDefinition wd = new WorkflowDefinition();
            //如是修改。
            string id = this.HProcessId.Value.ToString().Trim();

            if (!string.IsNullOrEmpty(id))
            {
                wd = RuntimeContextExamples.GetRuntimeContext().PersistenceService.FindWorkflowDefinitionById(id);
            }
            else
            {
                wd.PublishTime = DateTime.Now;
                wd.PublishUser = "******";
            }
            wd.UploadTime = DateTime.Now;
            wd.UploadUser = "******";
            wd.State      = Boolean.Parse(this.state.SelectedItem.Value);

            if (this.BasicField.HasFile)
            {
                string filename = this.Server.MapPath("~/WorkFlowTemp/" + BasicField.PostedFile.FileName);
                BasicField.PostedFile.SaveAs(filename);

                WorkflowProcess workflowProcess;
                using (Stream inStream = new FileStream(filename, FileMode.Open))
                {
                    if (inStream == null)
                    {
                        throw new IOException("没有找到名称为" + filename + "的流程定义文件");
                    }
                    Dom4JFPDLParser parser = new Dom4JFPDLParser();
                    workflowProcess = parser.parse(inStream);
                }
                if (workflowProcess != null)
                {
                    if (string.IsNullOrEmpty(id))
                    {
                        wd.ProcessId = workflowProcess.Id;
                    }
                    wd.Name           = workflowProcess.Name;
                    wd.DisplayName    = workflowProcess.DisplayName;
                    wd.Description    = workflowProcess.Description;
                    wd.ProcessContent = File.ReadAllText(filename);// twd.ProcessContent;
                }
                else
                {
                    Ext.Msg.Show(new MessageBox.Config
                    {
                        Buttons = MessageBox.Button.OK,
                        Icon    = MessageBox.Icon.INFO,
                        Title   = "Success",
                        Message = "错误的流程文件。"
                    });
                    return;
                }
            }

            if (RuntimeContextExamples.GetRuntimeContext().PersistenceService.SaveOrUpdateWorkflowDefinition(wd))
            {
                WorkflowEdit.Hide();

                Ext.Msg.Show(new MessageBox.Config
                {
                    Buttons = MessageBox.Button.OK,
                    Icon    = MessageBox.Icon.INFO,
                    Title   = "Success",
                    Message = "保存成功。"
                });

                query_Click(null, null);
            }
            else
            {
                Ext.Msg.Show(new MessageBox.Config
                {
                    Buttons = MessageBox.Button.OK,
                    Icon    = MessageBox.Icon.INFO,
                    Title   = "Success",
                    Message = "保存出错。"
                });
            }
        }