protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { try { int id = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Values[0].ToString()); string SlnName = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("SlnName")).Text; string Namespace = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("Namespace")).Text; string RefNamespace = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("RefNamespace")).Text; string url = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("Url")).Text; string gameid = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("gameid")).Text; SolutionModel mode = new SolutionModel(); mode.SlnID = id; mode.SlnName = SlnName; mode.Namespace = Namespace; mode.RefNamespace = RefNamespace; mode.Url = url; mode.GameID = Convert.ToInt32(gameid); SolutionBLL Pinfo = new SolutionBLL(); if (Pinfo.Update(mode)) { GridView1.EditIndex = -1; BindData(); } } catch (Exception erro) { Response.Write("错误信息:" + erro.Message); } }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { int id = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Values[0].ToString()); SolutionBLL Pinfo = new SolutionBLL(); if (Pinfo.Delete(id)) { GridView1.EditIndex = -1; BindData(); } } catch (Exception erro) { Response.Write("错误信息:" + erro.Message); } }
protected void butSubmit_Click(object sender, EventArgs e) { try { SolutionBLL con = new SolutionBLL(); SolutionModel model = new SolutionModel(); model.SlnName = txtDescption.Text.Trim(); model.Namespace = txtNamespace.Text.Trim(); model.RefNamespace = txtRefNamespace.Text.Trim(); model.GameID = Convert.ToInt32(txtGameID.Text); model.Url = txtUrl.Text.Trim(); if (con.Add(model) > 0) { Response.Redirect("SolutionsList.aspx"); } } catch(Exception ex) { Page.RegisterStartupScript("", "<script language=javascript>alert('添加失败,填写重复!')</script>"); } }
private void BindData() { if (ddlSolution.Items.Count <= 0) { ddlSolution.Items.Clear(); DataSet ds = new SolutionBLL().GetList(""); ddlSolution.DataSource = ds; 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 = new AgreementBLL().GetList(" GameID=" + GameID, GameID); this.GridView1.DataBind(); this.ddlSolution.SelectedValue = GameID; }
/// <summary> /// 初始化加载 /// </summary> public void Bind() { ddlSolution.Items.Clear(); DataSet ds = new SolutionBLL().GetList(""); ddlSolution.DataSource = ds; ddlSolution.DataTextField = "SlnName"; ddlSolution.DataValueField = "SlnID"; ddlSolution.DataBind(); ddlSolution.SelectedValue = SlnID; ddlAgreement.Items.Clear(); ddlAgreement.Items.Add(new ListItem("全部", "0")); DataSet ds2 = new AgreementBLL().GetList(" gameid=" + ddlSolution.SelectedValue, ddlSolution.SelectedValue); for (int i = 0; i < ds2.Tables[0].Rows.Count; i++) { ddlAgreement.Items.Add(new ListItem(ds2.Tables[0].Rows[i]["Title"].ToString(), ds2.Tables[0].Rows[i]["AgreementID"].ToString())); } //ddlAgreement.DataSource = ds2; //ddlAgreement.DataTextField = "Title"; //ddlAgreement.DataValueField = "AgreementID"; //ddlAgreement.DataBind(); ddlAgreement.SelectedValue = "0"; DataSet ds3 = new AgreementBLL().GetList(" gameid=" + ddlSolution.SelectedValue, ddlSolution.SelectedValue); DataSet ds4 = new ContractBLL().GetList(" SlnID=" + ddlSolution.SelectedValue); TreeList.Nodes.Clear(); leftStyle = "display:none;"; for (int i = 0; i < ds3.Tables[0].Rows.Count; i++) { leftStyle = ""; TreeNode node = new TreeNode(); node.Text = ds3.Tables[0].Rows[i]["Title"].ToString(); node.Value = ds3.Tables[0].Rows[i]["AgreementID"].ToString(); node.Target = "0"; node.Expanded = false; TreeList.Nodes.Add(node); //TreeList(0, node); TreeList.DataBind(); } for (int i = 0; i < ds4.Tables[0].Rows.Count; i++) { if (Convert.ToInt32(ds4.Tables[0].Rows[i]["AgreementID"]) > 0) { for (int j = 0; j < TreeList.Nodes.Count; j++) { TreeNode node = TreeList.Nodes[j]; if (ds4.Tables[0].Rows[i]["AgreementID"].ToString() == node.Value) { TreeNode nodes = new TreeNode(); nodes.Text = ds4.Tables[0].Rows[i]["uname"].ToString(); nodes.Value = ds4.Tables[0].Rows[i]["ID"].ToString(); node.ChildNodes.Add(nodes); } } } } //TreeList.Attributes.Add("onclick", "HandleCheckEvent()"); // if (!string.IsNullOrEmpty(hi_SlnId.Value)) // { // } if (ddlSolution.Text.Length > 0) { BindContract(Convert.ToInt32(ddlSolution.Text)); } }
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); } }
private void Bind(int slnID) { ddlSolution.Items.Clear(); DataSet dssln = new SolutionBLL().GetList(""); ddlSolution.DataSource = dssln; ddlSolution.DataTextField = "SlnName"; ddlSolution.DataValueField = "SlnID"; ddlSolution.DataBind(); var slnTable = dssln.Tables[0]; slnTable.PrimaryKey = new DataColumn[] { slnTable.Columns["SlnID"] }; var row = slnTable.Rows.Find(slnID); if (row != null) { lblSlnName.Text = row["SlnName"].ToString(); } ddContract.Items.Clear(); ContractBLL BLL = new ContractBLL(); DataSet ds = BLL.GetList("SlnID=" + slnID); if (ds.Tables[0].Rows.Count > 0) { ddContract.DataSource = ds; ddContract.DataTextField = "uname"; ddContract.DataValueField = "ID"; ddContract.DataBind(); ddContract.SelectedValue = ContractID.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { this.txtServerUrl.Text = GetCookies(string.Empty); if (this.txtServerUrl.Text.Length == 0) { this.txtServerUrl.Text = new SolutionBLL().GetUrl(SlnID); } SolutionModel solutionModel = new SolutionModel(); this.lbtGmeID.Text = new SolutionBLL().GetGameID(SlnID); ddlServerID.Items.Clear(); DataSet ds = new SolutionBLL().GetServerList(" GameID="+lbtGmeID.Text); ddlServerID.DataSource = ds; ddlServerID.DataTextField = "ServerName"; ddlServerID.DataValueField = "ID"; ddlServerID.DataBind(); BindContract(); } }