• 绑定递归数据


      private IList<Model.Menus> ModelParent(DataTable dt, int parentid, IList<Model.Menus> ddl, string str)
            {
                string str_;
                string slt;
                slt = string.Format("parentid={0}", parentid);
                DataRow[] drarr = dt.Select(slt);
                foreach (DataRow dr in drarr)
                {
                    if (parentid == 0)
                    {
                        str_ = "";
                    }
                    else
                    {
                        str_ = "";
                    }
                    Model.Menus model=new Model.Menus();
                    if (dr["MenuID"] != null && dr["MenuID"].ToString() != "")
                    {
                        model.MenuID = int.Parse(dr["MenuID"].ToString());
                    }
                    if (dr["RankID"] != null)
                    {
                        model.RankID = dr["RankID"].ToString();
                    }
                    if (dr["TypeID"] != null && dr["TypeID"].ToString() != "")
                    {
                        model.TypeID = int.Parse(dr["TypeID"].ToString());
                    }
                    if (dr["MenuName"] != null)
                    {
                        model.MenuName = str + str_ + dr["MenuName"].ToString();
                    }
                    if (dr["ParentID"] != null && dr["ParentID"].ToString() != "")
                    {
                        model.ParentID = int.Parse(dr["ParentID"].ToString());
                    }
                    if (dr["ParentPath"] != null)
                    {
                        model.ParentPath = dr["ParentPath"].ToString();
                    }
                    if (dr["MenuDepth"] != null && dr["MenuDepth"].ToString() != "")
                    {
                        model.MenuDepth = int.Parse(dr["MenuDepth"].ToString());
                    }
                    if (dr["PrevID"] != null && dr["PrevID"].ToString() != "")
                    {
                        model.PrevID = int.Parse(dr["PrevID"].ToString());
                    }
                    if (dr["NextID"] != null && dr["NextID"].ToString() != "")
                    {
                        model.NextID = int.Parse(dr["NextID"].ToString());
                    }
                    if (dr["OrderID"] != null && dr["OrderID"].ToString() != "")
                    {
                        model.OrderID = int.Parse(dr["OrderID"].ToString());
                    }
                    if (dr["ChildCount"] != null && dr["ChildCount"].ToString() != "")
                    {
                        model.ChildCount = int.Parse(dr["ChildCount"].ToString());
                    }
                    if (dr["MenuNewsCount"] != null && dr["MenuNewsCount"].ToString() != "")
                    {
                        model.MenuNewsCount = int.Parse(dr["MenuNewsCount"].ToString());
                    }
                    if (dr["Content"] != null)
                    {
                        model.Content = dr["Content"].ToString();
                    }
                    if (dr["Visible"] != null && dr["Visible"].ToString() != "")
                    {
                        if ((dr["Visible"].ToString() == "1") || (dr["Visible"].ToString().ToLower() == "true"))
                        {
                            model.Visible = true;
                        }
                        else
                        {
                            model.Visible = false;
                        }
                    }
                    if (dr["ViewAmount"] != null && dr["ViewAmount"].ToString() != "")
                    {
                        model.ViewAmount = int.Parse(dr["ViewAmount"].ToString());
                    }
                    if (dr["LinkAddr"] != null)
                    {
                        model.LinkAddr = dr["LinkAddr"].ToString();
                    }
                    if (dr["Template"] != null && dr["Template"].ToString() != "")
                    {
                        model.Template = int.Parse(dr["Template"].ToString());
                    }
                    int parent_id = Convert.ToInt32(model.MenuID);
                    ddl.Add(model);
                    ModelParent(dt, parent_id, ddl, str + "..");
                }
                return ddl;
            }
  • 相关阅读:
    jquery ui autocomplete
    解决IIS服务和用户上传的文件分别部署在不同的电脑上时,解决权限的问题
    wpf一些例子
    t-sql 笔记(2)
    t-sql 笔记(1)
    测试基础之软件测试模型
    测试用例设计方法之错误猜测法
    测试用例设计方法之边界值分析法
    批处理文件将多台连接的手机安装同一个APP
    安卓和IOS抓包工具
  • 原文地址:https://www.cnblogs.com/zlzly/p/3324350.html
Copyright © 2020-2023  润新知