Esempio n. 1
0
        public ActionResult EasyMain()
        {
            t_user model = new Dal.UserComm().getUser();

            ViewBag.usercode = model.code;
            ViewBag.userPwd  = model.pwd;

            return(View());
        }
Esempio n. 2
0
        //        public ActionResult Main()
        //        {
        //            ViewBag.systemName = ConfigurationManager.AppSettings["systemName"];//从webconfig取系统名称

        //            t_user usermodel = new Dal.UserComm().getUser();
        //            ViewBag.usercode = usermodel.bh;
        //            ViewBag.username = usermodel.username;
        //            string strsql = @"select code,name,topcode,icon,src
        //                            from s_menu
        //                            where 1=1
        //                            and code in (select menucode from s_menu_user where usercode = '" + usermodel.bh + @"')
        //                            order by code
        //                                                        ";
        //            DataTable dt = Dal.DataHelper.GetDataTable(strsql);

        //            DataRow[] dr = dt.Select(" topcode = '~' ");

        //            List<Tree> list = new List<Tree>();

        //            foreach (DataRow i in dr)
        //            {
        //                Tree tTree = new Tree()
        //                {
        //                    id = i["code"].ToString(),
        //                    text = i["name"].ToString(),
        //                    iconCls = i["icon"].ToString(),

        //                };
        //                DataRow[] drs = dt.Select(" topcode = '" + i["code"].ToString() + "'");

        //                List<Tree> lists = new List<Tree>();

        //                foreach (var s in drs)
        //                {
        //                    lists.Add(new Tree()
        //                    {
        //                        id = s["code"].ToString(),
        //                        text = s["name"].ToString(),
        //                        iconCls = s["icon"].ToString(),
        //                        link = s["src"].ToString(),
        //                    });
        //                }

        //                tTree.children = lists.ToArray();


        //                list.Add(tTree);
        //            }



        //            return View(list);
        //        }

        public ActionResult Main()
        {
            ViewBag.systemName = ConfigurationManager.AppSettings["systemName"];//从webconfig取系统名称
            t_user usermodel = new Dal.UserComm().getUser();

            ViewBag.usercode = usermodel.code;
            ViewBag.username = usermodel.name;
            string    strsql = @"select code,name,topcode,icon,src
                            from s_menu
                            where 1=1
                            and code in (select menucode from s_menu_user where usercode = '" + usermodel.code + @"')
                            order by code
                                                        ";
            DataTable dt     = Dal.DataHelper.GetDataTable(strsql);

            DataRow[] dr = dt.Select(" topcode = '~' ");

            List <Tree> list = new List <Tree>();

            foreach (DataRow i in dr)
            {
                Tree tTree = new Tree()
                {
                    id      = i["code"].ToString(),
                    text    = i["name"].ToString(),
                    iconCls = i["icon"].ToString(),
                };
                DataRow[] drs = dt.Select(" topcode = '" + i["code"].ToString() + "'");

                List <Tree> lists = new List <Tree>();

                foreach (var s in drs)
                {
                    //闪电sts.Add(new Tree()
                    //{
                    //    id = s["code"].ToString(),
                    //    text = s["name"].ToString(),
                    //    iconCls = s["icon"].ToString(),
                    //    link = s["src"].ToString(),
                    //});
                    Tree tTrees = new Tree()
                    {
                        id      = s["code"].ToString(),
                        text    = s["name"].ToString(),
                        iconCls = s["icon"].ToString(),
                        link    = s["src"].ToString(),
                    };

                    DataRow[]   drss   = dt.Select(" topcode = '" + s["code"].ToString() + "'");
                    List <Tree> listss = new List <Tree>();
                    foreach (var ss in drss)
                    {
                        Tree tTreess = new Tree()
                        {
                            id      = ss["code"].ToString(),
                            text    = ss["name"].ToString(),
                            iconCls = ss["icon"].ToString(),
                            link    = ss["src"].ToString(),
                        };
                        listss.Add(tTreess);
                    }
                    tTrees.children = listss.ToArray();
                    lists.Add(tTrees);
                }

                tTree.children = lists.ToArray();


                list.Add(tTree);
            }



            return(View(list));
        }