📄 globaldb.cs
字号:
using System;
using System.Collections;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
namespace ExamineSystem
{
/// <summary>
/// Summary description for GlobalDB.
/// </summary>
public class DataBaseDB
{
public static String ConnectionString = ConfigurationSettings.AppSettings["SQLCONNECTIONSTRING"];
}
//自定义Exception
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 class GlobalVars
{
//上载照片的类型
public static String[] FILETAILNAME = {".gif",".jpg",".jpeg",".bmp",".png"};
///由开发程序员的IP地址决定;
///目的:为了消除localhost这个字符串;
public static String localhost = "218.3.197.162";
public static String ApplicationPath = "";
public static int NewDateCount = 10;
public static int ModuleID(string sModuleName)
{
switch(sModuleName)
{
case "NormalNews":
return 2;
default:
return 2;
}
}
}
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();
}
}
public class PreviewNewsDetails
{
public String Title = ""; ///新闻的标题
public String Body = ""; ///新闻的内容
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -