Exemple #1
0
        private void GridTest_Load(object sender, EventArgs e)
        {
            List <SUC_MODULE> models = new SUC_MODULE().FindAll();

            Maxrows = models.Count;
            int ids   = 0;
            int?pids  = 0;
            int?sords = 0;

            models.ForEach(x => {
                ids   += x.ID;
                pids  += x.PARENT_ID;
                sords += x.SHOW_ORDER;
            });
            models.Add(new SUC_MODULE()
            {
                ID         = ids,
                PARENT_ID  = pids,
                SHOW_ORDER = sords,
                NAME       = "合计"
            });
            dgv_ts1.DataSource        = models;
            dgv_ts1.Rows[2].Frozen    = true;
            dgv_ts1.Columns[0].Frozen = true;
        }
Exemple #2
0
        public string GetMenuData()
        {
            //string json = "[{\"UserId\": \"1\",\"MenuId\": \"1\",\"ParentId\": \"0\",\"FullName\": \"权限应用\",\"Description\": \"\",\"Img\": \"eye.png\",\"NavigateUrl\": \"\",\"FormName\": \"\",\"Target\": \"Click\",\"IsUnfold\": \"1\"},";
            //json+="{\"UserId\": \"1\",\"MenuId\": \"2\",\"ParentId\": \"1\",\"FullName\": \"职员管理\",\"Description\": \"\",\"Img\": \"people.png\",\"NavigateUrl\": \"/CommonModule/Employee/EmployeeIndex.html\",\"FormName\": \"\",\"Target\": \"Iframe\",\"IsUnfold\": \"0\"}";
            //json+="]";

            List <TreeMenu>   ltm = new List <TreeMenu>();
            List <SUC_MODULE> ms  = new List <SUC_MODULE>();

            ms = new SUC_MODULE().FindAll();
            foreach (SUC_MODULE m in ms)
            {
                TreeMenu t = new TreeMenu()
                {
                    Description = "",//m.DESCRPTION,
                    FormName    = m.NAME,
                    FullName    = m.NAME,
                    Img         = m.IMG,
                    IsUnfold    = m.PARENT_ID == 0 ? 1 : 0,
                    MenuId      = m.ID,
                    NavigateUrl = m.LOCATION,
                    ParentId    = m.PARENT_ID,
                    Target      = m.PARENT_ID == 0 ? "Click" : "Iframe",
                    UserId      = AppHelper.GetCurrentUser().ID
                };
                ltm.Add(t);
            }
            JSS.Serialize(ltm, sb);
            return(sb.ToString());
        }