private void SaveQuyenLoi(int OidLoaiThe) { DmLoaiTheQuyenLoiInfo dm = new DmLoaiTheQuyenLoiInfo(); dm.IdLoaiThe = OidLoaiThe; DmLoaitheQuyenLoiProvider.Delete(dm); for (int i = 0; i < dmtheQL.Count; i++) { dm.IdSanPham = dmtheQL[i].IdSanPham; dm.TyLeGiam = dmtheQL[i].TyLeGiam; dm.GhiChu = dmtheQL[i].GhiChu; DmLoaitheQuyenLoiProvider.Insert(dm); } }
private void LoadData() { if (frmThe.isAdd) { txtBaoLuuDiem.Text = ""; txtTinhNangKhac.Text = ""; txtTichLuyTu.Text = ""; txtTichLuyDen.Text = ""; txtTenThe.Text = ""; txtMaThe.Text = ""; txtHieuLuc.Text = ""; txtGiaTriMuaLanDau.Text = ""; txtMaThe.Focus(); btnXoa.Enabled = false; } else { dm = DmLoaitheKhachHangProvider.GetListDmLoaiTheInfoFromIdLoaiThe(frmThe.Oid); dmtheQL = DmLoaitheQuyenLoiProvider.GetListLoaiTheQuyenLoiInfoFromOid(frmThe.Oid); dmTheUD = DmLoaitheUuDaiProvider.GetListDmLoaiTheUuDaiInfoFromOid(frmThe.Oid); txtMaThe.Text = dm.MaThe; txtTenThe.Text = dm.TenThe; txtTinhNangKhac.Text = dm.GhiChu; txtTichLuyTu.Text = dm.DK_GT_TichLuy_Tu.ToString(); txtTichLuyDen.Text = dm.DK_GT_TichLuy_Den.ToString(); txtHieuLuc.Text = dm.ThoiGianHieuLuc.ToString(); txtGiaTriMuaLanDau.Text = dm.DK_GT_LanDau.ToString(); txtBaoLuuDiem.Text = dm.BaoLuuDiem.ToString(); cboDoUuTien.SelectedItem = dm.DoUuTien; if (dm.DK_SP_KemTheo != null) { string[] sp = dm.DK_SP_KemTheo.Split(','); for (int i = 0; i < sp.Length; i++) { for (int j = 0; j < liSP.Count; j++) { if (sp[i].ToString().ToUpper() == liSP[j].TenSanPham.ToUpper()) { chkLstSanPham.SetItemChecked(j, true); } } } } chkBaoHanhVang.Checked = dm.IsBHVang == 1; chkThamGiaDaoTao.Checked = dm.IsJointCourse == 1; chkSuDung.Checked = dm.SuDung == 1; chkDuocTuVanHoTro.Checked = dm.IsSupport == 1; chkTangQuaSinhNhat.Checked = dm.IsTangQuaSN == 1; chkThamGiaDaoTao.Checked = dm.IsJointCourse == 1; chkBaoHanhVang.Checked = dm.IsBHVang == 1; chkCapNhatThongTinSanPhamMoi.Checked = dm.IsUpdateSPNew == 1; dgvQuyenLoi.DataSource = new BindingList <DmLoaiTheQuyenLoiInfo>(dmtheQL) { AllowNew = true, AllowEdit = true, AllowRemove = true }; dgvUuDai.DataSource = new BindingList <DmLoaiTheUuDaiInfo>(dmTheUD) { AllowNew = true, AllowEdit = true, AllowRemove = true }; } if (frmThe.IsSync) { //không cho phép người dùng sửa, xóa các thông tin trên form. txtMaThe.Enabled = false; txtTenThe.Enabled = false; btnXoa.Enabled = false; } }