public void CreateItem(PhieuThuHP phieuThuHP) { try { if (connection.State != ConnectionState.Open) { connection.Open(); } OleDbCommand command = new OleDbCommand( "INSERT INTO PHIEU_THUHP (SoPhieuThuHP, PhieuDKHP, NgayLap, SoTienThu) " + "VALUES (@sophieu, @phieudkhp, @ngaylap, @sotien)", connection); command.Parameters.Add("@sophieu", OleDbType.Numeric).Value = phieuThuHP.SoPhieuThuHP; command.Parameters.Add("@phieudkhp", OleDbType.Numeric).Value = phieuThuHP.PhieuDKHP; command.Parameters.Add("@ngaylap", OleDbType.Date).Value = phieuThuHP.NgayLap; command.Parameters.Add("@sotien", OleDbType.Currency).Value = phieuThuHP.SoTienThu; command.ExecuteNonQuery(); } catch (Exception ex) { throw ex; } finally { connection.Close(); } }
private void NhapLaiThongTinPhieuThuHP() { PhieuDKHP = new PhieuDKHP(); phieuDKHP.SoPhieuDKHP = -1; SinhVien = new SinhVien(); PhieuThuHP = new PhieuThuHP(); }
public PhieuThuHpViewModel() : base() { phieuDKHP = new PhieuDKHP(); phieuDKHP.SoPhieuDKHP = -1; sinhVien = new SinhVien(); phieuThuHP = new PhieuThuHP(); XacNhan = new RelayCommand( param => true, param => XacNhanLuuPhieuThuHP()); NhapLai = new RelayCommand( param => true, param => NhapLaiThongTinPhieuThuHP()); LoadDanhMucSinhVien(); LoadDanhMucHocKy(); }