private void KhoiTaoDanhBaBuuDien5() { lock (dicDanhBa_BuuDien) { // lấy ds danh ba buu dien List <DanhBaCongTy> listDBBuuDien = new List <DanhBaCongTy>(); listDBBuuDien = DanhBa.GetDanhBa_BuuDien_5(); // thêm vào dic foreach (DanhBaCongTy dbbd in listDBBuuDien) { // chưa tồn tài thì thêm vào ds if (!dicDanhBa_BuuDien.ContainsKey(dbbd.PhoneNumber)) { dicDanhBa_BuuDien.TryAdd(dbbd.PhoneNumber, new DanhBaEx() { PhoneNumber = dbbd.PhoneNumber, Address = dbbd.Address, IsActive = true, Name = dbbd.Name, KieuDanhBa = KieuDanhBa.BuuDien }); } } } }
/// <summary> /// tra ve dia chi cua so dien thoai /// </summary> /// <param name="PhoneNumber"></param> /// <returns></returns> public static string GetDanhBa(string PhoneNumber) { if (!DanhBa.IsDienThoaiDiDong(PhoneNumber)) { if (DanhBa.IsDienThoaiCoDinh(PhoneNumber)) { DataTable dt = new DataTable(); dt = new Data.DanhBa().GetDanhBa(PhoneNumber.Substring(PhoneNumber.Length - 8, 8)); string strDiaChi = ""; if (dt.Rows.Count > 0) // Co dia chi { strDiaChi = string.Format("[{0}]{1}", MaHoaDuLieu.GiaiMa(dt.Rows[0]["Name"].ToString()), MaHoaDuLieu.GiaiMa(dt.Rows[0]["Address"].ToString())); } dt.Dispose(); dt = null; return(strDiaChi); } } return(string.Empty); }
/// <summary> /// tra ve so dient hoai toi thieu /// input : 0437856099,0905228313,01689581628 /// output: 37856099,905228313,1689581628 /// /// </summary> /// <param name="PhoneNumber"></param> /// <returns></returns> public static string GetSoDienThoaiToiThieu(string PhoneNumber) { if (PhoneNumber.Length <= 8) { return(PhoneNumber); } if (DanhBa.IsDienThoaiCoDinh(PhoneNumber)) { if (PhoneNumber.Length > 8) { return(PhoneNumber.Substring(PhoneNumber.Length - 8, 8)); } } if (DanhBa.IsDienThoaiDiDong(PhoneNumber)) { if (PhoneNumber.Substring(0, 1) == "0") { return(PhoneNumber.Substring(1, PhoneNumber.Length - 1)); } } return(PhoneNumber); }