12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- using CP.Model;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using CP.Common;
- using System.Configuration;
- using System.Linq.Expressions;
- namespace CP.Kjh.Models
- {
- public class RouteHelper
- {
- #region 配置
- private static readonly Lazy<List<RouteModel>> routeList = new Lazy<List<RouteModel>>(() =>
- {
- var data = OtherHelper.ConvertXMLToObject<RouteModel>(HttpContext.Current.Server.MapPath($@"{ConfigurationManager.AppSettings["RouteXml"]}"));
- data.ForEach(p =>
- {
- if (p.ViewNewName.IsEmpty())
- p.ViewNewName = p.OldName;
- });
- return data;
- });
- private static readonly Lazy<List<RouteModel>> homeRouteList = new Lazy<List<RouteModel>>(() => OtherHelper.ConvertXMLToObject<RouteModel>(HttpContext.Current.Server.MapPath($@"{ConfigurationManager.AppSettings["HomeRouteXml"]}")));
-
-
-
- public static List<RouteModel> RouteList { get { return routeList.Value; } }
-
-
-
- public static List<RouteModel> HomeRouteList { get { return homeRouteList.Value; } }
- #endregion
-
-
-
-
-
- public static string GetNewTypeName(string oldTypeName)
- {
- var list = RouteList.Where(p => p.OldName == oldTypeName).ToList();
- if (list.Count > 0)
- return list[0].NewName;
- return oldTypeName;
- }
-
-
-
-
-
- public static string GetOldTypeName(string newTypeName)
- {
- var list = RouteList.Where(p => p.NewName == newTypeName).ToList();
- if (list.Count > 0)
- return list[0].OldName;
- return newTypeName;
- }
-
-
-
-
-
- public static List<RouteModel> GetRouteList(CzTypeEnum? czTypeEnum)
- {
- if (czTypeEnum.HasValue)
- return RouteList.Where(p => p.CzTypeEnum == (int)czTypeEnum && p.IsShow == true).ToList();
- return RouteList;
- }
-
-
-
-
- public static List<RouteModel> GetHomeRouteList()
- {
- return HomeRouteList;
- }
- }
- }
|