using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.NetworkInformation;
using System.Web;
using JGDJWeb.Helper;
/*
* Created by Calos 2015年5月20日 15:28:59
**/
namespace System {
/// <summary>
/// 0519本次的所有pageNames
/// </summary>
public enum PageNames {
单篇 = 0,
多级列表页 = 1,
党员驿站 = 2,
公示公告 = 3,
列表页 = 4,
搜索页 = 5,
图片列表页 = 6,
详细页 = 7
}
/// <summary>
/// 设计静态存储类
/// </summary>
public class PageNamesCollection {
/// <summary>
/// do not only change the text or order in the list below,it correspond to the enum above
/// </summary>
private static readonly IList<string> PageNameShorts = new List<string>()
{
"danpian",
"djlby",
"dyyzh",
"gsgg",
"lby",
"sousuoye",
"tplby",
"xxy"
};
private const String Prefix = "Page";
private const String Suffix = ".aspx";
public static String GetPageName(PageNames pageName) {
return Prefix + PageNameShorts[int.Parse(pageName.ToString())] + Suffix;
}
}
public static class Extensions {
/// <summary>
/// 添加扩展方法
/// </summary>
/// <param name="pageName"></param>
/// <returns></returns>
public static String ToPageTitleCn(this PageNames pageName) {
return pageName.GetType().GetEnumName(int.Parse(pageName.ToString()));
}
public static String ToPageName(this PageNames pageName) {
return PageNamesCollection.GetPageName(pageName);
}
}
}
今天写个页面跳转helper,厌烦了不停跳的时候定中文写字母名字,还是管理起来好
原文:http://www.cnblogs.com/hualiu0/p/4517395.html