public static List <DanhBaKhachQuen_Rank> GetDanhSachKhachQuen_Rank()
        {
            try
            {
                List <DanhBaKhachQuen_Rank> listKhachQuen_Rank = new List <DanhBaKhachQuen_Rank>();
                DataTable dt = new DataTable();
                dt = new Data.DanhBaKhachQuen().GetDanhBaKhachQuen_Rank_ID("");
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        listKhachQuen_Rank.Add(GetKhachQuen_Rank_Row(dr));
                    }
                }
                dt.Dispose();
                dt = null;

                return(listKhachQuen_Rank);
            }
            catch (Exception ex)
            {
                LogError.WriteLogError("GetDanhSachKhachQuen_Rank: ", ex);
                return(new List <DanhBaKhachQuen_Rank>());
            }
        }
        public static List <DanhBaEx> GetAllKhachQuens_V2()
        {
            List <DanhBaEx> lstKhachQuen = new List <DanhBaEx>();
            DataTable       dt           = new DataTable();

            dt = new Data.DanhBaKhachQuen().GetAll();
            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    DanhBaEx item = GetDanhBaEx_Row(dr);
                    if (item != null)
                    {
                        string[] arrDienThoai = item.PhoneNumber.Split(";".ToCharArray());
                        for (int i = 0; i < arrDienThoai.Length; i++)
                        {
                            item.PhoneNumber = arrDienThoai[i];
                            lstKhachQuen.Add(item);
                        }
                    }
                }
            }
            dt.Dispose();
            dt = null;

            return(lstKhachQuen);
        }
        public static List <DanhBaKhachQuen> GetKhachQuens_LastUpdate(DateTime LastUpdate)
        {
            try
            {
                List <DanhBaKhachQuen> lstKhachQuen = new List <DanhBaKhachQuen>();
                DataTable dt = new DataTable();

                dt = new Data.DanhBaKhachQuen().GetKhachQuens_LastUpdate(LastUpdate);
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        lstKhachQuen.Add(GetKhachQuen_Row(dr));
                    }
                    dt.Dispose();
                    dt = null;
                }
                return(lstKhachQuen);
            }
            catch (Exception ex)
            {
                LogError.WriteLogError("GetKhachQuens_LastUpdate", ex);
                return(new List <DanhBaKhachQuen>());
            }
        }
        public static DanhBaKhachQuen GetKhachQuen_Phones_Search(string Phones)
        {
            DanhBaKhachQuen objKhachQuen = new DanhBaKhachQuen();
            DataTable       dt           = new DataTable();

            dt = new Data.DanhBaKhachQuen().GetDanhBaKhachQuen_Phones_Search(Phones);
            if (dt.Rows.Count > 0)
            {
                objKhachQuen = GetKhachQuen_Row(dt.Rows[0]);
            }
            dt.Dispose();
            dt = null;

            return(objKhachQuen);
        }
        public static List <DanhBaKhachQuen> GetDanhBaKhachQuen_Search(string PhoneNumber, string TenKH, string DiaChi)
        {
            List <DanhBaKhachQuen> listKhachQuen = new List <DanhBaKhachQuen>();
            DataTable dt = new Data.DanhBaKhachQuen().GetDanhBaKhachQuen_Search(PhoneNumber, TenKH, DiaChi);

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    listKhachQuen.Add(GetKhachQuen_Row(dr));
                }
            }
            dt.Dispose();
            dt = null;

            return(listKhachQuen);
        }
        /// <summary>
        /// Lấy ds khách quên theo một khoảng thời gian.
        /// </summary>
        public static List <DanhBaKhachQuenEx> GetKhachQuens(DateTime tuNgay, DateTime denNgay)
        {
            List <DanhBaKhachQuenEx> lstKhachQuen = new List <DanhBaKhachQuenEx>();
            DataTable dt = new DataTable();

            dt = new Data.DanhBaKhachQuen().GetKhachQuens(tuNgay, denNgay);
            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    lstKhachQuen.Add(GetKhachQuenEx_Row(dr));
                }
            }
            dt.Dispose();
            dt = null;

            return(lstKhachQuen);
        }
        public static List <DanhBaEx> GetKhachQuens_LastUpdate_V2(DateTime LastUpdate)
        {
            List <DanhBaEx> lstKhachQuen = new List <DanhBaEx>();
            DataTable       dt           = new DataTable();

            dt = new Data.DanhBaKhachQuen().GetKhachQuens_LastUpdate(LastUpdate);
            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    lstKhachQuen.Add(GetDanhBaEx_Row(dr));
                }
            }
            dt.Dispose();
            dt = null;

            return(lstKhachQuen);
        }
        public static List <DanhBaKhachQuen> GetKhachQuens(string strSQL)
        {
            List <DanhBaKhachQuen> lstKhachQuen = new List <DanhBaKhachQuen>();
            DataTable dt = new DataTable();

            dt = new Data.DanhBaKhachQuen().GetKhachQuens(strSQL);
            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    lstKhachQuen.Add(GetKhachQuen_Row(dr));
                }
            }
            dt.Dispose();
            dt = null;

            return(lstKhachQuen);
        }
 /// <summary>
 /// Tra ve dia chi cua so dien thoai
 /// </summary>
 public static string GetAddress(string PhoneNumber)
 {
     try
     {
         DataTable dt = new DataTable();
         dt = new Data.DanhBaKhachQuen().GetAddress_Phones(PhoneNumber);
         if (dt.Rows.Count > 0)
         {
             return(dt.Rows[0]["Address"].ToString());
         }
         dt.Dispose();
         dt = null;
         return(string.Empty);
     }
     catch (Exception ex)
     {
         LogError.WriteLogError("GetAddress: ", ex);
         return(string.Empty);
     }
 }
        public static List <DanhBaKhachQuen> GetDanhSachKhachQuen()
        {
            try
            {
                List <DanhBaKhachQuen> listKhachQuen = new List <DanhBaKhachQuen>();
                DataTable dt = new DataTable();
                dt = new Data.DanhBaKhachQuen().GetDanhBaKhachQuen_ID("");
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        listKhachQuen.Add(GetKhachQuen_Row(dr));
                    }
                }
                dt.Dispose();
                dt = null;

                return(listKhachQuen);
            }
            catch
            {
                return(null);
            }
        }