using System;
using System.Text.RegularExpressions;
using Shared.Common;
namespace Shared.Phone.Device.Account
{
public class AccountLogic
{
#region ◆ 变量____________________________
///
/// _instance
///
private static AccountLogic _instance;
///
/// Instance
///
public static AccountLogic Instance
{
get
{
if(_instance==null)
{
_instance = new AccountLogic();
}
return _instance;
}
}
#endregion
#region ◆ 邮箱____________________________
///
/// 检查邮箱合法性
///
///
///
public bool CheckEmail(string email)
{
var regex= new Regex(CommonPage.EmailRegexStr);
return regex.IsMatch(email);
}
#endregion
#region ◆ 手机____________________________
///
/// 检查手机号合法性
///
///
///
public bool CheckPhone(string phone)
{
var regex = new Regex(CommonPage.PhoneForForeignRegexStr);
return regex.IsMatch(phone);
}
///
/// 检查手机号合法性、区分区号
///
/// 手机号
/// 区号
///
public bool CheckPhoneWithZone(string phone, string zoneCode)
{
if (zoneCode == "86")
{
var regex = new Regex(CommonPage.PhoneRegexStr);
return regex.IsMatch(phone);
}
else
{
var regex = new Regex(CommonPage.PhoneForForeignRegexStr);
return regex.IsMatch(phone);
}
}
#endregion
#region ◆ 密码____________________________
///
/// 检查密码长度合法性
///
///
///
public bool CheckPwdLength(string password)
{
if (password.Trim().Length >= 6 && password.Trim().Length <= 13)
{
return true;
}
return false;
}
#endregion
}
}