Exemplo n.º 1
0
        private void LoadChungTuHeader()
        {
            LoadTrungTam();
            txtSoOrderKH.Text     = Business.ChungTu.SoChungTu;
            mstNgayLapPhieu.Value = Business.ChungTu.NgayLap;
            txtKyHieu.Text        = Business.ChungTu.KyHieu;
            txtSoSerie.Text       = Business.ChungTu.SoSeri;
            bteKhoXuat.Tag        = DMKhoDataProvider.GetKhoByIdInfo(Business.ChungTu.IdKho);
            bteKhoXuat.Text       = bteKhoXuat.Tag != null ? ((DMKhoInfo)bteKhoXuat.Tag).TenKho : "";
            bteKhachHang.Tag      = DmDoiTuongProvider.GetDmDoiTuongInfoFromOid(Business.ChungTu.IdDoiTuong);
            bteKhachHang.Text     = bteKhachHang.Tag != null ? ((DMDoiTuongInfo)bteKhachHang.Tag).TenDoiTuong : "";
            txtDienThoai.Text     = Business.ChungTu.DienThoai;
            txtCMND.Text          = Business.ChungTu.SoCMND;

            txtHoTenKhachHang.Text    = Business.ChungTu.HoTen;
            cboGioiTinh.SelectedIndex = Business.ChungTu.GioiTinh;
            txtTuoi.Text           = Business.ChungTu.DoTuoi.ToString();
            txtMaSoThue.Text       = Business.ChungTu.MaSoThue;
            txtEmail.Text          = Business.ChungTu.Email;
            txtDiaChi.Text         = Business.ChungTu.DiaChiHoaDon;
            txtDiaChiGiaoHang.Text = Business.ChungTu.DiaChiGiaoHang;

            txtTongTienHang.Text      = Common.Double2Str(Business.ChungTu.TongTienHang);
            txtTongTienCK.Text        = Common.Double2Str(Business.ChungTu.TongTienChietKhau);
            txtTongTienSauCK.Text     = Common.Double2Str(Business.ChungTu.TongTienSauChietKhau);
            txtTongTienVAT.Text       = Common.Double2Str(Business.ChungTu.TongTienVAT);
            txtTongTienThanhToan.Text = Common.Double2Str(Business.ChungTu.TongTienThanhToan);
            txtTienThucTra.Text       = Common.Double2Str(Business.ChungTu.TienThanhToanThuc);
            txtTienConNo.Text         = Common.Double2Str(Business.ChungTu.TienConNo);
            bteThoiHanThanhToan.Tag   = DMLoaiThuChiDataProvider.GetListDmThuChiInfoFromOid(Business.ChungTu.HinhThucTra);
            bteThoiHanThanhToan.Text  = bteThoiHanThanhToan.Tag != null ? ((DMLoaiThuChiInfor)bteThoiHanThanhToan.Tag).Ten : "";
        }
Exemplo n.º 2
0
        private void LoadChungTuHeader()
        {
            LoaiChungTu      = Business.ChungTu.LoaiChungTu;
            TrangThaiDonHang = Business.ChungTu.TrangThai;
            Draft            = Business.ChungTu.Draft;

            bteKhoXuat.Tag    = DMKhoDataProvider.GetKhoByIdInfo(Business.ChungTu.IdKho);
            bteKhoXuat.Text   = bteKhoXuat.Tag != null ? ((DMKhoInfo)bteKhoXuat.Tag).TenKho : "";
            bteKhachHang.Tag  = DmDoiTuongProvider.GetDmDoiTuongInfoFromOid(Business.ChungTu.IdDoiTuong);
            bteKhachHang.Text = bteKhachHang.Tag != null ? ((DMDoiTuongInfo)bteKhachHang.Tag).TenDoiTuong : "";
            IdKhoSelected     = Business.ChungTu.IdKho;
            txtGhiChu.Text    = Business.ChungTu.GhiChu;

            txtSoOrderKH.Text     = Business.ChungTu.SoChungTu;
            mstNgayLapPhieu.Value = Business.ChungTu.NgayLap;
            txtSoPhieu.Text       = Business.ChungTu.SoPhieuXuat;
            try
            {
                mstNgayXuat.Value = Business.ChungTu.NgayXuatHang;
            }
            catch
            {
                mstNgayXuat.Value = DateTime.Now;
            }

            cboNhanVien.SelectedValue = Business.ChungTu.IdNhanVienGiao;
            bteNhanVien.Tag           = DmNhanVienDataProvider.GetListDmNhanVienInfoFromOid(Business.ChungTu.IdNhanVienGiao);
            bteNhanVien.Text          = bteNhanVien.Tag != null ? ((DMNhanVienInfo)bteNhanVien.Tag).HoTen : "";
            txtDienThoai.Text         = Business.ChungTu.DienThoai;
            txtHoTenKhachHang.Text    = Business.ChungTu.HoTen;
            txtDiaChi.Text            = Business.ChungTu.DiaChi;
        }
Exemplo n.º 3
0
 private void btnFilter_Click(object sender, EventArgs e)
 {
     listDoiTuong = DmDoiTuongProvider.Search(new DMDoiTuongInfo {
         MaDoiTuong = txtFilterMa.Text.Trim(), TenDoiTuong = txtFilterTen.Text.Trim()
     });
     grcBase.DataSource = listDoiTuong;
 }
 private void SaveDoiTuong()
 {
     if (Check())
     {
         try
         {
             ConnectionUtil.Instance.BeginTransaction();
             if (frmKH.isAdd)
             {
                 int oid = DmDoiTuongProvider.Insert(SetKhachHangInfo());
                 SaveDiaChi(oid);
                 ConnectionUtil.Instance.CommitTransaction();
             }
             else
             {
                 DMDoiTuongInfo info = SetKhachHangInfo();
                 info.IdDoiTuong = frmKH.Oid;
                 DmDoiTuongProvider.Update(info);
                 SaveDiaChi(info.IdDoiTuong);
                 ConnectionUtil.Instance.CommitTransaction();
             }
         }
         catch (Exception)
         {
             ConnectionUtil.Instance.RollbackTransaction();
             throw;
         }
     }
 }
        private void btnFilter_Click(object sender, EventArgs e)
        {
            #region Old
            //string dk = "1=1";
            //if (!String.IsNullOrEmpty(txtFilterMa.Text)) {
            //    dk += String.Format(" and MaDoiTuong like '{0}'", txtFilterMa.Text);
            //}
            //if (!String.IsNullOrEmpty(txtFilterTen.Text)) {
            //    dk += String.Format(" and TenDoiTuong like N'{0}'", txtFilterTen.Text);
            //}
            ////string sql = "SELECT 0 as SoTT,IdDoiTuong, IdCha, MaDoiTuong, TenDoiTuong, NguoiLienLac, DienThoai,"
            ////            + " Fax, Email, MaSoThue, Type, SuDung, GhiChu, GioiTinh, NgaySinh, IdOrderType"
            ////            + " FROM tbl_DM_DoiTuong WHERE " + dk;
            ////this.listDoiTuong = DBTools.getData("tbl_DM_DoiTuong", sql).Tables["tbl_DM_DoiTuong"];
            //this.listDoiTuong = DoiTuongDataProvider.GetListDoiTuongInfo();

            //this.LuoiHienThi_GanNguon();
            //this.LuoiHienThi_AnCot();
            //this.KhachHang_CapNhatSoTT(0);

            //cm = (CurrencyManager)this.BindingContext[this.listDoiTuong];
            //cm.PositionChanged += new EventHandler(this.Position_Changed);
            //this.KhachHang_HienThi(this.cm.Position);
            #endregion

            dgvKhachHang.DataSource = DmDoiTuongProvider.Search(new DMDoiTuongInfo {
                MaDoiTuong = txtFilterMa.Text.Trim(), TenDoiTuong = txtFilterTen.Text.Trim()
            });
        }
