protected override void InitFormData() { try { SupplementalAgreementInfo info = SupplementalAgreement.GetModel(this.FormId); if (info != null) { //if (Pkurg.PWorldBPM.Business.BIZ.ERP.ERP_Common.IsExsitRunFlow(info.ErpFormId, ERP_WF_T_Name.ERP_ContractApproval)) //{ // ERP_CallbackResultType resultType = new ContractApproval_Service().NotifyStartAdvance(Request["erpFormId"], true); // new WF_WorkFlowInstance().DeleteWorkFlowInstance(_BPMContext.ProcID); // ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ajax", "alert('BPM已存在正在审批的该单据!'); window.opener=null;window.open('', '_self', '');window.close();", true); // return false; //} ListItem selectedItem = ddlDepartName.Items.FindByValue(info.StartDeptId); if (selectedItem != null) { selectedItem.Selected = true; } cbIsReportResource.Checked = info.IsReportToResource.Value == 1; cbIsReportFounder.Checked = info.IsReportToFounder.Value == 1; StartDeptId = info.StartDeptId; } } catch (Exception ex) { throw ex; } }
/// <summary> /// 流程成功启动后操作 /// </summary> protected override bool AfterWorkflowStart(int wfInstanceId) { //return true; SupplementalAgreementInfo info = SupplementalAgreement.GetModel(FormId); ERP_CallbackResultType resultType = new CommonService(int.Parse(AppID)).NotifyStartAdvance(info.ErpFormId, true); if (resultType != ERP_CallbackResultType.调用成功) { //删除流程实例 new WF_WorkFlowInstance().DeleteWorkFlowInstance(_BPMContext.ProcID); //撤销已发起的流程 WorkflowManage.StopWorkflow(wfInstanceId); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ajax", "alert('" + ConstString.RepeatAlertTip + "'); window.opener=null;window.open('', '_self', '');window.close();", true); return(false); } return(true); }
/// <summary> /// 对已保存的表单,从数据库中加载表单数据 /// </summary> protected void InitFormData() { try { SupplementalAgreementInfo info = SupplementalAgreement.GetModel(this.FormId); if (info != null) { Department deptInfo = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(info.StartDeptId); lbDeptName.Text = deptInfo.Remark; cbIsReportResource.Checked = info.IsReportToResource.Value == 1; cbIsReportFounder.Checked = info.IsReportToFounder.Value == 1; StartDeptId = info.StartDeptId; } } catch (Exception ex) { throw ex; } }
protected override void SaveFormData() { SupplementalAgreementInfo info = null; try { info = SupplementalAgreement.GetModel(FormId); if (info == null) { info = new SupplementalAgreementInfo() { CreateTime = DateTime.Now.ToString(), IsReportToResource = cbIsReportResource.Checked ? 1 : 0, IsReportToFounder = cbIsReportFounder.Checked ? 1 : 0, StartDeptId = ddlDepartName.SelectedItem.Value, FormID = FormId, ErpFormId = Request["erpFormId"], RelationContract = Request["erpPoId"], ErpFormType = "SUPPLMENT", ApproveResult = "" }; SupplementalAgreement.Add(info); //必须首次调用 cbIsReportResource.SaveToDB(FormId, AppID); } else { info.IsReportToResource = cbIsReportResource.Checked ? 1 : 0; info.IsReportToFounder = cbIsReportFounder.Checked ? 1 : 0; info.StartDeptId = ddlDepartName.SelectedItem.Value; SupplementalAgreement.Update(info); } } catch (Exception ex) { throw ex; } }