Exemplo n.º 1
0
        public string GetKHSDT(string SDT)
        {
            QLyKHDTO khachHang = QLKHDAO.GetKhachHangSDT(SDT);
            string   jsonData  = JsonConvert.SerializeObject(khachHang);

            return(jsonData);
        }
Exemplo n.º 2
0
        public int KTThongTinThemKH(string soTKLK, DateTime ngayMoTK, string hoTen, string email, DateTime ngaySinh, string noiCap, string soCMND, string diaChi, string hanMucVay, string SDT)
        {
            DateTime ngayDu18Tuoi = ngaySinh.AddYears(18);
            Check    check        = new Check();

            if (soTKLK == "")
            {
                return(1);
            }
            if (hoTen == "")
            {
                return(2);
            }
            if (noiCap == "")
            {
                return(3);
            }
            if (soCMND == "")
            {
                return(4);
            }
            if (diaChi == "")
            {
                return(5);
            }
            if (hanMucVay == "")
            {
                return(6);
            }
            if (SDT == "")
            {
                return(7);
            }
            if (ngayMoTK < ngayDu18Tuoi)
            {
                return(8);
            }
            if (check.ChiChuaChuCai(hoTen) == false || hoTen.Length > 50)
            {
                return(9);
            }
            if (check.ChiChuaChuSo(hanMucVay) == false)
            {
                return(10);
            }
            if (!check.ChiChuaChuSo(soCMND) || soCMND.Length > 12)
            {
                return(11);
            }
            if (!check.ChiChuaChuSo(SDT) || SDT.Length > 12 || QLKHDAO.GetKhachHangSDT(SDT) != null)
            {
                return(12);
            }
            if (QLKHDAO.layMotKhachHang(soTKLK) != null)
            {
                return(13);
            }
            if (soTKLK.Length != 10 || !check.ChiChuaChuSo(soTKLK.Substring(4, 6)) || soTKLK.Substring(0, 4) != "001C")
            {
                return(14);
            }
            if (QLKHDAO.GetKhachHang(soCMND) != null)
            {
                return(15);
            }
            if (check.ChiChuaChuCai(diaChi) == false || diaChi.Length > 50)
            {
                return(16);
            }
            if (check.ChiChuaChuCai(noiCap) == false || noiCap.Length > 50)
            {
                return(17);
            }
            if (email.Length > 50)
            {
                return(18);
            }
            return(0);
        }