示例#1
0
 private void Loaddata()
 {
     if (frmDMLoaiDT.isAdd)
     {
         Reset();
         btnDelete.Enabled = false;
     }
     else
     {
         txtMaLoaiDT.Enabled = false;
         dm = DmLoaiDoiTuongDataProvider.GetListDmLoaiDTInfoFromOid(frmDMLoaiDT.Oid);
         txtTenLoaiDT.Text = dm.TenLoaiDT;
         txtMaLoaiDT.Text  = dm.MaLoaiDT;
         txtGhiChu.Text    = dm.GhiChu;
         txtNhomCha.Text   = Convert.ToString(dm.NhomCha);
         chkSuDung.Checked = dm.SuDung == 1;
     }
     if (frmDMLoaiDT.IsSync)
     {
         //không cho phép người dùng sửa, xóa các thông tin trên form.
         txtMaLoaiDT.Enabled  = false;
         txtTenLoaiDT.Enabled = false;
         btnDelete.Enabled    = false;
     }
 }
示例#2
0
 private void btTimKiem_Click(object sender, EventArgs e)
 {
     grcBase.DataSource = DmLoaiDoiTuongDataProvider.Search(new DmLoaiDoiTuongInfor()
     {
         TenLoaiDT = txtTenLoaiDoiTuongSearch.Text.Trim()
     });
 }
示例#3
0
 private void Delete()
 {
     DmLoaiDoiTuongDataProvider.Delete(new DmLoaiDoiTuongInfor {
         IdLoaiDT = Oid
     });
     LoadData();
     SetControl(false);
 }
        //public frmChiTiet_KhachHang(frmDM_KhachHangLe frm)
        //{
        //    InitializeComponent();
        //    this.frmKHL = frm;
        //}
        #endregion

        #region Action

        #region LoadLoaiDoiTuong
        private void LoadLoaiDoiTuong()
        {
            liKhachHang = DmLoaiDoiTuongDataProvider.GetListLoaiDoiTuongInfor();
            if (liKhachHang.Count > 0)
            {
                cboLoaiDoiTuong.DataSource    = liKhachHang;
                cboLoaiDoiTuong.DisplayMember = "TenLoaiDT";
                cboLoaiDoiTuong.ValueMember   = "IdLoaiDT";
            }
            else
            {
                cboLoaiDoiTuong.DataSource = null;
            }
        }
示例#5
0
 private void SaveDoiTuong()
 {
     if (Check())
     {
         if (frmDMLoaiDT.isAdd)
         {
             DmLoaiDoiTuongDataProvider.Insert(SetDanhMuc());
         }
         else
         {
             DmLoaiDoiTuongDataProvider.Update(SetDanhMuc());
         }
     }
 }
示例#6
0
 private void Delete()
 {
     if (frmDMLoaiDT.isAdd)
     {
         throw new InvalidOperationException("Bạn không thể xóa khi đang thêm mới!");
     }
     if (frmDMLoaiDT.IsSync)
     {
         throw new InvalidOperationException("Bạn không thể xóa dữ liệu được đồng bộ!");
     }
     DmLoaiDoiTuongDataProvider.Delete(new DmLoaiDoiTuongInfor()
     {
         IdLoaiDT = frmDMLoaiDT.Oid
     });
 }
示例#7
0
        private void LoadLoaiDT()
        {
            liLoaiDT = DmLoaiDoiTuongDataProvider.GetListLoaiDoiTuongInfor();

            if (liLoaiDT.Count > 0)
            {
                cboCurrentLoaiDT.DataSource    = liLoaiDT;
                cboCurrentLoaiDT.DisplayMember = "TenLoaiDT";
                cboCurrentLoaiDT.ValueMember   = "IdLoaiDT";
                cboCurrentLoaiDT.SelectedValue = Declare.IdLoaiKhachHang;
            }
            else
            {
                cboCurrentLoaiDT.DataSource = null;
            }
        }
        private void LoadNhomDoiTuong()
        {
            List <DmLoaiDoiTuongInfor> liLoaiDT = DmLoaiDoiTuongDataProvider.GetListLoaiDoiTuongInfor();

            liLoaiDT.Insert(0, new DmLoaiDoiTuongInfor()
            {
                IdLoaiDT  = 0,
                MaLoaiDT  = "",
                TenLoaiDT = "Tất cả",
                SuDung    = 1
            });
            cboLoaiDoiTuong.DataSource    = liLoaiDT;
            cboLoaiDoiTuong.DisplayMember = "TenLoaiDT";
            cboLoaiDoiTuong.ValueMember   = "IdLoaiDT";
            cboLoaiDoiTuong.SelectedIndex = 0;
        }
示例#9
0
 private void LoadLoaiDoiTuong()
 {
     liLoaiDT = DmLoaiDoiTuongDataProvider.GetListLoaiDoiTuongInfor();
     if (liLoaiDT.Count >= 0)
     {
         liLoaiDT.Insert(0, new DmLoaiDoiTuongInfor()
         {
             IdLoaiDT  = 0,
             MaLoaiDT  = "",
             TenLoaiDT = "Tất cả"
         });
         cboLoaiDoiTuong.DataSource    = liLoaiDT;
         cboLoaiDoiTuong.DisplayMember = "TenLoaiDT";
         cboLoaiDoiTuong.ValueMember   = "IdLoaiDT";
         cboLoaiDoiTuong.SelectedValue = 0;// Declare.IdLoaiKhachHang;
     }
     else
     {
         cboLoaiDoiTuong.DataSource = null;
     }
 }
示例#10
0
 private bool Check()
 {
     if (String.IsNullOrEmpty(txtMaLoaiDT.Text))
     {
         txtMaLoaiDT.Focus();
         throw new InvalidOperationException("Mã loại đối tượng không được để trống !");
     }
     if (String.IsNullOrEmpty(txtTenLoaiDT.Text))
     {
         txtTenLoaiDT.Focus();
         throw new InvalidOperationException("Tên loại đối tượng không được để trống !");
     }
     if (String.IsNullOrEmpty(txtNhomCha.Text))
     {
         txtNhomCha.Focus();
         throw new InvalidOperationException("Bạn chưa nhập nhóm cha!");
     }
     if (frmDMLoaiDT.IsSync)
     {
         if (txtMaLoaiDT.Text != dm.MaLoaiDT)
         {
             throw new InvalidOperationException("Mã loại đối tượng đã bị thay đổi !");
         }
         //if (txtTenLoaiDT.Text != dm.TenLoaiDT)
         //{
         //    throw new InvalidOperationException("Tên loại đối tượng đã bị thay đổi !");
         //}
     }
     if (DmLoaiDoiTuongDataProvider.KiemTra(new DmLoaiDoiTuongInfor()
     {
         IdLoaiDT = frmDMLoaiDT.Oid, MaLoaiDT = txtMaLoaiDT.Text.Trim()
     }))
     {
         throw new InvalidOperationException("Mã loại đối tượng đã tồn tại trong hệ thống!");
     }
     return(true);
 }
示例#11
0
 private void LoadNhomDoiTuong()
 {
     lupNhomDoiTuong.Properties.DataSource    = DmLoaiDoiTuongDataProvider.GetListLoaiDoiTuongInfor();
     lupNhomDoiTuong.Properties.DisplayMember = "TenLoaiDT";
     lupNhomDoiTuong.Properties.ValueMember   = "IdLoaiDT";
 }
示例#12
0
 protected override void LoadData()
 {
     grcBase.DataSource = DmLoaiDoiTuongDataProvider.GetListLoaiDoiTuongInfor();
     btnTimKiem.Text    = Resources.btnSearch;
 }