public List <Models.ProductDataSqlModel> DataList(string verId)
        {
            var query     = ProductDataSqlRepository.GetQuery(o => o.DataId == verId);
            var queryVer  = ProductDataVerRepository.GetQuery(o => o.DataId == verId);
            var queryMenu = ProductMenuLimitRepository.GetQuery();
            var q         = from x in query
                            join y in queryVer on x.DataId equals y.DataId
                            orderby x.RunSort
                            select new Models.ProductDataSqlModel()
            {
                Id      = x.Id,
                MenuId  = x.MenuId,
                RunSort = x.RunSort,
                RunSql  = x.RunSql,
                DataId  = x.DataId,
                Title   = queryMenu.Where(o => o.ModuleId == y.ModuleId && o.MenuId == x.MenuId).Select(o => o.Title).FirstOrDefault()
            };

            var ms    = q.ToList();
            var menus = new List <Models.ProductDataSqlModel>();
            int i     = 0;

            foreach (var m in ms)
            {
                m.SqlMore = m.RunSql.TrimMore(200);
                m.Count   = ms.Count;
                m.Index   = i;
                i++;
                menus.Add(m);
            }
            return(menus);
        }
        public void MoveItem(short mode, int sn, string verId)
        {
            var list = ProductDataSqlRepository.GetQuery(o => o.DataId == verId).OrderBy(o => o.RunSort).ToList();
            var obj  = list.FirstOrDefault(o => o.MenuId == sn);

            switch (mode)
            {
            case 2:    //下移
                var obj1 = list.LastOrDefault();
                if (obj.Id != obj1.Id)
                {
                    Entity.ProductDataSql next = null;
                    for (var i = 0; i < list.Count; i++)
                    {
                        if (obj.Id == list[i].Id)
                        {
                            next = list[i + 1]; break;
                        }
                    }
                    if (next != null)
                    {
                        var sort = obj.RunSort;
                        obj.RunSort  = next.RunSort;
                        next.RunSort = sort;
                        ProductDataSqlRepository.SaveChanges();
                    }
                }
                break;

            default:    //上移
                var obj2 = list.FirstOrDefault();
                if (obj.Id != obj2.Id)
                {
                    Entity.ProductDataSql prev = null;
                    for (var i = 0; i < list.Count; i++)
                    {
                        if (obj.Id == list[i].Id)
                        {
                            prev = list[i - 1]; break;
                        }
                    }
                    if (prev != null)
                    {
                        var sort = obj.RunSort;
                        obj.RunSort  = prev.RunSort;
                        prev.RunSort = sort;
                        ProductDataSqlRepository.SaveChanges();
                    }
                }
                break;
            }
        }