private string FormatTips(string text) { int i, j; int slnid = 0; try { slnid = int.Parse(ddlSolution.Text); } catch { } Hashtable ht = Mainfun.LoadEnumApplication(slnid, false); StringBuilder sb = new StringBuilder(); while (true) { i = text.IndexOfAny(new char[] { '[', '【' }); if (i != -1) { j = text.IndexOfAny(new char[] { ']', '】' }); if (j != -1) { sb.Append(text.Substring(0, i)); string innertext = text.Substring(i, j - i + 1); text = text.Substring(j + 1); innertext = innertext.Replace('[', '【').Replace(']', '】'); if (ht.Contains(innertext)) { sb.Append(string.Format("<a href='addenum.aspx?enum={2}&id={0}&slnid={1}' onmouseover='ShowPrompt(event, \"{3}\")'>{2}</a>", DropGetList.Text, ddlSolution.Text, innertext, ht[innertext].ToString().Replace("\r", "").Replace("\n", "<br>"))); } else { sb.Append(string.Format("<a href='addenum.aspx?enum={2}&id={0}&slnid={1}' onmouseover='ShowPrompt(event, \"{3}\")'>{2}</a>", DropGetList.Text, ddlSolution.Text, innertext, "暂无此枚举信息,请点击连接进行定义")); } } else { sb.Append(text); } } else { sb.Append(text); break; } } return(sb.ToString()); }
protected void QueryResult() { try { gvGetlist.EditIndex = -1; DataSet ds = BindList(); string parameter = string.Format("?ID={0}&slnID={1}", DropGetList.Text, ddlSolution.Text); UnitTestLink.NavigateUrl = "UnitTest.aspx" + parameter; AddRecordLink.NavigateUrl = "AddParamInfo.aspx" + parameter; AddProtocolLink.NavigateUrl = "AddContract.aspx" + parameter; UPRecordLink.NavigateUrl = "UpParamInfo.aspx" + parameter; btnCopyContract.NavigateUrl = "ContractList.aspx" + parameter; AddEnumLink.NavigateUrl = "addenum.aspx" + parameter; SearchLink.NavigateUrl = "search.aspx" + parameter; if (gvGetlist.Rows.Count != 0) { txtContent.Visible = true; txtContentto.Visible = true; btnCopy.Visible = true; btnCopyto.Visible = true; string name = Path.Combine(Server.MapPath("~"), "CustomerModel.txt"); string tempContentto = Mainfun.ReadTemp(name); txtContentto.Text = Mainfun.FromatTempto(tempContentto, ds, DropGetList.SelectedItem.Text); DataSet slnRecord = new SolutionBLL().GetList("SlnID=" + ddlSolution.Text); if (LangDropDownList.SelectedValue == "C#") { string fileName = Path.Combine(Server.MapPath("~"), "model.txt"); string tempContent = Mainfun.ReadTemp(fileName); string tempActionDefine = Mainfun.ReadTemp(Path.Combine(Server.MapPath("~"), "ActionIDDefine.txt")); txtContent.Text = Mainfun.FormatTemp(tempContent, ds, slnRecord, DropGetList.SelectedItem.Text); DataSet contractDs = new ContractBLL().GetList("slnID=" + ddlSolution.Text); txtActionDefine.Text = Mainfun.FormatActionDefineTemp(tempActionDefine, contractDs, slnRecord); txtActionDefine.Visible = true; } else { string fileName = Path.Combine(Server.MapPath("~"), "pythonmodel.txt"); string tempContent = Mainfun.ReadTemp(fileName); txtContent.Text = Mainfun.FormatPython(tempContent, ds, slnRecord, DropGetList.SelectedItem.Text); txtActionDefine.Text = string.Empty; txtActionDefine.Visible = false; }; lblExample.Text = Mainfun.GetExampleUrl(ds, DropGetList.Text); } else { txtContent.Text = string.Empty; txtContentto.Text = string.Empty; txtContent.Visible = false; btnCopy.Visible = false; btnCopyto.Visible = false; txtContentto.Visible = false; } } catch (Exception ex) { Response.Write("错误信息:" + ex.Message); } }
protected void btRefreshCache_Click(object sender, EventArgs e) { Mainfun.LoadEnumApplication(SlnID, true); }