/// <summary>
        /// Input : SoDienThoai
        /// Output
        ///     : KieuKhachHangGoiDen
        ///     : DiaChicuakhach hang
        ///  //Tim trong kho Khach VIP
        ///  Tim trong kho doi tac
        ///  Tim trong kho danh ba tam
        ///  Tim trong kho danh ba buu dien
        /// </summary>
        private string GetDiaChiGoiDen(string PhoneNumber, out KieuKhachHangGoiDen outKieuKhachHang, out string MaDoiTac)
        {
            if (StringTools.TrimSpace(PhoneNumber).Length <= 0)
            {
                outKieuKhachHang = KieuKhachHangGoiDen.KhachHangBinhThuong;
                MaDoiTac         = "";
                return(string.Empty);
            }

            string strDiaChiKhachAo = DanhBaKhachAo.GetDanhBa(DanhBa.GetSoDienThoaiToiThieu(PhoneNumber));

            if (strDiaChiKhachAo.Length > 0)
            {
                outKieuKhachHang = KieuKhachHangGoiDen.KhachHangKhongHieu;//khach ao
                MaDoiTac         = "";
                return(strDiaChiKhachAo);
            }

            // Tim kiem trong khach VIP (3_)
            DanhBaKhachQuen objKhachQuen = DanhBaKhachQuen.GetKhachQuen_Phones_Search(DanhBa.GetSoDienThoaiToiThieu(PhoneNumber));

            if (objKhachQuen != null && objKhachQuen.Name.Length > 0)
            {
                if (objKhachQuen.Type == 1)
                {
                    outKieuKhachHang = KieuKhachHangGoiDen.KhachHangVIP;
                }
                else if (objKhachQuen.Type > 1 && objKhachQuen.Rank == 1)
                {
                    outKieuKhachHang = KieuKhachHangGoiDen.KhachHangVang;
                }
                else if (objKhachQuen.Type > 1 && objKhachQuen.Rank == 2)
                {
                    outKieuKhachHang = KieuKhachHangGoiDen.KhachHangBac;
                }
                else
                {
                    outKieuKhachHang = KieuKhachHangGoiDen.KhachHangBinhThuong;
                }
                MaDoiTac = objKhachQuen.MaKH;

                return(String.Format("[{0}]{1}", objKhachQuen.Name, objKhachQuen.Address));
            }

            // Tim kiem trong DOI TAC (2_)
            DoiTac objDoiTac = DoiTac.GetDoiTacByOPhoneNumber(DanhBa.GetSoDienThoaiToiThieu(PhoneNumber));

            if (objDoiTac != null)
            {
                outKieuKhachHang = KieuKhachHangGoiDen.KhachHangMoiGioi;
                MaDoiTac         = objDoiTac.MaDoiTac;
                g_kinhdo         = objDoiTac.KinhDo;
                g_vido           = objDoiTac.ViDo;
                return(objDoiTac.Name + "-" + objDoiTac.Address);
            }

            //Tim kiem trong danh ba dien thoai cua rieng cong ty (1_)
            string strDiaChiCuocGoiGanNhat = GetDiaChiCuaCuocGoiGanNhatTrongNgay(DanhBa.GetSoDienThoaiToiThieu(PhoneNumber));

            if (strDiaChiCuocGoiGanNhat.Length > 0)
            {
                outKieuKhachHang = KieuKhachHangGoiDen.KhachHangBinhThuong;
                MaDoiTac         = "";
                return(strDiaChiCuocGoiGanNhat);
            }

            // tim kiem trong danh ba cong ty
            string strDiaChiDanhBaCongTy = DanhBaCongTy.GetDanhBa(DanhBa.GetSoDienThoaiToiThieu(PhoneNumber));

            if (strDiaChiDanhBaCongTy.Length > 0)
            {
                outKieuKhachHang = KieuKhachHangGoiDen.KhachHangBinhThuong;//khach ao
                MaDoiTac         = "";
                return(strDiaChiDanhBaCongTy);
            }

            //Tim kiem trong danh ba dien thoai (1_)
            outKieuKhachHang = KieuKhachHangGoiDen.KhachHangBinhThuong;
            MaDoiTac         = "";
            return(DanhBa.GetDanhBa(DanhBa.GetSoDienThoaiToiThieu(PhoneNumber)));
        }
