protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { return; } dropBing(); if (!string.IsNullOrEmpty(Request.QueryString["kid"])) { int kid = Convert.ToInt32(Request.QueryString["kid"]); Model.GameKindInfo gk = new BLL.GameKindInfo().GetModel(kid); txtKindName.Text = gk.KindName; txtSortID.Text = Convert.ToString(gk.SortID); dropType.SelectedValue = Convert.ToString(gk.TypeID); txtTableCount.Text = Convert.ToString(gk.TableCount); txtCellScore.Text = Convert.ToString(gk.CellScore); txtHighScore.Text = Convert.ToString(gk.HighScore); txtLessScore.Text = Convert.ToString(gk.LessScore); txtProcessType.Text = Convert.ToString(gk.ProcessType); txtTaxRate.Text = Convert.ToString(gk.TaxRate); txtBetPool.Text = Convert.ToString(gk.BetPool); TextBox1.Text = Convert.ToString(gk.AILevel); txtAIUserCount.Text = Convert.ToString(gk.AIUserCount); txtProcessType.ReadOnly = true; } else if (!string.IsNullOrEmpty(Request.QueryString["tid"])) { int tid = Convert.ToInt32(Request.QueryString["tid"]); dropType.SelectedValue = Convert.ToString(tid); dropType.Enabled = false; txtProcessType.ReadOnly = false; } }
protected void btnenable_Click(object sender, EventArgs e) { try { bool result = false; for (int i = 0; i < TreeView1.CheckedNodes.Count; i++) { int KindID = Convert.ToInt32(TreeView1.CheckedNodes[i].Value.Substring(1)); int TypeID = Convert.ToInt32(TreeView1.CheckedNodes[i].Parent.Value.Substring(1)); int enab = 1; result = new BLL.GameKindInfo().isEnaableGame(enab, KindID); if (TreeView1.CheckedNodes[i].ChildNodes.Count > 0) { result = new BLL.GameServerInfo().isEnableGame(KindID, TypeID, enab); } TreeNode node = TreeView1.CheckedNodes[i].Parent; node.ChildNodes.Remove(TreeView1.CheckedNodes[i]); i--; } if (result) { Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('启用成功')</script>"); } else { Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('启用失败')</script>"); } } catch (Exception) { throw; } }
/// <summary> /// 递归树 /// </summary> /// <param name="node"></param> public void RecursiveTree(TreeNode node) { if (node.Value.Substring(0, 1) == "T") { DataSet dst = new BLL.GameKindInfo().KindBind(Convert.ToInt32(node.Value.Substring(1)), 0); DataTable dtt = dst.Tables["ds"]; foreach (DataRow trow in dtt.Rows) { TreeNode Tnd = new TreeNode(trow["Texts"].ToString(), "K" + trow["KindID"]); Tnd.ShowCheckBox = true; node.ChildNodes.Add(Tnd); RecursiveTree(Tnd); } } else if (node.Value.Substring(0, 1) == "K") { DataSet dsk = new BLL.GameServerInfo().ServerBind(Convert.ToInt32(node.Value.Substring(1)), 0); DataTable dtk = dsk.Tables["ds"]; foreach (DataRow krow in dtk.Rows) { TreeNode stnd = new TreeNode(krow["Texts"].ToString(), "S" + krow["ServerID"]); node.ChildNodes.Add(stnd); } } }
protected void btndisable_Click(object sender, EventArgs e) { bool result = false; if (TreeView1.SelectedValue.Substring(0, 1) != "K") { Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请选择正确的游戏类型')</script>"); } else { int KindID = Convert.ToInt32(TreeView1.SelectedValue.Substring(1)); int TypeID = Convert.ToInt32(TreeView1.SelectedNode.Parent.Value.Substring(1)); result = new BLL.GameKindInfo().isEnaableGame(0, KindID); if (TreeView1.SelectedNode.ChildNodes.Count > 0) { result = new BLL.GameServerInfo().isEnableGame(KindID, TypeID, 0); } TreeNode node = TreeView1.SelectedNode.Parent; node.ChildNodes.Remove(TreeView1.SelectedNode); if (result) { Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('禁用成功')</script>"); } else { Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('禁用失败')</script>"); } } }
protected void TreeView1_TreeNodeExpanded(object sender, TreeNodeEventArgs e) { e.Node.ChildNodes.Clear(); switch (e.Node.Value.Substring(0, 1)) { case "P": TreeNode tnode = new TreeNode(); DataSet ds = new BLL.GameTypeInfo().TypeBind(1); DataTable dt = ds.Tables["ds"]; foreach (DataRow row in dt.Rows) { tnode = new TreeNode { Text = "" + row["Texts"].ToString() + "", Value = "T" + row["TypeID"].ToString() + "", PopulateOnDemand = true }; e.Node.ChildNodes.Add(tnode); } break; case "T": TreeNode knode = new TreeNode(); DataSet dsk = new BLL.GameKindInfo().KindBind(Convert.ToInt32(e.Node.Value.Substring(1)), 1); DataTable dtk = dsk.Tables["ds"]; foreach (DataRow krow in dtk.Rows) { knode = new TreeNode { Text = "" + krow["Texts"].ToString() + "", Value = "K" + krow["KindID"].ToString() + "", PopulateOnDemand = true }; e.Node.ChildNodes.Add(knode); } break; case "K": TreeNode snode = new TreeNode(); DataSet dss = new BLL.GameServerInfo().ServerBind(Convert.ToInt32(e.Node.Value.Substring(1)), 1); DataTable dts = dss.Tables["ds"]; foreach (DataRow srow in dts.Rows) { snode = new TreeNode { Text = "" + srow["Texts"].ToString() + "", Value = "S" + srow["ServerID"].ToString() + "", PopulateOnDemand = true }; e.Node.ChildNodes.Add(snode); } break; } }
protected void btnSubSpecies_Click(object sender, EventArgs e) { try { Model.GameKindInfo gk = new Model.GameKindInfo(); gk.KindName = txtKindName.Text.Trim(); gk.SortID = Convert.ToInt32(txtSortID.Text); gk.TypeID = Convert.ToInt32(dropType.SelectedValue); gk.TableCount = Convert.ToInt32(txtTableCount.Text); gk.HighScore = Convert.ToInt32(txtHighScore.Text); gk.CellScore = Convert.ToInt32(txtCellScore.Text); gk.LessScore = Convert.ToInt32(txtLessScore.Text); gk.TaxRate = Convert.ToDecimal(txtTaxRate.Text) / 1000; gk.AIUserCount = Convert.ToInt32(txtAIUserCount.Text); gk.AILevel = Convert.ToInt32(TextBox1.Text); gk.BetPool = Convert.ToInt32(gk.BetPool); gk.ProcessType = Convert.ToInt32(txtProcessType.Text); gk.Enable = true; bool result = false; if (!string.IsNullOrEmpty(Request.QueryString["kid"])) { int kid = Convert.ToInt32(Request.QueryString["kid"]); gk.KindID = kid; result = new BLL.GameKindInfo().Update(gk); } else { result = new BLL.GameKindInfo().Add(gk); } if (result) { Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('保存成功')</script>"); } else { Page.ClientScript.RegisterStartupScript(GetType(), "", "<scirpt>alert('保存失败')</script>"); } } catch (Exception) { throw; } }