示例#1
0
    //获取子类
    protected void GetChildClass(int parentID)
    {
        jiantou += "---";

        string cmdText = "select * from " + TableName + " where ParentID=" + parentID + " order by OrderBy asc";

        DataTable list = new YK.Core.SqlHelper().GetDataSet(cmdText).Tables[0];

        if (list.Rows.Count > 0)
        {
            foreach (DataRow dr in list.Rows)
            {
                ListItem li = new ListItem();
                li.Value = dr["ID"].ToStr();
                li.Text  = jiantou + dr[NameField].ToStr();

                DDLMenu.Items.Add(li);

                //再次查询子类
                GetChildClass(dr["ID"].ToInt());
            }
        }

        //每推出一次循环jiantou减少两个>>符号
        jiantou = jiantou.Substring(0, jiantou.Length - 3);
    }
示例#2
0
    DataTable dt = new DataTable(); //记录类别信息,绑定到Repeater,采用递归方式记录

    //加载
    public void LoadDataBind()
    {
        string cmdText = "select * from " + TableName + " where ParentID=0 order by OrderBy asc";

        DataTable list = new YK.Core.SqlHelper().GetDataSet(cmdText).Tables[0];

        foreach (DataRow dr in list.Rows)
        {
            ListItem li = new ListItem();
            li.Value = dr["ID"].ToStr();
            li.Text  = dr[NameField].ToStr();

            DDLMenu.Items.Add(li);

            jiantou = "";//记录级别

            //获取子类
            GetChildClass(dr["ID"].ToInt());
        }

        ListItem li2 = new ListItem();

        li2.Text  = "==请选择==";
        li2.Value = "0";
        DDLMenu.Items.Insert(0, li2);
    }
示例#3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        _logger.Info("hello");

        Response.Write(545646.GetType().Name);
        Response.Write("adfasdfaf".GetType().Name);

        aaaa aa = new aaaa();

        foreach (var prop in aa.GetType().GetProperties())
        {
            Type typex = Nullable.GetUnderlyingType(prop.PropertyType) ?? prop.PropertyType;
            Response.Write(typex.Name + "<br/>");
        }

        DataSet ds = new YK.Core.SqlHelper().GetDataSet("select top 0 * from dbo.TB_Admin_Resources");

        foreach (DataColumn cn in ds.Tables[0].Columns)
        {
            Response.Write(cn.DataType + "<br/>");
        }

        object[] paras = new object[1] {
            1
        };
        Type   type = Type.GetType("_Default");
        object obj  = Activator.CreateInstance(type, null);

        Type[] types = new Type[1];
        for (int i = 0; i < paras.Length; i++)
        {
            types[i] = paras[i].GetType();
        }
        MethodInfo methodInfo = type.GetMethod("GetCount", types);

        Response.Write(methodInfo.Invoke(obj, paras));
        //
        //Response.Write(type.InvokeMember("GetCount", BindingFlags.InvokeMethod, null, obj, paras));

        string name = "家用电器";

        var list2 = YK.Service.ProductService.CategoryService.Search(w => w.CategoryName != name && w.ID > 8);

        var list = YK.Service.ProductService.CategoryService.Search(w => w.CategoryName.Like(name));

        List <object> arr = new List <object>()
        {
            "家用电器"
        };
        var list3 = YK.Service.ProductService.CategoryService.Search(w => w.CategoryName.In(arr) && w.ID < 8);
    }