| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1117 人关注过本帖
标题:c#语言不会翻译 请解答
取消只看楼主 加入收藏
xsz9223344
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2009-11-5
收藏
 问题点数:0 回复次数:1 
c#语言不会翻译 请解答
using System;
using System.Web.UI.WebControls;
using System.Collections.Generic;
using BookManage.Model;
using BookManage.BLL;


public partial class Book_Manage : PageBase
{
    public int book_category_id = 0;
    private const string STRING_ROOT = "所有分类";
    protected void Page_Load(object sender, EventArgs e)
    {
        base.CheckUserPopedom();
        if (!Page.IsPostBack)
        {
            LoadTreeView();
            BindGrid();
        }
    }

    private void LoadTreeView()
    {
        BookManage.BLL.Book_Category newCategory = new BookManage.BLL.Book_Category();
        IList<BookManage.Model.Book_CategoryInfo> data = newCategory.Get_All();
        InitTreeView("0", (TreeNode)null, data);
        this.tv_book_category.CollapseAll();
    }

    //InitTreeView 使用递归生成类别树
    private void InitTreeView(string ParentId, TreeNode ParentNode, IList<BookManage.Model.Book_CategoryInfo> data)
    {
        if (ParentNode == null)//无根结点
        {
            TreeNode treeNode = new TreeNode();
            treeNode.Value = "0";
            treeNode.Text = STRING_ROOT;
            treeNode.ToolTip = STRING_ROOT;
            this.tv_book_category.Nodes.Add(treeNode);
            InitTreeView(treeNode.Value, treeNode, data);
        }
        else
        {
            foreach (BookManage.Model.Book_CategoryInfo category in data)
            {
                TreeNode treeNode = new TreeNode();
                if (ParentNode.Value.Equals(category.book_category_parent_id.ToString()) && !ParentId.Equals(category.book_category_id.ToString()))
                {
                    {
                        treeNode.Value = category.book_category_id.ToString();
                        treeNode.Text = category.book_category_name;
                        treeNode.ToolTip = category.book_category_name;
                        ParentNode.ChildNodes.Add(treeNode);
                        InitTreeView(treeNode.Value, treeNode, data);
                    }
                }
            }
        }
    }

    protected void tv_book_category_SelectedNodeChanged(object sender, EventArgs e)
    {
        this.book_category_id = Int32.Parse(this.tv_book_category.SelectedNode.Value);
    }

    //绑定信息
    private void BindGrid()
    {
        try
        {
            this.book_category_id = Int32.Parse(this.tv_book_category.SelectedNode.Value);
            Book newBook = new Book();
            IList<BookInfo> data = newBook.Get_By_Keyword(this.hdf_keyword.Value, this.book_category_id);
            gv_manage.DataSource = data;
            gv_manage.DataBind();
        }
        catch
        {
            Book newBook = new Book();
            IList<BookInfo> data = newBook.Get_By_Keyword(this.hdf_keyword.Value, 0);
            gv_manage.DataSource = data;
            gv_manage.DataBind();
        }
    }

    protected void btn_search_Click(object sender, EventArgs e)
    {
        this.hdf_keyword.Value = this.txt_keyword.Text;
        BindGrid();
    }

    protected void btn_del_Click(object sender, EventArgs e)
    {
        string ids = this.GetSelectedItemID("checkbox");
        int flag = 1;
        if (ids.Trim() != "")
        {
            try
            {
                string[] sResult = ids.Split(',');
                foreach (string s in sResult)
                {
                    int id = Int32.Parse(s);
                    Book newBook = new Book();
                    flag = 1 + newBook.Delete(id) - flag;//flag<=0时说明有删除失败
                }
                WebUtility.CheckOperating(flag, 1);
                BindGrid();
            }
            catch
            {
                flag = 0;
                WebUtility.CheckOperating(flag, 5);
            }
        }
    }

    //遍历GridView获得checked的ID
    private string GetSelectedItemID(string controlID)
    {
        string selectedID = "";
        for (int i = 0; i < this.gv_manage.Rows.Count; i++)
        {
            CheckBox cb = (CheckBox)this.gv_manage.Rows[i].Cells[0].FindControl(controlID);
            if (cb.Checked)
            {
                selectedID += gv_manage.DataKeys[gv_manage.Rows[i].RowIndex].Value.ToString() + ",";
            }
        }
        if (selectedID.Length > 0)
        {
            selectedID = selectedID.Substring(0, selectedID.Length - 1);
        }
        return selectedID;
    }

    protected void gv_manage_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        this.gv_manage.PageIndex = e.NewPageIndex;
        BindGrid();
    }
}
搜索更多相关主题的帖子: 解答 语言 翻译 
2009-11-05 11:28
xsz9223344
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2009-11-5
收藏
得分:0 
回复 2楼 jedypjd
不会翻译
2009-11-05 13:17
快速回复:c#语言不会翻译 请解答
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.034062 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved