/// <summary> /// 获取地区数据 /// </summary> /// <param name="id"></param> /// <returns></returns> public static Tuple <bool, Model.Model.w_address_basic_data> GetAddressFromID(int id) { lock (_lockobj) { Model.Model.w_address_basic_data lcr = null; if (addressDic == null) { addressDic = w_address_basic_data.GetAllAddress(); } if (addressDic.TryGetValue(id, out lcr)) { return(new Tuple <bool, Model.Model.w_address_basic_data>(true, lcr)); } return(new Tuple <bool, Model.Model.w_address_basic_data>(false, null)); } }
/// <summary> /// 获取完整地址 /// </summary> /// <param name="AreaID"></param> /// <returns></returns> public static Tuple <int?, int?, int?> GetAllAddress(int AreaID) { List <int?> _addresslist = new List <int?>(); Model.Model.w_address_basic_data wabd = null; wabd = GetAddressFromID(AreaID)?.Item2; _addresslist.Add(wabd.id); if (wabd != null) { wabd = GetAddressFromID(wabd.TopAddressID.ConvertData <int>()).Item2; _addresslist.Add(wabd?.id); if (wabd != null) { wabd = GetAddressFromID(wabd.TopAddressID.ConvertData <int>()).Item2; _addresslist.Add(wabd?.id); } } return(new Tuple <int?, int?, int?>(_addresslist[2], _addresslist[1], _addresslist[0])); }
/// <summary> /// 获取完整地址 /// </summary> /// <param name="AreaID"></param> /// <returns></returns> public static (string sheng, string shi, string qu) GetAllAddressNames(int?AreaID) { List <string> _addresslist = new List <string>(); Model.Model.w_address_basic_data wabd = null; wabd = GetAddressFromID(AreaID.ConvertData <int>())?.Item2; _addresslist.Add(wabd.Name); if (wabd != null) { wabd = GetAddressFromID(wabd.TopAddressID.ConvertData <int>()).Item2; _addresslist.Add(wabd.Name); if (wabd != null) { wabd = GetAddressFromID(wabd.TopAddressID.ConvertData <int>()).Item2; _addresslist.Add(wabd.Name); } } return(_addresslist[2], _addresslist[1], _addresslist[0]); }
/// <summary> /// /// </summary> /// <param name="AreaID"></param> /// <returns></returns> public static string GetAllAddressToString(int AreaID) { string allname = string.Empty; Model.Model.w_address_basic_data wabd = null; wabd = GetAddressFromID(AreaID)?.Item2; allname = wabd?.Name ?? string.Empty; if (wabd != null) { wabd = GetAddressFromID(wabd.TopAddressID.ConvertData <int>()).Item2; allname = (wabd?.Name ?? string.Empty) + " " + allname; if (wabd != null) { wabd = GetAddressFromID(wabd.TopAddressID.ConvertData <int>()).Item2; allname = (wabd?.Name ?? string.Empty) + " " + allname; } } return(allname); }