Exemplo n.º 6
0
        private void LoadChungTuHeader()
        {
            LoadTrungTam();
            LoadKhoXuat();
            LoadKhachHang();

            txtSoOrderKH.Text     = ChungTu.SoChungTu;
            mstNgayLapPhieu.Value = ChungTu.NgayLap;
            txtSoChungTuGoc.Text  = ChungTu.SoChungTuGoc;

            txtSoPhieuDC.Text = ChungTu.SoPhieuDC;

            bteThuongVien.Tag         = DmNhanVienDataProvider.GetListDmNhanVienInfoFromOid(ChungTu.IdNhanVien);
            bteThuongVien.Text        = bteThuongVien.Tag != null ? ((DMNhanVienInfo)bteThuongVien.Tag).HoTen : "";
            cboGiaoHang.SelectedIndex = ChungTu.GiaoNhan;

            try
            {
                mstNgayHenGiaoHang.Value = ChungTu.NgayHenGiaoHang;
            }
            catch
            {
                mstNgayHenGiaoHang.Value = CommonProvider.Instance.GetSysDate();
            }

            txtGhiChu.Text = ChungTu.GhiChu;

            txtSoSerie.Text        = ChungTu.SoSeri;
            bteKhachLe.Tag         = DmDoiTuongProvider.GetDmDoiTuongInfoFromOid(ChungTu.IdKhachLe);
            bteKhachLe.Text        = bteKhachHang.Tag != null ? ((DMDoiTuongInfo)bteKhachHang.Tag).TenDoiTuong : "";
            txtCongTy.Text         = ChungTu.CongTy;
            txtHoTenKhachHang.Text = ChungTu.HoTen;
            txtDiaChi.Text         = ChungTu.DiaChi;
            txtSoHDDaMua.Text      = ChungTu.SoHDDaMua;
        }
Exemplo n.º 7
0
        private void LoadDoiTuongCha()
        {
            DMDoiTuongInfo dmDoiTuongInfo = DmDoiTuongProvider.GetDmDoiTuongInfoFromOid(dm.IdCha);

            bteDoiTuongCha.Tag  = dmDoiTuongInfo;
            bteDoiTuongCha.Text = dmDoiTuongInfo.TenDoiTuong;
            txtMa.Text          = dmDoiTuongInfo.MaDoiTuong;
        }
        //fill dữ liệu vào control
        private void LoadOldChungTuInfor(ChungTuBanHangInfor lstHD)
        {
            grbChungTuMua.Text = "Thông tin phiếu mua hàng: " +
                                 (String.IsNullOrEmpty(lstHD.TenTrungTam)
                          ? ""
                          : (lstHD.TenTrungTam + (String.IsNullOrEmpty(lstHD.TenKho) ? "" : "(" + lstHD.TenKho + ")")));
            _IdTrungTam               = lstHD.IdTrungTam;
            txtSoGiaoDich.Text        = lstHD.SoChungTu;
            txtSoPhieuXuat.Text       = lstHD.SoPhieuXuat;
            dteNgayLap.EditValue      = lstHD.NgayLap;
            dteNgayXuat.EditValue     = lstHD.NgayXuatHang;
            txtKiHieu.Text            = lstHD.KyHieu;
            txtSoHoaDon.Text          = lstHD.SoSeri;
            txtTenDoiTuong.Text       = lstHD.HoTen;
            txtCongTy.Text            = lstHD.CongTy;
            cboGioiTinh.SelectedIndex = lstHD.GioiTinh;
            txtCMND.Text              = lstHD.SoCMND;
            txtSoDienThoai.Text       = lstHD.MaSoThue;
            txtEmail.Text             = lstHD.Email;
            txtDiaChiHD.Text          = lstHD.DiaChiHoaDon;
            txtDiaChiGH.Text          = lstHD.DiaChiGiaoHang;
            txtSoDienThoai.Text       = lstHD.DienThoai;

            if (lstHD.IdNhanVien != 0)
            {
                DMNhanVienInfo thuongvien = DmNhanVienDataProvider.GetListDmNhanVienInfoFromOid(lstHD.IdNhanVien);
                if (thuongvien != null)
                {
                    bteThuongVien.Tag  = thuongvien;
                    bteThuongVien.Text = thuongvien.HoTen;
                }
            }

            if (lstHD.IdDoiTuong != 0)
            {
                DMDoiTuongInfo doituong = DmDoiTuongProvider.GetDmDoiTuongInfoFromOid(lstHD.IdDoiTuong);
                if (doituong != null)
                {
                    txtKhachHang.Tag  = doituong;
                    txtKhachHang.Text = doituong.TenDoiTuong;
                }
            }
            if (lstHD.IdKhachLe != 0)
            {
                DMDoiTuongInfo khachle = DmDoiTuongProvider.GetDmDoiTuongInfoFromOid(lstHD.IdKhachLe);
                if (khachle != null)
                {
                    bteKhachLe.Tag  = khachle;
                    bteKhachLe.Text = khachle.TenDoiTuong;
                }
            }

            txtTongTienTT.Text   = Common.Double2Str(lstHD.TongTienThanhToan);
            txtTienThucTra.Text  = Common.Double2Str(lstHD.TienThanhToanThuc);
            txtTienConNo.Text    = Common.Double2Str(lstHD.TienConNo);
            txtTienTraKhach.Text = "0";
            txtTienNoKhach.Text  = txtTienThucTra.Text;
        }
Exemplo n.º 9
0
 private void LoadDoiTuong()
 {
     KHangSelected = DmDoiTuongProvider.GetDmDoiTuongInfoFromOid(Declare.IdKHMacDinh);
     if (KHangSelected != null)
     {
         bteKhachHang.Text = KHangSelected.TenDoiTuong;
         bteKhachHang.Tag  = KHangSelected;
     }
 }
Exemplo n.º 10
0
        private bool Check()
        {
            if (String.IsNullOrEmpty(txtMa.Text))
            {
                txtMa.Focus();
                throw new InvalidOperationException("Mã khách hàng không được để trống !");
            }
            if (String.IsNullOrEmpty(txtTen.Text))
            {
                txtTen.Focus();
                throw new InvalidOperationException("Tên khách hàng không được để trống !");
            }

            if (Equals(cboGioiTinh.SelectedItem, String.Empty))
            {
                cboGioiTinh.Focus();
                throw new InvalidOperationException("Bạn chưa chọn giới tính !");
            }
            if (txtEmail.Text.Trim().Length > 0 && Common.ValidEmail(txtEmail.Text.Trim()) == false)
            {
                txtEmail.Focus();
                throw new InvalidExpressionException("Email chưa đúng định dạng!");
            }
            //if (Equals(cboType.SelectedItem, String.Empty))
            //{
            //    cboType.Focus();
            //    throw new InvalidOperationException("bạn chưa chọn loại đối tượng !");
            //}
            if (Equals(cboOrderType.SelectedItem, String.Empty))
            {
                cboOrderType.Focus();
                throw new InvalidOperationException("Bạn chưa chọn OrderType !");
            }
            if (Equals(bteDoiTuongCha.Tag, null))
            {
                bteDoiTuongCha.Focus();
                throw new InvalidOperationException("Bạn chưa chọn đối tượng cha !");
            }
            if (String.IsNullOrEmpty(txtMaRieng.Text))
            {
                txtMaRieng.Focus();
                throw new InvalidOperationException("Mã riêng không được để trống !");
            }
            //if (Common.DoubleValue(txtCongNoKhachHang.Text) < 0)
            //{
            //    txtCongNoKhachHang.Focus();
            //    throw new InvalidOperationException("Công nợ khách hàng không thể âm !");
            //}
            if (DmDoiTuongProvider.KiemTraLe(new DMDoiTuongInfo {
                IdDoiTuong = frmKHL == null ? 0 : frmKHL.Oid, MaRieng = txtMaRieng.Text.Trim()
            }))
            {
                txtMaRieng.Focus();
                throw new InvalidOperationException("Mã riêng đã tồn tại trong hệ thống !");
            }
            return(true);
        }
