protected void butSubmit_Click(object sender, EventArgs e) { ContractBLL BLL = new ContractBLL(); ContractModel model = new ContractModel(); model.ID = ContractID; model.SlnID = SlnID; model.Descption = txtDescption.Text.Trim(); model.AgreementID = Convert.ToInt32(ddlAgreement.SelectedValue); if (BLL.Update(model)) { Response.Write("<script language=javascript>alert('修改成功!')</script>"); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { this.txtServerUrl.Text = new SolutionBLL().GetUrl(SlnID); ddlContract.Items.Clear(); ContractBLL BLL = new ContractBLL(); DataSet ds = BLL.GetList("SlnID=" + SlnID); if (ds.Tables[0].Rows.Count > 0) { ddlContract.DataSource = ds; ddlContract.DataTextField = "uname"; ddlContract.DataValueField = "ID"; ddlContract.DataBind(); ddlContract.SelectedValue = ContractID.ToString(); } } }
protected void butSubmit_Click(object sender, EventArgs e) { if (txtSlnID.Text.Trim() == ddlSolution.Text.Trim() && txtCopyID.Text.Trim() == ddContract.Text) { Page.RegisterStartupScript("", "<script language=javascript>alert('不能复制至相同项目方案!')</script>"); return; } ContractBLL con = new ContractBLL(); if (con.Copy(int.Parse(txtSlnID.Text), int.Parse(ddContract.Text), int.Parse(ddlSolution.Text), int.Parse(txtCopyID.Text))) { Page.RegisterStartupScript("", "<script language=javascript>alert('复制成功!')</script>"); } else { Page.RegisterStartupScript("", "<script language=javascript>alert('复制失败!')</script>"); } }
private void BindData() { if (!string.IsNullOrEmpty(SearchTextBox.Text)) { ContractBLL BLL = new ContractBLL(); DataSet ds = BLL.Search(SlnID, SearchTextBox.Text); if (ds.Tables[0].Rows.Count == 0) { ResultLiteral.Visible = true; ResultLiteral.Text = "查不到任何结果"; } else { ResultLiteral.Visible = false; GridView.DataSource = ds; GridView.DataBind(); } } }
/// <summary> /// 初始化加载 /// </summary> public void Bind() { ddlAgreement.Items.Clear(); DataSet ds = SlnID == 0 ? new AgreementBLL().GetList("", "0") : new AgreementBLL().GetList(" gameid=" + SlnID, SlnID.ToString()); ddlAgreement.DataSource = ds; ddlAgreement.DataTextField = "Title"; ddlAgreement.DataValueField = "AgreementID"; ddlAgreement.DataBind(); if (ddlAgreement.Items.Count == 0) { ddlAgreement.Items.Add(new ListItem("无接口分类", "0")); } if (!Request.QueryString["ID"].Equals("")) { int ID = Convert.ToInt32(Request.QueryString["ID"]); int slnID = Convert.ToInt32(Request.QueryString["slnID"]); ContractBLL BLL = new ContractBLL(); ContractModel model = new ContractModel(); model = BLL.GetModel(ContractID, SlnID); txtDescption.Text = model.Descption; ddlAgreement.SelectedValue = model.AgreementID.ToString(); } }
protected void butSubmit_Click(object sender, EventArgs e) { try { ContractBLL con = new ContractBLL(); ContractModel model = new ContractModel(); model.ID = Convert.ToInt32(txtID.Text.Trim()); model.Descption = txtDescption.Text.Trim(); model.ParentID = 1; model.SlnID = SlnID; //model.AgreementID = Convert.ToInt32(ddlAgreement.SelectedValue); if (con.Add(model)) { Response.Redirect(String.Format("index.aspx?ID={0}&slnID={1}", model.ID, model.SlnID)); return; } } catch(Exception ex) { Page.RegisterStartupScript("", "<script language=javascript>alert('添加失败,填写重复!')</script>"); } }
/// <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)); } }
private void UpdateStatus(bool complated) { ContractBLL BLL = new ContractBLL(); if (BLL.UpdateStatus(Convert.ToInt32(DropGetList.Text), Convert.ToInt32(ddlSolution.Text), complated)) { //Response.Write("<script language=javascript>alert('提交成功!');</script>"); QueryResult(); Bind(); } else { Response.Write("<script language=javascript>alert('提交失败!')</script>"); } }
private void BindContract(int slnID) { DropGetList.Items.Clear(); ContractBLL BLL = new ContractBLL(); DataSet ds = BLL.GetList("SlnID=" + slnID); if (ds.Tables[0].Rows.Count > 0) { DropGetList.DataSource = ds; DropGetList.DataTextField = "uname"; DropGetList.DataValueField = "ID"; DropGetList.DataBind(); } string conId = ContractID; if (!string.IsNullOrEmpty(conId) && conId != "0") { try { DropGetList.SelectedValue = conId; } catch { } } }
protected void TreeList_SelectedNodeChanged(object sender, EventArgs e) { if (TreeList.SelectedNode.Target != "0") { ddlAgreement.SelectedValue = TreeList.SelectedNode.Parent.Value; ContractBLL BLL = new ContractBLL(); DataSet ds = ddlAgreement.SelectedValue == "0" ? BLL.GetList("AgreementID>=0") : BLL.GetList("AgreementID=" + ddlAgreement.SelectedValue); if (ds.Tables[0].Rows.Count > 0) { DropGetList.DataSource = ds; DropGetList.DataTextField = "uname"; DropGetList.DataValueField = "ID"; DropGetList.DataBind(); } else { DropGetList.Items.Clear(); DropGetList.Items.Add(new ListItem("无接口", "0")); } TreeList.SelectedNode.Checked = true; TreeList.SelectedNode.Selected = true; DropGetList.SelectedValue = TreeList.SelectedValue; SetCookies(ddlSolution.Text, DropGetList.Text); QueryResult(); } }
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 ddlSolution_SelectedIndexChanged(object sender, EventArgs e) { SetCookies(string.Empty, ddlSolution.Text); BindContract(Convert.ToInt32(ddlSolution.SelectedValue)); try { if (!string.IsNullOrEmpty(GetCookies(ddlSolution.Text))) { DropGetList.SelectedValue = GetCookies(ddlSolution.Text); } else { DropGetList.SelectedValue = ContractID; } } catch { } QueryResult(); 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())); } DataSet ds3 = new AgreementBLL().GetList(" gameid=" + ddlSolution.SelectedValue, ddlSolution.SelectedValue); DataSet ds4 = new ContractBLL().GetList(" SlnID=" + ddlSolution.SelectedValue); TreeList.Nodes.Clear(); for (int i = 0; i < ds3.Tables[0].Rows.Count; i++) { 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); } } } } }
protected void ddlAgreement_SelectedIndexChanged(object sender, EventArgs e) { ContractBLL BLL = new ContractBLL(); DataSet ds = ddlAgreement.SelectedValue == "0" ? BLL.GetList("AgreementID>=0") : BLL.GetList("AgreementID=" + ddlAgreement.SelectedValue); if (ds.Tables[0].Rows.Count > 0) { DropGetList.DataSource = ds; DropGetList.DataTextField = "uname"; DropGetList.DataValueField = "ID"; DropGetList.DataBind(); } else { DropGetList.Items.Clear(); DropGetList.Items.Add(new ListItem("无接口","0")); } }
protected void btnDeldte_Click(object sender, EventArgs e) { ContractBLL BLL = new ContractBLL(); if (!DropGetList.Text.Trim().Equals("")) { if (BLL.Delete(Convert.ToInt32(DropGetList.Text), Convert.ToInt32(ddlSolution.Text))) { Response.Write("<script language=javascript>alert('删除成功!')</script>"); QueryResult(); Bind(); } else { Response.Write("<script language=javascript>alert('删除失败!')</script>"); } } }
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(); } }
private void BindContract() { ddlContract.Items.Clear(); ContractBLL BLL = new ContractBLL(); DataSet ds = BLL.GetList("SlnID=" + SlnID); if (ds.Tables[0].Rows.Count > 0) { ddlContract.DataSource = ds; ddlContract.DataTextField = "uname"; ddlContract.DataValueField = "ID"; ddlContract.DataBind(); ddlContract.SelectedValue = ContractID.ToString(); ddlContract_SelectedIndexChanged(null, null); } }