首页 > 其他 > 详细

今天写个页面跳转helper,厌烦了不停跳的时候定中文写字母名字,还是管理起来好

时间:2015-05-20 16:18:35      阅读:219      评论:0      收藏:0      [点我收藏+]
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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!