Exemplo n.º 11
0
        protected override void LoadDataInstance()
        {
            liChiTietChungTu.Clear();
            //load theo id của sản phẩm
            XuatTraNccBusiness.ListChiTietChungTu = KhoXuatNccDataProvider.Instance.GetListChiTietChungTuByIdChungTu(OID != 0 ? OID : idChungTuGoc);
            bdSource              = new BindingSource();
            bdSource.DataSource   = new BindingList <ChungTuXuatNhapNccChiTietInfo>(XuatTraNccBusiness.ListChiTietChungTu);
            bdSource.AddingNew   += new AddingNewEventHandler(bdSource_AddingNew);
            dgvChiTiet.DataSource = bdSource;
            if (IdNhaCC != 0)
            {
                DMDoiTuongInfo dmDoiTuong = DmDoiTuongProvider.GetDmDoiTuongInfoFromOid(IdNhaCC);
                bteNhaCC.Tag  = dmDoiTuong;
                bteNhaCC.Text = dmDoiTuong.TenDoiTuong;
            }
            if (OID == 0)
            {
                txtNguoiLap.Text    = Declare.UserName;
                dtNgayLap.EditValue = CommonProvider.Instance.GetSysDate();
            }
            else
            {
                txtNguoiLap.Text    = NguoiLap;
                dtNgayLap.EditValue = Convert.ToDateTime(NgayLap);
            }

            txtGhiChu.Text = GhiChu;

            txtPO.Text               = soPO;
            txtSoRE.Text             = soRE;
            bteNhaCC.Text            = TenDT;
            bteNhaCC.Tag             = DmDoiTuongProvider.GetDmDoiTuongInfoFromOid(IdNhaCC);
            btnChiTietMaVach.Enabled = false;
            btnXoaSP.Enabled         = false;
            btnCapNhat.Enabled       = false;
            dtNgayLap.Enabled        = false;
            if (trangThai == Convert.ToInt32(TrangThaiDuyet.DA_XUAT))
            {
                btnXoaSP.Enabled    = false;
                btnThemSP.Enabled   = false;
                btnCapNhat.Enabled  = false;
                btnThemSP.Enabled   = false;
                txtNguoiLap.Enabled = false;
                txtGhiChu.Enabled   = false;
                txtPO.Enabled       = false;
                bteNhaCC.Enabled    = false;
                dtNgayLap.Enabled   = false;
                clSoLuong.ReadOnly  = true;
            }
            else
            {
                dtNgayLap.Enabled  = false;
                btnCapNhat.Enabled = true;
                clSoLuong.ReadOnly = false;
            }
        }
Exemplo n.º 12
0
        private void Delete()
        {
            DmDoiTuongProvider.Delete(new DMDoiTuongInfo {
                IdDoiTuong = Oid
            });

            MessageBox.Show("Xóa thành công !");
            LoadData();
            SetControl(false);
        }
Exemplo n.º 13
0
        private void LoadKhachHang()
        {
            DMDoiTuongInfo dmDoiTuong = DmDoiTuongProvider.GetDmDoiTuongInfoFromOid(ChungTu.IdDoiTuong);

            if (dmDoiTuong != null)
            {
                bteKhachHang.Text = dmDoiTuong.TenDoiTuong;
                bteKhachHang.Tag  = dmDoiTuong;
            }
        }
Exemplo n.º 14
0
 private void Delete()
 {
     if (frmKHL.isAdd)
     {
         throw new InvalidOperationException("Bạn không thể xóa khi đang thêm mới!");
     }
     DmDoiTuongProvider.Delete(new DMDoiTuongInfo {
         IdDoiTuong = frmKHL.Oid
     });
 }
 protected override void OnLoad()
 {
     if (idNhomDoiTuong == -1)
     {
         ListInitInfo = DmDoiTuongProvider.GetListDmDoiTuongKhachHang();
     }
     else
     {
         ListInitInfo = DmDoiTuongProvider.GetDmDoiTuongByLoaiDT(idNhomDoiTuong);
     }
 }
Exemplo n.º 16
0
 protected override void OnLoad()
 {
     if (GiaoVan)
     {
         ListInitInfo = DmDoiTuongProvider.GetListDmDoiTuongDTacGVan();
     }
     else
     {
         ListInitInfo = DmDoiTuongProvider.GetListDmDoiTuongNCC();
     }
 }
