private void InitData() { leftTree.Nodes.Clear(); Hashtable htYx = new Hashtable(); htYx.Add("yxbz", 1); DataTable dtYx = YX.QueryYX(htYx); foreach (DataRow drYx in dtYx.Rows) { TreeNode RootNode = new TreeNode(); RootNode.Text = drYx["Yxmc"].ToString(); RootNode.Value = drYx["Yxbh"].ToString(); leftTree.Nodes.Add(RootNode); Hashtable ht = new Hashtable(); ht.Add("Zybh", drYx["Yxbh"].ToString()); ht.Add("yxbz", 1); DataTable dtZy = ZY.QueryZY(ht); foreach (DataRow drZy in dtZy.Rows) { TreeNode ParentNode = new TreeNode(); AddNodes(RootNode, ParentNode, drZy["Zymc"].ToString(), drZy["Zybh"].ToString()); Hashtable ht1 = new Hashtable(); ht1.Add("bjbh", drZy["Zybh"].ToString()); ht1.Add("yxbz", 1); DataTable dtBj = BJ.QueryBJ(ht1); foreach (DataRow drBj in dtBj.Rows) { TreeNode LeafNode = new TreeNode(); AddNodes(ParentNode, LeafNode, drBj["Bjmc"].ToString(), drBj["Bjbh"].ToString()); LeafNode.ShowCheckBox = true; } } } }
/// <summary> /// 初始化页面数据 /// </summary> private void InitData() { //if (Session["login_name"] == null) // Response.Redirect("login.aspx", false); //else //{ // string loginName = Session["login_name"].ToString(); // userMessage01.InnerText = "你好!" + loginName; string loginName = Session["login_name"].ToString(); userMessage01.InnerText = "你好!" + loginName; labelXnd.Text = Session["xnd"].ToString() + "学年度"; //初始化:类别下拉框中的数据,用院系表中的数据进行绑定 Hashtable ht = new Hashtable(); ht.Add("yxbz", 1); DataTable dt = YX.QueryYX(ht); selSelSsyx.Items.Add(new ListItem("全部", "")); foreach (DataRow dr in dt.Rows) { selSelSsyx.Items.Add(new ListItem(dr["Yxmc"].ToString(), dr["Yxbh"].ToString())); selSsyx.Items.Add(new ListItem(dr["Yxmc"].ToString(), dr["Yxbh"].ToString())); } //} }
/// <summary> /// 查询数据 /// </summary> private void Query() { //构造查询Hash对象 Hashtable queryItems = new Hashtable(); switch (selRange.Value) { case "教师编号": queryItems.Add("[js_kc_gxb].jsbh", txtContent.Value); break; case "教师姓名": queryItems.Add("jsxm", txtContent.Value); break; case "开办院系编号": queryItems.Add("[js_kc_gxb].kcbh", txtContent.Value); break; case "开办院系名称": { Hashtable ht = new Hashtable(); ht.Add("yxmc", txtContent.Value); string yxbh = ""; foreach (DataRow dr in YX.QueryYX(ht).Rows) { yxbh = dr["yxbh"].ToString(); } queryItems.Add("[js_kc_gxb].kcbh", yxbh); break; } } DataTable dt = Gzl.BusinessLogicLayer.KCRW.Query(queryItems); GV.DataSource = dt; GV.DataBind(); labelPageGV.Text = "查询结果(第" + (GV.PageIndex + 1).ToString() + "页 共" + GV.PageCount.ToString() + "页)"; }
/// <summary> /// 初始化页面数据 /// </summary> private void InitData() { string loginName = Session["login_name"].ToString(); userMessage01.InnerText = "你好!" + loginName; labelXnd.Text = Session["xnd"].ToString() + "学年度"; TreeView1.Nodes.Clear(); TreeNode RootNode = new TreeNode(); RootNode.Text = "全部"; RootNode.Value = ""; TreeView1.Nodes.Add(RootNode); Hashtable ht = new Hashtable(); ht.Add("yxbz", 1); DataTable dt = YX.QueryYX(ht); foreach (DataRow dr in dt.Rows) { TreeNode leafNode = new TreeNode(); AddNodes(RootNode, leafNode, dr["Yxmc"].ToString(), dr["Yxbh"].ToString()); } foreach (DataRow dr in dt.Rows) { selSsyx.Items.Add(new ListItem(dr["Yxmc"].ToString(), dr["Yxbh"].ToString())); } }
/// <summary> /// 初始化页面数据 /// </summary> private void InitData() { string loginName = Session["login_name"].ToString(); //读取Session中的登录名 userMessage01.InnerText = "你好!" + loginName; //欢迎信息 labelXnd.Text = Session["xnd"].ToString() + "学年度"; //读取Session中的学年度 //根据当前学年,设置年级下拉框数据 int i = Convert.ToInt32(labelXnd.Text.Substring(5, 4)); int n = i - 5; for (; n < i;) { selNj.Items.Add(Convert.ToString(i)); i--; } TreeView1.Nodes.Clear(); //清空所有树节点 TreeNode RootNode = new TreeNode(); //根节点实例化 RootNode.Text = "全部"; RootNode.Value = "__"; //设置根节点数据 TreeView1.Nodes.Add(RootNode); //把根节点插入到树中 Hashtable htYx = new Hashtable(); htYx.Add("yxbz", 1); DataTable dtYx = YX.QueryYX(htYx); //查找所有有效标志为True的院系 foreach (DataRow drYx in dtYx.Rows) { TreeNode ParentNode = new TreeNode(); //父节点实例化 AddNodes(RootNode, ParentNode, drYx["Yxmc"].ToString(), drYx["Yxbh"].ToString()); //以RootNode为父节点把ParentNode插入到树中 ListItem listYx = new ListItem(); //建立下拉框列表数据项对象 listYx.Text = drYx["Yxmc"].ToString(); //数据项文本为院系名称域中的值 listYx.Value = drYx["Yxbh"].ToString(); //数据项值为院系编号域中的值 selSsyx.Items.Add(listYx); //把数据项添加到院系下拉框 Hashtable ht = new Hashtable(); ht.Add("Zybh", drYx["Yxbh"].ToString()); ht.Add("yxbz", 1); DataTable dtZy = ZY.QueryZY(ht); //查找所有有效标志为True的专业 foreach (DataRow drZy in dtZy.Rows) { TreeNode LeafNode = new TreeNode(); AddNodes(ParentNode, LeafNode, drZy["Zymc"].ToString(), drZy["Zybh"].ToString());//以ParentNode为父节点把LeafNode插入到树中 } } Hashtable htZy = new Hashtable(); htZy.Add("Zybh", selSsyx.Items[0].Value); htZy.Add("yxbz", 1); DataTable dtZy1 = ZY.QueryZY(htZy); //查找所有有效标志为True的专业 foreach (DataRow drZy in dtZy1.Rows) { selSszy.Items.Add(new ListItem(drZy["zymc"].ToString(), drZy["zybh"].ToString())); //把数据项添加到院系下拉框 } }
/// <summary> /// 初始化页面数据 /// </summary> private void InitData() { selKbyx.Items.Add(new ListItem("全部", "")); Hashtable hash = new Hashtable(); hash.Add("yxbz", 1); DataTable dt = YX.QueryYX(hash); foreach (DataRow dr in dt.Rows) { selKbyx.Items.Add(new ListItem(dr["Yxmc"].ToString(), dr["Yxbh"].ToString())); } }
/// <summary> /// 初始化页面数据 /// </summary> private void InitData() { string loginName = Session["login_name"].ToString(); userMessage01.InnerText = "你好!" + loginName; labelXnd.Text = Session["xnd"].ToString() + "学年度"; Hashtable ht = new Hashtable(); ht.Add("yxbz", 1); DataTable dt = YX.QueryYX(ht); foreach (DataRow dr in dt.Rows) { selSsyx.Items.Add(new ListItem(dr["Yxmc"].ToString(), dr["Yxbh"].ToString())); } }
/// <summary> /// 初始化页面数据 /// </summary> private void InitData() { string loginName = Session["login_name"].ToString(); userMessage01.InnerText = "你好!" + loginName; labelXnd.Text = Session["xnd"].ToString() + "学年度"; leftTree.Nodes.Clear(); Hashtable htYx = new Hashtable(); htYx.Add("yxbz", 1); DataTable dtYx = YX.QueryYX(htYx); foreach (DataRow drYx in dtYx.Rows) { TreeNode RootNode = new TreeNode(); RootNode.Text = drYx["Yxmc"].ToString(); RootNode.Value = drYx["Yxbh"].ToString(); leftTree.Nodes.Add(RootNode); Hashtable ht = new Hashtable(); ht.Add("Zybh", drYx["Yxbh"].ToString()); ht.Add("yxbz", 1); DataTable dtZy = ZY.QueryZY(ht); foreach (DataRow drZy in dtZy.Rows) { TreeNode ParentNode = new TreeNode(); AddNodes(RootNode, ParentNode, drZy["Zymc"].ToString(), drZy["Zybh"].ToString()); Hashtable ht1 = new Hashtable(); ht1.Add("bjbh", drZy["Zybh"].ToString()); ht1.Add("yxbz", 1); DataTable dtBj = BJ.QueryBJ(ht1); foreach (DataRow drBj in dtBj.Rows) { TreeNode LeafNode = new TreeNode(); AddNodes(ParentNode,LeafNode,drBj["Bjmc"].ToString(),drBj["Bjbh"].ToString()); LeafNode.ShowCheckBox = true; } } } }
private void InitData() { string loginName = Session["login_name"].ToString(); userMessage01.InnerText = "你好!" + loginName; labelXnd.Text = Session["xnd"].ToString() + "学年度"; Database db = new Database(); DataTable dt = db.GetDataTable("select * from xndb"); foreach (DataRow dr in dt.Rows) { selXnxz.Items.Add(new ListItem(dr["xnd"].ToString(), dr["mrxn"].ToString())); } foreach (ListItem li in selXnxz.Items) { if (li.Selected == true) { li.Selected = false; } if (Convert.ToBoolean(li.Value)) { li.Selected = true; } } Hashtable hash = new Hashtable(); selYxmc.Items.Add(new ListItem("全部信息", "")); hash.Add("yxbz", 1); DataTable dtYx = YX.QueryYX(hash); foreach (DataRow drYx in dtYx.Rows) { selYxmc.Items.Add(new ListItem(drYx["Yxmc"].ToString(), drYx["Yxmc"].ToString())); } }
private void InitData() { Hashtable ht = new Hashtable(); ht.Add("yxbz", 1); DataTable dt = YX.QueryYX(ht); foreach (DataRow dr in dt.Rows) { selSsyx.Items.Add(new ListItem(dr["Yxmc"].ToString(), dr["Yxbh"].ToString())); } selSszy.Items.Add(new ListItem("全部", selSsyx.Items[0].Value)); Hashtable hash = new Hashtable(); hash.Add("yxbz", 1); hash.Add("zybh", selSsyx.Items[0].Value); DataTable dtZy = ZY.QueryZY(hash); foreach (DataRow drZy in dtZy.Rows) { selSszy.Items.Add(new ListItem(drZy["Zymc"].ToString(), drZy["Zybh"].ToString())); } }