Esempio n. 1
0
 private bool Search(DMDoiTuongInfo dmKHInfor)
 {
     return((txtFilterMa.Text.Trim() == String.Empty || (txtFilterMa.Text.Trim() != String.Empty &&
                                                         dmKHInfor.MaDoiTuong.ToLower().Contains(txtFilterMa.Text.Trim().ToLower()))) &&
            (txtFilterTen.Text.Trim() == String.Empty || (txtFilterTen.Text.Trim() != String.Empty &&
                                                          dmKHInfor.TenDoiTuong.ToLower().Contains(txtFilterTen.Text.Trim().ToLower()))));
 }
 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;
         }
     }
 }
Esempio n. 3
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;
        }
Esempio n. 5
0
 private void Insert()
 {
     if (_dmdoituonginfo == null)
     {
         _dmdoituonginfo                 = new DMDoiTuongInfo();
         _dmdoituonginfo.MaDoiTuong      = View.MaDoiTuong;
         _dmdoituonginfo.TenDoiTuong     = View.TenDoiTuong;
         _dmdoituonginfo.MaRieng         = View.MaRieng;
         _dmdoituonginfo.IdLoaiDoiTuong  = View.IdLoaiDoiTuong;
         _dmdoituonginfo.GioiTinh        = View.GioiTinh;
         _dmdoituonginfo.DoTuoi          = View.DoTuoi;
         _dmdoituonginfo.NgaySinh        = View.NgaySinh;
         _dmdoituonginfo.SoCMND          = View.SoCMND;
         _dmdoituonginfo.DiaChi          = View.DiaChi;
         _dmdoituonginfo.DienThoai       = View.DienThoai;
         _dmdoituonginfo.Fax             = View.Fax;
         _dmdoituonginfo.Email           = View.Email;
         _dmdoituonginfo.Tinh            = View.Tinh;
         _dmdoituonginfo.Huyen           = View.Huyen;
         _dmdoituonginfo.QuocGia         = View.QuocGia;
         _dmdoituonginfo.IdCha           = View.IdCha;
         _dmdoituonginfo.NgheNghiep      = View.NgheNghiep;
         _dmdoituonginfo.PhongBan        = View.PhongBan;
         _dmdoituonginfo.ChuDoanhNghiep  = View.ChuDoanhNghiep;
         _dmdoituonginfo.DienThoai_CDN   = View.DienThoai_CDN;
         _dmdoituonginfo.Email_CDN       = View.Email_CDN;
         _dmdoituonginfo.MaSoThue        = View.MaSoThue;
         _dmdoituonginfo.SoDKKD          = View.SoDKKD;
         _dmdoituonginfo.WebSite         = View.WebSite;
         _dmdoituonginfo.NguoiLienLac    = View.NguoiLienLac;
         _dmdoituonginfo.CMND_NLL        = View.CMND_NLL;
         _dmdoituonginfo.DienThoai_NLL   = View.DienThoai_NLL;
         _dmdoituonginfo.Biet_Ta_Tu      = View.Biet_Ta_Tu;
         _dmdoituonginfo.TaiKhoan        = View.TaiKhoan;
         _dmdoituonginfo.ThuNhap         = View.ThuNhap;
         _dmdoituonginfo.NganHang        = View.NganHang;
         _dmdoituonginfo.HanMucTinDung   = View.HanMucTinDung;
         _dmdoituonginfo.HanMucTDConLai  = View.HanMucTDConLai;
         _dmdoituonginfo.CongNoKhachHang = View.CongNoKhachHang;
         _dmdoituonginfo.HanTra          = View.HanTra;
         _dmdoituonginfo.TyLePhat        = View.TyLePhat;
         _dmdoituonginfo.BillTo          = View.BillTo;
         _dmdoituonginfo.ShipTo          = View.ShipTo;
         _dmdoituonginfo.GhiChu          = View.GhiChu;
         _dmdoituonginfo.ThuNhap         = View.ThuNhap;
         _dmdoituonginfo.GiaTriMuaHang   = View.GiaTriMuaHang;
         _dmdoituonginfo.SoLanMuaHang    = View.SoLanMuaHang;
         _dmdoituonginfo.IdOrderType     = View.IdOrderType;
         _dmdoituonginfo.IdLoaiThe       = View.IdLoaiThe;
         _dmdoituonginfo.NgayCapThe      = View.NgayCapThe;
         _dmdoituonginfo.SuDung          = View.SuDung;
         _dmdoituonginfo.Type            = 1;
         _dmdoituonginfo.IdDoiTuong      = DMDoiTuongDAO.Instance.Insert(_dmdoituonginfo);
         ((List <DMDoiTuongInfo>)DSDoiTuongView.Instance.DataSource).Add(_dmdoituonginfo);
         DSDoiTuongView.Instance.RefreshDataSource();
     }
 }
Esempio n. 6
0
 private void LoadDoiTuong()
 {
     KHangSelected = DmDoiTuongProvider.GetDmDoiTuongInfoFromOid(Declare.IdKHMacDinh);
     if (KHangSelected != null)
     {
         bteKhachHang.Text = KHangSelected.TenDoiTuong;
         bteKhachHang.Tag  = KHangSelected;
     }
 }
Esempio n. 7
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;
            }
        }
Esempio n. 8
0
        private void LoadKhachHang()
        {
            DMDoiTuongInfo dmDoiTuong = DmDoiTuongProvider.GetDmDoiTuongInfoFromOid(ChungTu.IdDoiTuong);

            if (dmDoiTuong != null)
            {
                bteKhachHang.Text = dmDoiTuong.TenDoiTuong;
                bteKhachHang.Tag  = dmDoiTuong;
            }
        }
        //#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;
            }
        }
Esempio n. 10
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);
 }
Esempio n. 11
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;
                }
            }
        }
Esempio n. 12
0
        private DMDoiTuongInfo SetKhachHangInfo()
        {
            //oj.IdLoaiDT = Convert.ToInt32(cboNhomCha.SelectedValue);
            //return new DMDoiTuongInfo
            //   {
            //       IdCha = Convert.ToInt32(cboCha.SelectedValue),
            //       IdOrderType = Convert.ToInt32(cboOrderType.SelectedValue),
            //       MaDoiTuong = txtMa.Text.Trim(),
            //       TenDoiTuong = txtTen.Text.Trim(),
            //       MaSoThue = txtMaSoThue.Text.Trim(),
            //       NguoiLienLac = txtNguoiLienLac.Text.Trim(),
            //       NgaySinh = txtNgaySinh.Value,
            //       Fax = txtFax.Text.Trim(),
            //       Email = txtEmail.Text.Trim(),
            //       DienThoai = txtDienThoai.Text.Trim(),
            //       SuDung = Convert.ToInt32(chkSuDung.Checked),
            //       DiaChi = txtDiaChi.Text.Trim(),
            //       GioiTinh = (cboGioiTinh.SelectedIndex + 1)%3 - 1,
            //       Type = cboType.SelectedIndex,
            //       MaRieng = txtMaRieng.Text.Trim(),
            //       SoCMND = txtSoCMND.Text.Trim()
            //   };
            DMDoiTuongInfo dm = new DMDoiTuongInfo();

            dm.IdCha           = ((DMDoiTuongInfo)bteDoiTuongCha.Tag).IdDoiTuong;
            dm.IdLoaiDoiTuong  = Convert.ToInt32(cboNhomCha.SelectedValue);
            dm.IdOrderType     = Convert.ToInt32(cboOrderType.SelectedValue);
            dm.MaDoiTuong      = txtMa.Text.Trim();
            dm.TenDoiTuong     = txtTen.Text.Trim();
            dm.MaSoThue        = txtMaSoThue.Text.Trim();
            dm.NguoiLienLac    = txtNguoiLienLac.Text.Trim();
            dm.NgaySinh        = txtNgaySinh.Value;
            dm.Fax             = txtFax.Text.Trim();
            dm.Email           = txtEmail.Text.Trim();
            dm.DienThoai       = txtDienThoai.Text.Trim();
            dm.SuDung          = Convert.ToInt32(chkSuDung.Checked);
            dm.DiaChi          = txtDiaChi.Text.Trim();
            dm.GioiTinh        = cboGioiTinh.SelectedIndex; // (cboGioiTinh.SelectedIndex + 1) % 3 - 1;
            dm.Type            = 1;                         //cboType.SelectedIndex;
            dm.MaRieng         = txtMaRieng.Text.Trim();
            dm.SoCMND          = txtSoCMND.Text.Trim();
            dm.BillTo          = ((DMDoiTuongInfo)bteDoiTuongCha.Tag).BillTo;
            dm.ShipTo          = ((DMDoiTuongInfo)bteDoiTuongCha.Tag).ShipTo;
            dm.HanMucTinDung   = Common.DoubleValue(txtHanMucTinDung.Text);
            dm.HanMucTDConLai  = Common.DoubleValue(txtHanMucTDConLai.Text);
            dm.CongNoKhachHang = Common.DoubleValue(txtCongNoKhachHang.Text);
            dm.GiaTriMuaHang   = Common.DoubleValue(txtGiaTriDaMua.Text);
            return(dm);
        }
Esempio n. 13
0
        public int Insert(DMDoiTuongInfo dmDoiTuongInfor)
        {
            var objStackTrace = new StackTrace(true);

            MethodBase methodExecuting = objStackTrace.GetFrame(1).GetMethod();

            if (methodExecuting.ReflectedType.Module.Name != GetType().Module.Name)
            {
                if (String.IsNullOrEmpty(dmDoiTuongInfor.MaRieng))
                {
                    throw new ManagedException("Đối tượng này phải có mã riêng.");
                }
            }

            return(GetObjectCommand <int>(Declare.StoreProcedureNamespace.spDoiTuongInsert, ParseToParams(dmDoiTuongInfor)));
        }
Esempio n. 14
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;
        }
        private DMDoiTuongInfo SetKhachHangInfo()
        {
            DMDoiTuongInfo dm = new DMDoiTuongInfo();

            ob.IdLoaiDT     = Convert.ToInt32(cboLoaiDoiTuong.SelectedValue);
            dm.IdOrderType  = Convert.ToInt32(cboOrderType.SelectedValue);
            dm.MaDoiTuong   = txtMa.Text.Trim();
            dm.TenDoiTuong  = txtTen.Text.Trim();
            dm.MaSoThue     = txtMaSoThue.Text.Trim();
            dm.NguoiLienLac = txtNguoiLienLac.Text.Trim();
            dm.NgaySinh     = txtNgaySinh.Value;
            dm.Fax          = txtFax.Text.Trim();
            dm.Email        = txtEmail.Text.Trim();
            dm.DienThoai    = txtDienThoai.Text.Trim();
            dm.SuDung       = Convert.ToInt32(chkSuDung.Checked);
            dm.GioiTinh     = (cboGioiTinh.SelectedIndex + 1) % 3 - 1;
            dm.Type         = cboType.SelectedIndex;
            return(dm);
        }
Esempio n. 16
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
            }
        }
Esempio n. 17
0
        public void TestKhachHang07_DeleteSuccess()
        {
            TestKhachHang05_InsertSuccess();
            List <DMDoiTuongInfo> list  = DmDoiTuongProvider.GetListDmDoiTuongInfoEx();
            DMDoiTuongInfo        infor = list.Find(delegate(DMDoiTuongInfo match)
            {
                return(match.MaDoiTuong == "15121988");
            });

            frmDM_KhachHangLe frm = new frmDM_KhachHangLe();

            frm.isAdd = false;
            frm.Oid   = infor.IdDoiTuong;
            frmChiTiet_KhachHangLe frmChiTietKhachHang = new frmChiTiet_KhachHangLe(frm);

            frmChiTietKhachHang.TestDelete();
            list  = DmDoiTuongProvider.GetListDmDoiTuongInfoEx();
            infor = list.Find(delegate(DMDoiTuongInfo match)
            {
                return(match.MaDoiTuong == "15121988");
            });
            Assert.AreEqual(infor, null);
        }
Esempio n. 18
0
        public void TestKhachHang03_MaKhachHangHasExistedOnUpdate()
        {
            try
            {
                TestKhachHang05_InsertSuccess();
                List <DMDoiTuongInfo> list  = DmDoiTuongProvider.GetListDmDoiTuongInfoEx();
                DMDoiTuongInfo        infor = list.Find(delegate(DMDoiTuongInfo match)
                {
                    return(match.MaDoiTuong == "15121988");
                });

                frmDM_KhachHangLe frm = new frmDM_KhachHangLe();
                frm.isAdd = false;
                frm.Oid   = infor.IdDoiTuong;
                frmChiTiet_KhachHangLe frmChiTietKhachHang = new frmChiTiet_KhachHangLe(frm);
                frmChiTietKhachHang.SetInput("Nguyễn văn dũng", "22222222", "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 = DmDoiTuongProvider.GetListDmDoiTuongInfoEx();
                List <DMDoiTuongInfo> listDuplicate = list.FindAll(delegate(DMDoiTuongInfo match)
                {
                    return(match.MaDoiTuong == "22222222");
                });
                frmChiTietKhachHang.TestDelete();
                Assert.AreEqual(1, listDuplicate.Count);
            }
            catch (Exception ex)
            {
                if (ex.GetType() != typeof(AssertFailedException))
                {
                    Assert.AreEqual(ex.Message, "Mã khách hàng đã tồn tại trong hệ thống !");
                }
                else
                {
                    throw;
                }
            }
        }
        private void LoadChungTuHeader()
        {
            Draft       = Business.ChungTu.Draft;
            TrangThai   = Business.ChungTu.TrangThai;
            LoaiChungTu = Business.ChungTu.LoaiChungTu;
            _IdTrungTam = Business.ChungTu.IdTrungTam;

            bteKhoXuat.Tag      = DMKhoDataProvider.GetKhoByIdInfo(Business.ChungTu.IdKho);
            bteKhoXuat.Text     = bteKhoXuat.Tag != null ? ((DMKhoInfo)bteKhoXuat.Tag).TenKho : "";
            txtSoPhieuNhap.Text = Business.ChungTu.SoChungTu;
            txtGhiChu.Text      = Business.ChungTu.GhiChu;
            try
            {
                dteNgayNhap.EditValue = Business.ChungTu.NgayLap;
            }
            catch (Exception)
            {
                dteNgayNhap.EditValue = CommonProvider.Instance.GetSysDate();
            }

            try
            {
                dteNgayXacNhan.EditValue = Business.ChungTu.NgayXuatHang;
            }
            catch (Exception)
            {
                dteNgayXacNhan.EditValue = CommonProvider.Instance.GetSysDate();
            }

            lueLyDo.EditValue = Business.ChungTu.IdLyDoGiaoDich;

            grbChungTuMua.Text = "Thông tin phiếu mua hàng: " +
                                 (String.IsNullOrEmpty(Business.ChungTu.TenTrungTam)
                          ? ""
                          : (Business.ChungTu.TenTrungTam + (String.IsNullOrEmpty(Business.ChungTu.TenKho) ? "" : "(" + Business.ChungTu.TenKho + ")")));
            txtSoGiaoDich.Text  = Business.ChungTu.SoChungTuGoc;
            txtSoPhieuXuat.Text = Business.ChungTu.SoPhieuXuat;
            try
            {
                dteNgayLap.EditValue = Business.ChungTu.NgayHenGiaoHang;
            }
            catch (Exception)
            {
                dteNgayLap.EditValue = CommonProvider.Instance.GetSysDate();
            }
            try
            {
                dteNgayXuat.EditValue = Business.ChungTu.NgayGiaoHang;
            }
            catch (Exception)
            {
                dteNgayXuat.EditValue = CommonProvider.Instance.GetSysDate();
            }
            //cboCaBanHang.SelectedIndex = Business.ChungTu.CaBanHang;
            txtKiHieu.Text            = Business.ChungTu.KyHieu;
            txtSoHoaDon.Text          = Business.ChungTu.SoSeri;
            txtTenDoiTuong.Text       = Business.ChungTu.HoTen;
            txtCongTy.Text            = Business.ChungTu.CongTy;
            cboGioiTinh.SelectedIndex = Business.ChungTu.GioiTinh;
            txtCMND.Text        = Business.ChungTu.SoCMND;
            txtSoDienThoai.Text = Business.ChungTu.DienThoai;
            txtEmail.Text       = Business.ChungTu.Email;
            txtDiaChiHD.Text    = Business.ChungTu.DiaChiHoaDon;
            txtDiaChiGH.Text    = Business.ChungTu.DiaChiGiaoHang;

            if (Business.ChungTu.IdNhanVien != 0)
            {
                DMNhanVienInfo nhanvien = DmNhanVienDataProvider.GetListDmNhanVienInfoFromOid(Business.ChungTu.IdNhanVien);
                if (nhanvien != null)
                {
                    bteThuongVien.Tag  = nhanvien;
                    bteThuongVien.Text = nhanvien.HoTen;
                }
            }

            if (Business.ChungTu.IdDoiTuong != 0)
            {
                DMDoiTuongInfo doituong = DmDoiTuongProvider.GetDmDoiTuongInfoFromOid(Business.ChungTu.IdDoiTuong);
                if (doituong != null)
                {
                    txtKhachHang.Tag  = doituong;
                    txtKhachHang.Text = doituong.TenDoiTuong;
                }
            }

            if (Business.ChungTu.IdKhachLe != 0)
            {
                DMDoiTuongInfo khachle = DmDoiTuongProvider.GetDmDoiTuongInfoFromOid(Business.ChungTu.IdKhachLe);
                if (khachle != null)
                {
                    bteKhachLe.Tag  = khachle;
                    bteKhachLe.Text = khachle.TenDoiTuong;
                }
            }
            txtTongTienTT.Text  = Common.Double2Str(Business.ChungTu.TongTienHang);
            txtTienThucTra.Text = Common.Double2Str(Business.ChungTu.TongTienThanhToan);
            txtTienConNo.Text   = Common.Double2Str(Business.ChungTu.TongTienHang - Business.ChungTu.TongTienThanhToan);

            txtTienTraKhach.Text = Common.Double2Str(Business.ChungTu.TienThanhToanThuc);
            txtTienNoKhach.Text  = Common.Double2Str(Business.ChungTu.TienConNo);
        }
Esempio n. 20
0
 internal List <DMDoiTuongInfo> SearchRieng(DMDoiTuongInfo dmDoiTuongInfor)
 {
     return(GetListCommand <DMDoiTuongInfo>(Declare.StoreProcedureNamespace.spDoiTuongSearchRieng, dmDoiTuongInfor.MaRieng, dmDoiTuongInfor.SoCMND));
 }
Esempio n. 21
0
 internal List <DMDoiTuongInfo> Search(DMDoiTuongInfo dmDoiTuongInfor)
 {
     return(GetListCommand <DMDoiTuongInfo>(Declare.StoreProcedureNamespace.spDoiTuongSearch, dmDoiTuongInfor.MaDoiTuong,
                                            dmDoiTuongInfor.TenDoiTuong));
 }
Esempio n. 22
0
        private void LoadData()
        {
            if ((frmKHL != null && frmKHL.isAdd) || frmKHL == null)
            {
                btnXoa.Enabled       = false;
                txtTen.Text          = String.Empty;
                txtOrderType.Text    = String.Empty;
                txtNguoiLienLac.Text = String.Empty;
                txtMaSoThue.Text     = String.Empty;
                txtMa.Text           = String.Empty;
                txtDiaChi.Text       = String.Empty;
                txtFax.Text          = String.Empty;
                txtEmail.Text        = String.Empty;
                txtDienThoai.Text    = String.Empty;
                txtMaRieng.Text      = String.Empty;
                txtSoCMND.Text       = String.Empty;
                dgvDiaChi.DataSource = new BindingList <DoiTuong_DiaChiInfo>(liDoiTuong)
                {
                    AllowNew = true, AllowEdit = true, AllowRemove = true
                };
                txtMa.Enabled           = true;
                txtHanMucTinDung.Text   = String.Empty;
                txtHanMucTDConLai.Text  = String.Empty;
                txtCongNoKhachHang.Text = String.Empty;
                txtGiaTriDaMua.Text     = String.Empty;
            }
            else
            {
                btnXoa.Enabled            = false;
                txtMa.Enabled             = false;
                dm                        = DmDoiTuongProvider.GetDmDoiTuongInfoFromOid(frmKHL.Oid);
                liDoiTuong                = DoiTuong_DiaChiDataProvider.GetListDoiTuongDiaChiInfoFromIdDoiTuong(frmKHL.Oid);
                txtTen.Text               = dm.TenDoiTuong;
                txtNguoiLienLac.Text      = dm.NguoiLienLac;
                txtMaSoThue.Text          = dm.MaSoThue;
                txtMa.Text                = dm.MaDoiTuong;
                txtDiaChi.Text            = dm.DiaChi;
                txtFax.Text               = dm.Fax;
                txtEmail.Text             = dm.Email;
                txtDienThoai.Text         = dm.DienThoai;
                txtMaRieng.Text           = dm.MaRieng;
                txtSoCMND.Text            = dm.SoCMND;
                txtNgaySinh.Text          = Convert.ToString(dm.NgaySinh);
                chkSuDung.Checked         = dm.SuDung == 1;
                cboGioiTinh.SelectedIndex = dm.GioiTinh > 2 ? 0 : dm.GioiTinh;
                cboNhomCha.SelectedValue  = dm.IdLoaiDoiTuong;
                //cboType.SelectedIndex = dm.Type;
                txtHanMucTinDung.Text   = Common.Double2Str(dm.HanMucTinDung);
                txtHanMucTDConLai.Text  = Common.Double2Str(dm.HanMucTDConLai);
                txtCongNoKhachHang.Text = Common.Double2Str(dm.CongNoKhachHang);
                txtGiaTriDaMua.Text     = Common.Double2Str(dm.GiaTriMuaHang);

                DMDoiTuongInfo dmDoiTuongInfo = DmDoiTuongProvider.GetDmDoiTuongInfoFromOid(dm.IdCha);
                bteDoiTuongCha.Tag         = dmDoiTuongInfo;
                bteDoiTuongCha.Text        = dmDoiTuongInfo.TenDoiTuong;
                cboOrderType.SelectedValue = dm.IdOrderType;
                dgvDiaChi.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;
        }
Esempio n. 23
0
 internal bool Exist(DMDoiTuongInfo dmDoiTuongInfor)
 {
     return(GetObjectCommand <int>(Declare.StoreProcedureNamespace.spDoiTuongExist,
                                   dmDoiTuongInfor.IdDoiTuong,
                                   dmDoiTuongInfor.MaDoiTuong) > 0);
 }
Esempio n. 24
0
 internal void Delete(DMDoiTuongInfo dmDoiTuongInfor)
 {
     ExecuteCommand(Declare.StoreProcedureNamespace.spDoiTuongDelete, dmDoiTuongInfor.IdDoiTuong);
 }
Esempio n. 25
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (ValidData())
            {
                if (bteTrungTam.Tag != null)
                {
                    TTamSelected = (DMTrungTamInfor)bteTrungTam.Tag;
                }
                if (bteKhoXuat.Tag != null)
                {
                    KhoSelected = (DMKhoInfo)bteKhoXuat.Tag;
                }
                if (cboCurrentLoaiDT.SelectedIndex != -1)
                {
                    LoaiDTSelected = liLoaiDT[cboCurrentLoaiDT.SelectedIndex];
                }
                if (bteKhachHang.Tag != null)
                {
                    KHangSelected = (DMDoiTuongInfo)bteKhachHang.Tag;
                }
                if (bteTruongCa.Tag != null)
                {
                    TruongCaSelected = (DMNhanVienInfo)bteTruongCa.Tag;
                }
                if (bteThuNgan.Tag != null)
                {
                    ThuNganSelected = (DMNhanVienInfo)bteThuNgan.Tag;
                }
                if (bteThoiHanThanhToan.Tag != null)
                {
                    ThoiHanTTSelected = (DMLoaiThuChiInfor)bteThoiHanThanhToan.Tag;
                }

                if (TypeReset == 1 || TypeReset == 2)
                {
                    if (TTamSelected != null)
                    {
                        Declare.IdTrungTam  = TTamSelected.IdTrungTam;
                        Declare.TenTrungTam = TTamSelected.TenTrungTam;
                    }
                    if (KhoSelected != null)
                    {
                        Declare.IdKho  = KhoSelected.IdKho;
                        Declare.TenKho = KhoSelected.TenKho;
                    }
                    if (LoaiDTSelected != null)
                    {
                        Declare.IdLoaiKhachHang = LoaiDTSelected.IdLoaiDT;
                    }
                    if (KHangSelected != null)
                    {
                        Declare.IdKHMacDinh  = KHangSelected.IdDoiTuong;
                        Declare.TenKhachHang = KHangSelected.TenDoiTuong;
                    }
                    Declare.IdThuNgan          = ThuNganSelected != null ? ThuNganSelected.IdNhanVien : 0;
                    Declare.IdTruongCa         = TruongCaSelected != null ? TruongCaSelected.IdNhanVien : 0;
                    Declare.IdThoiHanThanhToan = ThoiHanTTSelected != null ? ThoiHanTTSelected.IdThuChi : 0;
                    Declare.NgayLamViec        = dtNgayLamViec.Value;

                    DateTime now = CommonProvider.Instance.GetSysDate();
                    if (KhoSelected.NgayDuDau.CompareTo(now) > 0)
                    {
                        Declare.NgayDuDau = KhoSelected.NgayDuDau;
                    }
                    else
                    {
                        Declare.NgayDuDau = now;
                    }
                }
                if (TypeReset == 2)
                {
                    string formMacDinh = "";
                    if (choseForm && lueFormMacDinh.EditValue != null)
                    {
                        formMacDinh = lueFormMacDinh.EditValue.ToString();
                    }

                    NguoiDungDataProvider.SetKhoMacDinh(Declare.IdTrungTam, Declare.IdKho, Declare.IdLoaiKhachHang,
                                                        Declare.IdKHMacDinh, Declare.IdTruongCa,
                                                        Declare.IdThuNgan, Declare.IdThoiHanThanhToan,
                                                        nguoiDung.IdNguoiDung, formMacDinh);
                }
                if (this.frmParent != null)
                {
                    foreach (Form frm in frmParent.MdiChildren)
                    {
                        frm.Close();
                    }
                }
                this.DialogResult = DialogResult.OK;
            }
        }
Esempio n. 26
0
 private void GetData()
 {
     _dmdoituonginfo = View.dmDoiTuongInfo;
 }
 private bool Exist(DMDoiTuongInfo dmOrderTypeInfor)
 {
     return(dmOrderTypeInfor.IdDoiTuong == frmKH.Oid);
 }
Esempio n. 28
0
 internal bool ExistLe(DMDoiTuongInfo dmDoiTuongInfo)
 {
     return(GetObjectCommand <int>(Declare.StoreProcedureNamespace.spDoiTuongLeExist,
                                   dmDoiTuongInfo.IdDoiTuong,
                                   dmDoiTuongInfo.MaRieng) > 0);
 }
Esempio n. 29
0
 internal void Update(DMDoiTuongInfo dmDoiTuongInfor)
 {
     ExecuteCommand(Declare.StoreProcedureNamespace.spDoiTuongUpdate, ParseToParams(dmDoiTuongInfor));
 }
 public static List <DMDoiTuongInfo> SearchRieng(DMDoiTuongInfo match)
 {
     return(DMDoiTuongDAO.Instance.SearchRieng(match));
 }