Exemplo n.º 17
0
        //private void LuoiHienThi_AnCot()
        //{
        //    this.dgvKhachHang.Columns["IdDoiTuong"].Visible = false;
        //    this.dgvKhachHang.Columns["clFax"].Visible = false;
        //    this.dgvKhachHang.Columns["clEmail"].Visible = false;
        //    this.dgvKhachHang.Columns["clType"].Visible = false;
        //    this.dgvKhachHang.Columns["clGhiChu"].Visible = false;
        //    this.dgvKhachHang.Columns["IdCha"].Visible = false;
        //    this.dgvKhachHang.Columns["clIdOrderType"].Visible = false;
        //}

        //private void LuoiHienThi_Resize()
        //{
        //    int Luoi_ChieuDai = this.dgvKhachHang.Width;
        //    int Luoi_ChieuDaiCacCot;
        //    Luoi_ChieuDaiCacCot = this.SoTT.Width +
        //        this.clSuDung.Width +
        //        this.TenKhachHang.Width +
        //        this.MaKhachHang.Width +
        //        this.clDiaChi.Width +
        //        this.clDienThoai.Width +
        //        this.dgvKhachHang.RowHeadersWidth + 2;
        //    if (Luoi_ChieuDai > Luoi_ChieuDaiCacCot)
        //        this.dgvKhachHang.Columns["clDiaChi"].Width = Luoi_ChieuDai - (this.SoTT.Width +
        //                                            this.clSuDung.Width +
        //                                            this.TenKhachHang.Width +
        //                                            this.MaKhachHang.Width +
        //                                            this.clDienThoai.Width +
        //                                            this.dgvKhachHang.RowHeadersWidth + 2);
        //    else
        //        this.dgvKhachHang.Columns["clDiaChi"].Width = 300;
        //    this.dgvKhachHang.Refresh();


        //}

        //private DoiTuongInfo GetInfor()
        //{
        //    DoiTuongInfo doiTuongInfo = new DoiTuongInfo();
        //    doiTuongInfo.IdDoiTuong = 0;
        //    doiTuongInfo.IdCha = this.cboCha.SelectedItem == null ? 0 : (this.cboCha.SelectedItem as ListItem).ItemData;
        //    doiTuongInfo.MaDoiTuong = this.txtMa.Text.Trim();
        //    doiTuongInfo.TenDoiTuong = this.txtTen.Text.Trim();
        //    doiTuongInfo.NguoiLienLac = this.txtNguoiLienLac.Text.Trim();
        //    doiTuongInfo.DienThoai = this.txtDienThoai.Text.Trim();
        //    doiTuongInfo.Fax = this.txtFax.Text.Trim();
        //    doiTuongInfo.Email = this.txtEmail.Text.Trim();
        //    doiTuongInfo.MaSoThue = this.txtMaSoThue.Text.Trim();
        //    doiTuongInfo.Type = this.cboType.SelectedIndex;
        //    doiTuongInfo.SuDung = this.chkSuDung.Checked ? 1 : 0;
        //    doiTuongInfo.GhiChu = this.txtGhiChu.Text.Trim();
        //    doiTuongInfo.GioiTinh = this.cboGioiTinh.SelectedIndex;
        //    doiTuongInfo.NgaySinh = mstNgaySinh.Value;
        //    doiTuongInfo.IdOrderType = cboOrderType.SelectedValue == null
        //                                   ? 0
        //                                   : int.Parse(cboOrderType.SelectedValue.ToString());
        //    return doiTuongInfo;
        //}

        //private object[] KhachHang_MangThongTin()
        //{
        //    object[] arrMang ={ 0,0,
        //                       this.cboCha.SelectedItem == null ? this.cboCha.SelectedItem : (this.cboCha.SelectedItem as ListItem).ItemData,
        //                       this.txtMa.Text.Trim(),
        //                       this.txtTen.Text.Trim(),
        //                       this.txtNguoiLienLac.Text.Trim(),
        //                       this.txtDienThoai.Text.Trim(),
        //                       this.txtFax.Text.Trim(),
        //                       this.txtEmail.Text.Trim(),
        //                       this.txtMaSoThue.Text.Trim(),
        //                       this.cboType.SelectedIndex,
        //                       this.chkSuDung.Checked ? 1 : 0,
        //                       this.txtGhiChu.Text.Trim(),
        //                       this.cboGioiTinh.SelectedIndex,
        //                       mstNgaySinh.Value,
        //                       this.cboOrderType.SelectedValue,//.cboOrderType.se.SelectedItem == null ? this.cboOrderType.SelectedItem : (this.cboOrderType.SelectedItem as ListItem).ItemData,
        //    };
        //    return arrMang;
        //}

        //private void KhachHang_ThemMoi()
        //{
        //    this.KhachHang_KhoiTaoGiaTri();
        //    this.KhachHang_IsThemMoi = true;
        //    this.txtMa.Focus();
        //    btnThemMoi.Enabled = false;
        //}

        //private void KhachHang_KhoiTaoGiaTri()
        //{
        //    this.KhachHang_IsThemMoi = false;
        //    this.txtMa.Text = "";
        //    this.txtTen.Text = "";
        //    this.txtNguoiLienLac.Text = "";
        //    this.txtDienThoai.Text = "";
        //    this.txtFax.Text = "";
        //    this.txtEmail.Text = "";
        //    this.txtMaSoThue.Text = String.Empty;
        //    this.cboType.SelectedValue = "Khách hàng";
        //    this.cboCha.SelectedIndex = -1;
        //    this.chkSuDung.Checked = true;
        //    this.txtGhiChu.Text = "";
        //    this.IdDoiTuong = 0;
        //    this.mstNgaySinh.Value = DateTime.Now;
        //    this.cboGioiTinh.SelectedIndex = 0;
        //    this.cboOrderType.SelectedIndex = 0;
        //    this.txtOrderType.Text = "";
        //    while(!dgvDiaChi.Rows[0].IsNewRow){
        //        dgvDiaChi.Rows.RemoveAt(0);
        //    }
        //}

        //private bool KhachHang_LayDuLieu()
        //{
        //    //string sql = "SELECT 0 as SoTT, IdDoiTuong, IdCha, MaDoiTuong, TenDoiTuong, NguoiLienLac, DienThoai,"
        //    //            + " Fax, Email, MaSoThue, Type, SuDung, GhiChu, GioiTinh, NgaySinh, IdOrderType"
        //    //            + " FROM tbl_DM_DoiTuong";
        //    //this.listDoiTuong = (DataTable)DBTools.getData("tbl_DM_DoiTuong", sql).Tables["tbl_DM_DoiTuong"];
        //    this.listDoiTuong = DoiTuongDataProvider.GetListDoiTuongInfo();
        //    if (this.listDoiTuong == null)
        //        return false;
        //    //this.KhachHang_ThemTruongSoTT();

        //    clMaVung.DataSource = MaVungDataProvider.ListMaVung();
        //    clMaVung.DisplayMember = "TenVung";
        //    clMaVung.ValueMember = "MaVung";

        //    return true;
        //}

        //private void LuoiHienThi_GanNguon()
        //{
        //    if (this.listDoiTuong != null)
        //    {
        //        this.dgvKhachHang.DataSource = this.listDoiTuong;
        //        this.dgvKhachHang.Refresh();
        //    }

        //}

        //private void ListCha_GanNguon()
        //{
        //    string sql = "Select IdDoiTuong, TenDoiTuong from tbl_DM_DoiTuong where SuDung=1";
        //    DBTools.List_LoadData(cboCha, sql, "IdDoiTuong", "TenDoiTuong", " ", 0);

        //}

        //private void ListOrderType_GanNguon()
        //{
        //    string sql = "Select IdOrderType, Code, Name from tbl_DM_OrderType where SuDung=1";
        //    //DBTools.List_LoadData(cboOrderType, sql, "IdOrderType", "Name", " ", 0);
        //    this.dtOrderType = DBTools.getData("tmp", sql).Tables["tmp"];
        //    if (this.dtOrderType != null)
        //    {
        //        DataRow r = this.dtOrderType.NewRow();
        //        r[0] = 0;
        //        r[1] = "";
        //        this.dtOrderType.Rows.InsertAt(r, 0);
        //        this.cboOrderType.DataSource = this.dtOrderType;
        //        this.cboOrderType.DisplayMember = "Name";
        //        this.cboOrderType.ValueMember = "IdOrderType";
        //        this.cboOrderType.SelectedIndex = -1;

        //        // AutoCompleteStringCollection
        //        AutoCompleteStringCollection data = new AutoCompleteStringCollection();
        //        for (int i = 1; i < this.dtOrderType.Rows.Count; i++)
        //        {
        //            data.Add(this.dtOrderType.Rows[i]["Code"].ToString());
        //        }

        //        txtOrderType.AutoCompleteSource = AutoCompleteSource.CustomSource;
        //        txtOrderType.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
        //        txtOrderType.AutoCompleteCustomSource = data;
        //    }
        //}

        //private void KhachHang_ThemTruongSoTT()
        //{
        //    //this.listDoiTuong.Columns.Add("SoTT", System.Type.GetType("System.Int16"));
        //    this.KhachHang_CapNhatSoTT(0);

        //}

        //private void KhachHang_CapNhatSoTT(int VitriRong)
        //{
        //    //for (int i = VitriRong; i <= this.listDoiTuong.DefaultView.Count - 1; i++)
        //    //{
        //    //    this.listDoiTuong.DefaultView[i]["SoTT"] = i + 1;
        //    //}
        //}

        //private void KhachHang_HienThi(int IndexRow)
        //{
        //    DoiTuongInfo doiTuongInfo = this.listDoiTuong[IndexRow];
        //    if (IndexRow >= 0) {
        //        this.IdDoiTuong = doiTuongInfo.IdDoiTuong;
        //        this.cboCha.SelectedItem = null;
        //        foreach (ListItem item in this.cboCha.Items)
        //        {
        //            if (item.ItemData == doiTuongInfo.IdCha)
        //            {
        //                this.cboCha.SelectedIndex = this.cboCha.Items.IndexOf(item);
        //                break;
        //            }
        //        }
        //        this.cboOrderType.SelectedValue = doiTuongInfo.IdOrderType;
        //        this.txtMa.Text = doiTuongInfo.MaDoiTuong;
        //        this.strMaKhachHang = this.txtMa.Text.Trim();
        //        this.txtTen.Text = doiTuongInfo.TenDoiTuong;
        //        this.txtNguoiLienLac.Text = doiTuongInfo.NguoiLienLac;
        //        this.txtDienThoai.Text = doiTuongInfo.DienThoai;
        //        this.txtFax.Text = doiTuongInfo.Fax;
        //        this.txtEmail.Text = doiTuongInfo.Email;
        //        this.txtMaSoThue.Text = doiTuongInfo.MaSoThue;
        //        this.cboType.SelectedIndex = doiTuongInfo.Type;
        //        this.chkSuDung.Checked = Equals(doiTuongInfo.SuDung, 1);
        //        this.txtGhiChu.Text = doiTuongInfo.GhiChu;
        //        this.mstNgaySinh.Value =  doiTuongInfo.NgaySinh == DateTime.MinValue ? DateTime.Now : doiTuongInfo.NgaySinh;

        //        this.cboGioiTinh.SelectedIndex = doiTuongInfo.GioiTinh;

        //        string sql = "Select IdDiaChi,IdDoiTuong,SiteNumber,DiaChi,MaVung from tbl_DM_DoiTuong_DiaChi where IdDoiTuong=" + this.IdDoiTuong;
        //        dgvDiaChi.DataSource = DBTools.getData("Temp", sql).Tables["Temp"];
        //        //dgvDiaChi.Columns["IdDiaChi"].Visible = false;
        //        //dgvDiaChi.Columns["IdDoiTuong"].Visible = false;
        //        dgvDiaChi.Refresh();
        //    }
        //    else {
        //        this.KhachHang_KhoiTaoGiaTri();
        //        this.strMaKhachHang = "";
        //    }
        //}

        //private bool KhachHang_SuHopLeCuaThongTin()
        //{
        //    string strSql;
        //    if (this.txtMa.Text.Trim().Length == 0) {
        //        MessageBox.Show("Mã khách hàng chưa nhập." + "\n" + "-Hãy nhập mã khách hàng", Declare.titleNotice, MessageBoxButtons.OK, MessageBoxIcon.Information);
        //        this.txtMa.Focus();
        //        return false;
        //    }
        //    if (this.txtMa.Text.Trim().Length > 0) {
        //        strSql = "Select * from tbl_DM_DoiTuong where MaDoiTuong =N'" + this.txtMa.Text.Trim() + "'";
        //        bool blnIsCheck = DBTools.ExistData(strSql);

        //        if (this.KhachHang_IsThemMoi) {
        //            if (blnIsCheck) {
        //                MessageBox.Show("Mã khách hàng này đã có." + "\n" + "-Hãy nhập lại mã khách hàng", Declare.titleWarning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
        //                this.txtMa.Focus();
        //                return false;
        //            }
        //        }
        //        else {
        //            if (string.Compare(this.txtMa.Text.Trim().ToUpper(), this.strMaKhachHang.ToUpper()) != 0) {
        //                if (blnIsCheck) {
        //                    MessageBox.Show("Mã khách hàng này đã có." + "\n" + "-Hãy nhập lại mã khách hàng", Declare.titleWarning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
        //                    this.txtMa.Focus();
        //                    return false;
        //                }
        //            }
        //        }
        //    }


        //    if (this.txtTen.Text.Trim().Length == 0) {
        //        MessageBox.Show("Tên khách hàng chưa nhập." + "\n" + "-Hãy nhập tên khách hàng", Declare.titleNotice, MessageBoxButtons.OK, MessageBoxIcon.Information);
        //        this.txtTen.Focus();
        //        return false;
        //    }
        //    if(this.txtEmail.Text.Trim().Length>0)
        //        if (Common.ValidEmail(this.txtEmail.Text.Trim()) == false)
        //        {
        //            MessageBox.Show("Email không đúng định dạng"+"\n"+"-Hãy nhập lại email", Declare.titleWarning, MessageBoxButtons.OK,MessageBoxIcon.Warning);
        //            this.txtEmail.Focus();
        //            return false;
        //        }
        //    if (!this.KhachHang_IsThemMoi) {
        //        DBTools._IsCheck IsCheck;
        //        IsCheck = DBTools.CheckExistsRecord(this.KhachHang_IsCheckDeleteCommand(int.Parse(this.dgvKhachHang.CurrentRow.Cells["IdDoiTuong"].Value.ToString())));
        //        if (IsCheck == DBTools._IsCheck._TRUE) {
        //            if (!this.chkSuDung.Checked) {
        //                MessageBox.Show("Thông tin của khách hàng này đã được sử dụng nên trạng thái sử dụng luôn được chọn" + "\n" + "-Hãy chọn lại trạng thái sử dụng", Declare.titleWarning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
        //                this.chkSuDung.Focus();
        //                return false;
        //            }
        //        }
        //        else if (IsCheck == DBTools._IsCheck._EXCEPTION) {
        //            MessageBox.Show("Lỗi ngoại lệ: " + DBTools._LastError.Message, Declare.titleError, MessageBoxButtons.OK, MessageBoxIcon.Error);
        //            return false;
        //        }

        //        if (Object.Equals(this.dgvKhachHang.CurrentRow.Cells["IdDoiTuong"].Value, cboCha.SelectedValue)) {
        //            MessageBox.Show("Cha không thể là chính nó", Declare.titleWarning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
        //            this.cboCha.Focus();
        //            return false;
        //        }
        //    }
        //    if (dgvDiaChi.Rows[0].IsNewRow){
        //        MessageBox.Show("Phải có ít nhất một địa chỉ SiteNumber", Declare.titleWarning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
        //        return false;
        //    }else {
        //        for (int i = 0; i < dgvDiaChi.Rows.Count - 1; i++ ) {
        //            if (!dgvDiaChi.Rows[i].IsNewRow) {
        //                if (dgvDiaChi.Rows[i].Cells["clSiteNumber"].Value == DBNull.Value) {
        //                    MessageBox.Show("Bạn vẫn chưa nhập SiteNumber", Declare.titleWarning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
        //                    return false;
        //                }
        //                for (int j = i + 1; j < dgvDiaChi.Rows.Count - 1; j++) {
        //                    if (!dgvDiaChi.Rows[j].IsNewRow) {
        //                        if (Object.Equals(dgvDiaChi.Rows[j].Cells["clSiteNumber"].Value, dgvDiaChi.Rows[i].Cells["clSiteNumber"].Value)) {
        //                            MessageBox.Show("Bạn đang nhập trùng SiteNumber", Declare.titleWarning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
        //                            return false;
        //                        }
        //                    }
        //                }
        //                strSql = String.Format("select * from tbl_DM_DoiTuong_DiaChi where SiteNumber=N'{0}' and IdDoiTuong<>{1}", dgvDiaChi.Rows[i].Cells["clSiteNumber"].Value, IdDoiTuong);
        //                if(DBTools.ExecuteScalar(strSql) != null){
        //                    MessageBox.Show(String.Format("Số SiteNumber {0} đã được dùng cho khách hàng khác", dgvDiaChi.Rows[i].Cells["clSiteNumber"].Value), Declare.titleWarning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
        //                    return false;
        //                }
        //            }
        //        }
        //    }
        //    return true;
        //}

        //private int KhachHang_DefaultView_Find(int Id)
        //{
        //    if (this.listDoiTuong != null) {
        //        for (int i = 0; i <= this.listDoiTuong.Count - 1; i++) {
        //            if (Equals(this.listDoiTuong[i].IdDoiTuong, Id))
        //                return i;
        //        }
        //    }
        //    return -1;
        //}

        //private void KhachHang_SuaRong(int VitriRong, Object[] arrMangGiaTri)
        //{
        //    //this.listDoiTuong.DefaultView.AllowEdit = true;
        //    //this.listDoiTuong.DefaultView.BeginInit();
        //    //for (int i = 1; i <= this.listDoiTuong.Columns.Count - 1; i++)
        //    //{
        //    //    this.listDoiTuong.DefaultView[VitriRong][i] = arrMangGiaTri[i] == null ? System.DBNull.Value : arrMangGiaTri[i];
        //    //}
        //    //this.listDoiTuong.DefaultView.EndInit();
        //}

        //private GtidCommand KhachHang_InsertCommand(DoiTuongInfo MangThongTin)
        //{
        //    GtidCommand sqlcmd = new GtidCommand();
        //    sqlcmd.CommandText = "sp_DM_DoiTuong_Insert";
        //    sqlcmd.Parameters.AddWithValue("@IdDoiTuong", MangThongTin.IdDoiTuong).Direction = ParameterDirection.Output;
        //    sqlcmd.Parameters.AddWithValue("@IdCha", MangThongTin.IdCha);
        //    sqlcmd.Parameters.AddWithValue("@MaDoiTuong", MangThongTin.MaDoiTuong);
        //    sqlcmd.Parameters.AddWithValue("@TenDoiTuong", MangThongTin.TenDoiTuong);
        //    sqlcmd.Parameters.AddWithValue("@NguoiLienLac", MangThongTin.NguoiLienLac);
        //    sqlcmd.Parameters.AddWithValue("@DienThoai", MangThongTin.DienThoai);
        //    sqlcmd.Parameters.AddWithValue("@Fax", MangThongTin.Fax);
        //    sqlcmd.Parameters.AddWithValue("@Email", MangThongTin.Email);
        //    sqlcmd.Parameters.AddWithValue("@MaSoThue", MangThongTin.MaSoThue);
        //    sqlcmd.Parameters.AddWithValue("@Type", MangThongTin.Type);
        //    sqlcmd.Parameters.AddWithValue("@SuDung", MangThongTin.SuDung);
        //    sqlcmd.Parameters.AddWithValue("@GhiChu", MangThongTin.GhiChu);
        //    sqlcmd.Parameters.AddWithValue("@GioiTinh", MangThongTin.GioiTinh);
        //    sqlcmd.Parameters.AddWithValue("@NgaySinh", MangThongTin.NgaySinh);
        //    sqlcmd.Parameters.AddWithValue("@IdOrderType", MangThongTin.IdOrderType);
        //    sqlcmd.CommandType = CommandType.StoredProcedure;
        //    return sqlcmd;
        //}

        //private GtidCommand KhachHang_UpdateCommand(DoiTuongInfo MangThongTin)
        //{
        //    GtidCommand sqlcmd = new GtidCommand();
        //    sqlcmd.CommandText = "sp_DM_DoiTuong_Update";
        //    sqlcmd.Parameters.AddWithValue("@IdDoiTuong", MangThongTin.IdDoiTuong);
        //    sqlcmd.Parameters.AddWithValue("@IdCha", MangThongTin.IdCha);
        //    sqlcmd.Parameters.AddWithValue("@MaDoiTuong", MangThongTin.MaDoiTuong);
        //    sqlcmd.Parameters.AddWithValue("@TenDoiTuong", MangThongTin.TenDoiTuong);
        //    sqlcmd.Parameters.AddWithValue("@NguoiLienLac", MangThongTin.NguoiLienLac);
        //    sqlcmd.Parameters.AddWithValue("@DienThoai", MangThongTin.DienThoai);
        //    sqlcmd.Parameters.AddWithValue("@Fax", MangThongTin.Fax);
        //    sqlcmd.Parameters.AddWithValue("@Email", MangThongTin.Email);
        //    sqlcmd.Parameters.AddWithValue("@MaSoThue", MangThongTin.MaSoThue);
        //    sqlcmd.Parameters.AddWithValue("@Type", MangThongTin.Type);
        //    sqlcmd.Parameters.AddWithValue("@SuDung", MangThongTin.SuDung);
        //    sqlcmd.Parameters.AddWithValue("@GhiChu", MangThongTin.GhiChu);
        //    sqlcmd.Parameters.AddWithValue("@GioiTinh", MangThongTin.GioiTinh);
        //    sqlcmd.Parameters.AddWithValue("@NgaySinh", MangThongTin.NgaySinh);
        //    sqlcmd.Parameters.AddWithValue("@IdOrderType", MangThongTin.IdOrderType);
        //    sqlcmd.CommandType = CommandType.StoredProcedure;
        //    return sqlcmd;
        //}

        //private GtidCommand KhachHang_DeleteCommand(int IdKhachHang)
        //{
        //    GtidCommand sqlcmd = new GtidCommand();
        //    sqlcmd.CommandText = "sp_DM_DoiTuong_Delete";
        //    sqlcmd.Parameters.AddWithValue("@IdDoiTuong", IdKhachHang).Direction = ParameterDirection.Input;
        //    sqlcmd.CommandType = CommandType.StoredProcedure;
        //    return sqlcmd;
        //}

        //private GtidCommand KhachHang_IsCheckDeleteCommand(int IdKhachHang)
        //{
        //    GtidCommand sql = new GtidCommand("sp_DM_DoiTuong_CheckDelete");
        //    sql.Parameters.AddWithValue("@IdDoiTuong", IdKhachHang).Direction = ParameterDirection.Input;
        //    sql.Parameters.AddWithValue("@IsCheck", 0).Direction = ParameterDirection.Output;
        //    sql.CommandType = CommandType.StoredProcedure;
        //    return sql;
        //}
        #endregion
        #region LoadData
        private void LoadData()
        {
            listDoiTuong = DmDoiTuongProvider.GetListDmDoiTuongInfo();
            if (listDoiTuong.Count > 0)
            {
                dgvKhachHang.DataSource = listDoiTuong;
            }
            else
            {
                dgvKhachHang.DataSource = null;
            }
        }