示例#2
0
        /// <summary>
        /// Input : SoDienThoai
        /// Output
        ///     : KieuKhachHangGoiDen
        ///     : DiaChicuakhach hang
        ///  //Tim trong kho Khach VIP
        ///  Tim trong kho doi tac
        ///  Tim trong kho danh ba tam
        ///  Tim trong kho danh ba buu dien
        /// </summary>
        private string GetDiaChiGoiDen(string phoneNumber, out KieuKhachHangGoiDen outKieuKhachHang, out string outMaDoiTac)
        {
            try
            {
                if (StringTools.TrimSpace(phoneNumber).Length <= 0)
                {
                    outKieuKhachHang = KieuKhachHangGoiDen.KhachHangBinhThuong;
                    outMaDoiTac      = "";
                    return(string.Empty);
                }
                //// xu ly co tong dai
                //if (PhoneNumber[0].ToString() == "5")
                //{
                //    PhoneNumber = PhoneNumber.Substring(1, PhoneNumber.Length - 1);
                //}

                string strDiaChiKhachAo = DanhBaKhachAo.GetDanhBa(DanhBa.GetSoDienThoaiToiThieu(phoneNumber));

                if (strDiaChiKhachAo.Length > 0)
                {
                    outKieuKhachHang = KieuKhachHangGoiDen.KhachHangKhongHieu;//khach ao
                    outMaDoiTac      = "";
                    return(strDiaChiKhachAo);
                }

                // Tim kiem trong khach VIP (3_)
                DanhBaKhachQuen objKhachQuen = DanhBaKhachQuen.GetKhachQuen_Phones_Search(DanhBa.GetSoDienThoaiToiThieu(phoneNumber));

                if (objKhachQuen != null && objKhachQuen.Name.Length > 0)
                {
                    if (objKhachQuen.Type == 1)
                    {
                        outKieuKhachHang = KieuKhachHangGoiDen.KhachHangVIP;
                    }
                    else if (objKhachQuen.Type > 1 && objKhachQuen.Rank == 1)
                    {
                        outKieuKhachHang = KieuKhachHangGoiDen.KhachHangVang;
                    }
                    else if (objKhachQuen.Type > 1 && objKhachQuen.Rank == 2)
                    {
                        outKieuKhachHang = KieuKhachHangGoiDen.KhachHangBac;
                    }
                    else
                    {
                        outKieuKhachHang = KieuKhachHangGoiDen.KhachHangBinhThuong;
                    }
                    outMaDoiTac = objKhachQuen.MaKH;

                    return(String.Format("[{0}]{1}", objKhachQuen.Name, objKhachQuen.Address));
                }

                //Tim kiem trong DOI TAC (2)
                DoiTac objDoiTac = DoiTac.GetDoiTacByOPhoneNumber(DanhBa.GetSoDienThoaiToiThieu(phoneNumber));

                if (objDoiTac != null && objDoiTac.MaDoiTac.Length > 0)
                {
                    outKieuKhachHang = KieuKhachHangGoiDen.KhachHangMoiGioi;
                    outMaDoiTac      = objDoiTac.MaDoiTac;
                    return(objDoiTac.Address);
                }

                //Tim kiem trong danh ba dien thoai cua rieng cong ty (1)

                string strDiaChiCuocGoiGanNhat = GetDiaChiCuaCuocGoiGanNhatTrongNgay(DanhBa.GetSoDienThoaiToiThieu(phoneNumber));

                if (strDiaChiCuocGoiGanNhat.Length > 0)
                {
                    outKieuKhachHang = KieuKhachHangGoiDen.KhachHangBinhThuong;
                    outMaDoiTac      = "";
                    return(strDiaChiCuocGoiGanNhat);
                }

                //Tim kiem trong danh ba cong ty

                string strDiaChiDanhBaCongTy = DanhBaCongTy.GetDanhBa(DanhBa.GetSoDienThoaiToiThieu(phoneNumber));

                if (strDiaChiDanhBaCongTy.Length > 0)
                {
                    outKieuKhachHang = KieuKhachHangGoiDen.KhachHangBinhThuong;//khach ao
                    outMaDoiTac      = "";
                    return(strDiaChiDanhBaCongTy);
                }

                //Tim kiem trong danh ba dien thoai (1_)
                outKieuKhachHang = KieuKhachHangGoiDen.KhachHangBinhThuong;
                outMaDoiTac      = "";
                return(DanhBa.GetDanhBa(DanhBa.GetSoDienThoaiToiThieu(phoneNumber)));
            }
            catch
            {
                outKieuKhachHang = KieuKhachHangGoiDen.KhachHangKhongHieu;
                outMaDoiTac      = string.Empty;
                return(string.Empty);
            }
        }