111,094
社区成员




private bool submitValidate()
{
//校验用途是否符合G字符集
if (!ClientValidationHelper.GB2312CharSetCheck(this.bos_ct_purpose.Text))
{
MessageInfoHelper.Instance.ShowMessage("用途输入格式非法!不允许X字符集的“%、:、”等字符");
return false;
}
if (!this.Validate(this.data))
{
return false;
}
if (this.bos_ct_purpose.GetValue().ToString() == "")
{
MessageInfoHelper.Instance.ShowErrorMessage("请输入业务要素!");
return false;
}
return true;
}
/// 检查数据是否符合GB2312标准
/// <param name="gb2312String"></param>
public static bool GB2312CharSetCheck(string gb2312String)
{
if (gb2312String == null)
return false;
gb2312String = gb2312String.Trim();
byte[] bytes = Encoding.GetEncoding("GB2312").GetBytes(gb2312String);
return GB2312CharSetCheck(bytes);
}
/// 检查数据是否符合GB2312标准
/// <param name="gb2312bytes"></param>
public static bool GB2312CharSetCheck(byte[] gb2312bytes)
{
if (null == gb2312bytes)
return false;
for (int i = 0; i < gb2312bytes.Length - 1; i++)
{
int current = Convert.ToInt32(gb2312bytes[i]);
int next = Convert.ToInt32(gb2312bytes[i + 1]);
if ((current >= 0x81) && (current <= 0xFE) && (next >= 0x40)
&& (current != 0x7F) && (current != 0x7B) && (current != 0x7D) && (next <= 0xFE))
{
continue;
}
else
return false;
}
return true;
}