Exemplo n.º 18
0
        private bool Check()
        {
            if (String.IsNullOrEmpty(txtMa.Text))
            {
                txtMa.Focus();
                throw new InvalidOperationException("Mã khách hàng không được để trống !");
            }
            if (String.IsNullOrEmpty(txtTen.Text))
            {
                txtTen.Focus();
                throw new InvalidOperationException("Tên khách hàng không được để trống !");
            }

            if (Equals(cboGioiTinh.SelectedItem, String.Empty))
            {
                cboGioiTinh.Focus();
                throw new InvalidOperationException("Giới tính không được để trống !");
            }
            if (Equals(cboType.SelectedItem, String.Empty))
            {
                cboType.Focus();
                throw new InvalidOperationException("Chưa chọn kiểu !");
            }
            if (Equals(cboOrderType.SelectedItem, String.Empty))
            {
                cboOrderType.Focus();
                throw new InvalidOperationException("Chưa chọn OrderType !");
            }
            if (Equals(cboLoaiDoiTuong.SelectedItem, String.Empty))
            {
                cboLoaiDoiTuong.Focus();
                throw new InvalidOperationException("Chưa chọn Loại đối tượng !");
            }
            if (frmKH.IsSync)
            {
                if (txtMa.Text != dm.MaDoiTuong)
                {
                    throw new InvalidOperationException("Mã khách hàng đã bị thay đổi !");
                }
                if (txtMaSoThue.Text != dm.MaSoThue)
                {
                    throw new InvalidOperationException("Mã số thuế  đã bị thay đổi !");
                }
            }

            if (DmDoiTuongProvider.KiemTra(new DMDoiTuongInfo {
                IdDoiTuong = frmKH.Oid, MaDoiTuong = txtMa.Text.Trim()
            }))
            {
                throw new InvalidOperationException("Mã khách hàng đã tồn tại trong hệ thống !");
            }
            return(true);
        }
        protected override void OnLoad()
        {
            if (idDoiTuongCha == -1)
            {
                ListInitInfo = DmDoiTuongProvider.GetListDmDoiTuongInfoEx();
            }

            else
            {
                ListInitInfo = DmDoiTuongProvider.GetListDoiTuongKLInfo(idDoiTuongCha);
            }
        }
