public frmTiepNhanKN(string db, string loai)
        {
            danhbo = db;
            loaikh = loai;
            InitializeComponent();
            fLoad(loaikh);
            if ("KH".Equals(loaikh))
            {
                TB_DULIEUKHACHHANG khachhang = DAL.KhachHang.CKhachHang.finByDanhBo(danhbo);
                if (khachhang != null)
                {
                    txtSoDanhBo.Text  = khachhang.DANHBO;
                    txtTenKH.Text     = khachhang.HOTEN;
                    txtsonha.Text     = khachhang.SONHA;
                    txtDuong.Text     = khachhang.TENDUONG;
                    txtDienThoai.Text = khachhang.DIENTHOAI;

                    cbQuan.SelectedValue = khachhang.QUAN;

                    cbPhuong.SelectedValue = khachhang.PHUONG;
                }
            }
            else if ("GM".Equals(loaikh))
            {
                BIENNHANDON donkh = DAL.KhachHang.CGanMoi.searchBienNhan(danhbo);
                if (donkh != null)
                {
                    txtSoDanhBo.Text  = donkh.SHS;
                    txtTenKH.Text     = donkh.HOTEN;
                    txtsonha.Text     = donkh.SONHA;
                    txtDuong.Text     = donkh.DUONG;
                    txtDienThoai.Text = donkh.DIENTHOAI;
                    QUAN q = CHeThongDuong.finByMaQuan(donkh.QUAN);
                    cbQuan.Text   = q.TENQUAN;
                    cbPhuong.Text = CHeThongDuong.finbyPhuong(q.MAQUAN, donkh.PHUONG).TENPHUONG;
                }
            }
        }
Beispiel #2
0
        void LoadThongTinDB(string sodanhbo)
        {
            if (sodanhbo.Length == 11)
            {
                khachhang = DAL.KhachHang.CKhachHang.finByDanhBo(sodanhbo);
                if (khachhang != null)
                {
                    rDanhBo.Text         = khachhang.DANHBO;
                    LOTRINH.Text         = khachhang.LOTRINH;
                    DOT.Text             = khachhang.LOTRINH.Substring(1, 2);
                    HOPDONG.Text         = khachhang.HOPDONG;
                    HOTEN.Text           = khachhang.HOTEN;
                    TENDUONG.Text        = khachhang.SONHA + ' ' + khachhang.TENDUONG;
                    txtDienThoai.Text    = khachhang.DIENTHOAI;
                    QUAN.Text            = khachhang.QUAN + "." + khachhang.PHUONG;
                    txtHieuLuc.Text      = String.Format("{0:00}", khachhang.KY) + "/" + khachhang.NAM;
                    GIABIEU.Text         = khachhang.GIABIEU;
                    DINHMUC.Text         = khachhang.DINHMUC;
                    NGAYGAN.ValueObject  = khachhang.NGAYTHAY;
                    KIEMDINH.ValueObject = khachhang.NGAYKIEMDINH;
                    HIEUDH.Text          = khachhang.HIEUDH;
                    CO.Text     = khachhang.CODH;
                    CAP.Text    = khachhang.CAP;
                    SOTHAN.Text = khachhang.SOTHANDH;
                    VITRI.Text  = khachhang.VITRIDHN;
                    txtDMA.Text = khachhang.MADMA;

                    txtNhanVienDocSo.Text = CKhachHang.getNVDS(khachhang.LOTRINH.Substring(2, 2));
                    txtNVThuTien.Text     = CKhachHang.getNVThuTien(khachhang.DANHBO);
                    loadghichu(khachhang.DANHBO);
                    loadHoaDon(khachhang.DANHBO);
                    loadDongNuoc(khachhang.DANHBO);
                    loadCall(khachhang.DANHBO);
                    searchBaoThay(khachhang.DANHBO);
                    gridControl.DataSource = _cKinhDoanh.GetTienTrinhByDanhBo(khachhang.DANHBO).Tables["Don"];
                }
                else
                {
                    TB_DULIEUKHACHHANG_HUYDB khachhanghuy = DAL.KhachHang.CKhachHang.finByDanhBoHuy(sodanhbo);
                    if (khachhanghuy != null)
                    {
                        rDanhBo.Text         = khachhanghuy.DANHBO;
                        LOTRINH.Text         = khachhanghuy.LOTRINH;
                        DOT.Text             = khachhanghuy.DOT;
                        HOPDONG.Text         = khachhanghuy.HOPDONG;
                        HOTEN.Text           = khachhanghuy.HOTEN;
                        TENDUONG.Text        = khachhanghuy.SONHA + " " + khachhanghuy.TENDUONG;
                        QUAN.Text            = khachhanghuy.QUAN + "  " + khachhanghuy.PHUONG;
                        txtHieuLuc.Text      = "Hết HL " + khachhanghuy.HIEULUCHUY;
                        GIABIEU.Text         = khachhanghuy.GIABIEU;
                        DINHMUC.Text         = khachhanghuy.DINHMUC;
                        NGAYGAN.ValueObject  = khachhanghuy.NGAYTHAY;
                        KIEMDINH.ValueObject = khachhanghuy.NGAYKIEMDINH;
                        HIEUDH.Text          = khachhanghuy.HIEUDH;
                        CO.Text     = khachhanghuy.CODH;
                        CAP.Text    = khachhanghuy.CAP;
                        SOTHAN.Text = khachhanghuy.SOTHANDH;
                        VITRI.Text  = khachhanghuy.VITRIDHN;
                        //CHITHAN.Text = khachhanghuy.CHITHAN;
                        //CHIGOC.Text = khachhanghuy.CHIGOC;
                        //btCapNhatThongTin.Enabled = false;
                        txtNhanVienDocSo.Text = CKhachHang.getNVDS(khachhanghuy.LOTRINH.Substring(2, 2));
                        txtNVThuTien.Text     = CKhachHang.getNVThuTien(khachhanghuy.DANHBO);

                        loadghichu(khachhanghuy.DANHBO);
                        loadHoaDon(khachhanghuy.DANHBO);
                        loadDongNuoc(khachhanghuy.DANHBO);
                        loadCall(khachhanghuy.DANHBO);
                        searchBaoThay(khachhanghuy.DANHBO);
                        gridControl.DataSource = _cKinhDoanh.GetTienTrinhByDanhBo(khachhanghuy.DANHBO).Tables["Don"];
                    }
                    else
                    {
                        MessageBox.Show(this, "Không Tìm Thấy Thông Tin !", "..: Thông Báo :..", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        //Refesh();
                    }
                }
            }
        }