Asp.net源码专业站
首页->企业网站->缤纷企业管理系统源码>>App-Code/CommFun.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:缤纷企业管理系统源码
当前文件:文件类型 BinFenEnterpriseWeb/App_Code/CommFun.cs[2K,2009-6-12 11:33:52]打开代码结构图
普通视图
		            
1using System; 2using System.Data; 3using System.Configuration; 4using System.Collections; 5using System.Web; 6using System.Web.Security; 7using System.Web.UI; 8using System.Web.UI.WebControls; 9using System.Web.UI.WebControls.WebParts; 10using System.Web.UI.HtmlControls; 11namespace Web 12{ 13 /// <summary> 14 /// CommFun 的摘要说明 15 /// </summary> 16 public class CommFun 17 { 18 public CommFun() 19 { 20 // 21 // TODO: 在此处添加构造函数逻辑 22 // 23 } 24 public string CutChar(string strChar, int intLength) 25 { 26 //取得自定义长度的字符串 27 if (strChar.Length > intLength) 28 { return strChar.Substring(0, intLength); } 29 else 30 { return strChar; } 31 32 } 33 public static string GetLimitChar(string txt, int lenght) 34 { 35 //取得自定义长度的字符串 中文123456789 36 string outputtext = ""; 37 if (txt.Length > lenght) 38 { 39 //int tempnum = 0; 40 int tempnum1 = 0; 41 int tempnum2 = 0; 42 byte[] byitem =System.Text.ASCIIEncoding.ASCII.GetBytes(txt); 43 for (int i = 0; i < txt.Length; i++) 44 { 45 46 if ((int)byitem[i] != 63) tempnum1++; else tempnum2++; 47 48 if (tempnum2*2 + tempnum1 >= lenght*2) break; 49 50 } 51 outputtext = txt.Substring(0, tempnum2 + tempnum1); 52 53 54 } 55 else 56 { 57 outputtext = txt; 58 } 59 return outputtext; 60 } 61 public static void IsAdmin() 62 { 63 //查看是否为超级管理员 64 if (HttpContext.Current.Session["Admin"] != "yes") 65 { 66 HttpContext.Current.Response.Write(@"<script>alert('你还没有登录或登录超时!');window.location.href='login.aspx';</script>"); 67 68 69 70 } 71 72 } 73 74 } 75}
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:缤纷企业管理系统源码
51Aspx.com 版权所有 CopyRight © 2006-2010. 京ICP备06046876号 本站法律顾问:ITlaw-庄毅雄律师
返回顶部
客户服务:点击这里进行客户咨询 业务合作:点击这里洽谈业务合作 合作热线:010-68880146