Exemplo n.º 20
0
        //#region Test
        //public void Test(bool var)
        //{
        //    txtMaRieng.Enabled = var;
        //    txtSoCMND.Enabled = var;
        //}
        //#endregion

        #region LoadData
        private void LoadData()
        {
            if (frmKH.isAdd)
            {
                txtTen.Text          = String.Empty;
                txtOrderType.Text    = String.Empty;
                txtNguoiLienLac.Text = String.Empty;
                txtMaSoThue.Text     = String.Empty;
                txtMa.Text           = String.Empty;
                txtGhiChu.Text       = String.Empty;
                txtFax.Text          = String.Empty;
                txtEmail.Text        = String.Empty;
                txtDienThoai.Text    = String.Empty;
                dgvDiaChi.DataSource = new BindingList <DoiTuong_DiaChiInfo>(liDoiTuong)
                {
                    AllowNew = true, AllowEdit = true, AllowRemove = true
                };
                btnXoa.Enabled = false;
            }
            else
            {
                txtMa.Enabled                 = false;
                dm                            = DmDoiTuongProvider.GetDmDoiTuongInfoFromOid(frmKH.Oid);
                liDoiTuong                    = DoiTuong_DiaChiDataProvider.GetListDoiTuongDiaChiInfoFromIdDoiTuong(frmKH.Oid);
                btnXoa.Enabled                = false;
                txtTen.Text                   = dm.TenDoiTuong;
                txtNguoiLienLac.Text          = dm.NguoiLienLac;
                txtMaSoThue.Text              = dm.MaSoThue;
                txtMa.Text                    = dm.MaDoiTuong;
                txtGhiChu.Text                = dm.DiaChi;
                txtFax.Text                   = dm.Fax;
                txtEmail.Text                 = dm.Email;
                txtDienThoai.Text             = dm.DienThoai;
                txtNgaySinh.Text              = Convert.ToString(dm.NgaySinh);
                chkSuDung.Checked             = dm.SuDung == 1;
                cboGioiTinh.SelectedIndex     = dm.GioiTinh;
                cboType.SelectedIndex         = dm.Type;
                cboLoaiDoiTuong.SelectedValue = ob.IdLoaiDT;
                cboOrderType.SelectedValue    = dm.IdOrderType;
                dgvDiaChi.DataSource          = new BindingList <DoiTuong_DiaChiInfo>(liDoiTuong)
                {
                    AllowNew = true, AllowEdit = true, AllowRemove = true
                };
            }
            if (frmKH.IsSync)
            {
                //không cho phép người dùng sửa, xóa các thông tin trên form.
                txtMa.Enabled       = false;
                txtMaSoThue.Enabled = false;
                btnXoa.Enabled      = false;
            }
        }
