你的位置:首页 > ASP.net教程

[ASP.net教程]【C#公共帮助类】枚举独特类


这个是枚举类,可能大家根据个人需求不同,不是很需要,但是跟着做那个项目的朋友会用到 我在这贴一下代码

 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.ComponentModel; 6  7 namespace Common.Enums 8 { 9   /// <summary> 10   /// 枚举独特类 11   /// add yuangang by 2016-05-10 12   /// </summary> 13   public class EnumsClass 14   { 15     /// <summary> 16     /// 枚举value 17     /// </summary> 18     public int Value { get; set; } 19     /// <summary> 20     /// 枚举显示值 21     /// </summary> 22     public string Name { get; set; } 23     /// <summary> 24     /// 枚举说明 25     /// </summary> 26     public string Text { get; set; } 27   } 28  29   #region 系统管理相关 30   /// <summary> 31   /// 系统操作枚举 32   /// </summary> 33   public enum enumOperator 34   { 35     /// <summary> 36     /// 无 37     /// </summary> 38     [Description("无")] 39     None, 40     /// <summary> 41     /// 查询 42     /// </summary> 43     [Description("查询")] 44     Select, 45     /// <summary> 46     /// 添加 47     /// </summary> 48     [Description("添加")] 49     Add, 50     /// <summary> 51     /// 修改 52     /// </summary> 53     [Description("修改")] 54     Edit, 55     /// <summary> 56     /// 移除 57     /// </summary> 58     [Description("移除")] 59     Remove, 60     /// <summary> 61     /// 登录 62     /// </summary> 63     [Description("登录")] 64     Login, 65     /// <summary> 66     /// 登出 67     /// </summary> 68     [Description("登出")] 69     LogOut, 70     /// <summary> 71     /// 导出 72     /// </summary> 73     [Description("导出")] 74     Export, 75     /// <summary> 76     /// 导入 77     /// </summary> 78     [Description("导入")] 79     Import, 80     /// <summary> 81     /// 审核 82     /// </summary> 83     [Description("审核")] 84     Audit, 85     /// <summary> 86     /// 回复 87     /// </summary> 88     [Description("回复")] 89     Reply, 90     /// <summary> 91     /// 下载 92     /// </summary> 93     [Description("下载")] 94     Download, 95     /// <summary> 96     /// 上传 97     /// </summary> 98     [Description("上传")] 99     Upload,100     /// <summary>101     /// 分配102     /// </summary>103     [Description("分配")]104     Allocation,105     /// <summary>106     /// 文件107     /// </summary>108     [Description("文件")]109     Files,110     /// <summary>111     /// 流程112     /// </summary>113     [Description("流程")]114     Flow115   }116   /// <summary>117   /// log4net枚举118   /// </summary>119   public enum enumLog4net 120   {121     [Description("普通")]122     INFO,123     [Description("警告")]124     WARN,125     [Description("错误")]126     ERROR,127     [Description("异常")]128     FATAL129   }130   /// <summary>131   /// 模块类别枚举,对应TBSYS_Module表的ModuleType字段132   /// </summary>133   public enum enumModuleType134   {135     无页面 = 1,136     列表页 = 2,137     弹出页 = 3138   }139   /// <summary>140   /// 部门类型141   /// </summary>142   public enum enumDepartmentType143   {144     胜利石油管理局 = 1,145     施工队=2,146     工程部 = 3,147     计划科=4,148     其他单位=5149   }150 151   #endregion152 153   #region 流程枚举154   /// <summary>155   /// 流程枚举156   /// </summary>157   public enum FLowEnums 158   {159     /// <summary>160     /// 空白161     /// </summary>162     [Description("空白")]163     Blank = 0,164     /// <summary>165     /// 草稿166     /// </summary>167     [Description("草稿")]168     Draft = 1,169     /// <summary>170     /// 运行中171     /// </summary>172     [Description("运行中")]173     Runing = 2,174     /// <summary>175     /// 已完成176     /// </summary>177     [Description("已完成")]178     Complete = 3,179     /// <summary>180     /// 挂起181     /// </summary>182     [Description("挂起")]183     HungUp = 4,184     /// <summary>185     /// 退回186     /// </summary>187     [Description("退回")]188     ReturnSta = 5,189     /// <summary>190     /// 转发(移交)191     /// </summary>192     [Description("移交")]193     Shift = 6,194     /// <summary>195     /// 删除(逻辑删除状态)196     /// </summary>197     [Description("删除")]198     Delete = 7,199     /// <summary>200     /// 加签201     /// </summary>202     [Description("加签")]203     Askfor = 8,204     /// <summary>205     /// 冻结206     /// </summary>207     [Description("冻结")]208     Fix = 9,209     /// <summary>210     /// 批处理211     /// </summary>212     [Description("批处理")]213     Batch = 10,214     /// <summary>215     /// 加签回复状态216     /// </summary>217     [Description("加签回复")]218     AskForReplay = 11219   }220   #endregion221 222   #region 系统字典223 224   /// <summary>225   /// 类描述:系统字典226   /// 创建标识:add yuangang by 2016-05-10227   /// </summary>228   public class ClsDic229   {230     /// <summary>231     /// 根据DicKey值获取value232     /// </summary>233     public static string GetDicValueByKey(string key, Dictionary<string, string> p)234     {235       if (p == null || p.Count == 0) return "";236       var dic = p.GetEnumerator();237       while (dic.MoveNext())238       {239         var obj = dic.Current;240         if (key == obj.Key)241           return obj.Value;242       }243       return "";244     }245     /// <summary>246     /// 根据DICValue获取Key247     /// </summary>248     public static string GetDicKeyByValue(string value, Dictionary<string, string> p) 249     {250       if (p == null || p.Count == 0) return "";251       var dic = p.GetEnumerator();252       while (dic.MoveNext())253       {254         var obj = dic.Current;255         if (obj.Value == value)256           return obj.Key;257       }258       return "";259     }260     /// <summary>261     /// 描述:实体与编码对应字典,在验证数据权限时,通过此处字典来枚举实体编号262     /// <author>创建标识: add yuangang by 2016-05-10</author>263     /// </summary>264     public static Dictionary<string, string> DicEntity265     {266       get267       {268         Dictionary<string, string> _dic = new Dictionary<string, string>();269         _dic.Add("日志", "");270         _dic.Add("用户", "18da4207-3bfc-49ea-90f7-16867721805c");271         return _dic;272       }273     }274     /// <summary>275     /// 描述:存放特别的角色编号字典,在验证操作权限时用到276     /// 创建标识:add by liuj 2013-8-9 9:56277     /// </summary>278     public static Dictionary<string, int> DicRole279     {280       get281       {282         Dictionary<string, int> _dic = new Dictionary<string, int>();283         _dic.Add("超级管理员", 1);284         return _dic;285       }286     }287     /// <summary>288     /// 字典类型289     /// </summary>290     public static Dictionary<string, string> DicCodeType291     {292       get293       {294         Dictionary<string, string> _dic = new Dictionary<string, string>();295         try296         {297           string dicStr = Utils.GetFileContent(System.Web.HttpContext.Current.Server.MapPath("/Models/DicType.txt"), false);298           var diclist = dicStr.TrimEnd(',').TrimStart(',').Split(',').ToList();299           if (diclist.Count>0)300           {301             foreach (var item in diclist)302             {303               _dic.Add(item.Split('-')[0], item.Split('-')[1]);304             }305           }306         }307         catch { }308         return _dic;309       }310     }311     /// <summary>312     /// 附件上传路径313     /// 创建标识:add yuangang by 2016-05-10314     /// </summary>315     public static Dictionary<string, string> DicAttachmentPath316     {317       get318       {319         Dictionary<string, string> _dic = new Dictionary<string, string>();320         _dic.Add("上传路径", System.Configuration.ConfigurationManager.AppSettings["upfile"]);321         _dic.Add("档案简历", System.Configuration.ConfigurationManager.AppSettings["upfile"]);322         _dic.Add("手机文件", System.Configuration.ConfigurationManager.AppSettings["upphone"]);323         _dic.Add("手机照片", System.Configuration.ConfigurationManager.AppSettings["photofile"]);324         _dic.Add("技术文件", System.Configuration.ConfigurationManager.AppSettings["upTsfile"]);325         _dic.Add("工程图", System.Configuration.ConfigurationManager.AppSettings["UploadFiles"]);326         _dic.Add("档案头像", System.Configuration.ConfigurationManager.AppSettings["upfile"]);327         return _dic;328       }329     }330     /// <summary>331     /// 业务办理图片宽高332     /// 创建标识:add yuangang by 2016-05-10333     /// </summary>334     public static Dictionary<string, string> DicImageWH335     {336       get337       {338         Dictionary<string, string> _dic = new Dictionary<string, string>();339         _dic.Add("图片宽度", System.Configuration.ConfigurationManager.AppSettings["imgWidth"]);340         _dic.Add("图片高度", System.Configuration.ConfigurationManager.AppSettings["imgHeight"]);341         _dic.Add("手机用户头像高", System.Configuration.ConfigurationManager.AppSettings["UserPhotoHeight"]);342         _dic.Add("手机用户头像宽", System.Configuration.ConfigurationManager.AppSettings["UserPhotoWidth"]);343         _dic.Add("用户头像高", System.Configuration.ConfigurationManager.AppSettings["PolicePhotoHeight"]);344         _dic.Add("用户头像宽", System.Configuration.ConfigurationManager.AppSettings["PolicePhotoWidth"]);345         return _dic;346       }347     }348     /// <summary>349     /// 警务室图片宽高350     /// 创建标识:add yuangang by 2016-05-10351     /// </summary>352     public static Dictionary<string, string> DicPoliceHouseImageWH353     {354       get355       {356         Dictionary<string, string> _dic = new Dictionary<string, string>();357         _dic.Add("图片宽度", System.Configuration.ConfigurationManager.AppSettings["imgPoliceWidth"]);358         _dic.Add("图片高度", System.Configuration.ConfigurationManager.AppSettings["imgPoliceHeight"]);359         return _dic;360       }361     }362     /// <summary>363     /// OracleReportData364     /// 创建标识:add yuangang by 2016-05-10365     /// </summary>366     public static Dictionary<string, string> OracleReportData367     {368       get369       {370         Dictionary<string, string> _dic = new Dictionary<string, string>();371         _dic.Add("OrcalReport", System.Configuration.ConfigurationManager.AppSettings["connectionString"]);372         return _dic;373       }374     }375     /// <summary>376     /// 手机客户端命名377     /// 创建标识:add yuangang by 2016-05-10378     /// </summary>379     public static Dictionary<string, string> DicPhone380     {381       get382       {383         Dictionary<string, string> _dic = new Dictionary<string, string>();384         _dic.Add("安卓程序", System.Configuration.ConfigurationManager.AppSettings["AndroidName"]);385         _dic.Add("苹果程序", System.Configuration.ConfigurationManager.AppSettings["IOSName"]);386         return _dic;387       }388     }389     /// <summary>390     /// 功能描述:记录Cookie的Key值 391     /// 创建标识:徐戈392     /// </summary>393     public static Dictionary<string, string> DicCookie394     {395       get396       {397         Dictionary<string, string> _dic = new Dictionary<string, string>();398         _dic.Add("Session中存储的帐号和CookieID", "AccountCookieID_Session");399         _dic.Add("Cookie中存储的帐号和CookieID", "AccountCookieIDNew");400         return _dic;401       }402     }403     /// <summary>404     /// 功能描述:记录Cookie的Key值 405     /// 创建标识:徐戈406     /// </summary>407     public static Dictionary<string, string> DicCookieTimeout408     {409       get410       {411         Dictionary<string, string> _dic = new Dictionary<string, string>();412         _dic.Add("帐号过期时间", "30");413         return _dic;414       }415     }416 417   }418   #endregion419 420   #region 业务相关421   /// <summary>422   /// 计划流转状态423   /// </summary>424   public enum enumHCA_RecognitionProgramProcessType425   {426     上报 = 1,427     同意 = 2,428     不同意 = 3429   }430   /// <summary>431   /// 上传文件类型432   /// </summary>433   public enum enumFileType434   {435     其他 = 0,436     Word = 1,437     Excel = 2,438     图片 = 3,439     PPT = 4,440     PDF = 5,441     RAR=6442   }443   /// <summary>444   ///路单状态445   /// </summary>446   public enum enumWAYBILLSTATE447   {448     分派 = 1,449     打印 = 2,450     数据录入 = 3,451     数据填报=4,452     车队审核回收=5,453     删除=6,454     作废=7,455     交接=8,456     纳入结算=9,457     完成结算=10458 459 460   }461   /// <summary>462   /// 来源463   /// </summary>464   public enum enumORIGIN465   {466     自建 = 1,467     任务 = 2,468     外委申请 = 3469   }470 471   /// <summary>472   /// 应急物资规格型号473   /// </summary>474   public enum enumReliefGoodsModel475   {476     规格型号1 = 1,477     规格型号2 = 2,478     规格型号3 = 3479   }480   /// <summary>481   /// 应急抢险救援物资类别482   /// </summary>483   public enum enumReliefGoodsType484   {485     溢油 = 1,486     防汛 = 2487   }488   /// <summary>489   /// 业务咨询枚举,对应业务咨询表的bptype字段490   /// </summary>491   public enum enumBptType492   {493     在线咨询 = 401002,494     身份证 = 501001,495     户籍 = 501002,496     治安管理 = 501003,497     出入境 = 501004,498     消防 = 501005,499     其他业务 = 501006,500     交警 = 501007,501     网安 = 501008,502     法制 = 501009503   }504 505   public enum enumNewsType506   {507     警务信息 = 301001,508     警方公告 = 301002,509     防范提示 = 101501510   }511 512   /// <summary>513   /// 上传文件类型514   /// </summary>515   public enum enumBusType516   {517 518     车辆图片上传 = 100001,519     套管图片上传 = 103002,520     三通图片上传 = 103003,521     阀门图片上传 = 103004,522     占压图片上传 = 103005,523 524  525   }526 527 528   /// <summary>529   /// 管道维修应急预案级别530   /// </summary>531   public enum enumEmergencyPlanLevel532   {533     中石化 = 1,534     油田 = 2,535     总厂 = 3,536     分厂 = 4537   }538 539   /// <summary>540   /// 阳极材料541   /// </summary>542   public enum enumAnodeMaterial543   {544     未知 = 0,545     镀铂阳极 = 1,546     磁性氧化铁 = 2,547     混合金属氧化物 = 3,548     镁 = 4,549     锌 = 5,550     铂 = 6,551     高硅铸铁 = 7,552     石墨 = 8,553     废钢铁 = 9,554     碳 = 10,555     铝合金 = 11,556     其它 = 99557   }558 559 560   /// <summary>561   /// 业务咨询处理状态枚举,对应业务咨询表的requesStatus字段562   /// </summary>563   public enum enumBussinessType564   {565     后台办理本部门业务 = 1,566     手机办理本部门业务 = 2,567     手机业务 = 3,568     社区民警 = 4569   }570 571   /// <summary>572   /// 业务咨询处理状态枚举,对应业务咨询表的requesStatus字段573   /// </summary>574   public enum enumRequesStatus575   {576     用户提交 = 0,577     指定处理 = 1,578     处理完成 = 2579   }580 581   public enum enumWorkType582   {583     未指定 = -1,584     手机方式 = 0,585     电脑Web = 1586   }587   public enum enumIsBool588   {589     是 = 1,590     否 = 2591   }592 593   public enum enumPhoneUserType594   {595     注册用户 = 1,596     匿名用户 = 2597   }598 599   public enum enumReplyType600   {601     未处理 = 0,602     审核通过 = 1,603     审核不通过 = 2604   }605 606   public enum enumBlogType607   {608     新浪微博 = 0,609     腾讯微博 = 1,610     东营公安局的腾讯微博 = 2611   }612 613 614   #endregion615 616 }

View Code

 原创文章 转载请尊重劳动成果 http://yuangang.cnblogs.com