/// <summary>
    /// 提交
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Submit_Click(object sender, EventArgs e)
    {
        if (!VertifyOverTime())
        {
            return;
        }

        if (!BeforeSubmit())
        {
            return;
        }
        string id = ViewState["FormID"].ToString();

        var dataInfo = SaveFormData();

        Countersign1.SaveData(true);//会签数据保存
        Countersign_Group1.SaveData(true);
        if (dataInfo != null)
        {
            uploadAttachments.SaveAttachment(FormId);
            // Countersign1.SaveAndSubmit();//会签数据保存

            #region 工作流参数
            NameValueCollection dataFields = SetWFParams();
            if (dataFields == null)
            {
                return;
            }
            #endregion


            WorkflowHelper.CurrentUser = "******" + _BPMContext.CurrentUser.LoginId;
            AppDict appInfo = new Pkurg.BPM.Services.AppDictService().GetByAppId("10109");
            if (appInfo == null)
            {
                Alert("提交失败");
                return;
            }
            int wfInstanceId = 0; //process instance id
            WorkflowHelper.StartProcess(appInfo.WorkFlowName, FormId, dataFields, ref wfInstanceId);
            if (wfInstanceId > 0)
            {
                string instId = SaveWorkFlowInstance("1", DateTime.Now, wfInstanceId.ToString());
                if (!string.IsNullOrEmpty(instId))
                {
                    SaveWorkItem();
                    if (!AfterWorkflowStart(wfInstanceId))
                    {
                        return;
                    }
                    IFrameHelper.DownloadLocalFileUrl(instId);
                    ScriptManager.RegisterClientScriptBlock(this, typeof(string), "1", "alert('提交成功');window.opener.location.href=window.opener.location.href;", true);
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ajax", " window.opener=null;window.open('', '_self', '');window.close();", true);
                    return;
                }
            }
        }

        Alert("提交失败");
    }
Esempio n. 2
0
    //测试时先注释掉
    /// <summary>
    /// 流程成功启动后操作
    /// </summary>
    protected override bool AfterWorkflowStart(int wfInstanceId)
    {
        var info = BizContext.ERP_ContractFinalAccount.FirstOrDefault(x => x.FormID == 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);
        }
        try
        {
            //保存嵌套的表单数据,下载该表单
            IFrameHelper.DownloadLocalFileUrl(_BPMContext.ProcID);
        }
        catch (Exception)
        {
        }
        return(true);
    }
Esempio n. 3
0
 public void TestFrame()
 {
     NavigationHelper.NavigateToUrl("http://omayo.blogspot.com/");
     IFrameHelper.SwitchToFrameId(By.Id("iframe2"));
     LinkHelper.ClickOnLink(By.XPath("//a[text()='Chapter1']"));
     RadioButtonHelper.ClickRadioButton(By.Id("radiobutton"));
     CheckBoxHelper.CheckedCheckBox(By.XPath("//select[@id='selecttype']/following-sibling::input"));
     ComboBoxHelper.SelectIndex(By.Id("selecttype"), 2);
     IFrameHelper.SwitchToDefaultContent();
     Console.WriteLine(ObjectRepository.Driver.Title);
 }
Esempio n. 4
0
    private static string GetERPPageUrl(string erpId, string erpType)
    {
        Dictionary <string, string> pageNames = IFrameHelper.GetUrlDatas();

        if (!pageNames.Keys.Contains(erpType))
        {
            ExceptionHander.GoToErrorPage("IFrameHelper GetERPPageUrl");
            //return null;
        }
        string pageName = pageNames[erpType];
        string erpUrl   = string.Format("{0}{1}", pageName, erpId);

        return(erpUrl);
    }
Esempio n. 5
0
    /// <summary>
    /// 加载页面时调用
    /// </summary>
    /// <returns></returns>
    public static string GetErpUrl()
    {
        string erpId   = HttpContext.Current.Request["erpFormId"];
        string erpType = HttpContext.Current.Request["erpFormType"];

        string id = HttpContext.Current.Request["Id"];

        if (string.IsNullOrEmpty(id))
        {
            //新建页面
            if (string.IsNullOrEmpty(erpId) || string.IsNullOrEmpty(erpType))
            {
                //参数错误
                ExceptionHander.GoToErrorPage("IFrameHelper 参数错误");
                return(null);
            }
            else
            {
                string erpUrl = GetERPPageUrl(erpId, erpType);
                return(erpUrl);
            }
        }
        else
        {
            string fileName = string.Format("ERP_{0}.html", id);
            string filePath = Path.Combine("/Files/ERP/", fileName);

            //查看页面或者审批页面,第一次生成文件
            if (!File.Exists(HttpContext.Current.Server.MapPath("~" + filePath)))
            {
                try
                {
                    IFrameHelper.DownloadLocalFileUrl(id);
                }
                catch
                {
                }
            }

            if (!File.Exists(HttpContext.Current.Server.MapPath("~" + filePath)))
            {
                return(GetERPPageUrlByInstId(id));
            }
            return(filePath);
        }
    }
Esempio n. 6
0
    public static string GetErpUrl()
    {
        string erpFormId   = HttpContext.Current.Request["erpFormId"];
        string erpFormType = HttpContext.Current.Request["erpFormType"];
        string startDeptId = HttpContext.Current.Request["startDeptId"];
        string id          = HttpContext.Current.Request["Id"];

        if (string.IsNullOrEmpty(id))
        {//新建页面
            if (string.IsNullOrEmpty(erpFormId) ||
                string.IsNullOrEmpty(erpFormType)
                )
            {
                //参数错误
                ExceptionHander.GoToErrorPage();
                return(null);
            }
        }
        else
        {
            ContractApprovalInfo info = ContractApproval.GetModelByInstId(id);
            if (info == null)
            {
                ExceptionHander.GoToErrorPage();
                return(null);
            }
            erpFormId   = info.ErpFormId;
            erpFormType = info.ErpFormType;
        }

        Dictionary <string, string> pageNames = IFrameHelper.GetUrlDatas();

        if (!pageNames.Keys.Contains(erpFormType))
        {
            ExceptionHander.GoToErrorPage();
            return(null);
        }
        string pageName = pageNames[erpFormType];

        return(string.Format("{0}{1}", pageName, erpFormId));
    }
Esempio n. 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Game"/> class.
 /// </summary>
 /// <param name="frameHelper">The frame helper.</param>
 public Game(IFrameHelper frameHelper)
 {
     Id               = Guid.NewGuid();
     Frames           = new List <Frame>();
     this.frameHelper = frameHelper;
 }