private void Bind(int slnID) { ddlSolution.Items.Clear(); var slnList = DbDataLoader.GetSolution(); ddlSolution.DataSource = slnList; ddlSolution.DataTextField = "SlnName"; ddlSolution.DataValueField = "SlnID"; ddlSolution.DataBind(); var slnModel = slnList.Where(p => p.SlnID == slnID).FirstOrDefault(); if (slnModel != null) { lblSlnName.Text = slnModel.SlnName; } ddContract.Items.Clear(); var contractList = DbDataLoader.GetContract(slnID, VerID); if (contractList.Count > 0) { ddContract.DataSource = contractList; ddContract.DataTextField = "uname"; ddContract.DataValueField = "ID"; ddContract.DataBind(); ddContract.SelectedValue = ContractID.ToString(); } }
private void BindData() { if (ddlSolution.Items.Count <= 0) { ddlSolution.Items.Clear(); ddlSolution.DataSource = DbDataLoader.GetSolution(null); ddlSolution.DataTextField = "SlnName"; ddlSolution.DataValueField = "SlnID"; ddlSolution.DataBind(); } string GameID = string.Empty; if (Request.QueryString["GameID"] == null || Request.QueryString["GameID"] == "") { GameID = ddlSolution.SelectedValue; } else { GameID = Request.QueryString["GameID"]; } this.GridView1.DataSource = DbDataLoader.GetAgreement(GameID.ToInt()); this.GridView1.DataBind(); this.ddlSolution.SelectedValue = GameID; }
private void BindSourceCode(int slnId, int versionId, int contractId, List <ParamInfoModel> requestParams, List <ParamInfoModel> responseParams) { var modol = DbDataLoader.GetContract(slnId, contractId, 0); var tileName = GetTileName(contractId, modol != null ? modol.Descption : null); bool isSelfAction = ckSelfAction.Checked; string clientTemp = string.Empty; string serverTemp = string.Empty; if (ddClientCodeType.Text == "Lua") { clientTemp = Path.Combine(Server.MapPath("~"), "Template/ClientLuaCode.txt"); txtClientCode.Text = TemplateHelper.FromatClientLuaTemp(TemplateHelper.ReadTemp(clientTemp), contractId, responseParams, requestParams, tileName); } else if (ddClientCodeType.Text == "C#") { clientTemp = Path.Combine(Server.MapPath("~"), isSelfAction ? "Template/ClientCsharpSelfCode.txt" : "Template/ClientCsharpCode.txt"); txtClientCode.Text = TemplateHelper.FromatClientCsharpTemp(TemplateHelper.ReadTemp(clientTemp), contractId, responseParams, requestParams, tileName); } else if (ddClientCodeType.Text == "Quick") { var clientSendTemp = Path.Combine(Server.MapPath("~"), "Template/ClientQuickCode-S.txt"); var clientReceiveTemp = Path.Combine(Server.MapPath("~"), "Template/ClientQuickCode-R.txt"); var codeBuild = new StringBuilder(); codeBuild.AppendLine(TemplateHelper.FromatClientQuickSendTemp(TemplateHelper.ReadTemp(clientSendTemp), contractId, responseParams, requestParams, tileName)); codeBuild.AppendLine(TemplateHelper.FromatClientQuickReceiveTemp(TemplateHelper.ReadTemp(clientReceiveTemp), contractId, responseParams, requestParams, tileName)); txtClientCode.Text = codeBuild.ToString(); } else { txtClientCode.Text = "Not supported code."; } var slnRecord = DbDataLoader.GetSolution(slnId); if (ddServerCodeType.Text == "C#") { serverTemp = Path.Combine(Server.MapPath("~"), isSelfAction ? "Template/ServerCsharpSelfCode.txt" : "Template/ServerCsharpCode.txt"); txtServerCode.Text = TemplateHelper.FormatTemp(TemplateHelper.ReadTemp(serverTemp), contractId, responseParams, requestParams, slnRecord, tileName); } else if (ddServerCodeType.Text == "Python") { serverTemp = Path.Combine(Server.MapPath("~"), "Template/ServerPythonCode.txt"); txtServerCode.Text = TemplateHelper.FormatPython(TemplateHelper.ReadTemp(serverTemp), responseParams, requestParams, slnRecord, tileName); } else if (ddServerCodeType.Text == "Lua") { //todo not serverTemp = Path.Combine(Server.MapPath("~"), "Template/ServerLuaCode.txt"); txtServerCode.Text = TemplateHelper.FormatLua(TemplateHelper.ReadTemp(serverTemp), contractId, responseParams, requestParams, slnRecord, tileName); } else { txtServerCode.Text = "Not supported code."; } }
private int BindSolution(int slnId) { ddlSolution.DataSource = DbDataLoader.GetSolution(); ddlSolution.DataTextField = "SlnName"; ddlSolution.DataValueField = "SlnID"; ddlSolution.DataBind(); ddlSolution.SelectedValue = slnId.ToString(); return(ddlSolution.SelectedValue.ToInt()); }
protected void OnRefresh(object sender, EventArgs e) { var slnModel = DbDataLoader.GetSolution(SlnID); int contractId = ddlContract.Text.ToInt(); var paramRecords = DbDataLoader.GetParamInfo(SlnID, contractId, VerID); string postParam = FormatPostParam(contractId, paramRecords.Where(t => t.ParamType == 1).ToList(), txtParams.Text); string query = NetHelper.GetSign(postParam, slnModel.IsDParam); txtPostParam.Text = slnModel.IsDParam ? string.Format("?d={0}", query) : query; Bind(); }
private void BindSourceCode(int slnId, int versionId, int contractId, List <ParamInfoModel> requestParams, List <ParamInfoModel> responseParams) { var modol = DbDataLoader.GetContract(slnId, contractId, 0); string tileName = modol != null ? modol.Descption : "Action " + contractId; int index = tileName.IndexOf("【", System.StringComparison.Ordinal); if (index != -1) { tileName = tileName.Substring(0, index); } bool isSelfAction = ckSelfAction.Checked; string clientTemp = string.Empty; string serverTemp = string.Empty; if (ddClientCodeType.Text == "Lua") { clientTemp = Path.Combine(Server.MapPath("~"), "Template/ClientLuaCode.txt"); txtClientCode.Text = TemplateHelper.FromatClientLuaTemp(TemplateHelper.ReadTemp(clientTemp), contractId, responseParams, requestParams, tileName); } else if (ddClientCodeType.Text == "C#") { clientTemp = Path.Combine(Server.MapPath("~"), isSelfAction ? "Template/ClientCsharpSelfCode.txt" : "Template/ClientCsharpCode.txt"); txtClientCode.Text = TemplateHelper.FromatClientCsharpTemp(TemplateHelper.ReadTemp(clientTemp), contractId, responseParams, requestParams, tileName); } var slnRecord = DbDataLoader.GetSolution(slnId); if (ddServerCodeType.Text == "C#") { serverTemp = Path.Combine(Server.MapPath("~"), isSelfAction ? "Template/ServerCsharpSelfCode.txt" : "Template/ServerCsharpCode.txt"); txtServerCode.Text = TemplateHelper.FormatTemp(TemplateHelper.ReadTemp(serverTemp), contractId, responseParams, requestParams, slnRecord, tileName); } else if (ddServerCodeType.Text == "Python") { serverTemp = Path.Combine(Server.MapPath("~"), "Template/ServerPythonCode.txt"); txtServerCode.Text = TemplateHelper.FormatPython(TemplateHelper.ReadTemp(serverTemp), responseParams, requestParams, slnRecord, tileName); } else if (ddServerCodeType.Text == "Lua") { //todo not serverTemp = Path.Combine(Server.MapPath("~"), "Template/ServerLuaCode.txt"); txtServerCode.Text = TemplateHelper.FormatLua(TemplateHelper.ReadTemp(serverTemp), contractId, responseParams, requestParams, slnRecord, tileName); } }
private void Bind() { int slnId = SlnID; int verId = VerID; int contractId = ddlContract.Text.ToInt(); SolutionModel solutionMode = DbDataLoader.GetSolution(slnId); if (solutionMode != null) { if (this.txtServerUrl.Text.Length == 0) { this.txtServerUrl.Text = solutionMode.Url; } int msgId = txtMsgId.Text.ToInt(); txtParams.Text = BuildRequestParam(msgId, txtSid.Text, txtUid.Text, contractId, slnId, verId, solutionMode.GameID); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { var slnModel = DbDataLoader.GetSolution(SlnID); this.txtServerUrl.Text = slnModel == null ? "" : slnModel.Url; ddlContract.Items.Clear(); var contractList = DbDataLoader.GetContract(SlnID); if (contractList.Count > 0) { ddlContract.DataSource = contractList; ddlContract.DataTextField = "uname"; ddlContract.DataValueField = "ID"; ddlContract.DataBind(); ddlContract.SelectedValue = ContractID.ToString(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { this.txtServerUrl.Text = GetCookies(string.Empty); SolutionModel solutionMode = DbDataLoader.GetSolution(SlnID); if (solutionMode != null) { if (this.txtServerUrl.Text.Length == 0) { this.txtServerUrl.Text = solutionMode.Url; } string gameId = solutionMode.GameID.ToString(); gameId = string.IsNullOrEmpty(gameId) ? "0" : gameId; this.lbtGmeID.Text = gameId; } BindContract(); } }
private int BindSolution(int slnId) { var list = DbDataLoader.GetSolution(); ddlSolution.DataSource = list; ddlSolution.DataTextField = "SlnName"; ddlSolution.DataValueField = "SlnID"; ddlSolution.DataBind(); ddlSolution.SelectedValue = slnId.ToString(); SolutionModel model = list.Find(t => t.SlnID == slnId); if (model != null) { ddServerCodeType.Text = model.SerUseScript; ddClientCodeType.Text = model.CliUseScript; } return(ddlSolution.SelectedValue.ToInt()); }
protected void OnSendClick(object sender, EventArgs e) { try { var slnModel = DbDataLoader.GetSolution(SlnID); int msgId = txtMsgId.Text.ToInt() + 1; txtMsgId.Text = msgId.ToString(); int contractId = ddlContract.Text.ToInt(); int headPropertyId = ddHeadProperty.Text.ToInt(); string pid = Session["pid"] == null ? Session.SessionID : Session["pid"].ToString(); Session["pid"] = pid; var paramRecords = DbDataLoader.GetParamInfo(SlnID, contractId, VerID); var headPropertyList = headPropertyId == 0 || headPropertyId == contractId ? new List <ParamInfoModel>() : DbDataLoader.GetParamInfo(SlnID, headPropertyId, VerID).Where(t => t.ParamType == 2).ToList(); string postParam = FormatPostParam(contractId, paramRecords.Where(t => t.ParamType == 1).ToList(), txtParams.Text); bool includeParam = slnModel.IsDParam; string query = NetHelper.GetSign(postParam, includeParam); txtPostParam.Text = includeParam ? string.Format("?d={0}", query) : query; dvResult.InnerHtml = "正在请求,请稍候..."; string sid; string uid; string st; var cookies = Session["cookies"] as CookieContainer ?? new CookieContainer(); dvResult.InnerHtml = PostGameServer(headPropertyList, paramRecords.Where(t => t.ParamType == 2).ToList(), contractId, txtServerUrl.Text, postParam, pid, includeParam, slnModel.RespContentType, ddResponseShowType.Text.ToInt(), cookies, out sid, out uid, out st); Session["cookies"] = cookies; if (!string.IsNullOrEmpty(sid)) { txtSid.Text = sid; txtUid.Text = uid; txtSt.Text = st; } } catch (Exception ex) { dvResult.InnerHtml = string.Format("请求异常:{0}", ex.Message); TraceLog.WriteError("Contract debug error:{0}", ex); } }
private void Bind(int slnID, int contractID, int newSlnId, int newContractID, int verId) { ddlSolution.Items.Clear(); var slnList = DbDataLoader.GetSolution(); ddlSolution.DataSource = slnList; ddlSolution.DataTextField = "SlnName"; ddlSolution.DataValueField = "SlnID"; ddlSolution.DataBind(); ddlSolution.SelectedValue = newSlnId.ToString(); var slnModel = slnList.Where(p => p.SlnID == slnID).FirstOrDefault(); if (slnModel != null) { lblSlnName.Text = slnModel.SlnName; } ddContract.Items.Clear(); var contractList = DbDataLoader.GetContract(slnID, verId); if (contractList.Count > 0) { ddContract.DataSource = contractList; ddContract.DataTextField = "uname"; ddContract.DataValueField = "ID"; ddContract.DataBind(); ddContract.SelectedValue = contractID.ToString(); } List <ParamInfoModel> requestParams; List <ParamInfoModel> responseParams; GetParamInfo(slnID, contractID, verId, out requestParams, out responseParams); int paramtype = 2; BindResponseParams(paramtype == 1 ? requestParams : responseParams); GetParamInfo(newSlnId, newContractID, 0, out requestParams, out responseParams); BindNewResponseParams(paramtype == 1 ? requestParams : responseParams); }
/// <summary> /// 初始化加载 /// </summary> public void Bind() { ddlSolution.Items.Clear(); var list = DbDataLoader.GetSolution(); ddlSolution.DataSource = list; ddlSolution.DataTextField = "SlnName"; ddlSolution.DataValueField = "SlnID"; ddlSolution.DataBind(); ddlSolution.SelectedValue = SlnID; int gameId = ddlSolution.SelectedValue.ToInt(); BindAgreement(gameId); BindContractTree(gameId); if (ddlSolution.Text.Length > 0) { BindContract(Convert.ToInt32((string)ddlSolution.Text)); } }
private void BindData() { this.GridView1.DataSource = DbDataLoader.GetSolution(); this.GridView1.DataBind(); }
protected void OnExportAllSererCode(object sender, EventArgs e) { try { string type = ddServerCodeType.Text; int slnId = ddlSolution.Text.ToInt(); int agreementId = ddlAgreement.Text.ToInt(); int versionId = ddVersion.Text.ToInt(); bool isSelfAction = ckSelfAction.Checked; var slnRecord = DbDataLoader.GetSolution(slnId); List <ZipFileInfo> zipFileList = null; List <ContractModel> contractList = DbDataLoader.GetContractByAgreement(slnId, agreementId, versionId); string serverTemp = string.Empty; if (type == "C#") { serverTemp = TemplateHelper.ReadTemp(Path.Combine(Server.MapPath("~"), isSelfAction ? "Template/ServerCsharpSelfCode.txt" : "Template/ServerCsharpCode.txt")); } else if (type == "Python") { serverTemp = TemplateHelper.ReadTemp(Path.Combine(Server.MapPath("~"), "Template/ServerPythonCode.txt")); } else if (type == "Lua") { serverTemp = TemplateHelper.ReadTemp(Path.Combine(Server.MapPath("~"), "Template/ServerLuaCode.txt")); } else { return; } ZipFileInfo zipFile; zipFileList = new List <ZipFileInfo>(); string fileExt; string content; foreach (var model in contractList) { int contractId = model.ID; var tileName = GetTileName(model.ID, model.Descption); List <ParamInfoModel> requestParams; List <ParamInfoModel> responseParams; GetParamInfo(slnId, contractId, versionId, out requestParams, out responseParams); if (type == "C#") { fileExt = ".cs"; content = TemplateHelper.FormatTemp(serverTemp, contractId, responseParams, requestParams, slnRecord, tileName); } else if (type == "Python") { fileExt = ".py"; content = TemplateHelper.FormatPython(serverTemp, responseParams, requestParams, slnRecord, tileName); } else if (type == "Lua") { fileExt = ".lua"; content = TemplateHelper.FormatLua(serverTemp, contractId, responseParams, requestParams, slnRecord, tileName); } else { break; } zipFile = new ZipFileInfo() { Name = string.Format("Action{0}{1}", contractId, fileExt) }; zipFile.Content = content; zipFileList.Add(zipFile); } if (zipFileList.Count > 0) { SaveAsAttachment(string.Format("{0}Action{1}.zip", type, DateTime.Now.ToString("HHmmss")), zipFileList, true); } } catch (Exception ex) { TraceLog.WriteError("OnExportAllSererCode error:{0}", ex); } }
protected void QueryResult() { try { gvGetlist.EditIndex = -1; var paramList = BindList(); var reqParams = paramList.Where(p => p.ParamType == 1).OrderBy(p => p.SortID).ToList(); var respParams = paramList.Where(p => p.ParamType == 2).OrderBy(p => p.SortID).ToList(); int contractId = DropGetList.Text.ToInt(); string parameter = string.Format("?ID={0}&slnID={1}", contractId, 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; syncLink.Target = "_blank"; syncLink.NavigateUrl = "SyncModelInfo.aspx" + parameter; btnTestCase.NavigateUrl = "TestCase.aspx" + parameter; btnTestCase.Target = "_blank"; string tileName = DropGetList.SelectedItem.Text; int index = tileName.IndexOf("【"); if (index != -1) { tileName = tileName.Substring(0, index); } int slnId = ddlSolution.Text.ToInt(); if (gvGetlist.Rows.Count != 0) { txtContent.Visible = true; txtContentto.Visible = true; btnCopy.Visible = true; btnCopyto.Visible = true; string name = Path.Combine(Server.MapPath("~"), "Template/CustomerModel.txt"); string tempContentto = TemplateHelper.ReadTemp(name); txtContentto.Text = TemplateHelper.FromatClientLuaTemp(tempContentto, contractId, respParams, reqParams, tileName); var slnRecord = DbDataLoader.GetSolution(slnId); if (LangDropDownList.SelectedValue == "C#") { string fileName = Path.Combine(Server.MapPath("~"), "Template/model.txt"); string tempContent = TemplateHelper.ReadTemp(fileName); string tempActionDefine = TemplateHelper.ReadTemp(Path.Combine(Server.MapPath("~"), "Template/ActionIDDefine.txt")); txtContent.Text = TemplateHelper.FormatTemp(tempContent, contractId, respParams, reqParams, slnRecord, tileName); var contractDs = DbDataLoader.GetContract(slnId); txtActionDefine.Text = TemplateHelper.FormatActionDefineTemp(tempActionDefine, contractDs, slnRecord); txtActionDefine.Visible = true; } else { string fileName = Path.Combine(Server.MapPath("~"), "Template/pythonmodel.txt"); string tempContent = TemplateHelper.ReadTemp(fileName); txtContent.Text = TemplateHelper.FormatPython(tempContent, respParams, reqParams, slnRecord, tileName); txtActionDefine.Text = string.Empty; txtActionDefine.Visible = false; }; lblExample.Text = TemplateHelper.GetExampleUrl(respParams, 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) { TraceLog.WriteError("QueryResult:{0}", ex); Response.Write("错误信息:" + ex.Message); } }