Exemplo n.º 21
0
 private void SetFormInfo(DMDoiTuongInfo doiTuongInfo)
 {
     txtWebSite.Text      = doiTuongInfo.WebSite;
     txtTyLePhat.Text     = Convert.ToString(doiTuongInfo.TyLePhat);
     txtTinh.Text         = doiTuongInfo.Tinh;
     txtThuNhap.Text      = Convert.ToString(doiTuongInfo.ThuNhap);
     txtTenDoiTuong.Text  = doiTuongInfo.TenDoiTuong;
     txtTaiKhoan.Text     = doiTuongInfo.TaiKhoan;
     txtSoLanMuaHang.Text = Convert.ToString(doiTuongInfo.SoLanMuaHang);
     txtSoDKKD.Text       = doiTuongInfo.SoDKKD;
     txtQuocGia.Text      = doiTuongInfo.QuocGia;
     txtPhongBan.Text     = doiTuongInfo.PhongBan;
     //lupOrderType.EditValue = doiTuongInfo.IdOrderType;
     bteOrderType.Tag          = DMOrderTypeProvider.GetListDmOrderTypeInfoFromOid(doiTuongInfo.IdOrderType);
     bteOrderType.Text         = bteOrderType.Tag == null ? String.Empty : ((DMOrderTypeInfor)bteOrderType.Tag).LineType;
     txtNguoiLienLac.Text      = doiTuongInfo.NguoiLienLac;
     txtNgheNghiep.Text        = doiTuongInfo.NgheNghiep;
     deNgaySinh.EditValue      = doiTuongInfo.NgaySinh;
     deNgayCapThe.EditValue    = doiTuongInfo.NgayCapThe;
     txtNganHang.Text          = doiTuongInfo.NganHang;
     txtMaSoThue.Text          = doiTuongInfo.MaSoThue;
     txtMaRieng.Text           = doiTuongInfo.MaRieng;
     txtMaDoiTuong.Text        = doiTuongInfo.MaDoiTuong;
     lupLoaiThe.EditValue      = doiTuongInfo.IdLoaiThe;
     txtKnownFrom.Text         = doiTuongInfo.Biet_Ta_Tu;
     txtHuyen.Text             = doiTuongInfo.Huyen;
     txtHanTra.Text            = Convert.ToString(doiTuongInfo.HanTra);
     txtHanMucTinDung.Text     = Common.Double2Str(doiTuongInfo.HanMucTinDung);
     txtHMTDConLai.Text        = Common.Double2Str(doiTuongInfo.HanMucTDConLai);
     cboGioiTinh.SelectedIndex = doiTuongInfo.GioiTinh > 2 ? 0 : doiTuongInfo.GioiTinh;
     txtGiaTriMuaHang.Text     = Common.Double2Str(doiTuongInfo.GiaTriMuaHang);
     txtFax.Text                   = doiTuongInfo.Fax;
     txtEmailDT.Text               = doiTuongInfo.Email;
     txtEmailCDN.Text              = doiTuongInfo.Email_CDN;
     txtDoTuoi.Text                = Convert.ToString(doiTuongInfo.DoTuoi);
     txtDienThoaiNLL.Text          = doiTuongInfo.DienThoai_NLL;
     txtDienThoaiDT.Text           = doiTuongInfo.DienThoai;
     txtDienThoaiCDN.Text          = doiTuongInfo.DienThoai_CDN;
     txtDiaChi.Text                = doiTuongInfo.DiaChi;
     txtCMTNLL.Text                = doiTuongInfo.CMND_NLL;
     txtCMTDT.Text                 = doiTuongInfo.SoCMND;
     txtCDN.Text                   = doiTuongInfo.ChuDoanhNghiep;
     cboLoaiDoiTuong.SelectedIndex = doiTuongInfo.Type;
     //lupDoiTuongCha.EditValue = doiTuongInfo.IdCha;
     bteDoiTuongCha.Tag        = DmDoiTuongProvider.GetDmDoiTuongInfoFromOid(doiTuongInfo.IdCha);
     bteDoiTuongCha.Text       = bteDoiTuongCha.Tag == null ? String.Empty : ((DMDoiTuongInfo)bteDoiTuongCha.Tag).TenDoiTuong;
     lupNhomDoiTuong.EditValue = doiTuongInfo.IdLoaiDoiTuong;
     txtBillTo.Text            = Convert.ToString(doiTuongInfo.BillTo);
     txtShipTo.Text            = Convert.ToString(doiTuongInfo.ShipTo);
     txtCongNoKhachHang.Text   = Common.Double2Str(doiTuongInfo.CongNoKhachHang);
 }
Exemplo n.º 22
0
        private void txtSoRE_Leave(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(txtPO.Text) && !String.IsNullOrEmpty(txtSoRE.Text))
            {
                DMDoiTuongInfo pt = NhapNoiBoDataProvider.Instance.GetIdDoiTuongByPO(txtPO.Text, txtSoRE.Text);

                if (pt != null)
                {
                    DMDoiTuongInfo dmPhongBan = DmDoiTuongProvider.GetDmDoiTuongInfoFromOid(pt.IdDoiTuong);
                    bteNhaCC.Tag  = dmPhongBan;
                    bteNhaCC.Text = dmPhongBan.TenDoiTuong;
                }
            }
        }
Exemplo n.º 23
0
        private void LoadDoiTuong()
        {
            int idLoaiDT = Common.IntValue(cboLoaiDoiTuong.SelectedValue);
            List <DMDoiTuongPairInfo> liLoaiDT = DmDoiTuongProvider.GetCboDmDoiTuongByLoaiDT(idLoaiDT);

            dgvShop.Rows.Clear();
            foreach (DMDoiTuongPairInfo dt in liLoaiDT)
            {
                if (Common.Int2Bool(dt.SuDung))
                {
                    object[] arr = { 0, dt.IdDoiTuong, dt.MaDoiTuong, dt.TenDoiTuong };
                    dgvShop.Rows.Add(arr);
                }
            }
        }
Exemplo n.º 24
0
        public void TestKhachHang05_InsertSuccess()
        {
            frmDM_KhachHangLe frm = new frmDM_KhachHangLe();

            frm.Oid   = 0;
            frm.isAdd = true;
            frmChiTiet_KhachHangLe frmChiTietKhachHang = new frmChiTiet_KhachHangLe(frm);

            frmChiTietKhachHang.SetInput("Nguyễn văn dũng", "15121988", "123123", "15121988", Convert.ToDateTime("18/10/1988"), "lê việt cường", "123321", "107/1/14 Lĩnh Nam", "0436987411", "dungnv", "112233", "135308601", "Units Test Khách Hàng Lẻ", 1);
            frmChiTietKhachHang.TestSave();
            List <DMDoiTuongInfo> list = DmDoiTuongProvider.SearchRieng(new DMDoiTuongInfo()
            {
                MaRieng = "123123"
            });

            Assert.AreEqual(1, list.Count);
        }
Exemplo n.º 25
0
        public void TestKhachHang05_InsertSuccess()
        {
            frmDM_KhachHang frm = new frmDM_KhachHang();

            frm.Oid   = 0;
            frm.isAdd = true;
            frmChiTiet_KhachHang frmChiTietKhachHang = new frmChiTiet_KhachHang(frm);

            frmChiTietKhachHang.SetInput("Nguyễn bá hải", "11021986", "11021986", Convert.ToDateTime("11/12/2011"), "lê cường", "123321", "0436987411", "hainb", "112233", "Units Test Khách Hàng", 1);
            frmChiTietKhachHang.TestSave();
            List <DMDoiTuongInfo> list = DmDoiTuongProvider.Search(new DMDoiTuongInfo()
            {
                MaDoiTuong = "11021986"
            });

            Assert.AreEqual(1, list.Count);
        }
Exemplo n.º 26
0
        protected override void LoadData()
        {
            LoadDoiTuongCha();
            LoadLoaiTheKhachHang();
            LoadOderType();
            LoadNhomDoiTuong();
            LoadMaVung();
            txtDoTuoi.Text          = "0";
            txtDienThoaiDT.Text     = "0";
            txtDienThoaiNLL.Text    = "0";
            txtDienThoaiCDN.Text    = "0";
            txtFax.Text             = "0";
            txtCMTNLL.Text          = "0";
            txtCMTDT.Text           = "0";
            txtTyLePhat.Text        = "0";
            txtThuNhap.Text         = "0";
            txtSoLanMuaHang.Text    = "0";
            txtHanTra.Text          = "0";
            txtHanMucTinDung.Text   = "0";
            txtGiaTriMuaHang.Text   = "0";
            txtCongNoKhachHang.Text = "0";
            liDoiTuong = new List <DoiTuong_DiaChiInfo>();
            if (idDoiTuong == 0)
            {
                Reset();
                txtMaDoiTuong.Enabled = true;
            }
            else
            {
                dm         = DmDoiTuongProvider.GetDmDoiTuongInfoFromOid(idDoiTuong);
                liDoiTuong = DoiTuong_DiaChiDataProvider.GetListDoiTuongDiaChiInfoFromIdDoiTuong(idDoiTuong);
                if (dm != null)
                {
                    SetFormInfo(dm);
                }
            }
            grCtlSiteNum.DataSource = new BindingList <DoiTuong_DiaChiInfo>(liDoiTuong)
            {
                AllowNew = true, AllowEdit = true, AllowRemove = true
            };

            txtHanMucTinDung.Enabled   = nguoiDung.SupperUser == 1;
            txtHanTra.Enabled          = nguoiDung.SupperUser == 1;
            txtCongNoKhachHang.Enabled = nguoiDung.SupperUser == 1;
        }
Exemplo n.º 27
0
        private void LoadDoiTuong()
        {
            int idLoaiDT = Common.IntValue(cboCurrentLoaiDT.SelectedValue);

            liDoiTuong = DmDoiTuongProvider.GetDmDoiTuongByLoaiDT(idLoaiDT);

            if (liDoiTuong.Count > 0)
            {
                cboCurrentDoiTuong.DataSource    = liDoiTuong;
                cboCurrentDoiTuong.DisplayMember = "TenDoiTuong";
                cboCurrentDoiTuong.ValueMember   = "IdDoiTuong";
                //cboCurrentDoiTuong.SelectedValue = Declare.IdKHMacDinh;
            }
            else
            {
                cboCurrentDoiTuong.DataSource = null;
            }
        }
Exemplo n.º 28
0
        private void Delete()
        {
            if (MessageBox.Show("Bạn có chắc chắn xóa bản ghi này?", "Thông báo", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                //DoiTuong_DiaChiInfo dt = new DoiTuong_DiaChiInfo();
                //dt.IdDoiTuong = OidKhachHang;
                //DoiTuong_DiaChiDataProvider.Delete(new DoiTuong_DiaChiInfo{IdDoiTuong = OidKhachHang});

                //DmKhachHangInfo kh = new DmKhachHangInfo();
                //kh.IdDoiTuong = OidKhachHang;
                DmDoiTuongProvider.Delete(new DMDoiTuongInfo {
                    IdDoiTuong = OidKhachHang
                });

                MessageBox.Show("Xóa thành công !");
                LoadData();
                SetControl(false);
            }
        }
Exemplo n.º 29
0
        private void LoadKhachHang()
        {
            try
            {
                DMDoiTuongInfo dmDoiTuong = DmDoiTuongProvider.GetDmDoiTuongInfoFromOid(this.IdKHangSelected);
                if (dmDoiTuong != null)
                {
                    bteKhachHang.Text = dmDoiTuong.TenDoiTuong;
                    bteKhachHang.Tag  = dmDoiTuong;
                }
            }
            catch (System.Exception ex)
            {
#if DEBUG
                MessageBox.Show("Lỗi ngoại lệ: " + ex.ToString(), Declare.titleError, MessageBoxButtons.OK, MessageBoxIcon.Error);
#else
                MessageBox.Show("Lỗi ngoại lệ: " + ex.Message, Declare.titleError, MessageBoxButtons.OK, MessageBoxIcon.Error);
#endif
            }
        }
Exemplo n.º 30
0
        public frmDmKhachHangLeTestUnits()
        {
            frmLogin frmLogin = new frmLogin();

            frmLogin.TestLogin("quantri", "quantri");

            //chuẩn bị dữ liệu để test
            List <DMDoiTuongInfo> list = DmDoiTuongProvider.GetListDmDoiTuongInfoEx();

            if (list != null)
            {
                List <DMDoiTuongInfo> listMatch = list.FindAll(delegate(DMDoiTuongInfo match)
                {
                    return(match.MaDoiTuong == "15121988");
                });
                foreach (var dmKhoInfor in listMatch)
                {
                    DmDoiTuongProvider.Delete(dmKhoInfor);
                }
            }
        }