private void btSave_Click(object sender, RoutedEventArgs e) { using (var db = new QLTV_DBContext()) { if (CheckNull() == true) { return; } else { var dg = new DOCGIA(txtMaDocGia.Text, txtTenDocGia.Text, DateTime.Parse(dpNgaySinh.Text), cbLoaiDG.SelectedValue.ToString(), txtDiaChi.Text, txtPhone.Text, txtEmail.Text, DateTime.Parse(dpNgayLapPhieu.Text), DateTime.Parse(dpNgayHetHan.Text)); db.DOCGIAs.Add(dg); db.SaveChanges(); DocGiaList.ItemsSource = db.DOCGIAs.ToList(); DocGiaList.Items.Refresh(); } } }
private void btCapNhatTG_Click(object sender, RoutedEventArgs e) { using (var db = new QLTV_DBContext()) { var t = db.TACGIAs.Find(txtMaTG.Text); t.TacGia_Id = txtMaTG.Text; t.TenTacGia = txtTenTG.Text; t.GhiChu = txtGhiChu.Text; db.SaveChanges(); TacGiaList.ItemsSource = db.TACGIAs.ToList(); TacGiaList.Items.Refresh(); } }
private void btCapNhatNXB_Click(object sender, RoutedEventArgs e) { using (var db = new QLTV_DBContext()) { var t = db.NHAXUATBANs.Find(txtMaNXB.Text); t.NXB_Id = txtMaNXB.Text; t.TenNXB = txtTenNXB.Text; t.GhiChu = txtGhiChu.Text; db.SaveChanges(); NXBList.ItemsSource = db.NHAXUATBANs.ToList(); NXBList.Items.Refresh(); } }
private void btThem_Click(object sender, RoutedEventArgs e) { if (CheckNull() == true) { return; } else { using (var db = new QLTV_DBContext()) { var qd = new THAMSO(txtNoiDungQD_ID.Text, int.Parse(txtGiaTri.Text), txtGhichu.Text); db.THAMSOs.Add(qd); db.SaveChanges(); QuyDinhList.ItemsSource = db.THAMSOs.ToList(); QuyDinhList.Items.Refresh(); } } }
private void btThemTG_Click(object sender, RoutedEventArgs e) { if (CheckNull() == true) { return; } else { using (var db = new QLTV_DBContext()) { var tg = new TACGIA(txtMaTG.Text, txtTenTG.Text, txtGhiChu.Text); db.TACGIAs.Add(tg); db.SaveChanges(); TacGiaList.ItemsSource = db.TACGIAs.ToList(); TacGiaList.Items.Refresh(); } } }
private void btThemNXB_Click(object sender, RoutedEventArgs e) { if (CheckNull() == true) { return; } else { using (var db = new QLTV_DBContext()) { var nxb = new NXB(txtMaNXB.Text, txtTenNXB.Text, txtGhiChu.Text); db.NHAXUATBANs.Add(nxb); db.SaveChanges(); NXBList.ItemsSource = db.NHAXUATBANs.ToList(); NXBList.Items.Refresh(); } } }
private void btXoaTG_Click(object sender, RoutedEventArgs e) { if (MessageBox.Show("Bạn muốn xóa tác giả này?", "Delete", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { using (var db = new QLTV_DBContext()) { var tg = db.TACGIAs.Find(txtMaTG.Text); if (tg != null) { db.TACGIAs.Remove(tg); db.SaveChanges(); TacGiaList.ItemsSource = db.TACGIAs.ToList(); TacGiaList.Items.Refresh(); } } } else { MessageBox.Show("Bạn chưa chọn sản phẩm", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Information); } }
private void btXoaNXB_Click(object sender, RoutedEventArgs e) { if (MessageBox.Show("Bạn muốn xóa thông tin này?", "Delete", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { using (var db = new QLTV_DBContext()) { var nxb = db.NHAXUATBANs.Find(txtMaNXB.Text); if (nxb != null) { db.NHAXUATBANs.Remove(nxb); db.SaveChanges(); NXBList.ItemsSource = db.NHAXUATBANs.ToList(); NXBList.Items.Refresh(); } } } else { MessageBox.Show("Bạn chưa chọn thông tin NXB nào!", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Information); } }