📄 globaldb.cs
字号:
using System;
using System.Text;
using System.Data;
using System.IO;
using System.ComponentModel;
using System.Configuration;
using System.Collections;
using System.Data.SqlClient;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Service
{
/// <summary>
/// Summary description for GlobalDB.
/// </summary>
//自定义Exception
public class GlobalVarables
{
public static int DirectionIndex = 0;
public static int DEGREE = 4;
public static String QUOTESTRING = @"""";
public static ArrayList aLinkName = new ArrayList();
public static String[] GetLinkName(string sLinkID)
{
String[] sName = new String[2];
switch(sLinkID.Substring(0,1))
{
case "b":
{
sName[0] = "报修管理";
break;
}
case "u":
{
sName[0] = "用户管理";
break;
}
case "j":
{
sName[0] = "角色管理";
break;
}
case "e":
{
sName[0] = "员工管理";
break;
}
case "w":
{
sName[0] = "维修类别管理";
break;
}
case "p":
{
sName[0] = "个人信息管理";
break;
}
case "x":
{
sName[0] = "系统帮助";
break;
}
case "t":
{
sName[0] = "退出系统";
break;
}
default:
break;
}
int index = Int32.Parse(sLinkID.Substring(1).ToString());
if(index < GlobalVarables.aLinkName.Count)
{
sName[1] = GlobalVarables.aLinkName[index].ToString();
}
return(sName);
}
}
public class MyException:Exception
{
//包含系统Excepton
public MyException(string source,string message,Exception inner):base(message,inner)
{
base.Source=source;
}
//不包含系统Exception
public MyException(string source,string message):base(message)
{
base.Source=source;
}
}
public sealed class CleanString
{
public static string InputText(string inputString, int maxLength)
{
StringBuilder retVal = new StringBuilder();
// check incoming parameters for null or blank string
if ((inputString != null) && (inputString != String.Empty))
{
inputString = inputString.Trim();
//chop the string incase the client-side max length
//fields are bypassed to prevent buffer over-runs
if (inputString.Length > maxLength)
inputString = inputString.Substring(0, maxLength);
//convert some harmful symbols incase the regular
//expression validators are changed
for (int i = 0; i < inputString.Length; i++)
{
switch(inputString[i])
{
case '"':
retVal.Append(""");
break;
case '<':
retVal.Append("<");
break;
case '>':
retVal.Append(">");
break;
default:
retVal.Append(inputString[i]);
break;
}
}
// Replace single quotes with white space
retVal.Replace("'", " ");
}
return retVal.ToString();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -