public bool InArea(PhoneAreaInfo phoneAreaInfo, string mobile) { if (Filters == null || Filters.Count <= 0) { return(false); } List <SPClientChannelSettingFiltersWrapper> filters = SPClientChannelSettingFiltersWrapper.FindAllByClientChannelSettingID(this); SPClientChannelSettingFiltersWrapper customerPhoneArea = filters.Find(p => (p.ParamsName.Trim().ToLower() == "province" && p.FilterValue.StartsWith("自定义"))); if (customerPhoneArea != null) { if (customerPhoneArea.HasPhone(mobile)) { return(true); } } SPClientChannelSettingFiltersWrapper otherPhoneArea = filters.Find(p => (p.ParamsName.Trim().ToLower() == "province" && p.FilterValue.Equals("其他"))); if (otherPhoneArea != null) { return(true); } return(filters.Exists(p => p.ParamsName.Trim().ToLower() == "province" && p.FilterValue == phoneAreaInfo.Province)); }
public static PhoneAreaInfo GetPhoneAreaInfo(string phoneNumber) { if (string.IsNullOrEmpty(phoneNumber)) { return(null); } if (phoneNumber.Length < 7) { return(null); } Document document = MongoHelper.FindOne(connectionString, databaseName, collectionName, new Document { { "PhonePrefix", phoneNumber.Substring(0, 7) } }); if (document == null) { return(null); } PhoneAreaInfo phoneAreaInfo = new PhoneAreaInfo(); phoneAreaInfo.Province = document["Province"].ToString(); phoneAreaInfo.City = document["City"].ToString(); phoneAreaInfo.MobileOperators = document["OperatorType"].ToString(); return(phoneAreaInfo); }
public bool InArea(PhoneAreaInfo phoneAreaInfo) { if (Filters == null || Filters.Count <= 0) { return(false); } List <SPClientChannelSettingFiltersWrapper> filters = SPClientChannelSettingFiltersWrapper.FindAllByClientChannelSettingID(this); return(filters.Exists(p => p.ParamsName.Trim().ToLower() == "province" && p.FilterValue == phoneAreaInfo.Province)); }
public void SetPaymentProviceAndCity() { if (!string.IsNullOrEmpty(this.MobileNumber) && this.MobileNumber.Length > 7) { try { PhoneAreaInfo phoneAreaInfo = SPPhoneAreaWrapper.GetPhoneCity(this.MobileNumber.Substring(0, 7)); if (phoneAreaInfo != null) { this.Province = phoneAreaInfo.Province; this.City = phoneAreaInfo.City; this.MobileOperators = phoneAreaInfo.MobileOperators; } } catch (Exception ex) { Logger.Error(ex.Message); } } }
public static Dictionary <string, PhoneAreaInfo> GetAllPhoneInfos_Key() { //List<SPPhoneAreaWrapper> spPhoneAreaWrappers = FindAll(); DataTable dt = SPPhoneAreaWrapper.GetAllPhoneAreaData(); Dictionary <string, PhoneAreaInfo> phoneinfos = new Dictionary <string, PhoneAreaInfo>(); foreach (DataRow item in dt.Rows) { if (!phoneinfos.ContainsKey(item["PhonePrefix"].ToString())) { PhoneAreaInfo phonearea = new PhoneAreaInfo(); phonearea.City = item["City"].ToString(); phonearea.Province = item["Province"].ToString(); phonearea.MobileOperators = item["MobileOperators"].ToString(); phoneinfos.Add(item["PhonePrefix"].ToString(), phonearea); } } return(phoneinfos); }
public static PhoneAreaInfo GetPhoneCity(string phone) { List <SPPhoneAreaWrapper> spPhoneAreaWrappers = ConvertToWrapperList(businessProxy.GetPhoneCity(phone)); if (spPhoneAreaWrappers.Count <= 0) { return(null); } PhoneAreaInfo phoneAreaInfo = new PhoneAreaInfo(); phoneAreaInfo.City = ""; foreach (SPPhoneAreaWrapper phoneAreaWrapper in spPhoneAreaWrappers) { phoneAreaInfo.Province = phoneAreaWrapper.Province; phoneAreaInfo.City += phoneAreaWrapper.City; phoneAreaInfo.MobileOperators = phoneAreaWrapper.MobileOperators; } return(phoneAreaInfo); }
public void ReAutoMatch() { PhoneAreaInfo phoneAreaInfo = null; #if DEBUG if (!string.IsNullOrEmpty(this.MobileNumber) && this.MobileNumber.Length > 7) { try { phoneAreaInfo = SPPhoneAreaWrapper.GetPhoneCity(this.MobileNumber.Substring(0, 7)); } catch (Exception ex) { Logger.Error(ex.Message); } } #else if (!string.IsNullOrEmpty(this.MobileNumber) && this.MobileNumber.Length > 7) { try { try { phoneAreaInfo = PhoneCache.GetPhoneAreaByPhoneNumber(this.MobileNumber); } catch (Exception ex) { Logger.Error("号段读取错误:" + ex.Message); phoneAreaInfo = SPPhoneAreaWrapper.GetPhoneCity(this.MobileNumber.Substring(0, 7)); } } catch (Exception ex) { Logger.Error("号段读取错误:" + ex.Message); } } //else //{ // if (string.IsNullOrEmpty(mobile)) // { // Logger.Error("空号错误"); // } // else // { // Logger.Error("号码错误:" + mobile); // } //} #endif if (phoneAreaInfo != null) { this.Province = phoneAreaInfo.Province; this.City = phoneAreaInfo.City; this.MobileOperators = phoneAreaInfo.MobileOperators; } SPClientChannelSettingWrapper channelSetting = this.ChannelID.GetClientChannelSettingFromRequestValue(this.Ywid, this.Cpid, phoneAreaInfo); if (channelSetting == null || !channelSetting.IsEnable) { List <SPClientChannelSettingWrapper> clientChannelSettings = this.ChannelID.GetAllClientChannelSetting(); channelSetting = clientChannelSettings.Find(p => (p.CommandType == "7" && p.Name.Contains("默认下家"))); } this.ClientID = channelSetting.ClinetID; this.ChannleClientID = channelSetting.Id; try { if (channelSetting.ClinetID != null && channelSetting.ClinetID.SPClientGroupID != null) { this.ClientGroupID = channelSetting.ClinetID.SPClientGroupID.Id; } } catch (Exception ex) { logger.Error("ClientGroup ID Error", ex); } this.IsSycnData = false; UrlSendTask sendTask = null; if (!(this.IsIntercept.HasValue && this.IsIntercept.Value)) { if (!string.IsNullOrEmpty(channelSetting.SyncDataUrl)) { this.IsSycnData = true; this.SucesssToSend = false; } else { this.IsSycnData = false; this.SucesssToSend = false; } } else { this.IsSycnData = false; this.SucesssToSend = false; } Update(this); }
public bool InArea(PhoneAreaInfo phoneAreaInfo) { if (Filters == null || Filters.Count <= 0) return false; List<SPClientChannelSettingFiltersWrapper> filters = SPClientChannelSettingFiltersWrapper.FindAllByClientChannelSettingID(this); return filters.Exists(p => p.ParamsName.Trim().ToLower() == "province" && p.FilterValue == phoneAreaInfo.Province); }